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

fixed between function #946

Merged
merged 4 commits into from
Jan 14, 2023

Conversation

mohammadKhalafi
Copy link
Contributor

@mohammadKhalafi mohammadKhalafi commented Jan 12, 2023

issue link : #915

@mohammadKhalafi mohammadKhalafi changed the title Update functions.js fixed between function Jan 12, 2023
Copy link
Member

@DmitrySharabin DmitrySharabin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there @mohammadKhalafi,

Thank you so much for your interest in Mavo and your PR. It indeed fixes the bug, and all the tests we have still pass. That's awesome!

However, I found a use case where the between function doesn't work as we expect (see the comment). Is there a chance you could fix that issue as well?

src/functions.js Outdated Show resolved Hide resolved
Comment on lines +619 to +623
if (tight && toIndex <= fromIndex){
return haystack.slice(toIndex + to.length, fromIndex);
}

return haystack.slice(fromIndex + from.length, toIndex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what if from and/or to are not provided (either of them can be an empty string)? They are optional by design (and you took it into account in your first commit). Moreover, the fromlast() and tofirst() functions are built on top of the optionality of from and to.

E.g., With this change, fromlast("foo.bar.baz", ".") returns foo.bar instead of baz, and tofirst("foo.bar.baz", ".") returns bar.baz instead of foo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! LGTM. Thanks!

@DmitrySharabin
Copy link
Member

@LeaVerou Lea, I reviewed this PR. And it looks like now everything works as it should: the tests pass, the bug is fixed, I also checked our demos—no regression. Do you mind me merging this PR?

@LeaVerou
Copy link
Member

@LeaVerou Lea, I reviewed this PR. And it looks like now everything works as it should: the tests pass, the bug is fixed, I also checked our demos—no regression. Do you mind me merging this PR?

If I assign you a review, it means I trust you to merge when you think it's ready 😄

@DmitrySharabin
Copy link
Member

If I assign you a review, it means I trust you to merge when you think it's ready 😄

Got it. Thanks! 😄

@DmitrySharabin DmitrySharabin merged commit a96680d into mavoweb:master Jan 14, 2023
@DmitrySharabin
Copy link
Member

@mohammadKhalafi Thank you so much for your work!

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

Successfully merging this pull request may close these issues.

None yet

3 participants