Comments (8)
Interesting idea. Probably worth it but I initially didn't do it because I had some debate as to whether to do:
if (this.can('render')) {
var _this = this;
return tr.normalizeFn(function (locals) {
return _this.render(str, options, locals).body;
});
}
or
if (this.can('render')) {
var result = this.render(str, options).body;
return tr.normalizeFn(function (locals) {
return result;
});
}
I think you're probably right that the first option is better though.
P.S. we should also use the same techniques to extend compileFile, compileAsync and compileFileAsync.
from jstransformer.
Saw that Tim implemented render() due to this deficiency in lodash's index.js .
from jstransformer.
I'm confused. This deficiency is the other way round. That render method definitely shouldn't be necessary
from jstransformer.
I'm confused. This deficiency is the other way round. That render method definitely shouldn't be necessary
Seems it is the other way around. Must have been thinking of something else. Either that, or it's one case where I found it weird to have both, and then saw why having both seemed like a good idea.
Either way, building .compile() seems like something JSTransformer should do when .render() is available.
from jstransformer.
The point of a compile()
function is that we can cache the function. This doesn't achieve that, but is the best thing to do when we want to ensure all jstransformers have a uniform API, so a +1 from me.
@RobLoach said:
Saw that Tim implemented render() due to this deficiency in lodash's index.js.
Huh? Don't think I ever touched lodash before…
from jstransformer.
Huh? Don't think I ever touched lodash before…
Sorry, meant Tunnck. Busy day.
from jstransformer.
the best thing to do when we want to ensure all jstransformers have a uniform API, so a +1 from me.
and et al 👍
from jstransformer.
from jstransformer.
Related Issues (20)
- jsx-template
- Mermaid: Data Flow Diagrams
- Polished CSS
- Ibra
- markdown-in-js
- thysultan/jsx.js - small and extensible transpiler HOT 1
- Switch to npm organization HOT 2
- Support sync rendering even of async transforms
- Emoji
- jQuery View Engine
- blockml HOT 1
- Typescript/JavaScript to C
- imagemin
- lit-html
- Mark
- trademark/copyright issue on logo HOT 3
- Prepack
- renderAsync can throw synchronously, should return a rejected promise instead? HOT 1
- Slack Group? HOT 3
- An in-range update of is-promise is breaking the build 🚨 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jstransformer.