string-replace-with-object
Replace contents of string with key/values from object
Install
npm install --save string-replace-with-object
Usage
// => 'cat' // => 'goodbye sky' // => 'hey hey' // => 'yo'
API
stringReplaceWithObject(str, obj, [delimeter])
Returns a string with replaced contents where key name occurrences are replaced with the key value.
str
type: string
A string to replace the contents of.
obj
type: object
An object with key/value pairs to replace the contents of str
.
delimeter
type: string
default: ''
A delimeter to surround both sides of key names when searching string. For example, a str
value of xYhelloxY
, an obj
of {hello: 'cat'}
, and a delimeter
of xY
would result in cat
.
LICENSE
MIT © Dustin Specker