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

using dust.isArray in place of Array.isArray #241

Merged
merged 1 commit into from Feb 28, 2013
Merged

using dust.isArray in place of Array.isArray #241

merged 1 commit into from Feb 28, 2013

Conversation

jairodemorais
Copy link
Contributor

No description provided.

@paulogaspar7
Copy link

@jairodemorais, you sure know much better your way around this code than me. =:o)

Sorry for the delay but had to test it at the office, where I had Internet Explorer and the original use case.

It worked with no problems. I will now try closing my (#235) pull request (if I can) since this is a better replacement.

@jairodemorais
Copy link
Contributor Author

@paulogaspar7 thanks for testing it.

ASA my partners approve the change I will merge it.

@paulogaspar7
Copy link

Cool, thanks man!

@@ -1,4 +1,4 @@
(function(dust) {
var comp = (function(dust) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this variable "comp" mean? , why not use a more descriptive name, if it refers to the compiler version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The compiler function was executed immediately when you require ./compiler. this function receive the dust object as param. In the browser case, the dust object is obtained with the getGlobal function but in nodejs we don't have access to the dust object. So I have assigned the compiler function to a variable, comp, and if dust is being executed from browser I call it but if dust is being executed in node, I return the function, so the server can call it with the dust object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you prefer calling it compiler? I can change it easily.

Copy link
Contributor

Choose a reason for hiding this comment

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

one more q: is this only relevant to node? or anything that works with server side?
I assume that latter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just for node, because the server file is just included when exports and process are different from "undefined"

if (typeof exports !== "undefined") {
  if (typeof process !== "undefined") {
      require('./server')(dust);
  }
  module.exports = dust;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

why woud not it apply for rhino or nashhorn?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Exports is undefined in Rhino.

I don't know in Nashorn.

I didn't know that we were maintaining dust compatible with it.

vybs added a commit that referenced this pull request Feb 28, 2013
using dust.isArray in place of Array.isArray
@vybs vybs merged commit ac5a137 into linkedin:master Feb 28, 2013
@vybs
Copy link
Contributor

vybs commented Feb 28, 2013

can we rename it to dustCompiler instead of comp?

@jairodemorais
Copy link
Contributor Author

yes let me do it now.

@jairodemorais
Copy link
Contributor Author

I send a new PR with the name change.
#243

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.

None yet

3 participants