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

array-promise-filter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-promise-filter

filter an array through async callback

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
increased by128.57%
Maintainers
1
Weekly downloads
 
Created
Source

array-promise-filter

filter an array through async callback

Usage

var filter = require('array-promise-filter');
var promisify = require('node-promisify');
var gt2 = promisify(function (n, m, cb) {
    process.nextTick(function () {
        var err = n <= m ? new Error('not greater') : null;
        cb(err, n << 1);
    });
});
filter([1,2,3,4,5,6], gt2, 3).then(function (res) {
    console.log(res);   // [8,10,12]
});

filter(values, fnReturnPromise, arg1, arg2,...)

  • values: Array
  • fnReturnPromise: some async function which return a promise. The first argument given to this function is an element from values, and the rest are from arg1, arg2,...

You can use tools like node-promisify to make a callback-style async function to a promise-style async function.

Keywords

FAQs

Package last updated on 24 May 2015

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