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

@supercharge/arrays

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supercharge/arrays

Array utilities for Node.js and JavaScript

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-3.57%
Maintainers
3
Weekly downloads
 
Created
Source


Arrays

Array utilities for JavaScript and Node.js


Installation · Docs · Usage



Latest Version Monthly downloads

Follow @marcuspoehls and @superchargejs for updates!


Introduction

The @supercharge/arrays package provides chainable array utilities for Node.js and JavaScript. It’s a wrapper around JavaScript arrays providing useful methods like .isEmpty(), .size(), .flatMap(), .contains(), and many more.

Installation

npm i @supercharge/arrays

Docs

Find all the details for @supercharge/arrays in the extensive Supercharge docs.

Usage

Using @supercharge/arrays is pretty straightforward. The package exports a function wrapping an array or individual items as an argument. You can then fluently chain methods interacting with your data:

const { Arr } = require('@supercharge/arrays')

const hasItemsGreaterTen = Arr([1, 2, 3, 4, 5, 6])
  .map(value => value * 2) // [2, 4, 6, 8, 10, 12]
  .filter(value => value > 10) // [12]
  .isNotEmpty() // true


// Only methods, no properties
Arr([1, 2, 3]).length() // 3


// Supports callbacks for `.includes`:
Arr([1, 2, 3]).includes(value => {
  return value > 2
})

Every method in the chain returns a @supercharge/array instance. This way, you can chain further methods without leaving the fluent interface. Call .all() to retrieve the plain JavaScript array.

Contributing

Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

  1. Create a fork
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 🚀

License

MIT © Supercharge


superchargejs.com  ·  GitHub @supercharge  ·  Twitter @superchargejs

Keywords

FAQs

Package last updated on 10 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