cafe-utility 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -498,6 +498,11 @@ const unshiftAndLimit = (array, item, limit) => {
|
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
+
const atRolling = (array, index) => {
|
|
502
|
+
const realIndex = index % array.length
|
|
503
|
+
return array[realIndex]
|
|
504
|
+
}
|
|
505
|
+
|
|
501
506
|
const pushAll = (array, elements) => Array.prototype.push.apply(array, elements)
|
|
502
507
|
|
|
503
508
|
const unshiftAll = (array, elements) => Array.prototype.unshift.apply(array, elements)
|
|
@@ -1425,7 +1430,8 @@ module.exports = {
|
|
|
1425
1430
|
merge: mergeArrays,
|
|
1426
1431
|
empty,
|
|
1427
1432
|
pushToBucket,
|
|
1428
|
-
unshiftAndLimit
|
|
1433
|
+
unshiftAndLimit,
|
|
1434
|
+
atRolling
|
|
1429
1435
|
},
|
|
1430
1436
|
System: {
|
|
1431
1437
|
sleepMillis,
|