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

array-back

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-back

Guarantees an array back

  • 6.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.6M
increased by6.72%
Maintainers
1
Weekly downloads
 
Created

What is array-back?

The array-back npm package is designed to ensure that any value provided to it is returned as an array. This can be useful when you are not sure if a function will receive an argument as a single value or an array of values. It helps to normalize the input for further processing.

What are array-back's main functionalities?

Convert a non-array value to an array

This feature takes a single value and wraps it in an array. If the value is already an array, it returns the array unchanged.

[].concat(arrayBack(value))

Flatten nested arrays

This feature can be used to flatten nested arrays into a single-level array.

arrayBack([1, [2, [3]]])

Ignore empty slots in sparse arrays

This feature allows the conversion of sparse arrays into compact arrays without empty slots.

arrayBack(new Array(5))

Other packages similar to array-back

Keywords

FAQs

Package last updated on 14 Jan 2022

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