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

main
Last change on this file since d565449 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
3var GetIntrinsic = require('get-intrinsic');
4
5var $String = GetIntrinsic('%String%');
6var $RangeError = require('es-errors/range');
7
8var StringPad = require('./StringPad');
9
10var isInteger = require('../helpers/isInteger');
11
12// https://262.ecma-international.org/13.0/#sec-tozeropaddeddecimalstring
13
14module.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.