is-ignored.js 851 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const defaults_1 = require("./defaults");
  4. function isIgnored(commit = '', opts = {}) {
  5. const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;
  6. if (!Array.isArray(ignores)) {
  7. throw new Error(`ignores must be of type array, received ${ignores} of type ${typeof ignores}`);
  8. }
  9. const invalids = ignores.filter((c) => typeof c !== 'function');
  10. if (invalids.length > 0) {
  11. throw new Error(`ignores must be array of type function, received items of type: ${invalids
  12. .map((i) => typeof i)
  13. .join(', ')}`);
  14. }
  15. const base = opts.defaults === false ? [] : defaults_1.wildcards;
  16. return [...base, ...ignores].some((w) => w(commit));
  17. }
  18. exports.default = isIgnored;
  19. //# sourceMappingURL=is-ignored.js.map