index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 objectTypes = require('lodash._objecttypes');
  10. /** Used for native method references */
  11. var objectProto = Object.prototype;
  12. /** Native method shortcuts */
  13. var hasOwnProperty = objectProto.hasOwnProperty;
  14. /**
  15. * A fallback implementation of `Object.keys` which produces an array of the
  16. * given object's own enumerable property names.
  17. *
  18. * @private
  19. * @type Function
  20. * @param {Object} object The object to inspect.
  21. * @returns {Array} Returns an array of property names.
  22. */
  23. var shimKeys = function(object) {
  24. var index, iterable = object, result = [];
  25. if (!iterable) return result;
  26. if (!(objectTypes[typeof object])) return result;
  27. for (index in iterable) {
  28. if (hasOwnProperty.call(iterable, index)) {
  29. result.push(index);
  30. }
  31. }
  32. return result
  33. };
  34. module.exports = shimKeys;