
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Extend Source Objects According to a Given Field-map
Ricotta is useful for extending your hierarchical "config.json" file using ENV flat settings.
ricotta.extendByMapFactory(fieldMap)=>(sourceObj, extensionObj)=>sourceObj
This library is 100% ES5 compatible, no deps.
npm install ricotta
var ricotta = require('ricotta');
// ricotta receives a field map, returns (sourceObj, extensionObj)=>sourceObj
var extender = ricotta({
"MY_ENV_KEY_1": "key1",
"MY_ENV_KEY_2_1": "key2.key1",
"MY_ENV_KEY_3": "key2.key3",
"MY_ENV_KEY_4": "key2.key4.key5"
});
var env = process.env || {
"MY_ENV_KEY_1": "This is the value of key1",
"MY_ENV_KEY_2_1": "This is the value of key2.key1",
"MY_ENV_KEY_3": "This will be mapped only if the destination exists (yes)",
"MY_ENV_KEY_4": "This will be mapped only if the destination exists (no)",
};
var baseConfig = require('config.json') || {
"key1": "My setting",
"key2": {
"key1": "My first nested setting",
"key2": "My second nested setting",
"key3": {}
}
};
extender(baseConfig, env);
console.log(baseConfig);
// {
// key1: 'This is the value of key1',
// key2:
// {
// key1: 'This is the value of key2.key1',
// key2: 'My second nested setting',
// key3: 'This will be mapped only if the destination exists (yes)'
// }
// }
FAQs
Extend source objects according to a given fieldmap
The npm package ricotta receives a total of 2 weekly downloads. As such, ricotta popularity was classified as not popular.
We found that ricotta demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.