Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

_baseKeysIn.js 870B

123456789101112131415161718192021222324252627282930313233
  1. var isObject = require('./isObject'),
  2. isPrototype = require('./_isPrototype'),
  3. nativeKeysIn = require('./_nativeKeysIn');
  4. /** Used for built-in method references. */
  5. var objectProto = Object.prototype;
  6. /** Used to check objects for own properties. */
  7. var hasOwnProperty = objectProto.hasOwnProperty;
  8. /**
  9. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  10. *
  11. * @private
  12. * @param {Object} object The object to query.
  13. * @returns {Array} Returns the array of property names.
  14. */
  15. function baseKeysIn(object) {
  16. if (!isObject(object)) {
  17. return nativeKeysIn(object);
  18. }
  19. var isProto = isPrototype(object),
  20. result = [];
  21. for (var key in object) {
  22. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  23. result.push(key);
  24. }
  25. }
  26. return result;
  27. }
  28. module.exports = baseKeysIn;