🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

universalify

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universalify - npm Package Compare versions

Comparing version

to
0.1.0

8

index.js
'use strict'
exports.fromCallback = function (fn) {
return function () {
return Object.defineProperty(function () {
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)

@@ -16,11 +16,11 @@ else {

}
}
}, 'name', { value: fn.name })
}
exports.fromPromise = function (fn) {
return function () {
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)).catch(cb)
}
}, 'name', { value: fn.name })
}
{
"name": "universalify",
"version": "0.0.1",
"version": "0.1.0",
"description": "Make a callback- or promise-based function support both promises and callbacks.",

@@ -5,0 +5,0 @@ "keywords": [