Sha256: f0f3998864757d11eca39efd1b8e99dbdc73e591da7a2efade52422dbed0a20a

Contents?: true

Size: 1.62 KB

Versions: 153

Compression:

Stored size: 1.62 KB

Contents

var isArguments = require('../lang/isArguments'),
    isArray = require('../lang/isArray'),
    isIndex = require('../internal/isIndex'),
    isLength = require('../internal/isLength'),
    isObject = require('../lang/isObject');

/** Used for native 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 _
 * @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) {
  if (object == null) {
    return [];
  }
  if (!isObject(object)) {
    object = Object(object);
  }
  var length = object.length;
  length = (length && isLength(length) &&
    (isArray(object) || isArguments(object)) && length) || 0;

  var Ctor = object.constructor,
      index = -1,
      isProto = typeof Ctor == 'function' && Ctor.prototype === object,
      result = Array(length),
      skipIndexes = length > 0;

  while (++index < length) {
    result[index] = (index + '');
  }
  for (var key in object) {
    if (!(skipIndexes && isIndex(key, length)) &&
        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
      result.push(key);
    }
  }
  return result;
}

module.exports = keysIn;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
blackboard-3.1.9 lib/site_template/node_modules/opt-merger/node_modules/lodash/object/keysIn.js
blackboard-3.1.9 lib/site_template/node_modules/easy-extender/node_modules/lodash/object/keysIn.js
babel-schmooze-sprockets-0.1.1 node_modules/lodash/object/keysIn.js
babel-schmooze-sprockets-0.1.0 node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/object/keysIn.js
babel-schmooze-sprockets-0.1.0.alpha.3 node_modules/lodash/object/keysIn.js
babel-schmooze-sprockets-0.1.0.alpha.2 node_modules/lodash/object/keysIn.js
trusty-festivity-extension-2.5.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/object/keysIn.js