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

call-last

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

call-last - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

24

index.js

@@ -15,2 +15,3 @@

// Async function call
module.exports = function() {

@@ -21,2 +22,15 @@ var cb = getLast(slice.call(arguments))

// Apply given arguments to each callback found
module.exports.with = function() {
var args = slice.call(arguments)
return function() {
var cb = getLast(slice.call(arguments))
if (cb) process.nextTick(function() {
cb.apply(cb, args)
})
}
}
// Sync function call
module.exports.sync = function() {

@@ -26,1 +40,11 @@ var cb = getLast(slice.call(arguments))

}
// Apply arguments, sync
module.exports.withSync = function() {
var args = slice.call(arguments)
return function() {
var cb = getLast(slice.call(arguments))
if (cb) cb.apply(cb, args)
}
}

2

package.json
{
"name": "call-last"
, "author": "Beau Sorensen <mail@beausorensen.com> (http://github.com/sorensen)"
, "version": "0.0.2"
, "version": "0.0.3"
, "license": "MIT"

@@ -6,0 +6,0 @@ , "keywords": ["callback"]

@@ -33,2 +33,10 @@ call-last

something.method = callLast.sync
// bind some arguments
var callWith = callLast.with('hello', 'world')
callWith(1, 2, function(a, b) {
console.log(a) // 'hello'
console.log(b) // 'world'
})
```
'use strict';
var assert = require('assert')
var info = require('./package.json')
, assert = require('assert')
, ase = assert.strictEqual
describe('call-last', function() {
describe(info.name + ' - v' + info.version, function() {
var last = require('./index')

@@ -19,2 +21,16 @@

it('with', function(done) {
var check = 0
, callWith = last.with(null, 'hello')
callWith(done, done, 2, 4, function(err, str) {
check = 1
ase(err, null)
ase(str, 'hello')
done()
})
assert.strictEqual(check, 0)
})
it('sync', function(done) {

@@ -21,0 +37,0 @@ var check = 0

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