All files / src util.js

100% Statements 6/6
100% Branches 6/6
100% Functions 3/3
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  215x     389x 389x           10x          
function toArray(a) {
  return Array.isArray(a) ? a : [a];
}
 
const isPromise = v => v && v.then;
const toPromise = v => (isPromise(v) ? v : Promise.resolve(v));
 
// istanbul ignore next
const delay =
  typeof setImmediate === undefined ? fn => setTimeout(fn, 0) : setImmediate;
 
module.exports = {
  toArray,
  toPromise,
  delay
};