Created
August 10, 2021 21:52
-
-
Save just-boris/9d4c233a085be3aee1737647b6733b5f to your computer and use it in GitHub Desktop.
slice a list
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
function sliceItems(items, limit) { | |
if (items.length <= limit + 1) { | |
return { visible: items, hidden: [] }; | |
} | |
return { | |
visible: items.slice(0, limit), | |
hidden: items.slice(limit) | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment