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

contra-find

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contra-find

Using contra, asynchronously find a value in a collection that matches a condition.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

contra-find

build status

Using contra, asynchronously find a value in a collection that matches a condition.

var λ = require('contra');
var find = require('contra-find');

var items = [
  [1, 2],
  [2, 3],
  [3, 4],
  [4, 5],
  [5, 6]
];

find(λ, items, function(item, next){

  console.log('item :', item);

  process.nextTick(function(){
    console.log('check:', item);
    next(undefined, item[0] === 3);
  });

}, function(err, item){
  console.log('item found!', item);
});

output

item : [ 1, 2 ]
check: [ 1, 2 ]
item : [ 2, 3 ]
check: [ 2, 3 ]
item : [ 3, 4 ]
check: [ 3, 4 ]
item found! [ 3, 4 ]

Notice that it iterates in series and stops as soon as the item is found.

License

MIT

Keywords

FAQs

Package last updated on 29 Jun 2016

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