nativity-fomatto
v1.0.0
Published
nativity plugin to install fomatto onto native String prototype.
Downloads
4
Maintainers
Readme
nativity-fomatto
nativity plugin to install fomatto's format method onto String.prototype.
Install
npm install --save nativity-fomatto
Usage
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
Restoration
var fomatto = require('nativity-fomatto').install();
console.log('Hello {0}!'.format(['Friend']));
fomatto.restore();
console.log('My string'.format);
// format is undefined