source: imaps-frontend/node_modules/es-abstract/2023/ToZeroPaddedDecimalString.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 572 bytes
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $String = GetIntrinsic('%String%');
6var $RangeError = require('es-errors/range');
7var isInteger = require('math-intrinsics/isInteger');
8
9var StringPad = require('./StringPad');
10
11// https://262.ecma-international.org/13.0/#sec-tozeropaddeddecimalstring
12
13module.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.