chenyc
2025-12-09 545c24c6a711d71b65f3d4e8122fee3837fb1edc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"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)
    );
};