UNPKG

988 BJavaScriptView Raw
1import Reflect from './_Reflect';
2import iteratorToArray from './_iteratorToArray';
3
4/** Used for built-in method references. */
5var objectProto = Object.prototype;
6
7/** Built-in value references. */
8var enumerate = Reflect ? Reflect.enumerate : undefined,
9 propertyIsEnumerable = objectProto.propertyIsEnumerable;
10
11/**
12 * The base implementation of `_.keysIn` which doesn't skip the constructor
13 * property of prototypes or treat sparse arrays as dense.
14 *
15 * @private
16 * @param {Object} object The object to query.
17 * @returns {Array} Returns the array of property names.
18 */
19function baseKeysIn(object) {
20 object = object == null ? object : Object(object);
21
22 var result = [];
23 for (var key in object) {
24 result.push(key);
25 }
26 return result;
27}
28
29// Fallback for IE < 9 with es6-shim.
30if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {
31 baseKeysIn = function(object) {
32 return iteratorToArray(enumerate(object));
33 };
34}
35
36export default baseKeysIn;