mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
25 lines
793 B
JavaScript
25 lines
793 B
JavaScript
define(['./_baseTimes', './isArguments', './isArray', './isLength', './isString'], function(baseTimes, isArguments, isArray, isLength, isString) {
|
|
|
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
var undefined;
|
|
|
|
/**
|
|
* Creates an array of index keys for `object` values of arrays,
|
|
* `arguments` objects, and strings, otherwise `null` is returned.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array|null} Returns index keys, else `null`.
|
|
*/
|
|
function indexKeys(object) {
|
|
var length = object ? object.length : undefined;
|
|
if (isLength(length) &&
|
|
(isArray(object) || isString(object) || isArguments(object))) {
|
|
return baseTimes(length, String);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
return indexKeys;
|
|
});
|