Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / keysIn.js
1 var baseKeysIn = require('./internal/baseKeysIn'),
2     indexKeys = require('./internal/indexKeys'),
3     isIndex = require('./internal/isIndex'),
4     isPrototype = require('./internal/isPrototype');
5
6 /** Used for built-in method references. */
7 var objectProto = global.Object.prototype;
8
9 /** Used to check objects for own properties. */
10 var hasOwnProperty = objectProto.hasOwnProperty;
11
12 /**
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  * @static
18  * @memberOf _
19  * @category Object
20  * @param {Object} object The object to query.
21  * @returns {Array} Returns the array of property names.
22  * @example
23  *
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  */
34 function keysIn(object) {
35   var index = -1,
36       isProto = isPrototype(object),
37       props = baseKeysIn(object),
38       propsLength = props.length,
39       indexes = indexKeys(object),
40       skipIndexes = !!indexes,
41       result = indexes || [],
42       length = result.length;
43
44   while (++index < propsLength) {
45     var key = props[index];
46     if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
47         !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
48       result.push(key);
49     }
50   }
51   return result;
52 }
53
54 module.exports = keysIn;