main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
568 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var GetIntrinsic = require('get-intrinsic');
|
---|
4 |
|
---|
5 | var $String = GetIntrinsic('%String%');
|
---|
6 | var $RangeError = require('es-errors/range');
|
---|
7 |
|
---|
8 | var StringPad = require('./StringPad');
|
---|
9 |
|
---|
10 | var isInteger = require('../helpers/isInteger');
|
---|
11 |
|
---|
12 | // https://262.ecma-international.org/13.0/#sec-tozeropaddeddecimalstring
|
---|
13 |
|
---|
14 | module.exports = function ToZeroPaddedDecimalString(n, minLength) {
|
---|
15 | if (!isInteger(n) || n < 0) {
|
---|
16 | throw new $RangeError('Assertion failed: `q` must be a non-negative integer');
|
---|
17 | }
|
---|
18 | var S = $String(n);
|
---|
19 | return StringPad(S, minLength, '0', 'start');
|
---|
20 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.