pax_global_header00006660000000000000000000000064143304043220014505gustar00rootroot0000000000000052 comment=e3236ba6cdee15eef18be63dcc46045c035d4429 gopd-1.0.1/000077500000000000000000000000001433040432200124355ustar00rootroot00000000000000gopd-1.0.1/.eslintrc000066400000000000000000000003401433040432200142560ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "func-style": [2, "declaration"], "id-length": 0, "multiline-comment-style": 0, "new-cap": [2, { "capIsNewExceptions": [ "GetIntrinsic", ], }], }, } gopd-1.0.1/.github/000077500000000000000000000000001433040432200137755ustar00rootroot00000000000000gopd-1.0.1/.github/FUNDING.yml000066400000000000000000000010771433040432200156170ustar00rootroot00000000000000# 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/gopd 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 up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] gopd-1.0.1/.github/workflows/000077500000000000000000000000001433040432200160325ustar00rootroot00000000000000gopd-1.0.1/.github/workflows/node-aught.yml000066400000000000000000000005161433040432200206120ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] 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' gopd-1.0.1/.github/workflows/node-pretest.yml000066400000000000000000000002061433040432200211640ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main gopd-1.0.1/.github/workflows/node-tens.yml000066400000000000000000000005211433040432200204470ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] 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' gopd-1.0.1/.github/workflows/rebase.yml000066400000000000000000000007001433040432200200130ustar00rootroot00000000000000name: 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 }} gopd-1.0.1/.github/workflows/require-allow-edits.yml000066400000000000000000000003031433040432200224470ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main gopd-1.0.1/.gitignore000066400000000000000000000032511433040432200144260ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-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/ # TypeScript v1 declaration files typings/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # 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 variables file .env .env.test # parcel-bundler cache (https://parceljs.org/) .cache # Next.js build output .next # 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 # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore gopd-1.0.1/.npmrc000066400000000000000000000000671433040432200135600ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s gopd-1.0.1/CHANGELOG.md000066400000000000000000000030051433040432200142440ustar00rootroot00000000000000# 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). ## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01 ### Commits - [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f) ## v1.0.0 - 2022-11-01 ### Commits - Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea) - Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe) - [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119) - npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582) - [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709) - [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002) - [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb) - Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b) gopd-1.0.1/LICENSE000066400000000000000000000020571433040432200134460ustar00rootroot00000000000000MIT License Copyright (c) 2022 Jordan Harband 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. gopd-1.0.1/README.md000066400000000000000000000030321433040432200137120ustar00rootroot00000000000000# gopd [![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] `Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation. ## Usage ```javascript var gOPD = require('gopd'); var assert = require('assert'); if (gOPD) { assert.equal(typeof gOPD, 'function', 'descriptors supported'); // use gOPD like Object.getOwnPropertyDescriptor here } else { assert.ok(!gOPD, 'descriptors not supported'); } ``` [package-url]: https://npmjs.org/package/gopd [npm-version-svg]: https://versionbadg.es/ljharb/gopd.svg [deps-svg]: https://david-dm.org/ljharb/gopd.svg [deps-url]: https://david-dm.org/ljharb/gopd [dev-deps-svg]: https://david-dm.org/ljharb/gopd/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/gopd#info=devDependencies [npm-badge-png]: https://nodei.co/npm/gopd.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/gopd.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/gopd.svg [downloads-url]: https://npm-stat.com/charts.html?package=gopd [codecov-image]: https://codecov.io/gh/ljharb/gopd/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/ljharb/gopd/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/gopd [actions-url]: https://github.com/ljharb/gopd/actions gopd-1.0.1/index.js000066400000000000000000000004071433040432200141030ustar00rootroot00000000000000'use strict'; var GetIntrinsic = require('get-intrinsic'); var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); if ($gOPD) { try { $gOPD([], 'length'); } catch (e) { // IE 8 has a broken gOPD $gOPD = null; } } module.exports = $gOPD; gopd-1.0.1/package.json000066400000000000000000000035251433040432200147300ustar00rootroot00000000000000{ "name": "gopd", "version": "1.0.1", "description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.", "main": "index.js", "exports": { ".": "./index.js", "./package.json": "./package.json" }, "sideEffects": false, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublishOnly": "safe-publish-latest", "prepublish": "not-in-publish || npm run prepublishOnly", "lint": "eslint --ext=js,mjs .", "postlint": "evalmd README.md", "pretest": "npm run lint", "tests-only": "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/ljharb/gopd.git" }, "keywords": [ "ecmascript", "javascript", "getownpropertydescriptor", "property", "descriptor" ], "author": "Jordan Harband ", "funding": { "url": "https://github.com/sponsors/ljharb" }, "license": "MIT", "bugs": { "url": "https://github.com/ljharb/gopd/issues" }, "homepage": "https://github.com/ljharb/gopd#readme", "dependencies": { "get-intrinsic": "^1.1.3" }, "devDependencies": { "@ljharb/eslint-config": "^21.0.0", "aud": "^2.0.1", "auto-changelog": "^2.4.0", "eslint": "=8.8.0", "evalmd": "^0.0.19", "in-publish": "^2.0.1", "npmignore": "^0.3.0", "safe-publish-latest": "^2.0.0", "tape": "^5.6.1" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true }, "publishConfig": { "ignore": [ ".github/workflows" ] } } gopd-1.0.1/test/000077500000000000000000000000001433040432200134145ustar00rootroot00000000000000gopd-1.0.1/test/index.js000066400000000000000000000011161433040432200150600ustar00rootroot00000000000000'use strict'; var test = require('tape'); var gOPD = require('../'); test('gOPD', function (t) { t.test('supported', { skip: !gOPD }, function (st) { st.equal(typeof gOPD, 'function', 'is a function'); var obj = { x: 1 }; st.ok('x' in obj, 'property exists'); var desc = gOPD(obj, 'x'); st.deepEqual( desc, { configurable: true, enumerable: true, value: 1, writable: true }, 'descriptor is as expected' ); st.end(); }); t.test('not supported', { skip: gOPD }, function (st) { st.notOk(gOPD, 'is falsy'); st.end(); }); t.end(); });