Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arraywrap

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arraywrap

if it's not an array, wrap it in an array. if it's already an array, do nothing.

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
179
decreased by-27.82%
Maintainers
1
Weekly downloads
 
Created
Source

array wrap dot js

If it's not an array, make it one:

arrayWrap(123)   // => [123]
arrayWrap('yo')  // => ['yo']
arrayWrap(null)  // => [null]
arrayWrap()      // => []

If it's already an array, do nothing:

arrayWrap([1, 2, 3]) // => [1, 2, 3]
arrayWrap([])        // => []

To use it in Node/Browserify/Webpack:

var arrayWrap = require('arraywrap')
arrayWrap(47)

To use it in the browser:

<script src="arraywrap.js"></script>
<script>arrayWrap(47)</script>

If you need to support browsers that don't have Array.isArray (like IE8 and below), you'll need to polyfill it.

Keywords

FAQs

Package last updated on 16 Nov 2014

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