Blame view

node_modules/es5-ext/number/#/pad.js 402 Bytes
f7563de62   Palak Handa   first commit
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));
  };