Front end of the Slack clone application.

12345678910111213141516
  1. "use strict";
  2. var pad = require("../../string/#/pad")
  3. , toPosInt = require("../to-pos-integer")
  4. , toFixed = Number.prototype.toFixed;
  5. module.exports = function (length/*, precision*/) {
  6. var precision;
  7. length = toPosInt(length);
  8. precision = toPosInt(arguments[1]);
  9. return pad.call(precision ? toFixed.call(this, precision) : this,
  10. "0", length + (precision ? 1 + precision : 0));
  11. };