333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"use strict";
 
var pad      = require("../../string/#/pad")
  , toPosInt = require("../to-pos-integer")
 
  , toFixed = Number.prototype.toFixed;
 
module.exports = function (length/*, precision*/) {
    var precision;
    length = toPosInt(length);
    precision = toPosInt(arguments[1]);
 
    return pad.call(precision ? toFixed.call(this, precision) : this,
        "0", length + (precision ? 1 + precision : 0));
};