aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/_to-index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/modules/_to-index.js')
-rw-r--r--node_modules/core-js/modules/_to-index.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/_to-index.js b/node_modules/core-js/modules/_to-index.js
new file mode 100644
index 000000000..4d380ce18
--- /dev/null
+++ b/node_modules/core-js/modules/_to-index.js
@@ -0,0 +1,7 @@
+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);
+}; \ No newline at end of file