@@ -13,7 +13,7 @@ describe('nav.nav', () => {
1313 }
1414
1515 function uncurriedInc ( obj , path , ...args ) {
16- return nav ( toPath ( path ) ) ( obj ) . update ( v => incV ( v , ...args ) )
16+ return nav ( toPath ( path ) ) . update ( v => incV ( v , ...args ) ) ( obj )
1717 }
1818
1919 function curriedInc ( path , ...args ) {
@@ -224,7 +224,7 @@ describe('nav.nav', () => {
224224 } )
225225
226226 it ( 'should throw an explicit error when en empty path is given as parameter' , ( ) => {
227- expect ( ( ) => inc ( { } , '' ) ) . toThrowError ( 'path should not be empty' )
227+ expect ( ( ) => inc ( { } , '' ) ) . toThrowError ( 'Path should not be empty' )
228228 } )
229229
230230 it ( 'should support curried first arg' , ( ) => {
@@ -262,22 +262,22 @@ describe('nav.nav', () => {
262262 } )
263263
264264 it ( 'should get a nested prop' , ( ) => {
265- expect ( nav ( toPath ( 'nested.prop' ) ) ( { nested : { prop : 'foo' } } ) . get ( ) ) . toBe ( 'foo' )
265+ expect ( nav ( toPath ( 'nested.prop' ) ) . get ( ) ( { nested : { prop : 'foo' } } ) ) . toBe ( 'foo' )
266266 } )
267267
268268 it ( 'should get a list of props' , ( ) => {
269- expect ( nav ( toPath ( 'nested.{prop1,prop2}' ) ) ( { nested : { prop1 : 'foo' ,
270- prop2 : 'bar' } } ) . get ( ) ) . toEqual ( [ 'foo' , 'bar' ] )
271- expect ( nav ( toPath ( 'nested.{*}' ) ) ( { nested : { prop1 : 'foo' ,
272- prop2 : 'bar' } } ) . get ( ) ) . toEqual ( [ 'foo' , 'bar' ] )
269+ expect ( nav ( toPath ( 'nested.{prop1,prop2}' ) ) . get ( ) ( { nested : { prop1 : 'foo' ,
270+ prop2 : 'bar' } } ) ) . toEqual ( [ 'foo' , 'bar' ] )
271+ expect ( nav ( toPath ( 'nested.{*}' ) ) . get ( ) ( { nested : { prop1 : 'foo' ,
272+ prop2 : 'bar' } } ) ) . toEqual ( [ 'foo' , 'bar' ] )
273273 } )
274274
275275 it ( 'should set a nested prop' , ( ) => {
276276 immutaTest (
277277 { nested : { prop : 'foo' } } ,
278278 [ 'nested.prop' ] ,
279279 ( input , [ path ] ) => {
280- const output = nav ( toPath ( path ) ) ( input ) . update ( ( ) => 'bar' )
280+ const output = nav ( toPath ( path ) ) . update ( ( ) => 'bar' ) ( input )
281281 expect ( output ) . toEqual ( { nested : { prop : 'bar' } } )
282282 return output
283283 } ,
@@ -289,7 +289,7 @@ describe('nav.nav', () => {
289289 { nested : { prop : 'foo' } } ,
290290 [ 'nested.prop' ] ,
291291 ( input , [ path ] ) => {
292- const output = nav ( toPath ( path ) ) ( input ) . update ( value => value . toUpperCase ( ) )
292+ const output = nav ( toPath ( path ) ) . update ( value => value . toUpperCase ( ) ) ( input )
293293 expect ( output ) . toEqual ( { nested : { prop : 'FOO' } } )
294294 return output
295295 } ,
@@ -301,34 +301,34 @@ describe('nav.nav', () => {
301301 { } ,
302302 [ 'nested.prop.0' , 'nested.prop.1' ] ,
303303 input => {
304- const output = nav ( toPath ( 'nested.prop[1]' ) ) ( input ) . update ( ( ) => 'foo' )
304+ const output = nav ( toPath ( 'nested.prop[1]' ) ) . update ( ( ) => 'foo' ) ( input )
305305 expect ( output ) . toEqual ( { nested : { prop : [ undefined , 'foo' ] } } )
306306 return output
307307 } ,
308308 )
309309 } )
310310
311311 it ( 'should get a slice' , ( ) => {
312- expect ( nav ( toPath ( 'nested.prop[:].val' ) ) ( {
312+ expect ( nav ( toPath ( 'nested.prop[:].val' ) ) . get ( ) ( {
313313 nested : {
314314 prop : [
315315 { val : 'foo' } ,
316316 { val : 'bar' } ,
317317 ] ,
318318 } ,
319- } ) . get ( ) ) . toEqual ( [ 'foo' , 'bar' ] )
320- expect ( nav ( toPath ( 'nested.prop[::-1].val' ) ) ( {
319+ } ) ) . toEqual ( [ 'foo' , 'bar' ] )
320+ expect ( nav ( toPath ( 'nested.prop[::-1].val' ) ) . get ( ) ( {
321321 nested : {
322322 prop : [
323323 { val : 'foo' } ,
324324 { val : 'bar' } ,
325325 ] ,
326326 } ,
327- } ) . get ( ) ) . toEqual ( [ 'bar' , 'foo' ] )
327+ } ) ) . toEqual ( [ 'bar' , 'foo' ] )
328328 } )
329329
330330 it ( 'should get a negative array index' , ( ) => {
331- expect ( nav ( toPath ( 'nested.prop[-3]' ) ) ( { nested : { prop : [ 0 , 1 , 2 , 3 , 4 ] } } ) . get ( ) ) . toBe ( 2 )
331+ expect ( nav ( toPath ( 'nested.prop[-3]' ) ) . get ( ) ( { nested : { prop : [ 0 , 1 , 2 , 3 , 4 ] } } ) ) . toBe ( 2 )
332332 } )
333333
334334 it ( 'should update a slice' , ( ) => immutaTest (
@@ -343,7 +343,7 @@ describe('nav.nav', () => {
343343 } ,
344344 [ 'nested.prop.1.val' , 'nested.prop.2.val' ] ,
345345 input => {
346- const output = nav ( toPath ( 'nested.prop[-2:].val' ) ) ( input ) . update ( value => value . toUpperCase ( ) )
346+ const output = nav ( toPath ( 'nested.prop[-2:].val' ) ) . update ( value => value . toUpperCase ( ) ) ( input )
347347 expect ( output ) . toEqual ( {
348348 nested : {
349349 prop : [
0 commit comments