Skip to content

refactor: drop string-length dependency and replace with native solution #6779

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Apr 15, 2025

☑️ Resolves

Remove useless dependencies where we can just use native ES alternatives.

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@susnux susnux added 3. to review Waiting for reviews refactor ♻️ Pull request that is neither a fix nor a feature labels Apr 15, 2025
@susnux susnux added this to the v9.0.0-rc.0 milestone Apr 15, 2025
@susnux susnux requested review from st3iny, skjnldsv and ShGKme April 15, 2025 13:31
Copy link
Contributor

@st3iny st3iny left a comment

Choose a reason for hiding this comment

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

Looks good and INTL is widely supported by now.

@@ -471,7 +474,8 @@ export default {
if (this.isEmptyValue || !this.maxlength) {
return false
}
return stringLength(this.localValue) > this.maxlength
const length = [...this.segmenter.segment(this.localValue)].length
Copy link
Contributor

@st3iny st3iny Apr 15, 2025

Choose a reason for hiding this comment

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

Ahhh, I love JavaScript's horrific iterator abstraction ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks clean to me 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also would like if they returned an proper array like but on the otherside browser implementation could be probably faster with a generator like it is now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it makes sense. I was referring to the incomplete API, for example, a <iterable>.count() function like in Rust etc. so that we don't have to copy memory all the time when working with iterators.

Copy link
Contributor

Choose a reason for hiding this comment

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

PS: But it will get better very soon, now that an important proposal was merged.

@skjnldsv skjnldsv merged commit 186365e into main Apr 15, 2025
28 checks passed
@skjnldsv skjnldsv deleted the refactor/drop-dependency branch April 15, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews refactor ♻️ Pull request that is neither a fix nor a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants