pax_global_header00006660000000000000000000000064145143737770014534gustar00rootroot0000000000000052 comment=1237980ed6c3915c5c3ba996345289546bdaebef hasOwn-2.0.0/000077500000000000000000000000001451437377700127725ustar00rootroot00000000000000hasOwn-2.0.0/.eslintrc000066400000000000000000000000531451437377700146140ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", } hasOwn-2.0.0/.github/000077500000000000000000000000001451437377700143325ustar00rootroot00000000000000hasOwn-2.0.0/.github/FUNDING.yml000066400000000000000000000010501451437377700161430ustar00rootroot00000000000000# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/hasown community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with a single custom sponsorship URL hasOwn-2.0.0/.github/workflows/000077500000000000000000000000001451437377700163675ustar00rootroot00000000000000hasOwn-2.0.0/.github/workflows/node-aught.yml000066400000000000000000000005551451437377700211520ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '< 10' type: minors command: npm run tests-only node: name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' hasOwn-2.0.0/.github/workflows/node-pretest.yml000066400000000000000000000002451451437377700215240ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main hasOwn-2.0.0/.github/workflows/node-tens.yml000066400000000000000000000005601451437377700210070ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10' type: minors command: npm run tests-only node: name: 'node >= 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' hasOwn-2.0.0/.github/workflows/rebase.yml000066400000000000000000000007001451437377700203500ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] permissions: contents: read jobs: _: permissions: contents: write # for ljharb/rebase to push code to rebase pull-requests: read # for ljharb/rebase to get info about PR name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} hasOwn-2.0.0/.github/workflows/require-allow-edits.yml000066400000000000000000000005151451437377700230110ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] permissions: contents: read jobs: _: permissions: pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main hasOwn-2.0.0/.gitignore000066400000000000000000000041601451437377700147630ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional stylelint cache .stylelintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variable files .env .env.development.local .env.test.local .env.production.local .env.local # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # vuepress v2.x temp and cache directory .temp .cache # Docusaurus cache and generated files .docusaurus # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.* # Only apps should have lockfile npm-shrinkwrap.json package-lock.json yarn.lock .npmignore *.d.ts *.d.ts.map hasOwn-2.0.0/.npmrc000066400000000000000000000000671451437377700141150ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s hasOwn-2.0.0/.nycrc000066400000000000000000000003301451437377700141050ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "lines": 86, "statements": 85.93, "functions": 82.43, "branches": 76.06, "exclude": [ "coverage", "test" ] } hasOwn-2.0.0/CHANGELOG.md000066400000000000000000000016101451437377700146010ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19 ### Commits - revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4) - [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458) - Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215) ## v1.0.1 - 2023-10-10 ### Commits - Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62) hasOwn-2.0.0/LICENSE000066400000000000000000000020731451437377700140010ustar00rootroot00000000000000MIT License Copyright (c) Jordan Harband and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hasOwn-2.0.0/README.md000066400000000000000000000031151451437377700142510ustar00rootroot00000000000000# hasown [![Version Badge][npm-version-svg]][package-url] [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] A robust, ES3 compatible, "has own property" predicate. ## Example ```js const assert = require('assert'); const hasOwn = require('hasown'); assert.equal(hasOwn({}, 'toString'), false); assert.equal(hasOwn([], 'length'), true); assert.equal(hasOwn({ a: 42 }, 'a'), true); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/hasown [npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg [deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg [deps-url]: https://david-dm.org/inspect-js/hasOwn [dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg [dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies [npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/hasown.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/hasown.svg [downloads-url]: https://npm-stat.com/charts.html?package=hasown [codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn [actions-url]: https://github.com/inspect-js/hasOwn/actions hasOwn-2.0.0/index.js000066400000000000000000000003521451437377700144370ustar00rootroot00000000000000'use strict'; var call = Function.prototype.call; var $hasOwn = Object.prototype.hasOwnProperty; var bind = require('function-bind'); /** @type {(o: {}, p: PropertyKey) => p is keyof o} */ module.exports = bind.call(call, $hasOwn); hasOwn-2.0.0/package.json000066400000000000000000000044531451437377700152660ustar00rootroot00000000000000{ "name": "hasown", "version": "2.0.0", "description": "A robust, ES3 compatible, \"has own property\" predicate.", "main": "index.js", "exports": { ".": "./index.js", "./package.json": "./package.json" }, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated && npm run emit-types", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "prelint": "evalmd README.md", "lint": "eslint --ext=js,mjs .", "postlint": "npm run tsc", "preemit-types": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map", "emit-types": "npm run tsc -- --noEmit false --emitDeclarationOnly", "pretest": "npm run lint", "tsc": "tsc -p .", "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "repository": { "type": "git", "url": "git+https://github.com/inspect-js/hasOwn.git" }, "keywords": [ "has", "hasOwnProperty", "hasOwn", "has-own", "own", "has", "property", "in", "javascript", "ecmascript" ], "author": "Jordan Harband ", "license": "MIT", "bugs": { "url": "https://github.com/inspect-js/hasOwn/issues" }, "homepage": "https://github.com/inspect-js/hasOwn#readme", "dependencies": { "function-bind": "^1.1.2" }, "devDependencies": { "@ljharb/eslint-config": "^21.1.0", "@types/function-bind": "^1.1.9", "@types/mock-property": "^1.0.1", "@types/tape": "^5.6.3", "aud": "^2.0.3", "auto-changelog": "^2.4.0", "eslint": "=8.8.0", "evalmd": "^0.0.19", "in-publish": "^2.0.1", "mock-property": "^1.0.2", "npmignore": "^0.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^2.0.0", "tape": "^5.7.1", "typescript": "^5.3.0-dev.20231019" }, "engines": { "node": ">= 0.4" }, "testling": { "files": "test/index.js" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true }, "publishConfig": { "ignore": [ ".github/workflows", "test", "!*.d.ts", "!*.d.ts.map" ] } } hasOwn-2.0.0/test/000077500000000000000000000000001451437377700137515ustar00rootroot00000000000000hasOwn-2.0.0/test/index.js000066400000000000000000000025431451437377700154220ustar00rootroot00000000000000'use strict'; var test = require('tape'); var mockProperty = require('mock-property'); var hasOwn = require('../'); test('hasOwn', function (t) { t.equal(typeof hasOwn, 'function', 'is a function'); t.equal( hasOwn({}, 'toString'), false, 'toString is not an own property of a normal object' ); t.equal( hasOwn({ toString: true }, 'toString'), true, 'toString as an own property is an own property' ); t.equal( hasOwn({ a: true }, 'a'), true, 'a normal own property is an own property' ); t.equal(hasOwn([], 'length'), true, 'an array length is an own property'); t.equal(hasOwn('', 'length'), true, 'a string length is an own property'); t.test('without a `.call`', function (st) { var restore = mockProperty(Function.prototype, 'call', { 'delete': true }); st.teardown(restore); var toS = hasOwn({ toString: true }, 'toString'); var ownA = hasOwn({ a: true }, 'a'); var arrL = hasOwn([], 'length'); var strL = hasOwn('', 'length'); // TODO: remove this line once node is fixed restore(); st.equal(toS, true, 'no call; toString as an own property is an own property'); st.equal(ownA, true, 'no call; a normal own property is an own property'); st.equal(arrL, true, 'no call; an array length is an own property'); st.equal(strL, true, 'no call; a string length is an own property'); st.end(); }); t.end(); }); hasOwn-2.0.0/tsconfig.json000066400000000000000000000070331451437377700155040ustar00rootroot00000000000000{ "compilerOptions": { /* Visit https://aka.ms/tsconfig to read more about this file */ /* Projects */ /* Language and Environment */ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ "module": "commonjs", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ "resolveJsonModule": true, /* Enable importing .json files. */ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ /* JavaScript Support */ "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ "declarationMap": true, /* Create sourcemaps for d.ts files. */ "noEmit": true, /* Disable emitting files from a compilation. */ /* Interop Constraints */ "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ /* Type Checking */ "strict": true, /* Enable all strict type-checking options. */ /* Completeness */ //"skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "exclude": [ "coverage" ] }