WIP - styles Globals

This commit is contained in:
James
2020-07-06 22:58:31 -04:00
parent 83567c68db
commit b263e04408
16 changed files with 418 additions and 113 deletions

View File

@@ -1 +0,0 @@
module.exports = (keys, obj) => keys.reduce((a, c) => ({ ...a, [c]: obj[c] }), {});

View File

@@ -1,33 +0,0 @@
const deepCopyObject = require('../utilities/deepCopyObject');
const recursivelySecure = (object) => {
const newObject = deepCopyObject(object);
delete newObject.hooks;
delete newObject.components;
delete newObject.policies;
if (newObject.fields) {
newObject.fields.forEach((field, i) => {
newObject.fields[i] = recursivelySecure(field);
});
}
return newObject;
};
const secureConfig = (insecureConfig) => {
const config = deepCopyObject(insecureConfig);
delete config.secret;
recursivelySecure(config);
config.collections.forEach((collection, i) => {
config.collections[i] = recursivelySecure(collection);
});
return config;
};
module.exports = secureConfig;