Git Product home page Git Product logo

Comments (8)

ForbesLindesay avatar ForbesLindesay commented on June 8, 2024

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.

RobLoach avatar RobLoach commented on June 8, 2024

Saw that Tim implemented render() due to this deficiency in lodash's index.js .

from jstransformer.

ForbesLindesay avatar ForbesLindesay commented on June 8, 2024

I'm confused. This deficiency is the other way round. That render method definitely shouldn't be necessary

from jstransformer.

RobLoach avatar RobLoach commented on June 8, 2024

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.

TimothyGu avatar TimothyGu commented on June 8, 2024

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.

RobLoach avatar RobLoach commented on June 8, 2024

Huh? Don't think I ever touched lodash before…

Sorry, meant Tunnck. Busy day.

from jstransformer.

tunnckoCore avatar tunnckoCore commented on June 8, 2024

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.

RobLoach avatar RobLoach commented on June 8, 2024

#28

from jstransformer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.