|
|
@ -8,7 +8,6 @@ import { |
|
|
|
} from '../types'; |
|
|
|
} from '../types'; |
|
|
|
|
|
|
|
|
|
|
|
import lodashDefaultsDeep from 'lodash/defaultsDeep'; |
|
|
|
import lodashDefaultsDeep from 'lodash/defaultsDeep'; |
|
|
|
import lodashMap from 'lodash/map'; |
|
|
|
|
|
|
|
import lodashCloneDeep from 'lodash/cloneDeep'; |
|
|
|
import lodashCloneDeep from 'lodash/cloneDeep'; |
|
|
|
import has from 'lodash/has'; |
|
|
|
import has from 'lodash/has'; |
|
|
|
|
|
|
|
|
|
|
@ -100,7 +99,7 @@ const DEFAULT_OPTIONS: Options = { |
|
|
|
|
|
|
|
|
|
|
|
export class CoreOptions<O extends Options> { |
|
|
|
export class CoreOptions<O extends Options> { |
|
|
|
_options: O; |
|
|
|
_options: O; |
|
|
|
_defaults: Options = DEFAULT_OPTIONS; |
|
|
|
_coreDefaults: Options = DEFAULT_OPTIONS; |
|
|
|
|
|
|
|
|
|
|
|
constructor(options: O) { |
|
|
|
constructor(options: O) { |
|
|
|
this.setOptions(options); |
|
|
|
this.setOptions(options); |
|
|
@ -111,7 +110,12 @@ export class CoreOptions<O extends Options> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected setOptions(options: O): void { |
|
|
|
protected setOptions(options: O): void { |
|
|
|
this._options = lodashDefaultsDeep(lodashCloneDeep(options), this._defaults); |
|
|
|
this._options = lodashDefaultsDeep(lodashCloneDeep(options), this.defaults); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this getter can be overrited in Pod
|
|
|
|
|
|
|
|
protected get defaults(): Options { |
|
|
|
|
|
|
|
return this._coreDefaults; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get allOptions(): O { |
|
|
|
get allOptions(): O { |
|
|
|