Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Jul 23, 2024 via pnpm

define-properties 1.2.1

Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.
Package summary
Share
0
issues
1
license
12
MIT
Package created
4 Jan 2015
Version published
13 Sep 2023
Maintainers
1
Total deps
12
Direct deps
3
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
12 Packages, Including:
define-data-property@1.1.4
define-properties@1.2.1
es-define-property@1.0.0
es-errors@1.3.0
function-bind@1.1.2
get-intrinsic@1.2.4
gopd@1.0.1
has-property-descriptors@1.0.2
has-proto@1.0.3
has-symbols@1.0.3
hasown@2.0.2
object-keys@1.1.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

3
All Dependencies CSV
β“˜ This is a list of define-properties 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
define-data-property1.1.430.13 kBMIT
prod
has-property-descriptors1.0.210.66 kBMIT
prod
object-keys1.1.17.5 kBMIT
prod

Visualizations

Frequently Asked Questions

What does define-properties do?

The Define Properties npm package allows users to define multiple non-enumerable properties simultaneously. It utilizes the Object.defineProperty where it is available and falls back to standard assignment in engines that are older and do not have the Object.defineProperty feature. Moreover, existing properties are not overridden unless a map of property names is provided to a predicate that, when true, force-overrides.

How do you use define-properties?

You can use the Define Properties package by first importing it to your project using the require function, like this: var define = require('define-properties');. After importing it, you use it to define properties of an object. Here's an example:

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

var obj = define({ a: 1, b: 2 }, {
	a: 10,
	b: 20,
	c: 30
});

In the above example, the properties a and b won't be overridden, and a new property c is added with the value 30.

You can also use predicates to define when to override existing properties. The example below demonstrates this:

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; }
});

In the above code, a predicate is used to determine whether to override the properties a and b. The property a is set not to override (a: function () { return false; }), with property b is set to override (b: function () { return true; }).

Where are the define-properties docs?

The documentation for the Define Properties package is provided in the README file in the package's repository on GitHub. The link to the repository is git://github.com/ljharb/define-properties.git. The README file contains everything you need to know to use this package.