Do not depend on Bluebird.
This commit is contained in:
parent
b8e2cfc47f
commit
84fbe9ee06
@ -27,7 +27,6 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-runtime": "^6.3.19",
|
"babel-runtime": "^6.3.19",
|
||||||
"bluebird": "^3.1.1",
|
|
||||||
"event-to-promise": "^0.6.0",
|
"event-to-promise": "^0.6.0",
|
||||||
"exec-promise": "^0.5.1",
|
"exec-promise": "^0.5.1",
|
||||||
"fs-promise": "^0.3.1",
|
"fs-promise": "^0.3.1",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import eventToPromise from 'event-to-promise'
|
import eventToPromise from 'event-to-promise'
|
||||||
import { createClient } from 'ldapjs'
|
import { createClient } from 'ldapjs'
|
||||||
import { escape } from 'ldapjs/lib/filters/escape'
|
import { escape } from 'ldapjs/lib/filters/escape'
|
||||||
import { promisify } from 'bluebird'
|
|
||||||
import { readFile } from 'fs-promise'
|
import { readFile } from 'fs-promise'
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -14,6 +13,22 @@ const bind = (fn, thisArg) => function () {
|
|||||||
|
|
||||||
const noop = () => {}
|
const noop = () => {}
|
||||||
|
|
||||||
|
export const promisify = (fn, thisArg) => function () {
|
||||||
|
const { length } = arguments
|
||||||
|
const args = new Array(length + 1)
|
||||||
|
for (let i = 0; i < length; ++i) {
|
||||||
|
args[i] = arguments[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
args[length] = (error, result) => error
|
||||||
|
? reject(error)
|
||||||
|
: resolve(result)
|
||||||
|
|
||||||
|
fn.apply(thisArg || this, args)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
const VAR_RE = /\{\{([^}]+)\}\}/g
|
const VAR_RE = /\{\{([^}]+)\}\}/g
|
||||||
|
Loading…
Reference in New Issue
Block a user