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: elche
Versions
latest
stable
elche
dubrovka
chiba.2
chiba.1
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.