Lutece / es5-string-binder

String and Object binder for ES5

Home Page:https://hyunjun19.github.io/es5-string-binder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

es5-string-binder

"No more plus, No more join"

This is the simplest way to deal with strings. This module is designed to work for ES5. If you are using the ES6 module, please use ES6 standard specification Template literals.

This module can be used in two ways. The first is to use function, the second is to use prototype.

install

$ npm install --save es5-string-binder
$ bower install --save es5-string-binder

How to use

// use function and object parameter
var foo = bind('No {key1} No {key2}', { key1: 'pain', key2: 'gain' });
console.log(foo); // No pain No gain

// use function and array parameter
var bar = bind('No {0} No {1}', 'pain', 'gain');
console.log(bar); // No pain No gain
// use prototype and object parameter
var foo = 'No {key1} No {key2}'.bind({ key1: 'pain', key2: 'gain' });
console.log(foo); // No pain No gain

// use prototype and array parameter
var bar = 'No {0} No {1}'.bind('pain', 'gain');
console.log(bar); // No pain No gain

About

String and Object binder for ES5

https://hyunjun19.github.io/es5-string-binder

License:MIT License


Languages

Language:JavaScript 100.0%