blueconfig
Version:
Merge and validate your config depending of your schema, forked from node-convict.
14 lines (11 loc) • 357 B
JavaScript
// With 'in': Prevent error: 'Cannot use 'in' operator to search for {key} in {value}'
function isObjNotNull(obj) {
return typeof obj === 'object' && obj !== null
}
function unroot(text) {
return (text || '').replace(/^(?:root(\.|\[)?|\.(.+))/g, (_, b, c) => c || ((b === '[') ? '[' : ''))
}
module.exports = {
isObjNotNull,
unroot
}