react / wstein / node_modules / jest-cli / node_modules / lodash.template / node_modules / lodash.keys / node_modules / lodash.isarray / index.js
80728 views/**1* lodash 3.0.3 (Custom Build) <https://lodash.com/>2* Build: `lodash modern modularize exports="npm" -o ./`3* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>4* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>5* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors6* Available under MIT license <https://lodash.com/license>7*/89/** `Object#toString` result references. */10var arrayTag = '[object Array]',11funcTag = '[object Function]';1213/**14* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).15* In addition to special characters the forward slash is escaped to allow for16* easier `eval` use and `Function` compilation.17*/18var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,19reHasRegExpChars = RegExp(reRegExpChars.source);2021/** Used to detect host constructors (Safari > 5). */22var reIsHostCtor = /^\[object .+?Constructor\]$/;2324/**25* Converts `value` to a string if it's not one. An empty string is returned26* for `null` or `undefined` values.27*28* @private29* @param {*} value The value to process.30* @returns {string} Returns the string.31*/32function baseToString(value) {33if (typeof value == 'string') {34return value;35}36return value == null ? '' : (value + '');37}3839/**40* Checks if `value` is object-like.41*42* @private43* @param {*} value The value to check.44* @returns {boolean} Returns `true` if `value` is object-like, else `false`.45*/46function isObjectLike(value) {47return !!value && typeof value == 'object';48}4950/** Used for native method references. */51var objectProto = Object.prototype;5253/** Used to resolve the decompiled source of functions. */54var fnToString = Function.prototype.toString;5556/** Used to check objects for own properties. */57var hasOwnProperty = objectProto.hasOwnProperty;5859/**60* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)61* of values.62*/63var objToString = objectProto.toString;6465/** Used to detect if a method is native. */66var reIsNative = RegExp('^' +67escapeRegExp(fnToString.call(hasOwnProperty))68.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'69);7071/* Native method references for those with the same name as other `lodash` methods. */72var nativeIsArray = getNative(Array, 'isArray');7374/**75* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)76* of an array-like value.77*/78var MAX_SAFE_INTEGER = 9007199254740991;7980/**81* Gets the native function at `key` of `object`.82*83* @private84* @param {Object} object The object to query.85* @param {string} key The key of the method to get.86* @returns {*} Returns the function if it's native, else `undefined`.87*/88function getNative(object, key) {89var value = object == null ? undefined : object[key];90return isNative(value) ? value : undefined;91}9293/**94* Checks if `value` is a valid array-like length.95*96* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).97*98* @private99* @param {*} value The value to check.100* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.101*/102function isLength(value) {103return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;104}105106/**107* Checks if `value` is classified as an `Array` object.108*109* @static110* @memberOf _111* @category Lang112* @param {*} value The value to check.113* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.114* @example115*116* _.isArray([1, 2, 3]);117* // => true118*119* _.isArray(function() { return arguments; }());120* // => false121*/122var isArray = nativeIsArray || function(value) {123return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;124};125126/**127* Checks if `value` is a native function.128*129* @static130* @memberOf _131* @category Lang132* @param {*} value The value to check.133* @returns {boolean} Returns `true` if `value` is a native function, else `false`.134* @example135*136* _.isNative(Array.prototype.push);137* // => true138*139* _.isNative(_);140* // => false141*/142function isNative(value) {143if (value == null) {144return false;145}146if (objToString.call(value) == funcTag) {147return reIsNative.test(fnToString.call(value));148}149return isObjectLike(value) && reIsHostCtor.test(value);150}151152/**153* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",154* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.155*156* @static157* @memberOf _158* @category String159* @param {string} [string=''] The string to escape.160* @returns {string} Returns the escaped string.161* @example162*163* _.escapeRegExp('[lodash](https://lodash.com/)');164* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'165*/166function escapeRegExp(string) {167string = baseToString(string);168return (string && reHasRegExpChars.test(string))169? string.replace(reRegExpChars, '\\$&')170: string;171}172173module.exports = isArray;174175176