Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.xprops.createOrder = mockAsyncProp(expect('createOrder', async () => ZalgoPromise.resolve(orderID)));
window.xprops.onClick = mockAsyncProp(expect('onClick', () => ZalgoPromise.resolve()));
window.xprops.onClick = mockAsyncProp(expect('onClick', () => ZalgoPromise.resolve()));
createOrder: () => ZalgoPromise.resolve('order-id'),
onApprove: td.function(),
window.xprops.onClick = mockAsyncProp(expect('onClick', () => ZalgoPromise.resolve()));
window.xprops.createOrder = avoid('createOrder', () => ZalgoPromise.reject(new Error(`Avoid createOrder`)));
export function awaitFrameWindow(frame : HTMLIFrameElement) : ZalgoPromise {
if (frame.contentWindow) {
return ZalgoPromise.resolve(frame.contentWindow);
}
return awaitFrameLoad(frame).then(loadedFrame => {
if (!loadedFrame.contentWindow) {
throw new Error(`Could not find window in iframe`);
}
return loadedFrame.contentWindow;
});
}
export function precacheRememberedFunding() : ZalgoPromise {
if (!getSessionState(session => session.recentlyCheckedRemembered)) {
return loadMeta();
}
return ZalgoPromise.resolve();
}
renderPayPalCheckout({ url, payment: () => ZalgoPromise.resolve(paymentToken) });
}
return function denodeifyWrapper() : ZalgoPromise {
let self = this;
let args = Array.prototype.slice.call(arguments);
if (args.length >= method.length) {
return ZalgoPromise.resolve(method.apply(self, args));
}
return new ZalgoPromise((resolve, reject) => {
args.push((err, result) => {
if (err && !(err instanceof Error)) {
throw new Error(`Passed non-Error object in callback: [ ${ err } ] -- callbacks should either be called with callback(new Error(...)) or callback(null, result).`);
}
return err ? reject(err) : resolve(result);
});
method.apply(self, args);
});
};
}
function ternary(condition, truthyResult, falsyResult) : ZalgoPromise<*> {
return ZalgoPromise.resolve(condition).then(result => {
return result ? truthyResult() : falsyResult();
});
}