_.castArray(value)
Casts value
as an array if it's not one.
Since
4.4.0
Arguments
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
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .