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

removing fromIndex arguments. #16

Closed
xgbuils opened this issue Jun 5, 2017 · 2 comments
Closed

removing fromIndex arguments. #16

xgbuils opened this issue Jun 5, 2017 · 2 comments
Milestone

Comments

@xgbuils
Copy link
Owner

xgbuils commented Jun 5, 2017

includes and indexOf has fromIndex arguments which don't make sense.

In Array approach it is useful to have better performance. But in lazy approach doing iterum.drop(fromIndex).includes(...) is the same.

@xgbuils xgbuils added this to the release 2.0 milestone Jun 5, 2017
@xgbuils
Copy link
Owner Author

xgbuils commented Jun 5, 2017

Notice that iterum.indexOf(n, fromIndex) does not returns the same that iterum.drop(fromIndex).indexOf(n).

However it's easy to create an snippet which obtains the same:

const result1 = iterum.indexOf(n, fromIndex)

const x = iterum.drop(fromIndex).indexOf(n)
const result2 = x === -1 ? -1 : fromIndex + x

// result1 === result2

Then, I'm also going to remove fromIndex of indexOf method.

@xgbuils
Copy link
Owner Author

xgbuils commented Jun 5, 2017

I've noticed that lodash/fp has indexOfFrom function. I'm also going to implement this method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant