Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/plugins/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
Lawnchair.plugin((function(){
//
var interpolate = function(template, args) {
var parts = template.split('?').filter(function(i) { return i != ''})
, query = ''

for (var i = 0, l = parts.length; i < l; i++) {
query += parts[i] + args[i]
}
return query
query = template.replace(/\?/g, function() {
var item = args.shift();
if(typeof item == "string") {
item = "'" + item + "'";
}
return item;
});

return query;
}

var sorter = function(p) {
Expand Down Expand Up @@ -44,7 +47,7 @@ Lawnchair.plugin((function(){
// overwrite working results
this.__results = r
// callback / chain
if (args.length === 1) this.fn(this.name, last).call(this, this.__results)
if (args.length) this.fn(this.name, last).call(this, this.__results)
return this
},

Expand Down