TenantAtlas/apps/platform/.pnpm-store/v10/files/8e/1852007d393bb12e8af7ac9c8e792c563101d0154bdea643248a8c9ec798123936a5729c246fd7fd542a2a907da3c108c366868239ab6f23cc89bee507a779
Ahmed Darrazi 9f74f7a658
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
feat: compress governance operator outcomes
2026-04-19 14:15:11 +02:00

19 lines
417 B
Plaintext

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;