1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function isObject(val) {
|
4 | if (val === null) {
|
5 | return false;
|
6 | }
|
7 | return typeof val === 'function' || typeof val === 'object';
|
8 | }
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function enableWithPropertyOrConfig(prop, config, merge = false) {
|
18 |
|
19 | if (prop) {
|
20 | if (isObject(prop)) {
|
21 | if (merge) {
|
22 | if (config == null || typeof config !== 'object') {
|
23 | throw new Error('enableWithPropertyOrConfig cannot merge config: ' + config);
|
24 | }
|
25 | return Object.assign(Object.assign({}, config), prop);
|
26 | }
|
27 |
|
28 | return prop;
|
29 | }
|
30 |
|
31 | return config;
|
32 | }
|
33 |
|
34 | return prop;
|
35 | }
|
36 | exports.enableWithPropertyOrConfig = enableWithPropertyOrConfig;
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | function overrideWithPropertyOrConfig(prop, config, merge = false) {
|
43 | if (prop === undefined) {
|
44 | return config;
|
45 | }
|
46 | return enableWithPropertyOrConfig(prop, config, merge);
|
47 | }
|
48 | exports.overrideWithPropertyOrConfig = overrideWithPropertyOrConfig;
|
49 |
|
\ | No newline at end of file |