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

Attempt to parse the JSON to see if it is already well formed #672

Merged
merged 1 commit into from
Sep 11, 2017

Conversation

cjpete
Copy link
Contributor

@cjpete cjpete commented Jul 26, 2017

Summary of changes:

Fixes an issue whereby injecting list items via pattern parameters into patterns would throw syntax errors. E.g:

{{> molecules-select-with-information(
    "sub-information": "Extra info about option 1",
    "options": [{
      "key": "1",
      "label": "Option 1"
    },
    {
      "key": "2",
      "label": "Option 2"
    },
    {
      "key": "3",
      "label": "Option 3"
    }],
    "value": "1"
  ) }}

Error thrown without fix:

[patternlab:build] There was an error parsing JSON for 02-organisms/visits/add-visit.mustache
[patternlab:build] SyntaxError: Unexpected token } in JSON at position 43
    at JSON.parse (<anonymous>)
    at /Users/cjpitt/development/the92club/node_modules/patternlab-node/core/lib/parameter_hunter.js:271:28
    at Array.forEach (native)

@bmuenzenmeyer
Copy link
Member

@cjpete this is a great idea - thanks for thinking to contribute it!

I may tweak this post-merge to only console.log during debug mode, fyi

@bmuenzenmeyer bmuenzenmeyer self-assigned this Aug 16, 2017
@bmuenzenmeyer bmuenzenmeyer merged commit ca6721c into pattern-lab:dev Sep 11, 2017
@bmuenzenmeyer
Copy link
Member

Thanks fo this - it will be included in the next release

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