array utilities
npm install @coolgk/arraynpm install @coolgk/array
array utilities
Report bugs here: https://github.com/coolgk/node-utils/issues
javascript
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 } ]
``array| Param | Type | Description |
| --- | --- | --- |
| data | \* | any data to be type cast to array |