@toreda/time
Version:
Simple, small footprint library for common time operations and converting between units of time.
20 lines (19 loc) • 575 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.logLike = logLike;
/**
* Structural runtime check: does `value` satisfy `LogLike`?
*
* @category Logging
*/
function logLike(value) {
if (!value || typeof value !== 'object') {
return false;
}
const candidate = value;
return (typeof candidate.error === 'function' &&
typeof candidate.warn === 'function' &&
typeof candidate.info === 'function' &&
typeof candidate.debug === 'function' &&
typeof candidate.trace === 'function');
}