2016-10-10 03:43:44 +02:00
|
|
|
/**
|
2017-04-20 03:09:25 +02:00
|
|
|
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
|
|
|
|
* Build: `lodash modularize modern exports="npm" -o ./npm/`
|
|
|
|
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
|
|
|
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
|
|
|
|
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
|
|
* Available under MIT license <http://lodash.com/license>
|
2016-10-10 03:43:44 +02:00
|
|
|
*/
|
2017-04-20 03:09:25 +02:00
|
|
|
var isNative = require('lodash._isnative'),
|
|
|
|
isObject = require('lodash.isobject'),
|
|
|
|
shimKeys = require('lodash._shimkeys');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2017-04-20 03:09:25 +02:00
|
|
|
/* Native method shortcuts for methods with the same name as other `lodash` methods */
|
|
|
|
var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
/**
|
2017-04-20 03:09:25 +02:00
|
|
|
* Creates an array composed of the own enumerable property names of an object.
|
2016-10-10 03:43:44 +02:00
|
|
|
*
|
|
|
|
* @static
|
|
|
|
* @memberOf _
|
2017-04-20 03:09:25 +02:00
|
|
|
* @category Objects
|
|
|
|
* @param {Object} object The object to inspect.
|
|
|
|
* @returns {Array} Returns an array of property names.
|
2016-10-10 03:43:44 +02:00
|
|
|
* @example
|
|
|
|
*
|
2017-04-20 03:09:25 +02:00
|
|
|
* _.keys({ 'one': 1, 'two': 2, 'three': 3 });
|
|
|
|
* // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
|
2016-10-10 03:43:44 +02:00
|
|
|
*/
|
|
|
|
var keys = !nativeKeys ? shimKeys : function(object) {
|
|
|
|
if (!isObject(object)) {
|
2017-04-20 03:09:25 +02:00
|
|
|
return [];
|
2016-10-10 03:43:44 +02:00
|
|
|
}
|
2017-04-20 03:09:25 +02:00
|
|
|
return nativeKeys(object);
|
|
|
|
};
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
module.exports = keys;
|