Comparing version 0.4.0 to 0.4.2
11
index.js
@@ -45,8 +45,7 @@ /** | ||
/** | ||
* 获取配置信息对象 | ||
* 获取所有配置项 | ||
* | ||
* @ignore | ||
* @return {Object} | ||
*/ | ||
function getConfig() { | ||
exports.all = function () { | ||
var config = {}; | ||
@@ -60,3 +59,3 @@ var configFile = getConfigFile(); | ||
return config; | ||
} | ||
}; | ||
@@ -70,3 +69,3 @@ /** | ||
exports.get = function ( name ) { | ||
return getConfig()[ name ]; | ||
return exports.all()[ name ]; | ||
}; | ||
@@ -81,3 +80,3 @@ | ||
exports.set = function ( name, value ) { | ||
var config = getConfig(); | ||
var config = exports.all(); | ||
var configFile = getConfigFile(); | ||
@@ -84,0 +83,0 @@ |
{ | ||
"name": "edp-config", | ||
"description": "Package for edp configuration", | ||
"version": "0.4.0", | ||
"version": "0.4.2", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ { "name": "errorrik", "email": "errorrik@gmail.com" }, |
@@ -15,2 +15,7 @@ # edp-config | ||
### all() | ||
Get all configuration items. | ||
### get( name ) | ||
@@ -17,0 +22,0 @@ |
@@ -24,3 +24,18 @@ var edpConfig = require( '../index' ); | ||
); | ||
t.type( | ||
edpConfig.all(), | ||
'object', | ||
'Method "edpConfig.all" return a object.' | ||
); | ||
t.equal( | ||
edpConfig.all()[ 'test.name' ], | ||
'erik', | ||
'The return object of "edpConfig.all" has "test.name" property.' | ||
); | ||
t.equal( | ||
edpConfig.all()[ 'test.age' ], | ||
18, | ||
'The return object of "edpConfig.all" has "test.age" property.' | ||
); | ||
t.end(); | ||
} ); |
3424
114
32