summaryrefslogtreecommitdiff
path: root/node_modules/universalify
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/universalify')
-rw-r--r--node_modules/universalify/README.md2
-rw-r--r--node_modules/universalify/index.js12
-rw-r--r--node_modules/universalify/package.json4
3 files changed, 9 insertions, 9 deletions
diff --git a/node_modules/universalify/README.md b/node_modules/universalify/README.md
index aa124747..1184939d 100644
--- a/node_modules/universalify/README.md
+++ b/node_modules/universalify/README.md
@@ -1,6 +1,6 @@
# universalify
-[![Travis branch](https://img.shields.io/travis/RyanZim/universalify/master.svg)](https://travis-ci.org/RyanZim/universalify)
+![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/RyanZim/universalify/ci.yml?branch=master)
![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/universalify/master.svg)
![npm](https://img.shields.io/npm/dm/universalify.svg)
![npm](https://img.shields.io/npm/l/universalify.svg)
diff --git a/node_modules/universalify/index.js b/node_modules/universalify/index.js
index ba6c6626..233beac7 100644
--- a/node_modules/universalify/index.js
+++ b/node_modules/universalify/index.js
@@ -5,11 +5,8 @@ exports.fromCallback = function (fn) {
if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
else {
return new Promise((resolve, reject) => {
- fn.call(
- this,
- ...args,
- (err, res) => (err != null) ? reject(err) : resolve(res)
- )
+ args.push((err, res) => (err != null) ? reject(err) : resolve(res))
+ fn.apply(this, args)
})
}
}, 'name', { value: fn.name })
@@ -19,6 +16,9 @@ exports.fromPromise = function (fn) {
return Object.defineProperty(function (...args) {
const cb = args[args.length - 1]
if (typeof cb !== 'function') return fn.apply(this, args)
- else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb)
+ else {
+ args.pop()
+ fn.apply(this, args).then(r => cb(null, r), cb)
+ }
}, 'name', { value: fn.name })
}
diff --git a/node_modules/universalify/package.json b/node_modules/universalify/package.json
index 006d4cc7..d60fccb5 100644
--- a/node_modules/universalify/package.json
+++ b/node_modules/universalify/package.json
@@ -1,6 +1,6 @@
{
"name": "universalify",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "Make a callback- or promise-based function support both promises and callbacks.",
"keywords": [
"callback",
@@ -19,7 +19,7 @@
"url": "git+https://github.com/RyanZim/universalify.git"
},
"scripts": {
- "test": "standard && nyc tape test/*.js | colortape"
+ "test": "standard && nyc --reporter text --reporter lcovonly tape test/*.js | colortape"
},
"devDependencies": {
"colortape": "^0.1.2",