2.0.5 • Published 5 years ago
@coolgk/array v2.0.5
@coolgk/array
a javascript / typescript module
npm install @coolgk/array
array utilities
Report bugs here: https://github.com/coolgk/node-utils/issues
Examples
import { toArray } from '@coolgk/array';
// OR
// const { toArray } = require('@coolgk/array');
const a = undefined;
const b = false;
const c = '';
const d = [1,2,3];
const e = {a:1};
console.log(toArray(a)); // []
console.log(toArray(b)); // [ false ]
console.log(toArray(c)); // [ '' ]
console.log(toArray(d)); // [ 1, 2, 3 ]
console.log(toArray(e)); // [ { a: 1 } ]
toArray(data) ⇒ array
Kind: global function
Param | Type | Description |
---|---|---|
data | * | any data to be type cast to array |