@graphistry/falcor-query-syntax
Advanced tools
Comparing version 2.6.3 to 2.6.4
@@ -42,3 +42,3 @@ var isArray = Array.isArray; | ||
_key = '$__' + (opts.$__index__$++) + '__$'; | ||
opts[_key] = { call: arg }; | ||
opts[_key] = arg; | ||
return _key; | ||
@@ -45,0 +45,0 @@ } |
{ | ||
"name": "@graphistry/falcor-query-syntax", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"description": "ES6 Template String and Builder function for Creating Falcor Paths (Experimental)", | ||
@@ -52,3 +52,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@graphistry/falcor-path-utils": "^2.6.0", | ||
"@graphistry/falcor-path-utils": "^2.6.4", | ||
"babel-plugin-transform-runtime": "~6.15.0", | ||
@@ -59,3 +59,3 @@ "pegjs": "0.10.0" | ||
"@graphistry/falcor-json-graph": "^2.5.3", | ||
"@graphistry/falcor-router": "^2.6.3", | ||
"@graphistry/falcor-router": "^2.6.4", | ||
"babel-plugin-istanbul": "~3.0.0", | ||
@@ -62,0 +62,0 @@ "babel-register": "~6.18.0", |
@@ -11,3 +11,2 @@ var expect = require('chai').expect; | ||
function pushHandler() {}; | ||
var getHandler = { get: function() {} }; | ||
@@ -34,7 +33,16 @@ var setHandler = { set: function() {} }; | ||
it('should coerce functions into call routes', function() { | ||
it('should accept functions as route handler factories', function() { | ||
function pushHandler() {}; | ||
function pushHandlerFactory(route) { | ||
expect(route).to.deep.equal( | ||
['genreLists', 'push'] | ||
); | ||
return { call: pushHandler }; | ||
} | ||
var routes = toRoutes`{ | ||
genreLists: { | ||
push: ${ pushHandler } | ||
push: ${ pushHandlerFactory } | ||
} | ||
@@ -41,0 +49,0 @@ }`; |
@@ -36,3 +36,3 @@ var expect = require('chai').expect; | ||
} | ||
}) | ||
}); | ||
}) | ||
@@ -81,3 +81,3 @@ .subscribe(null, done, done); | ||
} | ||
}) | ||
}); | ||
}) | ||
@@ -122,3 +122,3 @@ .subscribe(null, done, done); | ||
} | ||
}) | ||
}); | ||
}) | ||
@@ -153,7 +153,9 @@ .subscribe(null, done, done); | ||
}}, | ||
push: ${function pushGenreList(path, args) { | ||
return [ | ||
$value(`genreLists[${g.genreLists.length}]`, args[0]), | ||
$value(`genreLists.length`, g.genreLists.push(args[0])) | ||
]; | ||
push: ${{ | ||
call: function pushGenreList(path, args) { | ||
return [ | ||
$value(`genreLists[${g.genreLists.length}]`, args[0]), | ||
$value(`genreLists.length`, g.genreLists.push(args[0])) | ||
]; | ||
} | ||
}}, | ||
@@ -160,0 +162,0 @@ [{ integers: listIndexes }]: ${{ |
150718
1331