Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleResolved(self, deferred) {
asap(() => {
const cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
if (cb === null) {
if (self._state === 1) {
resolve(deferred.promise, self._value);
} else {
reject(deferred.promise, self._value);
}
return;
}
const ret = tryCallOne(cb, self._value);
if (ret === IS_ERROR) {
reject(deferred.promise, LAST_ERROR);
} else {
resolve(deferred.promise, ret);
}
});
function buffer(cb, options = {}) {
const { group = 'default' } = options;
if (!bufferContent.hasOwnProperty(group)) {
bufferContent[group] = '';
}
if (!element.hasOwnProperty(group)) {
element[group] = getStylishlyDOMElement(domDocument, group);
}
if (!isBuffering) {
isBuffering = true;
Object.keys(bufferContent).forEach((n) => bufferContent[n] = element[n].textContent);
asap(flushBuffers);
}
bufferContent[group] = cb(bufferContent[group]);
}