summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/pad.js
blob: 4478f6a11e0c9be0c5973a05d4e704f9545d2b80 (plain)
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));
};