All files / src utils.js

100% Statements 3/3
100% Branches 6/6
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                  135x               4394x     1x  
// @ts-check
 
/**
 * @template T=any
 * @param {T|null|undefined} value
 * @param {T} def
 * @return {T}
 */
export function defaultTo(value, def) {
  return (value === undefined || value === null) ? def : value;
}
 
/**
 * @param {any} value
 * @return {value is null | undefined}
 */
export function isNil(value /*: any */) /*: boolean */ {
  return (value === undefined) || (value === null);
}
 
export const argSepRe = new RegExp('\\s*[\\s,]\\s*');