Blame view

node_modules/es5-ext/number/#/pad.js 400 Bytes
2a09d1a4   liuqimichale   添加宜春 天水 宣化
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));
  };