New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pr-wrap

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pr-wrap

Wraps callback-based methods in promises

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

pr-wrap

Wraps callback-based methods in promises and uses ES6 Proxy for wrapping entire modules.

Install

npm install pr-wrap --save

Syntax

Wraps single function:

require('pr-wrap')(func[, context])
  • func <function> target function

  • context <object> context for function

Creates proxy-object for wrapping all method calls:

require('pr-wrap').all(srcObj)
  • srcObj <object> source object

Usage

Wrapping single function:

const prWrap = require('pr-wrap')
prWrap(require('fs').readdir)('/some/dir').then().catch()

Wrapping whole module:

const fsPr = require('pr-wrap').all(require('fs'))
fsPr.readdir('/some/dir').then().catch()

Keywords

es6

FAQs

Package last updated on 14 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts