#291: Fixes & improvements to parameter hunter #292
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #291
Summary of changes:
core/lib/parameter_hunter.js
paramToJson()
now uses. Hopefully the in-source comments explain their details sufficiently well:extractNextKeyOrValue()
: Extracts the next unquoted / single-quoted / double-quoted textdoubleQuoteKeyOrValIfNeeded()
: Converts text to its double-quoted equivalentextractNextKeyValPair()
: Extracts the next complete parameter (i.e. key:value pair)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.findparameters()
: Minor change to remove the curly braces from the param string before it is passed toparamToJson()
.test/parameter_hunter_tests.js
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
npm-debug.log
, which gets generated when you run withdebug
enabled in the config file.