Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
439 bytes
|
Line | |
---|
1 | var toInteger = require('../internals/to-integer');
|
---|
2 |
|
---|
3 | var max = Math.max;
|
---|
4 | var min = Math.min;
|
---|
5 |
|
---|
6 | // Helper for a popular repeating case of the spec:
|
---|
7 | // Let integer be ? ToInteger(index).
|
---|
8 | // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
---|
9 | module.exports = function (index, length) {
|
---|
10 | var integer = toInteger(index);
|
---|
11 | return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
---|
12 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.