Spaces:
Runtime error
Runtime error
Download masteringModule/node_modules/lodash/castArray.js from SE-09/HapticsProject: direct link, hf CLI and curl.
- Browser
- Download file 768 Bytes
-
https://huggingface.co/spaces/SE-09/HapticsProject/resolve/main/masteringModule/node_modules/lodash/castArray.js
- Command line
-
hf download hf://spaces/SE-09/HapticsProject/masteringModule/node_modules/lodash/castArray.js
-
curl -L -o castArray.js https://huggingface.co/spaces/SE-09/HapticsProject/resolve/main/masteringModule/node_modules/lodash/castArray.js
768 Bytes
| var isArray = require('./isArray'); | |
| /** | |
| * Casts `value` as an array if it's not one. | |
| * | |
| * @static | |
| * @memberOf _ | |
| * @since 4.4.0 | |
| * @category Lang | |
| * @param {*} value The value to inspect. | |
| * @returns {Array} Returns the cast array. | |
| * @example | |
| * | |
| * _.castArray(1); | |
| * // => [1] | |
| * | |
| * _.castArray({ 'a': 1 }); | |
| * // => [{ 'a': 1 }] | |
| * | |
| * _.castArray('abc'); | |
| * // => ['abc'] | |
| * | |
| * _.castArray(null); | |
| * // => [null] | |
| * | |
| * _.castArray(undefined); | |
| * // => [undefined] | |
| * | |
| * _.castArray(); | |
| * // => [] | |
| * | |
| * var array = [1, 2, 3]; | |
| * console.log(_.castArray(array) === array); | |
| * // => true | |
| */ | |
| function castArray() { | |
| if (!arguments.length) { | |
| return []; | |
| } | |
| var value = arguments[0]; | |
| return isArray(value) ? value : [value]; | |
| } | |
| module.exports = castArray; | |