remove dependency from 'util'

This commit is contained in:
Jun Yang
2018-10-01 23:08:39 +08:00
parent 22a7a85d50
commit c0181aec31
2 changed files with 12 additions and 3 deletions
+10
View File
@@ -9,6 +9,16 @@ export function isString (value) {
return toStr.call(value) === '[object String]'
}
export function promisify (fn) {
return function () {
return new Promise((resolve, reject) => {
fn(...arguments, (err, result) => {
err ? reject(err) : resolve(result)
})
})
}
}
export function stringify (value) {
if (isNil(value)) {
return String(value)