CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
castArray.js45 linesDownload Raw Back to lodash
1var isArray = require('./isArray');2 3/**4 * Casts `value` as an array if it's not one.5 *6 * @static7 * @memberOf _8 * @since 4.4.09 * @category Lang10 * @param {*} value The value to inspect.11 * @returns {Array} Returns the cast array.12 * @example13 *14 * _.castArray(1);15 * // => [1]16 *17 * _.castArray({ 'a': 1 });18 * // => [{ 'a': 1 }]19 *20 * _.castArray('abc');21 * // => ['abc']22 *23 * _.castArray(null);24 * // => [null]25 *26 * _.castArray(undefined);27 * // => [undefined]28 *29 * _.castArray();30 * // => []31 *32 * var array = [1, 2, 3];33 * console.log(_.castArray(array) === array);34 * // => true35 */36function castArray() {37  if (!arguments.length) {38    return [];39  }40  var value = arguments[0];41  return isArray(value) ? value : [value];42}43 44module.exports = castArray;45 
basant307/AI_Governance_Project · CoolFace