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

#291: Fixes & improvements to parameter hunter #292

Closed
wants to merge 6 commits into from

Conversation

james-nash
Copy link
Contributor

Addresses #291

Summary of changes:

  • core/lib/parameter_hunter.js
    • ADDED a bunch of helper functions that paramToJson() now uses. Hopefully the in-source comments explain their details sufficiently well:
      • extractNextKeyOrValue(): Extracts the next unquoted / single-quoted / double-quoted text
      • doubleQuoteKeyOrValIfNeeded(): Converts text to its double-quoted equivalent
      • extractNextKeyValPair(): Extracts the next complete parameter (i.e. key:value pair)
    • CHANGED paramToJson(): Completely re-written. It now acts more parser-like, trying to find key, colon, value and comma in that order. If one of them is missing, it skips ahead until it finds a comma (or the end of the string), so that subsequent parameters can still be found.
    • CHANGED findparameters(): Minor change to remove the curly braces from the param string before it is passed to paramToJson().
  • test/parameter_hunter_tests.js
    • ADDED the following tests:
      • parameter hunter parses parameters with values containing a closing parenthesis
      • parameter hunter parses parameters that follow a non-quoted value
      • parameter hunter parses parameters whose keys contain escaped quotes
      • parameter hunter skips malformed parameters

I also included this unrelated change by accident (sorry):

  • .gitignore
    • ADDED a rule to exclude npm-debug.log, which gets generated when you run with debug enabled in the config file.

@e2tha-e
Copy link
Contributor

e2tha-e commented Mar 16, 2016

@james-nash @bmuenzenmeyer
I want to be sure this doesn't conflict too much with pr #277 . Can I take some time to review this and add my thoughts? Thanks.

@e2tha-e e2tha-e mentioned this pull request Mar 16, 2016
@bmuenzenmeyer
Copy link
Member

Closing this PR per #293 (comment)

Appreciate the teamwork!

@james-nash james-nash deleted the improve-param-hunter branch June 24, 2016 13:57
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.

3 participants