universalify
Advanced tools
Comparing version 2.0.0 to 2.0.1
12
index.js
@@ -8,7 +8,4 @@ 'use strict' | ||
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) | ||
}) | ||
@@ -23,4 +20,7 @@ } | ||
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 }) | ||
} |
{ | ||
"name": "universalify", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Make a callback- or promise-based function support both promises and callbacks.", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"scripts": { | ||
"test": "standard && nyc tape test/*.js | colortape" | ||
"test": "standard && nyc --reporter text --reporter lcovonly tape test/*.js | colortape" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
# 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) | ||
@@ -5,0 +5,0 @@ ![npm](https://img.shields.io/npm/dm/universalify.svg) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4675