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

Bug Fix #36

Merged
merged 1 commit into from
Oct 5, 2020
Merged

Bug Fix #36

merged 1 commit into from
Oct 5, 2020

Conversation

pranavwani
Copy link

Content returning without replacing the parameter's value while the type of parameter is a function in the passed context.

…ype of parameter is a function in the passed context.
@curran
Copy link
Member

curran commented Oct 5, 2020

Nice catch!

@curran curran merged commit 3c86626 into datavis-tech:master Oct 5, 2020
@curran
Copy link
Member

curran commented Oct 5, 2020

Published as https://github.com/datavis-tech/json-templates/releases/tag/v4.1.0

I realize there's no documentation in the README for this new feature. Is that something you'd be willing to take on @pranavwani ? New issue for that is here #37 . Thanks!

it('should compute template with function with multiple inner parameters', () => {
const template = parse(JSON.stringify({ username: "{{username}}", password: "{{password}}" }));
assert.deepEqual(template.parameters, [{ key: 'username' }, { key: 'password' }]);
assert.equal(template({ username: () => ("John"), password: () => ("John") }), '{"username":"John","password":"John"}');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavwani I'm confused as to why template() is returning a string here. I would have expected it to return the object itself. Also, this test could be improved by using a different value for password.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, actually trying to passing JSON string to the template parser. It's similar to string with multiple arguments.

I think comment should be appropriate.

@pranavwani
Copy link
Author

@curran I'll add the doc for it. Thanks 👍.

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