0.1.2 • Published 9 years ago

string-prepend v0.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

string-prepend

Code Climate Build Status NPM version NPM downloads LICENSE

The unicorn String.prototype.prepend as a curried function.

$ npm install string-prepend --save

API Examples & Inspiration

Require
var prepend = require('./');
Equivalent to str1 + str2
prepend("http://", "example.com");
//=> http://example.com
URL building
var paramName = prepend('http://');
var interests = ["example.com", "google.com", "yahoo.com"];

interests.map(paramName);
//=> [ 'http://example.com', 'http://google.com', 'http://yahoo.com' ]
Query params building
var paramName = prepend('interest[]=');
var interests = ["finance", "fitness", "health"];

var params = interests.map(paramName);
//=> [ 'interest[]=finance', 'interest[]=fitness', 'interest[]=health']

params.join('&');
//=> interest[]=finance&interest[]=fitness&interest[]=health

License

MIT