Skip to content

Instantly share code, notes, and snippets.

@just-boris
Created August 10, 2021 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save just-boris/9d4c233a085be3aee1737647b6733b5f to your computer and use it in GitHub Desktop.
Save just-boris/9d4c233a085be3aee1737647b6733b5f to your computer and use it in GitHub Desktop.
slice a list
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