think-config
Advanced tools
Comparing version 1.0.0 to 1.0.2
24
index.js
@@ -62,2 +62,24 @@ const helper = require('think-helper'); | ||
module.exports = Config; | ||
function getConfigFn(configs, isMultiModule){ | ||
let configInstances = {}; | ||
if(isMultiModule){ | ||
for(let name in configs){ | ||
configInstances[name] = new Config(configs[name]); | ||
} | ||
}else{ | ||
configInstances.common = new Config(configs); | ||
} | ||
return (name, value, m) => { | ||
let conf = configInstances.common; | ||
if(isMultiModule){ | ||
conf = configInstances[m]; | ||
} | ||
if(value === undefined){ | ||
return conf.get(name); | ||
} | ||
conf.set(name, value); | ||
} | ||
} | ||
exports.Config = Config; | ||
exports.getConfigFn = getConfigFn; |
{ | ||
"name": "think-config", | ||
"description": "config for ThinkJS", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
import test from 'ava'; | ||
import Config from '../index.js'; | ||
import {Config} from '../index.js'; | ||
@@ -4,0 +4,0 @@ |
7031
148