nativity-fomatto

nativity plugin to install fomatto onto native String prototype.

nativity-fomatto

nativity plugin to install fomatto's format method onto String.prototype.

npm install --save nativity-fomatto
require('nativity-fomatto').install();

console.log('Hello {0}!'.format(['Friend']));
// Hello Friend!

Custom formatter:

require('nativity-fomatto').install({
    price: function(value) {
        return '$' + value + '.00';
    }
});

console.log('That will be {:price}'.format(5));
// That will be $5.00
var fomatto = require('nativity-fomatto').install();
console.log('Hello {0}!'.format(['Friend']));

fomatto.restore();

console.log('My string'.format);
// format is undefined