Created
July 2, 2014 02:41
-
-
Save motiooon/3a44b092d5c5318891b7 to your computer and use it in GitHub Desktop.
Loopback Helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lbPick (a){ | |
var str = ''; | |
a.forEach(function(field){ | |
str+='&filter[fields]['+field+']=1'; | |
}); | |
return str; | |
} | |
function lbGetPage(page){ | |
var str = '&filter[limit]=50&filter[skip]=' + ((page-1) * 50); | |
return str; | |
} | |
function lbKeywords(a){ | |
var str = ''; | |
a.forEach(function(key){ | |
str+='&filter[where][keywords][inq]='+ key; | |
}); | |
return str; | |
} | |
function lbObjKeywords(a){ | |
var filter={"where": {"keywords": {"inq": a}}}; | |
return '&filter=' + JSON.stringify(filter); | |
} | |
module.exports = { | |
lbPick: lbPick, | |
lbGetPage:lbGetPage, | |
lbKeywords:lbKeywords, | |
lbObjKeywords: lbObjKeywords | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment