Skip to content

Add match structure object for safer HTML wrapping of strings#17

Open
wolfd wants to merge 3 commits intomattyork:masterfrom
HubSpot:return_match_structure
Open

Add match structure object for safer HTML wrapping of strings#17
wolfd wants to merge 3 commits intomattyork:masterfrom
HubSpot:return_match_structure

Conversation

@wolfd
Copy link

@wolfd wolfd commented May 16, 2016

It may be a bit overkill, but returning an array of little objects containing whether each character is a match allows for easier parsing of the structure in other applications.

I have a use case where I need to transform the example <b> </b> tags into React components, which is possible by parsing through the string, finding matching tags, and replacing them with React components, but the original library is where this code should be.

The added single variable and if statement added to the main loop of the program will slightly degrade performance, but I believe the cost/benefit ratio is worth it for other people considering the fuzzy library.

@mattyork
Copy link
Owner

Thanks for the PR. Investigating this. The problem it solves is definitely worth solving, but not sure this is the best approach.

Created issue #26 to track this.

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.

2 participants