Skip to content
interpolate string
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
README.md
bower.json
index.js
index.proto.js
package.json

README.md

interpolate.js

simple interpolate string

Install

npm install interpolatejs

or

bower install interpolate.js

Use

include script on page, or require on node.js

// lines params
interpolate('?, ?', 'Hello', 'World');

// or 
'?, ?'.format('Hello', 'World');  // => 'Hello, World'

// ignore "?"
'?, ?/'.format('Hello', 'World');  // => 'Hello, ?'

js object

'${val + 123}'.format({val: 123}) // =>  '246'

// deep
'${val.val.val}'.format({val: {val: {val: 2} } }) // =>  '2'

Test

npm test
Something went wrong with that request. Please try again.