ioredis-mock
Advanced tools
Comparing version 5.2.1 to 5.2.2
@@ -12,25 +12,6 @@ "use strict"; | ||
function normalizeIndex(index, array) { | ||
if (index < 0) { | ||
return -index > array.length ? 0 : array.length + index; | ||
} | ||
return index; | ||
function slice(arr, start, end) { | ||
return arr.slice(start, end === -1 ? undefined : end + 1); | ||
} | ||
function slice(arr, s, e) { | ||
const start = normalizeIndex(s, arr); | ||
const end = normalizeIndex(e, arr); | ||
if (end === -1) { | ||
return []; | ||
} | ||
if (end - start < 0) { | ||
return Array.from(arr).reverse().slice(start, end + 1); | ||
} | ||
return arr.slice(start, end + 1); | ||
} | ||
function normalizeCountToIndex(offset, count, array) { | ||
@@ -37,0 +18,0 @@ if (count < 0) { |
@@ -128,3 +128,3 @@ { | ||
"runkitExampleFilename": "example.js", | ||
"version": "5.2.1" | ||
"version": "5.2.2" | ||
} |
177702
4672