MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / promisify

Function promisify

resources/benchmark.js:7–18  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

5var Benchmark = require('benchmark');
6
7function promisify(fn) {
8 return function () {
9 return new Promise((resolve, reject) =>
10 fn.apply(
11 this,
12 Array.prototype.slice
13 .call(arguments)
14 .concat((err, out) => (err ? reject(err) : resolve(out)))
15 )
16 );
17 };
18}
19
20var exec = promisify(child_process.exec);
21var readdir = promisify(fs.readdir);

Callers 1

benchmark.jsFile · 0.85

Calls 1

concatMethod · 0.65

Tested by

no test coverage detected