Skip to content

sorensen/call-last.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

call-last

Call the last function argument found. By default the function is called async, there is a sync method provided if needed.

Install

With npm

npm install call-last

Usage

Node.js

var callLast = require('call-last')

callLast(1, 2, function() {
  // ...
})

// mock some method, almost a noop, but continues control flow
redis.set = callLast

// run things synchronously if you want
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'
})

About

Call the last function argument sent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published