Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
887 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.mergeOptions = mergeOptions;
|
---|
7 | exports.isIterableIterator = isIterableIterator;
|
---|
8 |
|
---|
9 | function mergeOptions(target, source) {
|
---|
10 | for (const k of Object.keys(source)) {
|
---|
11 | if ((k === "parserOpts" || k === "generatorOpts" || k === "assumptions") && source[k]) {
|
---|
12 | const parserOpts = source[k];
|
---|
13 | const targetObj = target[k] || (target[k] = {});
|
---|
14 | mergeDefaultFields(targetObj, parserOpts);
|
---|
15 | } else {
|
---|
16 | const val = source[k];
|
---|
17 | if (val !== undefined) target[k] = val;
|
---|
18 | }
|
---|
19 | }
|
---|
20 | }
|
---|
21 |
|
---|
22 | function mergeDefaultFields(target, source) {
|
---|
23 | for (const k of Object.keys(source)) {
|
---|
24 | const val = source[k];
|
---|
25 | if (val !== undefined) target[k] = val;
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | function isIterableIterator(value) {
|
---|
30 | return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
|
---|
31 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.