🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
7.6M
-16.28%
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

to

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