8000 Add string built-ins to lodash wrapper? · Issue #1016 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

Add string built-ins to lodash wrapper? #1016

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

Closed
jasonkarns opened this issue Mar 4, 2015 · 8 comments
Closed

Add string built-ins to lodash wrapper? #1016

jasonkarns opened this issue Mar 4, 2015 · 8 comments

Comments

@jasonkarns
Copy link
Contributor

It's super handy that a bunch of the built-in Array methods (concat, join, pop, push, etc) are all added to the wrapper object. Thus when an array is wrapped, one can use any of the built-in array methods directly on the chain as if operating directly on the array.

Now that lodash has a suite of String methods, I was a bit surprised to learn that the String built-ins aren't added to the wrapper object as well.

Was this intentional or an oversight? I would love to be able to use methods like split or replace directly on a lodash-wrapped string.

@jdalton
Copy link
Member
jdalton commented Mar 4, 2015

I can dig a couple helpers. Let's open it to PRs :D

@megawac
Copy link
Contributor
megawac commented Mar 4, 2015

If these are back on the table it may be a good time to reconsider method proxies #821?

@jdalton
Copy link
Member
jdalton commented Mar 4, 2015
8000

Still not wanting method proxies. Chaining is pretty scenario specific.

@octref
Copy link
Contributor
octref commented Mar 5, 2015

I guess I can help :-)
I'll spend today and tomorrow looking for some possible implementations, post them here & do the PR in this weekend.

@jdalton
Copy link
Member
jdalton commented Mar 5, 2015

Rock, let's reuse the loop that's handling the array methods, adding just replace, and split, and toggle based on a regexp match of their names similar to how it's handled in other places.

@bnjmnt4n
Copy link
Contributor
bnjmnt4n commented Mar 5, 2015

👍 split and replace are a good start!

@jdalton
Copy link
Member
jdalton commented Mar 6, 2015

Taking it to #1016.

@jdalton jdalton closed this as completed Mar 6, 2015
jdalton added a commit that referenced this issue Mar 7, 2015
WIP: StringWrapper implementation for #1016.
@lock
Copy link
lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants
0