Module

x/lodash/keysIn.js

A modern JavaScript utility library delivering modularity, performance, & extras.
Extremely Popular
Go to Latest
File
import baseKeysIn from './_baseKeysIn.js';import indexKeys from './_indexKeys.js';import isIndex from './_isIndex.js';import isPrototype from './_isPrototype.js';
/** Used for built-in method references. */var objectProto = Object.prototype;
/** Used to check objects for own properties. */var hasOwnProperty = objectProto.hasOwnProperty;
/** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */function keysIn(object) { var index = -1, isProto = isPrototype(object), props = baseKeysIn(object), propsLength = props.length, indexes = indexKeys(object), skipIndexes = !!indexes, result = indexes || [], length = result.length;
while (++index < propsLength) { var key = props[index]; if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result;}
export default keysIn;