Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 0.0.1 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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc