Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubico/x/slice #148

Open
richytong opened this issue Sep 12, 2020 · 0 comments
Open

rubico/x/slice #148

richytong opened this issue Sep 12, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@richytong
Copy link
Collaborator

slice

Get a subset by range

synopsis

slice(
  from number, to number,
)(value Array|string|any) -> sliced Array|string|any

description

A tacit version of Array.prototype.slice with support for strings. to may be negative.

const trimFirstLast = slice(1, -1)

console.log(
  trimFirstLast([1, 2, 3]),
) // [2]

console.log(
  trimFirstLast('abc'),
) // 'b'
@richytong richytong added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant