{"_id":"cast-to-array","_rev":"26793","name":"cast-to-array","description":"Cast a value to an array.","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:02:45.000Z","created":"2015-11-06T07:01:37.095Z","0.1.0":"2015-11-06T07:01:37.095Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/cast-to-array.git"},"versions":{"0.1.0":{"name":"cast-to-array","description":"Cast a value to an array.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/cast-to-array","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/cast-to-array.git"},"bugs":{"url":"https://github.com/jonschlinkert/cast-to-array/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*"},"verb":{"related":{"list":["arr-map","array-xor","array-sum","array-map","array-last"]}},"_id":"cast-to-array@0.1.0","_shasum":"d29e968ad4c06afb67793e61c210c246ba3df9a3","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d29e968ad4c06afb67793e61c210c246ba3df9a3","size":2124,"noattachment":false,"key":"/cast-to-array/-/cast-to-array-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/cast-to-array/download/cast-to-array-0.1.0.tgz"},"directories":{},"publish_time":1446793297095,"_cnpm_publish_time":1446793297095,"_hasShrinkwrap":false}},"readme":"# cast-to-array [![NPM version](https://badge.fury.io/js/cast-to-array.svg)](http://badge.fury.io/js/cast-to-array)\n\n> Cast a value to an array.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i cast-to-array --save\n```\n\n## Usage\n\n```js\nvar arrayify = require('cast-to-array');\n```\n\n**returns an empty array when value is null or undefined**\n\n```js\narrayify(null);\narrayify(undefined);\n//=> []\n```\n\n**casts a non-array value to an array**\n\n```js\narrayify('abc');\n//=> ['abc']\n\narrayify(/xyz/);\n//=> [/xyz/]\n\narrayify(new RegExp('.'));\n//=> [new RegExp('.')]\n\narrayify([[]]);\n//=> [[]]\n\narrayify({});\n//=> [{}]\n```\n\n**returns an array directly**\n\n```js\narrayify(['foo']);\n//=> ['foo']\n\narrayify([]);\n//=> []\n```\n\n## Similar projects\n\n* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map)\n* [array-last](https://www.npmjs.com/package/array-last): Get the last or last n elements in an array. | [homepage](https://github.com/jonschlinkert/array-last)\n* [array-map](https://www.npmjs.com/package/array-map): `[].map(f)` for older browsers | [homepage](https://github.com/substack/array-map)\n* [array-sum](https://www.npmjs.com/package/array-sum): Add up all of the numbers in an array of numbers. Works when non-numbers are… [more](https://www.npmjs.com/package/array-sum) | [homepage](https://github.com/jonschlinkert/array-sum)\n* [array-xor](https://www.npmjs.com/package/array-xor): Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in… [more](https://www.npmjs.com/package/array-xor) | [homepage](https://github.com/jonschlinkert/array-xor)\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/cast-to-array/issues/new).\n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2015 Jon Schlinkert\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 06, 2015._","_attachments":{},"homepage":"https://github.com/jonschlinkert/cast-to-array","bugs":{"url":"https://github.com/jonschlinkert/cast-to-array/issues"},"license":"MIT"}