4478f6a11e0c9be0c5973a05d4e704f9545d2b80
[platform/framework/web/crosswalk-tizen.git] /
1 'use strict';
2
3 var pad      = require('../../string/#/pad')
4   , toPosInt = require('../to-pos-integer')
5
6   , toFixed = Number.prototype.toFixed;
7
8 module.exports = function (length/*, precision*/) {
9         var precision;
10         length = toPosInt(length);
11         precision = toPosInt(arguments[1]);
12
13         return pad.call(precision ? toFixed.call(this, precision) : this,
14                 '0', length + (precision ? (1 + precision) : 0));
15 };