assert.js 575 B

1234567891011121314151617
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.assertFunctionOrSelf = void 0;
  4. /**
  5. * This function asserts the given value as a function or itself.
  6. * If the value itself is a function it will evaluate it with the passed in arguments,
  7. * elsewise it will directly return itself.
  8. */
  9. function assertFunctionOrSelf(functionOrSelf, ...args) {
  10. if (typeof functionOrSelf === 'function') {
  11. return functionOrSelf(...args);
  12. }
  13. else {
  14. return functionOrSelf;
  15. }
  16. }
  17. exports.assertFunctionOrSelf = assertFunctionOrSelf;