25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
778 B

4 년 전
  1. var arrayLikeKeys = require('./_arrayLikeKeys'),
  2. baseKeysIn = require('./_baseKeysIn'),
  3. isArrayLike = require('./isArrayLike');
  4. /**
  5. * Creates an array of the own and inherited enumerable property names of `object`.
  6. *
  7. * **Note:** Non-object values are coerced to objects.
  8. *
  9. * @static
  10. * @memberOf _
  11. * @since 3.0.0
  12. * @category Object
  13. * @param {Object} object The object to query.
  14. * @returns {Array} Returns the array of property names.
  15. * @example
  16. *
  17. * function Foo() {
  18. * this.a = 1;
  19. * this.b = 2;
  20. * }
  21. *
  22. * Foo.prototype.c = 3;
  23. *
  24. * _.keysIn(new Foo);
  25. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26. */
  27. function keysIn(object) {
  28. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  29. }
  30. module.exports = keysIn;