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

Version Path
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/utile/lib/format.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/utile/lib/format.js
hooch-0.4.2 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/http-proxy/node_modules/utile/lib/format.js