@nevware21/ts-utils
    Preparing search index...

    Function objGetOwnPropertyDescriptors

    • The objGetOwnPropertyDescriptors() method returns all own property descriptors of a given object.

      Parameters

      • obj: any

        The object for which to get all own property descriptors

      Returns PropertyDescriptorMap

      An object containing all own property descriptors of the given object

      0.12.0

      const obj = {
      get foo() { return 17; },
      bar: 42
      };

      const descriptors = objGetOwnPropertyDescriptors(obj);
      // descriptors is:
      // {
      // foo: {
      // configurable: true,
      // enumerable: true,
      // get: [Function: get foo],
      // set: undefined
      // },
      // bar: {
      // configurable: true,
      // enumerable: true,
      // value: 42,
      // writable: true
      // }
      // }

      // This method can be used to create a shallow copy including getters and setters
      const shallowCopy = objCreate(
      objGetPrototypeOf(obj),
      objGetOwnPropertyDescriptors(obj)
      );