How to use the object-keys function in object-keys

To help you get started, we’ve selected a few object-keys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthewwithanm / react-controllables / src / index.js View on Github external
return function(...args) {
      // Calculate the new state.
      const currentProps = merge(this.state, omitDefaults(this.props), this.boundActionCreators);
      const newState = reducer(currentProps, ...args);

      // Update the state.
      this.setState(newState);

      // If there are callbacks for the changed values, invoke them.
      keys(newState).forEach(prop => {
        const newValue = newState[prop];
        const callbackName = toCallbackName(prop);
        const cb = this.props[callbackName];
        if (cb) cb(newValue);
      });
    };
  });
github mjackson / expect / modules / TestUtils.js View on Github external
const ownEnumerableKeys = (object) => {
  if (typeof Reflect === 'object' && typeof Reflect.ownKeys === 'function') {
    return Reflect.ownKeys(object)
      .filter(key => Object.getOwnPropertyDescriptor(object, key).enumerable)
  }

  if (typeof Object.getOwnPropertySymbols === 'function') {
    return Object.getOwnPropertySymbols(object)
      .filter(key => Object.getOwnPropertyDescriptor(object, key).enumerable)
      .concat(objectKeys(object))
  }

  return objectKeys(object)
}
github shaungrady / angular-http-etag / src / httpDecorator.js View on Github external
function stringifyParams (obj) {
    return obj ? arrayMap(objectKeys(obj).sort(), function (key) {
      var val = obj[key]

      if (angular.isArray(val)) {
        return arrayMap(val.sort(), function (val2) {
          return encodeURIComponent(key) + '=' + encodeURIComponent(val2)
        }).join('&')
      }

      return encodeURIComponent(key) + '=' + encodeURIComponent(val)
    }).join('&') : ''
  }
github mjackson / expect / modules / TestUtils.js View on Github external
const ownEnumerableKeys = (object) => {
  if (typeof Reflect === 'object' && typeof Reflect.ownKeys === 'function') {
    return Reflect.ownKeys(object)
      .filter(key => Object.getOwnPropertyDescriptor(object, key).enumerable)
  }

  if (typeof Object.getOwnPropertySymbols === 'function') {
    return Object.getOwnPropertySymbols(object)
      .filter(key => Object.getOwnPropertyDescriptor(object, key).enumerable)
      .concat(objectKeys(object))
  }

  return objectKeys(object)
}

object-keys

An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis

Popular object-keys functions