Replaces placeholder defined by the {{placeholder}} pattern in a string or JSON.
Arguments: |
|
---|---|
Returns: | Initial object with placeholders replaced. |
$.nosDataReplace(obj, data);
$.nosDataReplace('exemple {{foo}}', {foo : 'bar'});
// returns 'exemple bar'
$.nosDataReplace({
astring: 'example {{foo}}',
json: {
string: 'sample {{bar}}',
}
},
{
foo : 'bar',
bar : 'foo'
});
//returns {
// astring: 'example bar',
// json: {
// string: 'sample foo',
//}