Sha256: 20c5ad01462dda5175e5add9e148ab1f6905d29a7f4e5f488e2742d5688dd6c5
Contents?: true
Size: 594 Bytes
Versions: 19
Compression:
Stored size: 594 Bytes
Contents
/* * format.js: `util.format` enhancement to allow custom formatting parameters. * * (C) 2012, Nodejitsu Inc. * MIT LICENSE * */ var util = require('util'); exports = module.exports = function(str) { var formats = [].slice.call(arguments, 1, 3); if (!(formats[0] instanceof Array && formats[1] instanceof Array) || arguments.length > 3) return util.format.apply(null, arguments); var replacements = formats.pop(), formats = formats.shift(); formats.forEach(function(format, id) { str = str.replace(new RegExp(format), replacements[id]); }); return str; };
Version data entries
19 entries across 19 versions & 3 rubygems