MCPcopy
hub / github.com/vercel/hyper / toArray

Function toArray

bin/yarn-standalone.js:20040–20054  ·  view source on GitHub ↗

* Converts `value` to an array. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * _.toArray({ 'a': 1, 'b': 2 }); * // => [1, 2]

(value)

Source from the content-addressed store, hash-verified

20038 * // => []
20039 */
20040 function toArray(value) {
20041 if (!value) {
20042 return [];
20043 }
20044 if (isArrayLike(value)) {
20045 return isString(value) ? stringToArray(value) : copyArray(value);
20046 }
20047 if (symIterator && value[symIterator]) {
20048 return iteratorToArray(value[symIterator]());
20049 }
20050 var tag = getTag(value),
20051 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
20052
20053 return func(value);
20054 }
20055
20056 /**
20057 * Converts `value` to a finite number.

Callers 4

wrapperNextFunction · 0.85
yarn-standalone.jsFile · 0.85
PumpifyFunction · 0.85
defineFunction · 0.85

Calls 7

isArrayLikeFunction · 0.85
isStringFunction · 0.85
stringToArrayFunction · 0.85
copyArrayFunction · 0.85
iteratorToArrayFunction · 0.85
getTagFunction · 0.85
isNothingFunction · 0.85

Tested by

no test coverage detected