@adyen/adyen-platform-experience-web
Version:

32 lines (31 loc) • 944 B
JavaScript
import { getter as p } from "../../../utils/struct/property.js";
import { isFunction as c, isNullish as u } from "../../../utils/value/is.js";
import { struct as n } from "../../../utils/struct/main.js";
import { noop as f } from "../../../utils/common.js";
const b = (t) => {
const o = {}, r = Object.getOwnPropertyDescriptors(t);
for (const e of Object.keys(t)) {
const { get: i, value: s } = r[e];
o[e] = p(
i || (c(s) ? (
// ensure that the `this` binding of the getter function is preserved
s.bind(t)
) : () => s)
);
}
return n(o);
}, d = () => {
const t = { idle: null, resume: null }, o = {};
for (const r of Object.keys(t))
o[r] = {
get: () => t[r] ?? f,
set: (e) => {
u(e) ? t[r] = null : c(e) && e !== t[r] && (t[r] = e);
}
};
return n(o);
};
export {
b as createWatchListCurrentStateRecord,
d as createWatchListSubscriptionEventCallbacks
};