1 | import { __assign } from "tslib";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export function mergeSettings(oldSettings, newSettings) {
|
10 | if (oldSettings === void 0) { oldSettings = {}; }
|
11 | var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings);
|
12 | return mergeSettingsWith(oldSettings);
|
13 | }
|
14 | export function mergeScopedSettings(oldSettings, newSettings) {
|
15 | if (oldSettings === void 0) { oldSettings = {}; }
|
16 | var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings);
|
17 | return mergeSettingsWith(oldSettings);
|
18 | }
|
19 | function _isSettingsFunction(settings) {
|
20 | return typeof settings === 'function';
|
21 | }
|
22 | function _settingsMergeWith(newSettings) {
|
23 | return function (settings) { return (newSettings ? __assign(__assign({}, settings), newSettings) : settings); };
|
24 | }
|
25 | function _scopedSettingsMergeWith(scopedSettingsFromProps) {
|
26 | if (scopedSettingsFromProps === void 0) { scopedSettingsFromProps = {}; }
|
27 | return function (oldScopedSettings) {
|
28 | var newScopedSettings = __assign({}, oldScopedSettings);
|
29 | for (var scopeName in scopedSettingsFromProps) {
|
30 | if (scopedSettingsFromProps.hasOwnProperty(scopeName)) {
|
31 | newScopedSettings[scopeName] = __assign(__assign({}, oldScopedSettings[scopeName]), scopedSettingsFromProps[scopeName]);
|
32 | }
|
33 | }
|
34 | return newScopedSettings;
|
35 | };
|
36 | }
|
37 |
|
\ | No newline at end of file |