Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kjirou/npm-callback-end
By wrapping the function that sets the last callback, so that you can omit the argument when calling
https://github.com/kjirou/npm-callback-end
Last synced: 12 days ago
JSON representation
By wrapping the function that sets the last callback, so that you can omit the argument when calling
- Host: GitHub
- URL: https://github.com/kjirou/npm-callback-end
- Owner: kjirou
- License: mit
- Created: 2014-10-03T16:11:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-08-31T07:09:07.000Z (about 3 years ago)
- Last Synced: 2024-08-09T13:13:23.505Z (3 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.org/package/callback-end
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
callback-end [![Build Status](https://travis-ci.org/kjirou/npm-callback-end.svg?branch=master)](https://travis-ci.org/kjirou/npm-callback-end)
============By wrapping the function that sets the last callback, so that you can omit the argument when calling.
## Installation
```
npm install callback-end
```## Examples
```
var callbackEnd = require('callback-end');var func = function(foo, bar, cb){
return Array.prototype.slice.apply(arguments);
};var wrapped = callbackEnd(func);
console.log(
wrapped(1, 2, function(){}) // -> [1, 2, function(){}]
);// Omit a "bar" arg
console.log(
wrapped(1, function(){}) // -> [1, undefined, function(){}]
);// Omit "foo" and "bar" args
console.log(
wrapped(function(){}) // -> [undefined, undefined, function(){}]
);
```