Skip to content
This repository was archived by the owner on Sep 7, 2026. It is now read-only.

.template method will replace keys that do not exist with empty string - #117

Merged
jprichardson merged 1 commit into
jprichardson:masterfrom
az7arul:template-replace-non-existant-key
Oct 20, 2014
Merged

jprichardson merged 1 commit into
jprichardson:masterfrom
az7arul:template-replace-non-existant-key

Conversation

@az7arul

@az7arul az7arul commented Sep 28, 2014

Copy link
Copy Markdown
Collaborator

If the key does not exist current template method keeps the {{ _ }} string as is. Replacing it with empty string seems to be helpful.

@az7arul

az7arul commented Oct 12, 2014

Copy link
Copy Markdown
Collaborator Author

@jprichardson any thoughts ?

@jprichardson

Copy link
Copy Markdown
Owner

Ya, I think this is good :) Sorry for the delayed response, I'll take care
of this within a week.

On Sun, Oct 12, 2014 at 7:50 AM, Azharul Islam notifications@github.com
wrote:

@jprichardson https://github.com/jprichardson any thoughts ?

—
Reply to this email directly or view it on GitHub
#117 (comment)
.

Simple & Secure Bitcoin Wallet: https://www.coinbolt.com
Bitcoin / JavaScript: http://cryptocoinjs.com
Follow me on Twitter: http://twitter.com/jprichardson

@jprichardson

Copy link
Copy Markdown
Owner

Actually, I'm not so sure about this one. What is the default behavior in lodash or underscore? I think that it should follow those libraries as much as possible as those will be the expected behavior.

@az7arul

az7arul commented Oct 15, 2014

Copy link
Copy Markdown
Collaborator Author

underscore/lodash interpolate have the same behaviour.

var compiled = _.template("hello: <%= name %>");
compiled({});
=> "hello: "

They also have the capability of executing javascript and escaping HTML ( I can work on adding them here as well if thats in the vision.)

@jprichardson

Copy link
Copy Markdown
Owner

OK, sounds good. Could you resubmit this PR with the new master? (I can't automerge)

@az7arul
az7arul force-pushed the template-replace-non-existant-key branch from cbfa139 to b179720 Compare October 20, 2014 10:41
@az7arul

az7arul commented Oct 20, 2014

Copy link
Copy Markdown
Collaborator Author

@jprichardson done

jprichardson added a commit that referenced this pull request Oct 20, 2014
.template method will replace keys that do not exist with empty string
@jprichardson
jprichardson merged commit 5de7ec1 into jprichardson:master Oct 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants