File tree Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Expand file tree Collapse file tree 5 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -493,8 +493,8 @@ const object = {
493493const value = Json .get (object , ' hello.world.value.hello' ) // 'Hello World!'
494494const undefinedValue = Json .get (object , ' hello.worlld.value.hello' ) // undefined
495495const defaultValue = Json .get (object , ' hello.worlld.value.hello' , ' Hi World!' ) // 'Hi World!'
496- const fullObject = Json .get (object , ' * ' ) // Same as object { hello: { world: { value: { hello: 'Hello World!' } } } }
497- const defaultValueInObjectNull = Json .get (undefined , ' * ' , { hello: ' world' }) // { hello: 'world' }
496+ const fullObject = Json .get (object , ' ' ) // Same as object { hello: { world: { value: { hello: 'Hello World!' } } } }
497+ const defaultValueInObjectNull = Json .get (undefined , ' ' , { hello: ' world' }) // { hello: 'world' }
498498```
499499
500500---
Original file line number Diff line number Diff line change 11{
22 "name" : " @secjs/utils" ,
3- "version" : " 1.9.8 " ,
3+ "version" : " 1.9.9 " ,
44 "description" : " Utils functions and classes for Node.js" ,
55 "license" : " MIT" ,
66 "author" : " João Lenon <lenon@athenna.io>" ,
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ export class Json {
132132 * @return {any|undefined }
133133 */
134134 static get ( object , key , defaultValue ) {
135- if ( key === '* ' && object ) {
135+ if ( key === '' && object ) {
136136 return object
137137 }
138138
Original file line number Diff line number Diff line change @@ -30,6 +30,15 @@ test.group('ConfigTest', group => {
3030 await Folder . safeRemove ( Path . config ( ) )
3131 } )
3232
33+ test ( 'should be able to get full configurations values from Config class' , ( { assert } ) => {
34+ const app = Config . get ( 'app' )
35+
36+ assert . deepEqual ( app , {
37+ name : 'SecJS' ,
38+ env : 'test' ,
39+ } )
40+ } )
41+
3342 test ( 'should be able to get configurations values from Config class' , ( { assert } ) => {
3443 const appName = Config . get ( 'app.name' )
3544
Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ test.group('Json Class', () => {
108108 const value = Json . get ( object , 'hello.world.value.hello' )
109109 const undefinedValue = Json . get ( object , 'hello.worlld.value.hello' )
110110 const defaultValue = Json . get ( object , 'hello.worlld.value.hello' , 'Hi World!' )
111- const fullObject = Json . get ( object , '* ' )
112- const defaultValueInObjectNull = Json . get ( undefined , '* ' , { hello : 'world' } )
111+ const fullObject = Json . get ( object , '' )
112+ const defaultValueInObjectNull = Json . get ( undefined , '' , { hello : 'world' } )
113113
114114 assert . equal ( value , 'Hello World!' )
115115 assert . equal ( defaultValue , 'Hi World!' )
You can’t perform that action at this time.
0 commit comments