2020-06-17 18:12:01 -04:00
|
|
|
import { assignWithDepth } from './utils';
|
2020-06-17 05:54:24 -04:00
|
|
|
const config = {};
|
2019-07-13 22:50:53 -07:00
|
|
|
|
|
|
|
export const setConfig = conf => {
|
2020-06-17 18:12:01 -04:00
|
|
|
assignWithDepth(config, conf);
|
2019-09-12 12:58:57 -07:00
|
|
|
};
|
|
|
|
export const getConfig = () => config;
|
2019-10-11 15:39:50 +02:00
|
|
|
|
2020-06-17 18:14:10 -04:00
|
|
|
export const reset = conf => {
|
|
|
|
Object.keys(config).forEach(key => delete config[key]);
|
|
|
|
assignWithDepth(config, conf, { clobber: true });
|
|
|
|
};
|
|
|
|
|
2019-10-11 15:39:50 +02:00
|
|
|
const configApi = {
|
|
|
|
setConfig,
|
2020-06-17 18:14:10 -04:00
|
|
|
getConfig,
|
|
|
|
reset
|
2019-10-11 15:39:50 +02:00
|
|
|
};
|
|
|
|
export default configApi;
|