react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / object / keysIn.js
80742 viewsvar isArguments = require('../lang/isArguments'),1isArray = require('../lang/isArray'),2isIndex = require('../internal/isIndex'),3isLength = require('../internal/isLength'),4isObject = require('../lang/isObject');56/** Used for native method references. */7var objectProto = Object.prototype;89/** Used to check objects for own properties. */10var hasOwnProperty = objectProto.hasOwnProperty;1112/**13* Creates an array of the own and inherited enumerable property names of `object`.14*15* **Note:** Non-object values are coerced to objects.16*17* @static18* @memberOf _19* @category Object20* @param {Object} object The object to query.21* @returns {Array} Returns the array of property names.22* @example23*24* function Foo() {25* this.a = 1;26* this.b = 2;27* }28*29* Foo.prototype.c = 3;30*31* _.keysIn(new Foo);32* // => ['a', 'b', 'c'] (iteration order is not guaranteed)33*/34function keysIn(object) {35if (object == null) {36return [];37}38if (!isObject(object)) {39object = Object(object);40}41var length = object.length;42length = (length && isLength(length) &&43(isArray(object) || isArguments(object)) && length) || 0;4445var Ctor = object.constructor,46index = -1,47isProto = typeof Ctor == 'function' && Ctor.prototype === object,48result = Array(length),49skipIndexes = length > 0;5051while (++index < length) {52result[index] = (index + '');53}54for (var key in object) {55if (!(skipIndexes && isIndex(key, length)) &&56!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {57result.push(key);58}59}60return result;61}6263module.exports = keysIn;646566