index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
  3. * Build: `lodash modularize modern exports="npm" -o ./npm/`
  4. * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
  5. * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
  6. * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7. * Available under MIT license <http://lodash.com/license>
  8. */
  9. var isNative = require('lodash._isnative'),
  10. isObject = require('lodash.isobject'),
  11. shimKeys = require('lodash._shimkeys');
  12. /* Native method shortcuts for methods with the same name as other `lodash` methods */
  13. var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;
  14. /**
  15. * Creates an array composed of the own enumerable property names of an object.
  16. *
  17. * @static
  18. * @memberOf _
  19. * @category Objects
  20. * @param {Object} object The object to inspect.
  21. * @returns {Array} Returns an array of property names.
  22. * @example
  23. *
  24. * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
  25. * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
  26. */
  27. var keys = !nativeKeys ? shimKeys : function(object) {
  28. if (!isObject(object)) {
  29. return [];
  30. }
  31. return nativeKeys(object);
  32. };
  33. module.exports = keys;