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

removeSegment? #5

Closed
jbrooksuk opened this issue Jul 23, 2013 · 3 comments
Closed

removeSegment? #5

jbrooksuk opened this issue Jul 23, 2013 · 3 comments

Comments

@jbrooksuk
Copy link

Since you can getSegment, would it be worth being able to removeSegment? It'd only be used really when running tests or maybe changing your regex based on a later condition.

@selvinortiz
Copy link
Owner

Good observation James.

I felt it was a little dangerous to add/define removeSegment() as a public method accessible via Flux but I did need a way to read the segment for more accurate testing so I defined it but made sure that the pattern was not directly writable.

I think that it would be safer to define a getSegments() method that return the pattern array so that you can unset a segment (to mimic removeSegment) and use it for testing purposes that way.

However, I think you do make a good point regarding the removal of a segment based on another expression and I think a good example would an OR with a look ahead... it might also help with the orTry().

Feel free to add me on google plus (selvin@selvin.co) and maybe we ca talk about this in a hangout or something if you have some ideas you'd like to share.

selvinortiz added a commit that referenced this issue Jul 23, 2013
- Adds getSegments() to improve testability [Issue #5](#5)
- Adds composer package [selvinortiz/flux](https://packagist.org/packages/selvinortiz/flux)
- Adds dev branch
- Adds contributing notes
- Adds install notes
selvinortiz added a commit that referenced this issue Jul 24, 2013
- Adds getSegments() which was not included in 0.5.0 [Issue #5](#5)
- Adds removeSegment() which can be used in unit tests as well
- Adds lineBreak() and br() which matches a new line (DOS/Unix)
- Adds clear() which allows you to clear out the pattern and start from scratch
- Adds getPattern() which compiles the expression and returns it
- Adds deprecation candidates as @todos
- Fixes mixed logic between add() and raw()
- Fixes implementation on the orTry() method
- Moves example in readme above changelog
- Improves unit tests
@jbrooksuk
Copy link
Author

Flux 0.5.1 is now ported to node-flux

@selvinortiz
Copy link
Owner

@jbrooksuk Awesome James 👍

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

2 participants