This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
array-ify with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Turn anything into an array
$ npm install --save array-ify
var arrayify = require('array-ify'); arrayify('unicorn'); //=> ['unicorn'] arrayify(['unicorn']); //=> ['unicorn'] arrayify(null); //=> [null] arrayify(undefined); //=> [undefined]
The difference that is this module does NOT turn
undefined to an empty array.
MIT © Steve Mao