feat: update dependencies, node
This commit is contained in:
2
node_modules/universalify/README.md
generated
vendored
2
node_modules/universalify/README.md
generated
vendored
@@ -21,7 +21,7 @@ npm install universalify
|
||||
|
||||
Takes a callback-based function to universalify, and returns the universalified function.
|
||||
|
||||
Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with more than three arguments, and does not ensure that the callback is only called once.
|
||||
Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once.
|
||||
|
||||
```js
|
||||
function callbackFn (n, cb) {
|
||||
|
||||
6
node_modules/universalify/index.js
generated
vendored
6
node_modules/universalify/index.js
generated
vendored
@@ -20,6 +20,10 @@ exports.fromPromise = function (fn) {
|
||||
return Object.defineProperty(function () {
|
||||
const cb = arguments[arguments.length - 1]
|
||||
if (typeof cb !== 'function') return fn.apply(this, arguments)
|
||||
else fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
else {
|
||||
delete arguments[arguments.length - 1]
|
||||
arguments.length--
|
||||
fn.apply(this, arguments).then(r => cb(null, r), cb)
|
||||
}
|
||||
}, 'name', { value: fn.name })
|
||||
}
|
||||
|
||||
2
node_modules/universalify/package.json
generated
vendored
2
node_modules/universalify/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "universalify",
|
||||
"version": "0.1.2",
|
||||
"version": "0.2.0",
|
||||
"description": "Make a callback- or promise-based function support both promises and callbacks.",
|
||||
"keywords": [
|
||||
"callback",
|
||||
|
||||
Reference in New Issue
Block a user