Skip to content

Commit 9343291

Browse files
Adding 'as' typecasting
1 parent d857bac commit 9343291

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/woql.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ WOQL.with = function(graph, source, query){ return new WOQLQuery().with(graph, s
219219
* @param {string} vari - Target
220220
* @return {object} WOQLQuery
221221
*/
222-
WOQL.as = function(map, vari){ return new WOQLQuery().as(map, vari); }
222+
WOQL.as = function(map, vari, ty){ return new WOQLQuery().as(map, vari, ty); }
223223

224224
/**
225225
* Provides details of a remote data source in a JSON format that includes a URL property
@@ -1529,7 +1529,7 @@ WOQLQuery.prototype.boxDatatype = function(datatype, label, descr, graph, prefix
15291529
}
15301530

15311531

1532-
WOQLQuery.prototype.as = function(a, b){
1532+
WOQLQuery.prototype.as = function(a, b, c){
15331533
if(!a) return;
15341534
if(!this.asArray){
15351535
this.asArray = true;
@@ -1538,7 +1538,12 @@ WOQLQuery.prototype.as = function(a, b){
15381538
if(b){
15391539
b = (b.indexOf(":") == -1 ? "v:" + b : b);
15401540
var val = (typeof a == "object" ? a : { "@value" : a});
1541-
this.query.push({as: [val, b]});
1541+
1542+
if(c){
1543+
this.query.push({as: [val, b, c]});
1544+
}else{
1545+
this.query.push({as: [val, b]});
1546+
}
15421547
}
15431548
else {
15441549
a = (a.indexOf(":") == -1 ? "v:" + a : a);

0 commit comments

Comments
 (0)