pax_global_header00006660000000000000000000000064147246375300014525gustar00rootroot0000000000000052 comment=50ef129225ae17336a774f0eefc4e6bc88c79b8e ljharb-es-define-property-447ed2b/000077500000000000000000000000001472463753000171235ustar00rootroot00000000000000ljharb-es-define-property-447ed2b/.eslintrc000066400000000000000000000002201472463753000207410ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "new-cap": ["error", { "capIsNewExceptions": [ "GetIntrinsic", ], }], }, } ljharb-es-define-property-447ed2b/.github/000077500000000000000000000000001472463753000204635ustar00rootroot00000000000000ljharb-es-define-property-447ed2b/.github/FUNDING.yml000066400000000000000000000010641472463753000223010ustar00rootroot00000000000000# 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/es-define-property 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 ljharb-es-define-property-447ed2b/.github/workflows/000077500000000000000000000000001472463753000225205ustar00rootroot00000000000000ljharb-es-define-property-447ed2b/.github/workflows/node-aught.yml000066400000000000000000000005651472463753000253040ustar00rootroot00000000000000name: '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 skip-ls-check: true node: name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: true ljharb-es-define-property-447ed2b/.github/workflows/node-pretest.yml000066400000000000000000000002451472463753000256550ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main ljharb-es-define-property-447ed2b/.github/workflows/node-tens.yml000066400000000000000000000003721472463753000251410ustar00rootroot00000000000000name: 'Tests: node.js 10 - 20' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10 < 20' type: minors command: npm run tests-only ljharb-es-define-property-447ed2b/.github/workflows/node-twenties.yml000066400000000000000000000003631472463753000260320ustar00rootroot00000000000000name: 'Tests: node.js >= 20' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 20' type: minors command: npm run tests-only ljharb-es-define-property-447ed2b/.github/workflows/rebase.yml000066400000000000000000000007001472463753000245010ustar00rootroot00000000000000name: 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 }} ljharb-es-define-property-447ed2b/.github/workflows/require-allow-edits.yml000066400000000000000000000005151472463753000271420ustar00rootroot00000000000000name: 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 ljharb-es-define-property-447ed2b/.gitignore000066400000000000000000000041361472463753000211170ustar00rootroot00000000000000# 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 lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore ljharb-es-define-property-447ed2b/.npmrc000066400000000000000000000000671472463753000202460ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s ljharb-es-define-property-447ed2b/.nycrc000066400000000000000000000002131472463753000202360ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "exclude": [ "coverage", "test" ] } ljharb-es-define-property-447ed2b/CHANGELOG.md000066400000000000000000000043701472463753000207400ustar00rootroot00000000000000# 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/es-define-property/compare/v1.0.0...v1.0.1) - 2024-12-06 ### Commits - [types] use shared tsconfig [`954a663`](https://github.com/ljharb/es-define-property/commit/954a66360326e508a0e5daa4b07493d58f5e110e) - [actions] split out node 10-20, and 20+ [`3a8e84b`](https://github.com/ljharb/es-define-property/commit/3a8e84b23883f26ff37b3e82ff283834228e18c6) - [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `gopd`, `tape` [`86ae27b`](https://github.com/ljharb/es-define-property/commit/86ae27bb8cc857b23885136fad9cbe965ae36612) - [Refactor] avoid using `get-intrinsic` [`02480c0`](https://github.com/ljharb/es-define-property/commit/02480c0353ef6118965282977c3864aff53d98b1) - [Tests] replace `aud` with `npm audit` [`f6093ff`](https://github.com/ljharb/es-define-property/commit/f6093ff74ab51c98015c2592cd393bd42478e773) - [Tests] configure testling [`7139e66`](https://github.com/ljharb/es-define-property/commit/7139e66959247a56086d9977359caef27c6849e7) - [Dev Deps] update `tape` [`b901b51`](https://github.com/ljharb/es-define-property/commit/b901b511a75e001a40ce1a59fef7d9ffcfc87482) - [Tests] fix types in tests [`469d269`](https://github.com/ljharb/es-define-property/commit/469d269fd141b1e773ec053a9fa35843493583e0) - [Dev Deps] add missing peer dep [`733acfb`](https://github.com/ljharb/es-define-property/commit/733acfb0c4c96edf337e470b89a25a5b3724c352) ## v1.0.0 - 2024-02-12 ### Commits - Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480) - Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50) - npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e) - Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856) ljharb-es-define-property-447ed2b/LICENSE000066400000000000000000000020571472463753000201340ustar00rootroot00000000000000MIT License Copyright (c) 2024 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. ljharb-es-define-property-447ed2b/README.md000066400000000000000000000040101472463753000203750ustar00rootroot00000000000000# es-define-property [![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.defineProperty`, but not IE 8's broken one. ## Example ```js const assert = require('assert'); const $defineProperty = require('es-define-property'); if ($defineProperty) { assert.equal($defineProperty, Object.defineProperty); } else if (Object.defineProperty) { assert.equal($defineProperty, false, 'this is IE 8'); } else { assert.equal($defineProperty, false, 'this is an ES3 engine'); } ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` ## Security Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. [package-url]: https://npmjs.org/package/es-define-property [npm-version-svg]: https://versionbadg.es/ljharb/es-define-property.svg [deps-svg]: https://david-dm.org/ljharb/es-define-property.svg [deps-url]: https://david-dm.org/ljharb/es-define-property [dev-deps-svg]: https://david-dm.org/ljharb/es-define-property/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/es-define-property#info=devDependencies [npm-badge-png]: https://nodei.co/npm/es-define-property.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/es-define-property.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/es-define-property.svg [downloads-url]: https://npm-stat.com/charts.html?package=es-define-property [codecov-image]: https://codecov.io/gh/ljharb/es-define-property/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/ljharb/es-define-property/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-define-property [actions-url]: https://github.com/ljharb/es-define-property/actions ljharb-es-define-property-447ed2b/index.d.ts000066400000000000000000000001351472463753000210230ustar00rootroot00000000000000declare const defineProperty: false | typeof Object.defineProperty; export = defineProperty;ljharb-es-define-property-447ed2b/index.js000066400000000000000000000004401472463753000205660ustar00rootroot00000000000000'use strict'; /** @type {import('.')} */ var $defineProperty = Object.defineProperty || false; if ($defineProperty) { try { $defineProperty({}, 'a', { value: 1 }); } catch (e) { // IE 8 has a broken defineProperty $defineProperty = false; } } module.exports = $defineProperty; ljharb-es-define-property-447ed2b/package.json000066400000000000000000000041211472463753000214070ustar00rootroot00000000000000{ "name": "es-define-property", "version": "1.0.1", "description": "`Object.defineProperty`, but not IE 8's broken one.", "main": "index.js", "types": "./index.d.ts", "exports": { ".": "./index.js", "./package.json": "./package.json" }, "sideEffects": false, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "prelint": "evalmd README.md", "lint": "eslint --ext=js,mjs .", "postlint": "tsc -p .", "pretest": "npm run lint", "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "npx npm@'>= 10.2' audit --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/es-define-property.git" }, "keywords": [ "javascript", "ecmascript", "object", "define", "property", "defineProperty", "Object.defineProperty" ], "author": "Jordan Harband ", "license": "MIT", "bugs": { "url": "https://github.com/ljharb/es-define-property/issues" }, "homepage": "https://github.com/ljharb/es-define-property#readme", "devDependencies": { "@ljharb/eslint-config": "^21.1.1", "@ljharb/tsconfig": "^0.2.2", "@types/gopd": "^1.0.3", "@types/tape": "^5.6.5", "auto-changelog": "^2.5.0", "encoding": "^0.1.13", "eslint": "^8.8.0", "evalmd": "^0.0.19", "gopd": "^1.2.0", "in-publish": "^2.0.1", "npmignore": "^0.3.1", "nyc": "^10.3.2", "safe-publish-latest": "^2.0.0", "tape": "^5.9.0", "typescript": "next" }, "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" ] } } ljharb-es-define-property-447ed2b/test/000077500000000000000000000000001472463753000201025ustar00rootroot00000000000000ljharb-es-define-property-447ed2b/test/index.js000066400000000000000000000024231472463753000215500ustar00rootroot00000000000000'use strict'; var $defineProperty = require('../'); var test = require('tape'); var gOPD = require('gopd'); test('defineProperty: supported', { skip: !$defineProperty }, function (t) { t.plan(4); t.equal(typeof $defineProperty, 'function', 'defineProperty is supported'); if ($defineProperty && gOPD) { // this `if` check is just to shut TS up /** @type {{ a: number, b?: number, c?: number }} */ var o = { a: 1 }; $defineProperty(o, 'b', { enumerable: true, value: 2 }); t.deepEqual( gOPD(o, 'b'), { configurable: false, enumerable: true, value: 2, writable: false }, 'property descriptor is as expected' ); $defineProperty(o, 'c', { enumerable: false, value: 3, writable: true }); t.deepEqual( gOPD(o, 'c'), { configurable: false, enumerable: false, value: 3, writable: true }, 'property descriptor is as expected' ); } t.equal($defineProperty, Object.defineProperty, 'defineProperty is Object.defineProperty'); t.end(); }); test('defineProperty: not supported', { skip: !!$defineProperty }, function (t) { t.notOk($defineProperty, 'defineProperty is not supported'); t.match( typeof $defineProperty, /^(?:undefined|boolean)$/, '`typeof defineProperty` is `undefined` or `boolean`' ); t.end(); }); ljharb-es-define-property-447ed2b/tsconfig.json000066400000000000000000000002121472463753000216250ustar00rootroot00000000000000{ "extends": "@ljharb/tsconfig", "compilerOptions": { "target": "es2022", }, "exclude": [ "coverage", "test/list-exports" ], }