Socket
Socket
Sign inDemoInstall

construct-array

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

construct-array

Returns the passing value as an array.


Version published
Maintainers
1
Created
Source

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
  • 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

Keywords

FAQs

Package last updated on 25 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc