NPM Smell πŸ‘πŸ’¨

trivial and outdated NPM packages

define-properties outdated npm logo

Convoluted way of calling Object.defineProperties.

Weekly Downloads
37,666,297
Dependencies
28 (11 distinct)
Latest Release
a year ago
This dependency re-creates a native JavaScript API. It is recommended to use the native API instead
Outdated
natively supported
since 11 years (chrome, firefox, safari, nodejs)

Dependency Tree

define-properties
  define-data-property
    es-define-property
      get-intrinsic
        es-errors
        function-bind
        has-proto
        has-symbols
        hasown
          function-bind
    es-errors
    gopd
      get-intrinsic
        es-errors
        function-bind
        has-proto
        has-symbols
        hasown
          function-bind
  has-property-descriptors
    es-define-property
      get-intrinsic
        es-errors
        function-bind
        has-proto
        has-symbols
        hasown
          function-bind
  object-keys

About

This dependency lets you set multiple non enumerated 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 about 6 years.

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 28 dependencies of its own, which makes it a very heavy dependency for such a trivial task.