Created
April 29, 2021 09:15
-
-
Save EmilienD/377a12bc672ad4503db70371319da61e to your computer and use it in GitHub Desktop.
One liner to use arrays as fifo cache without mutating the array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fifo = limit => array => item => array.length === limit ? array.slice(1).concat(item) : array.concat(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment