您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

keys.js 884B

12345678910111213141516171819202122232425262728293031323334353637
  1. var arrayLikeKeys = require('./_arrayLikeKeys'),
  2. baseKeys = require('./_baseKeys'),
  3. isArrayLike = require('./isArrayLike');
  4. /**
  5. * Creates an array of the own enumerable property names of `object`.
  6. *
  7. * **Note:** Non-object values are coerced to objects. See the
  8. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  9. * for more details.
  10. *
  11. * @static
  12. * @since 0.1.0
  13. * @memberOf _
  14. * @category Object
  15. * @param {Object} object The object to query.
  16. * @returns {Array} Returns the array of property names.
  17. * @example
  18. *
  19. * function Foo() {
  20. * this.a = 1;
  21. * this.b = 2;
  22. * }
  23. *
  24. * Foo.prototype.c = 3;
  25. *
  26. * _.keys(new Foo);
  27. * // => ['a', 'b'] (iteration order is not guaranteed)
  28. *
  29. * _.keys('hi');
  30. * // => ['0', '1']
  31. */
  32. function keys(object) {
  33. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  34. }
  35. module.exports = keys;