From d1c4b48981946f542393ac753942002ccb5eeec0 Mon Sep 17 00:00:00 2001 From: aminya Date: Thu, 15 Oct 2020 18:54:53 -0500 Subject: [PATCH] promisify the async functions --- lib/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 15051ae..5b37318 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,10 +2,9 @@ const checkWindows = require("./checkWindows"); const {resolve: resolvePath} = require("path"); const whichLib = require("./whichLib"); +const { promisify } = require("util") - - -const get = (path, callback) => +const _get = (path, callback) => { if (checkWindows.async(callback)) { @@ -13,6 +12,7 @@ const get = (path, callback) => } }; +const get = promisify(_get) const getSync = path => @@ -25,7 +25,7 @@ const getSync = path => -const set = (path, attrs, callback) => +const _set = (path, attrs, callback) => { if (checkWindows.async(callback)) { @@ -33,7 +33,7 @@ const set = (path, attrs, callback) => } }; - +const set = promisify(_set) const setSync = (path, attrs) => {