backoffice/node_modules/core-js/modules/_to-index.js

7 lines
230 B
JavaScript
Raw Normal View History

2020-02-06 10:09:39 +00:00
var toInteger = require('./_to-integer')
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};