summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/keysIn.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/node_modules/lodash/keysIn.js')
-rw-r--r--tools/eslint/node_modules/lodash/keysIn.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/keysIn.js b/tools/eslint/node_modules/lodash/keysIn.js
new file mode 100644
index 0000000000..e327b874d9
--- /dev/null
+++ b/tools/eslint/node_modules/lodash/keysIn.js
@@ -0,0 +1,54 @@
+var baseKeysIn = require('./_baseKeysIn'),
+ indexKeys = require('./_indexKeys'),
+ isIndex = require('./_isIndex'),
+ isPrototype = require('./_isPrototype');
+
+/** 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 _
+ * @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;
+}
+
+module.exports = keysIn;