All files / src/internal/shared utils.js

100% Statements 25/25
100% Branches 6/6
100% Functions 4/4
100% Lines 25/25

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 23 24 25 262x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 401x 401x 2x 2x 2x 315x 315x 2x 2x 2x 3069x 3368x 3368x 3069x  
export const noop = () => {};
 
// Adapted from https://github.com/then/is-promise/blob/master/index.js
// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE
 
/**
 * @template [T=any]
 * @param {any} value
 * @returns {value is PromiseLike<T>}
 */
export function is_promise(value) {
	return typeof value?.then === 'function';
}
 
/** @param {Function} fn */
export function run(fn) {
	return fn();
}
 
/** @param {Array<() => void>} arr */
export function run_all(arr) {
	for (var i = 0; i < arr.length; i++) {
		arr[i]();
	}
}