Giter Site home page Giter Site logo

ljharb / define-properties Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 9.0 111 KB

Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.

License: MIT License

JavaScript 100.00%

define-properties's Introduction

define-properties Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Define multiple non-enumerable properties at once. Uses Object.defineProperty when available; falls back to standard assignment in older engines. Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides.

Example

var define = require('define-properties');
var assert = require('assert');

var obj = define({ a: 1, b: 2 }, {
	a: 10,
	b: 20,
	c: 30
});
assert(obj.a === 1);
assert(obj.b === 2);
assert(obj.c === 30);
if (define.supportsDescriptors) {
	assert.deepEqual(Object.keys(obj), ['a', 'b']);
	assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), {
		configurable: true,
		enumerable: false,
		value: 30,
		writable: false
	});
}

Then, with predicates:

var define = require('define-properties');
var assert = require('assert');

var obj = define({ a: 1, b: 2, c: 3 }, {
	a: 10,
	b: 20,
	c: 30
}, {
	a: function () { return false; },
	b: function () { return true; }
});
assert(obj.a === 1);
assert(obj.b === 20);
assert(obj.c === 3);
if (define.supportsDescriptors) {
	assert.deepEqual(Object.keys(obj), ['a', 'c']);
	assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), {
		configurable: true,
		enumerable: false,
		value: 20,
		writable: false
	});
}

Tests

Simply clone the repo, npm install, and run npm test

define-properties's People

Contributors

ljharb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

define-properties's Issues

An in-range update of @ljharb/eslint-config is breaking the build ๐Ÿšจ

The devDependency @ljharb/eslint-config was updated from 15.0.2 to 15.1.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@ljharb/eslint-config is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Commits

The new version differs by 4 commits.

  • 8803ef2 v15.1.0
  • 0280cc4 [minor] update eslint and add new rules
  • 6e786bc [meta] remove unused Makefile and associated utilities
  • f8c068e [patch] loosen max-params for tests

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of covert is breaking the build ๐Ÿšจ

The devDependency covert was updated from 1.1.0 to 1.1.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

covert is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 3 commits.

  • b2f79d7 v1.1.1
  • db3d7f8 Only apps should have lockfiles
  • ffa04cf [Deps] update browserify, coverify, parents, minimist, resolve

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of @ljharb/eslint-config is breaking the build ๐Ÿšจ

The devDependency @ljharb/eslint-config was updated from 13.0.0 to 13.1.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@ljharb/eslint-config is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 5 commits.

  • 2dd67e5 v13.1.0
  • 34a402a [Minor] update config and require eslint v5.11
  • fd1f310 [Dev Deps] update eslint, replace, safe-publish-latest, semver
  • 2d1a944 [Tests] use npm audit instead of nsp
  • a02c14b [Tests] up to node v11.6, v10.15, v8.15, v6.16

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of nsp is breaking the build ๐Ÿšจ

Version 2.7.0 of nsp just got published.

Branch Build failing ๐Ÿšจ
Dependency nsp
Current Version 2.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nsp is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 13 commits.

  • e88fb8a 2.7.0
  • f207e03 fix package.json so things actually work
  • 11d5635 Merge pull request #178 from nodesecurity/quiet-flag
  • cf32c95 remove unused code
  • 5ee23ec Merge pull request #164 from dblandin/devon/update-dockerfile
  • c41e59d Pick Lint
  • a9491bd Add quiet to --output usage
  • 215432f add quiet output
  • c20afb3 drone config
  • d9ba63b Update Dockerfile
  • 73c321d Merge pull request #158 from koresar/patch-1
  • 904dc3e Make sure the table width is a minimum width
  • da2b275 Fix nsp CLI crash in the no window (CI) envs

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

var foreach = require('foreach'); missing dependency?

Error: Cannot find module 'foreach'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (node_modules\define-properties\index.js:4)

Was fixed by npm i -S foreach but IMHO it should be in your dependencies

Issue with the new version

npm ERR! code ETARGET
npm ERR! notarget No matching version found for define-properties@^1.2.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

An in-range update of tape is breaking the build ๐Ÿšจ

Version 4.7.0 of tape just got published.

Branch Build failing ๐Ÿšจ
Dependency tape
Current Version 4.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tape is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 19 commits.

  • 1d0df26 v4.7.0
  • 51597e2 Merge pull request #374 from feross/master
  • b06f914 [Refactor] instead of throwing on undefined.forEach, throw explicitly.
  • dd93216 [Fix] fix spurious "test exited without ending"
  • 1a8e936 [Deps] update glob, resolve
  • 7eb9e36 [Dev Deps] update falafel, js-yaml
  • e030260 [Tests] on node v8; no need for sudo; v0.8 passes now; allow v5/v7/iojs to fail.
  • 4375661 [Tests] npm v5+ breaks on node < v4
  • df48bfa Only apps should have lock files.
  • 35e47e1 [Tests] npm v4.6+ breaks on node < v1
  • dc1ffa5 [Deps] update object-inspect
  • 66519cb [Deps] update resolve
  • e6d4625 [Dev Deps] update concat-stream, js-yaml
  • bdf2b04 tap-min moved to derhuerst/tap-min
  • 8b3a77e [Tests] fix thrower stack in node 0.8

There are 19 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Can't install define-properties@^1.2.1.

I am trying to install next js project which required define-properties@^1.2.1.

I got this error
pm ERR! code ETARGET npm ERR! notarget No matching version found for define-properties@^1.2.1. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.

I have tried to npm view define-properties versions and I got this
[ '1.0.0', '1.0.1', '1.0.2', '1.1.0', '1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.2.0' ]

An in-range update of eslint is breaking the build ๐Ÿšจ

Version 4.11.0 of eslint was just published.

Branch Build failing ๐Ÿšจ
Dependency eslint
Current Version 4.10.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585) (่–›ๅฎš่ฐ”็š„็Œซ)
  • d602f9e Upgrade: espree v3.5.2 (#9611) (Kai Cataldo)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364) (Teddy Katz)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605) (Teddy Katz)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603) (Moinul Hossain)
  • 980ecd3 Chore: Update copyright and license info (#9599) (่–›ๅฎš่ฐ”็š„็Œซ)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589) (Clรฉment Fiorio)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590) (Teddy Katz)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588) (Teddy Katz)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560) (Toru Nagashima)
  • e5a37ce Fix: object-curly-newline for flow code (#9458) (Tiddo Langerak)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500) (่–›ๅฎš่ฐ”็š„็Œซ)
  • b7c5b19 Fix: Correct [object Object] output of error.data. (#9561) (Jonathan Pool)
  • 51c8cf0 Docs: Disambiguate definition of Update tag (#9584) (Jonathan Pool)
  • afc3c75 Docs: clarify what eslint-config-eslint is (#9582) (Teddy Katz)
  • aedae9d Docs: fix spelling in valid-typeof example (#9574) (Maksim Degtyarev)
  • 4c5aaf3 Docs: Fix typo in no-underscore-dangle rule (#9567) (Fabien Lucas)
  • 3623600 Chore: upgrade [email protected] (#9557) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 1b606cd Chore: Remove an indirect dependency on jsonify (#9444) (Rouven WeรŸling)
  • 4d7d7ab Update: Resolve npm installed formatters (#5900) (#9464) (Tom Erik Stรธwer)
  • accc490 Fix: Files with no failures get "passing" testcase (#9547) (Samuel Levy)
  • ab0f66d Docs: Add examples to better show rule coverage. (#9548) (Jonathan Pool)
  • 88d2303 Chore: Add object-property-newline tests to increase coverage. (#9553) (Jonathan Pool)
  • 7f37b1c Build: test Node 9 on Travis (#9556) (Teddy Katz)
  • acccfbd Docs: Minor rephrase in no-invalid-this. (#9542) (Francisc)
  • 8f9c0fe Docs: improve id-match usage advice (#9544) (Teddy Katz)
  • a9606a3 Fix: invalid tests with super (fixes #9539) (#9545) (Teddy Katz)
  • 8e1a095 Chore: enable a modified version of multiline-comment-style on codebase (#9452) (Teddy Katz)
  • cb60285 Chore: remove commented test for HTML formatter (#9532) (Teddy Katz)
  • 06b491e Docs: fix duplicate entries in changelog (#9530) (Teddy Katz)
  • 2224733 Chore: use eslint-plugin-rulesdir instead of --rulesdir for self-linting (#9164) (Teddy Katz)
  • 9cf4ebe Docs: add .md to link(for github users) (#9529) (่–›ๅฎš่ฐ”็š„็Œซ)
Commits

The new version differs by 35 commits.

  • 1a9a6a5 4.11.0
  • ef4d268 Build: changelog update for 4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585)
  • d602f9e Upgrade: espree v3.5.2 (#9611)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603)
  • 980ecd3 Chore: Update copyright and license info (#9599)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560)
  • e5a37ce Fix: object-curly-newline for flow code (#9458)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500)

There are 35 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • [Deps] Update Update eslint to v8.57.0
  • [Deps] Update Update eslint to v9
  • [Deps] Update Update nyc to v17
  • ๐Ÿ” Create all pending approval PRs at once ๐Ÿ”

Detected dependencies

github-actions
.github/workflows/node-aught.yml
.github/workflows/node-pretest.yml
.github/workflows/node-tens.yml
.github/workflows/rebase.yml
.github/workflows/require-allow-edits.yml
npm
package.json
  • define-data-property ^1.0.1
  • has-property-descriptors ^1.0.0
  • object-keys ^1.1.1
  • @ljharb/eslint-config ^21.1.0
  • aud ^2.0.3
  • auto-changelog ^2.4.0
  • eslint =8.8.0
  • in-publish ^2.0.1
  • npmignore ^0.3.0
  • nyc ^10.3.2
  • safe-publish-latest ^2.0.0
  • tape ^5.6.6
  • node >= 0.4

  • Check this box to trigger a request for Renovate to run again on this repository

An in-range update of tape is breaking the build ๐Ÿšจ

The devDependency tape was updated from 4.10.0 to 4.10.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tape is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 4 commits.

  • 4708a3d v4.10.1
  • a63261e [Deps] update resolve
  • 34ebb4c [Refactor] consistent spacing
  • b74c4fd Partial revert of #403: fbe4b951cb6c6cc4f0e9e3ae4a57b123dd82c0fb and 367b010d21c7c9814c4bc6b21d1c2a9a67596c11

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of eslint is breaking the build ๐Ÿšจ

The devDependency eslint was updated from 5.12.0 to 5.12.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v5.12.1
  • eb5c401 Chore: use meta.messages in some rules (2/4) (refs #9870) (#10773) (่–›ๅฎš่ฐ”็š„็Œซ)
  • aa56247 Fix: avoid loading core rules dynamically from FS in Linter (#11278) (Peter Metz)
  • 04450bb Docs: clarify process for adding committers (#11272) (Kai Cataldo)
  • 3ffcf26 Docs: add @g-plane as committer (#11277) (Kai Cataldo)
  • c403445 Fix: warn constant on RHS of || in no-constant-condition (fixes #11181) (#11253) (Merlin Mason)
  • 9194f45 Fix: Manage severity of 1 with TAP reporter (fixes #11110) (#11221) (Gabriel Cousin)
  • 000f495 Docs: fix example for sort-imports ignoreDeclarationSort (#11242) (Remco Haszing)
  • 7c0bf2c Docs: Add npx usage to Getting Started guide (#11249) (eyal0803)
  • da9174e Docs: fixes typo peerDepencies (#11252) (Christian Kรผhl)
  • 9c31625 Docs: Improve custom formatter docs (#11258) (Nicholas C. Zakas)
Commits

The new version differs by 12 commits.

  • faf3c4e 5.12.1
  • 1010c98 Build: changelog update for 5.12.1
  • eb5c401 Chore: use meta.messages in some rules (2/4) (refs #9870) (#10773)
  • aa56247 Fix: avoid loading core rules dynamically from FS in Linter (#11278)
  • 04450bb Docs: clarify process for adding committers (#11272)
  • 3ffcf26 Docs: add @g-plane as committer (#11277)
  • c403445 Fix: warn constant on RHS of || in no-constant-condition (fixes #11181) (#11253)
  • 9194f45 Fix: Manage severity of 1 with TAP reporter (fixes #11110) (#11221)
  • 000f495 Docs: fix example for sort-imports ignoreDeclarationSort (#11242)
  • 7c0bf2c Docs: Add npx usage to Getting Started guide (#11249)
  • da9174e Docs: fixes typo peerDepencies (#11252)
  • 9c31625 Docs: Improve custom formatter docs (#11258)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

An in-range update of tape is breaking the build ๐Ÿšจ

The devDependency tape was updated from 4.9.1 to 4.9.2.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tape is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 11 commits.

  • a1e8f7e v4.9.2
  • 4b9c951 [Dev Deps] update eslint, eclint
  • 9ced991 [Fix] notEqual and notDeepEqual show "expected" value on failure
  • 75c467e [Docs] Updated readme to make test, test.only and test.skip consistent.
  • 1225d01 Merge pull request #450 from axelpale/patch-1
  • f53e3f1 Clarify doesNotThrow parameters
  • 96de340 Adding tap-junit
  • b1df632 [readme] Change broken image to use web archive
  • 5f1c5a2 [Docs] cleanup from #439
  • 6c633d0 Merge pull request #439 from abelmokadem/master
  • 4337f58 Convert list of tap reporters to links

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.