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