util.js 927 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.isIterableIterator = isIterableIterator;
  6. exports.mergeOptions = mergeOptions;
  7. function mergeOptions(target, source) {
  8. for (const k of Object.keys(source)) {
  9. if ((k === "parserOpts" || k === "generatorOpts" || k === "assumptions") && source[k]) {
  10. const parserOpts = source[k];
  11. const targetObj = target[k] || (target[k] = {});
  12. mergeDefaultFields(targetObj, parserOpts);
  13. } else {
  14. const val = source[k];
  15. if (val !== undefined) target[k] = val;
  16. }
  17. }
  18. }
  19. function mergeDefaultFields(target, source) {
  20. for (const k of Object.keys(source)) {
  21. const val = source[k];
  22. if (val !== undefined) target[k] = val;
  23. }
  24. }
  25. function isIterableIterator(value) {
  26. return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
  27. }
  28. 0 && 0;
  29. //# sourceMappingURL=util.js.map