source: imaps-frontend/node_modules/es-abstract/2021/substring.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: 638 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4var isInteger = require('math-intrinsics/isInteger');
5var callBound = require('call-bound');
6
7var $slice = callBound('String.prototype.slice');
8
9// https://262.ecma-international.org/12.0/#substring
10module.exports = function substring(S, inclusiveStart, exclusiveEnd) {
11 if (typeof S !== 'string' || !isInteger(inclusiveStart) || (arguments.length > 2 && !isInteger(exclusiveEnd))) {
12 throw new $TypeError('`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers');
13 }
14 return $slice(S, inclusiveStart, arguments.length > 2 ? exclusiveEnd : S.length);
15};
Note: See TracBrowser for help on using the repository browser.