NPM Smell 🍑💨

trivial and outdated NPM packages

define-properties outdated npm logo

Convoluted way of calling Object.defineProperties().

Weekly Downloads
32,647,779
Dependencies
7 (6 distinct)
Latest Release
2 years ago
Switch to the native implementation.
Outdated
natively supported
since 13 years (chrome, firefox, safari, nodejs)

Dependency Tree

  • define-properties @1.2.1 (7)
    • define-data-property @1.1.4 (3)
      • es-define-property @1.0.1
      • es-errors @1.3.0
      • gopd @1.2.0
    • has-property-descriptors @1.0.2 (1)
      • es-define-property @1.0.1
    • object-keys @1.1.1

About

This dependency lets you set multiple non-enumerable properties on an object at once. This can be done natively with the Object.defineProperties method.

It’s supported by all modern browsers and Node.js versions since ES5 (2009).

Example

// unless specified, added properties are non enumerable by default
Object.defineProperties(obj, {
    foo: { value: "bar" },
    baz: { value: "qux" }
});

Object.keys(obj); // []

While this dependency takes a 3rd argument to determine whether to overwrite existing properties, this functionality is very trivial to add yourself.

Not to mention this dependency comes with 7 dependencies of its own, which makes it a very heavy dependency for such a trivial task.