@akemona-org/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite
29 lines (22 loc) • 558 B
JavaScript
;
const assert = require('assert');
const _ = require('lodash');
module.exports = (initialConfig = {}) => {
assert(
typeof initialConfig === 'object' && initialConfig !== null,
'Initial config must be an object'
);
const _config = _.cloneDeep(initialConfig);
return Object.assign(_config, {
get(path, defaultValue) {
return _.get(_config, path, defaultValue);
},
set(path, val) {
_.set(_config, path, val);
return this;
},
has(path) {
return _.has(_config, path);
},
});
};