aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils/promise.js
blob: 4b59bba329f6e300e4a0df7d441a7b9c36e8eefd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import is from './is';
/**
 * Silence a Promise-like object.
 * This is useful for avoiding non-harmful, but potentially confusing "uncaught
 * play promise" rejection error messages.
 * @param  {Object} value An object that may or may not be `Promise`-like.
 */
export function silencePromise(value) {
  if (is.promise(value)) {
    value.then(null, () => {});
  }
}

export default { silencePromise };