New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

batchify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

batchify - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

.travis.yml

32

package.json
{
"name" : "batchify",
"version" : "0.0.1",
"main" : "./lib/batchify.coffee",
"description" : "",
"dependencies" :{
"coffee-script": ">=1.2.0"
"name": "batchify",
"version": "0.1.0",
"main": "./lib/batchify.js",
"description": "",
"dependencies": {
},
"devDependencies" :
{
"mocha" : ">=0.13.0",
"should" : ">=0.5.1"
"devDependencies": {
"gulp": "~3.6.0",
"gulp-mocha": "~0.4.1",
"should": "~3.2.0",
"mocha": "~1.18.2"
},
"engines" :
{
"node" : ">=0.6.10"
"engines": {
"node": ">=0.6.10"
},
"scripts" :
{
"test" : "bin/run_tests"
"scripts": {
"test": "gulp"
}
}

@@ -0,10 +1,12 @@

[![Build Status](https://travis-ci.org/davidmfoley/batchify.svg)](https://travis-ci.org/davidmfoley/batchify)
# Batchify
Batches calls to a particular resource (such as a database or network) so that, rather than making the call multiple times, a single call is made and all callbacks are triggered when it completes.
In some situations, many identical operations can occur in a short period of time, causing performance issues.
For example, let's say that we have the following code:
Batchify wraps a function so that when it is invoked with identical arguments multiple times while in progress, it will only be invoked once, and all callbacks will be notified when it completes.
```coffee
users.findAll (users) ->
```javascript
users.findAll(function(err, users) {
# do something with each user
});
```

@@ -15,7 +17,7 @@

With batchify, one request will be used to service all of the concurrent requests:
```coffee
batchedFindAll = Batchify.wrap(users, 'findAll')
```javascript
var batchedFindAll = Batchify.wrap(users, 'findAll');
# Now you use batchedFindAll the same as you would the original function:
batchedFindAll (users) ->
batchedFindAll(function(err, users) { ... });
```

@@ -25,11 +27,5 @@

The wrapped function can have parameters too:
The wrapped function can have parameters too.
```coffee
batchedFindByState = Batchify.wrap(users, 'findByState')
batchedFindAll 'active', (users) ->
```
(Batchify uses the parameter values as a hash key, so concurrent calls with different parameters will not conflict)
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