construct-array

0.0.1 • Public • Published

Built with Grunt Build Status Code Climate

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.

The difference that is this module does NOT turn array to array.

License

MIT © Bharathvaj Ganesan

Package Sidebar

Install

npm i construct-array

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • bharathvaj