mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
7 lines
231 B
JavaScript
7 lines
231 B
JavaScript
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);
|
|
}; |