Opal-Estate-Pro/node_modules/core-js/modules/_to-absolute-index.js

8 lines
223 B
JavaScript
Raw Normal View History

2019-09-13 04:44:33 +02:00
var toInteger = require('./_to-integer');
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};