UNPKG

@toreda/time

Version:

Simple, small footprint library for common time operations and converting between units of time.

25 lines (24 loc) 657 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.timeCheckMethods = timeCheckMethods; const methods_1 = require("../methods"); /** * Check whether provided object defines all time methods required to * a Time object, and is itself callable (Time instances are callable). * @param o * @returns * * @category Validators */ function timeCheckMethods(o) { if (typeof o !== 'function') { return false; } const candidate = o; for (const timeMethod of methods_1.timeMethods) { if (typeof candidate[timeMethod] !== 'function') { return false; } } return true; }