nosDataReplace

$.nosDataReplace(object, data)

Replaces placeholder defined by the {{placeholder}} pattern in a string or JSON.

Arguments:
  • object (mixed) – A string or a JSON, where to search placeholder to replace.
  • data (JSON) – A JSON, placeholder => replacement value.
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',
//}
Read the Docs v: 0.2
Versions
latest
chiba.2
chiba.1
0.2
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.