From 4d4308c46d4f7801c657cc79d2243e1a81831334 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 27 Oct 2023 22:29:56 +0200 Subject: Updated 32 files, added 279 files, deleted 3 files and renamed 14 files (automated) --- desktop/node_modules/axios/lib/helpers/callbackify.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 desktop/node_modules/axios/lib/helpers/callbackify.js (limited to 'desktop/node_modules/axios/lib/helpers/callbackify.js') diff --git a/desktop/node_modules/axios/lib/helpers/callbackify.js b/desktop/node_modules/axios/lib/helpers/callbackify.js new file mode 100644 index 0000000..4603bad --- /dev/null +++ b/desktop/node_modules/axios/lib/helpers/callbackify.js @@ -0,0 +1,16 @@ +import utils from "../utils.js"; + +const callbackify = (fn, reducer) => { + return utils.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +} + +export default callbackify; -- cgit