Skip to content

Instantly share code, notes, and snippets.

@DScheglov
Created December 18, 2019 13:29
Show Gist options
  • Save DScheglov/b9e0603fa8646921c8649ebebfe50a87 to your computer and use it in GitHub Desktop.
Save DScheglov/b9e0603fa8646921c8649ebebfe50a87 to your computer and use it in GitHub Desktop.
const get = items => index => items[index];
const push = items => item => { items.push(item); };
const pop = items => () => items.pop();
const arrayApi = items => Object.assign(
get(items), {
push: push(items),
pop: pop(items),
}
);
export const array = () => arrayApi([]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment