Skip to content
async/await-ready, chainable Array & Collection utilities
Branch: master
Clone or download
Latest commit 4f87dd9 Oct 22, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples standard v13; fix linting errors Jul 11, 2019
src formatting Oct 22, 2019
test add median test Oct 11, 2019
.eslintrc.json initial Jul 4, 2019
.gitignore initial Jul 4, 2019
.travis.yml add .travis.yml Jul 5, 2019 update changelog Oct 11, 2019
LICENSE Initial commit Jul 3, 2019 Update Oct 15, 2019
index.js refactor from individual methods to single collection class Jul 16, 2019
package.json Merge branch 'master' into dependabot/npm_and_yarn/hapi/lab-21.0.0 Oct 14, 2019


async/await-ready array & collection utilities for Node.js

Installation · Docs · Usage

Build Status Latest Version Monthly downloads

Follow @marcuspoehls and @superchargejs for updates!


npm i @supercharge/collections


Find all the details and available methods in the extensive Supercharge docs.


The package exports a function accepting an array as a parameter. From there, you can chain all collection methods.

The package is async/await-ready and supports async functions for most of the methods.

const User = require('models/user')
const Collect = require('@supercharge/collections')

await Collect(
    await User.all()
  .filter(async user => {
    return user.notSubscribedToNewsletter()
  .map(async user => {
    await user.subscribeToNewsletter()
    return user

// result: [ <list of newly-subscribed users> ]

Notice: when chaining methods like map or filter, you'll receive a collection instance in return. You must actively end the call chain using the .all() method to process the collection pipeline and retrieve the final result.

You can directly await the result for methods returning a definite value:

await Collect([ 1, 2, 3 ])
  .map(item => item * 100)
  .reduce((carry, item) => {
    return carry + item
  }, 0)

// result: 600


Do you miss a collection 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 🚀


MIT © Supercharge  ·  GitHub @superchargejs  ·  Twitter @superchargejs

You can’t perform that action at this time.