think-config
Advanced tools
Comparing version 1.0.5 to 1.1.0
27
index.js
@@ -73,10 +73,29 @@ const helper = require('think-helper'); | ||
let conf = configInstances.common; | ||
if (isMultiModule && m && configInstances[m]) { | ||
conf = configInstances[m]; | ||
// single module | ||
if (!isMultiModule) { | ||
if (value === undefined) { | ||
return conf.get(name); | ||
} | ||
return conf.set(name, value); | ||
} | ||
if (!conf) return; | ||
// get config | ||
if (value === undefined) { | ||
if (m && configInstances[m]) { | ||
conf = configInstances[m]; | ||
} | ||
return conf.get(name); | ||
} | ||
conf.set(name, value); | ||
// set all modules config | ||
if (m === true) { | ||
for (const mName in configInstances) { | ||
configInstances[mName].set(name, value); | ||
} | ||
return; | ||
} | ||
// set multi modules config | ||
m.split(',').forEach(item => { | ||
const conf = configInstances[item]; | ||
if (!conf) return; | ||
conf.set(name, value); | ||
}); | ||
}; | ||
@@ -83,0 +102,0 @@ } |
{ | ||
"name": "think-config", | ||
"description": "config for ThinkJS", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
4876
5
102