source: frontend/node_modules/axios/lib/helpers/callbackify.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 417 bytes
Line 
1import utils from '../utils.js';
2
3const callbackify = (fn, reducer) => {
4 return utils.isAsyncFn(fn)
5 ? function (...args) {
6 const cb = args.pop();
7 fn.apply(this, args).then((value) => {
8 try {
9 reducer ? cb(null, ...reducer(value)) : cb(null, value);
10 } catch (err) {
11 cb(err);
12 }
13 }, cb);
14 }
15 : fn;
16};
17
18export default callbackify;
Note: See TracBrowser for help on using the repository browser.