0.0.1 • Published 7 years ago
construct-array v0.0.1
construct-array
Returns the passing value(anything .. string,number,null,undefined,object,array) as an array.
Motivation
Inspired by Sindre Sorhus
Installation
$ npm install --save construct-array
Usuage
let arrayify = require('construct-array');
arrayify('India');
//=>['India']
arrayify(null);
//=>[null]
arrayify(undefined);
//=> [undefined]
arrayify([2,3]);
//=> [[2,3]] i.e arr[0]=[2,3]
arrayify(undefined);
//=> [undefined]
arrayify({name : "april"});
//=> [{name : "april"}] i.e array of objects
Related
- arrify - Convert a value to an array
The difference that is this module does NOT turn null
or undefined
to an empty array.
- array-ify - Turn anything into an array
The difference that is this module does NOT turn array
to array.
License
MIT © Bharathvaj Ganesan
0.0.1
7 years ago