join-params

Partial function application with parameter formatting

Partial function application with parameter formatting.

$ npm install join-params
 
request    = require('request')
joinParams = require('join-params')
 
search = joinParams(request, 'https://www.google.com/search?q={1} site:{0}')
 
search('npmjs.org', 'partial application', function(errorresponsebody){
 
    body
    // => search results for "partial application site:npmjs.org" 
 
})
 

Another example:

 
var log = joinParams(print, '[Log {0}]', 1) // "1" 
 
log('info', 'hello', 'world')
// => [Log info] hello, world 
 
function print(){
  process.stdout.write( Array.prototype.join.call(arguments, '') )
}