讨论打包

This commit is contained in:
A1300399510
2025-02-20 14:18:44 +08:00
parent 2c38811ed6
commit 93bd583c3e
419 changed files with 102193 additions and 3 deletions

View File

@@ -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;