6.2.2 • Published 2 years ago

array-back v6.2.2

Weekly downloads
1,685,956
License
MIT
Repository
github
Last release
2 years ago

view on npm npm module downloads Gihub repo dependents Gihub package dependents Node.js CI Coverage Status js-standard-style

array-back

Takes any input and guarantees an array back.

  • Converts array-like objects (e.g. arguments, Set) to a real array.
  • Converts undefined to an empty array.
  • Converts any another other, singular value (including null, objects and iterables other than Set) into an array containing that value.
  • Ignores input which is already an array.

Example

> const arrayify = require('array-back')

> arrayify(undefined)
[]

> arrayify(null)
[ null ]

> arrayify(0)
[ 0 ]

> arrayify([ 1, 2 ])
[ 1, 2 ]

> arrayify(new Set([ 1, 2 ]))
[ 1, 2 ]

> function f(){ return arrayify(arguments); }
> f(1,2,3)
[ 1, 2, 3 ]

arrayify(input) ⇒ Array

Kind: Exported function

ParamTypeDescription
input*The input value to convert to an array

Load anywhere

This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.

Node.js:

const arrayify = require('array-back')

Within Node.js with ECMAScript Module support enabled:

import arrayify from 'array-back'

Within an modern browser ECMAScript Module:

import arrayify from './node_modules/array-back/index.js'

© 2015-22 Lloyd Brookes \75pound@gmail.com\.

Isomorphic test suite by test-runner and web-runner. Documented by jsdoc-to-markdown.

dmd-jcdata-table-elquick-ep@75lb/dork-dossier-api@75lb/npm-api@coranos/dmd@coranos/jsdoc-to-markdownjsdoc-to-markdown-jc@everything-registry/sub-chunk-1164@skedulr/nebula-ui-library@75lb/simple-chart@aurelianoa/metadataupdatable@barchart/documentation-generator@bowogfc/bbpolymer@bonsaiswapv3/core@bonsaiswapv3/deploy@borealisswap/borealis-swap-libviber-botkitvue-picocsstip4tinymce-plugin-toyworkusage-statstldrawlignintable-layoutswagger2-2-postman-collectionswagger2-to-postman-updatedsort-arraystream-connecttest-solidity-npmtest-valueshen-dmd@chhengchansopheaktra/html2md@client-zone/npm@hyperone/cli-device-browser@hyperone/cli-device-node@esydoc/resolver-doc@esydoc/resolver-doc2@infinitebrahmanuniverse/nolb-array-@innoswap/core@innofake/jsdoc-api-debuggable@jorgeecaraballoveliz/components-library@kiwanoswap/v2-core@nirin100/quadratic-protocol@nodeberry/solidity-payment-processor@jmd01/lws-rewrite@olympfin/olymp-swap-libfeature-detect-es6find-replaceacquire-modulefile-setmiracle-webpack-tree-shaking@sudophunk/fulido@reusable-web/simple-chart@reusable-web/data-table@viglucci/command-line-usagenisicorporisfronthackfsm-baseapi-surfaceak-dmdapp-usage-statsgoogle-remake@zalastax/nolb-array-h1-cli-coreh1-cli-device-browser@satrianak/hardhat-teaxyz@soyjak/utils@torgeircook/cssjsonansi-escape-sequencesarray-basearray-toolsargv-toolsnotion-database-exporterhardhat-teaplughardhat-teaxyzbbpolymerbs4-flex-helperobject-toolscache-pointckeditor5-strapi-msgcommand-line-plugincommand-line-toolcommand-line-usagecommand-line-argscommand-line-commandsjsdoc-apijsdoc-parsejsdoc-parse-templatequadratic-sdkcolumn-layoutqudratic-uijsdoc-to-markdownkoa-mock-responseddatadiscord.js-bycondiscordjs-con-selflinguistdmd-tfdmd
6.2.1

2 years ago

6.2.2

2 years ago

6.2.0

3 years ago

6.1.2

3 years ago

6.1.0

3 years ago

6.1.1

3 years ago

6.0.1

3 years ago

6.0.0

3 years ago

4.0.2

3 years ago

5.0.0

4 years ago

4.0.1

4 years ago

4.0.0

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago