Giter Club home page Giter Club logo

Comments (6)

appinsanity avatar appinsanity commented on September 5, 2024

`


  • ` Just my two cents, I have been avoiding any dot notation like the plague

    from plates.

    mwawrusch avatar mwawrusch commented on September 5, 2024

    Good point. One should treat . notation as a last resort.

    from plates.

    appinsanity avatar appinsanity commented on September 5, 2024

    Another issue that will arrise in some templates is the notion of a transformation of the data during the binding process, this ultimately winds up being a function call. For example:

    function fullName() { return this.firstName + ' ' + this.lastName; }

    I can't find my test case right now but it leverages the valueOf operator

    var person_prototype = {
        fullName: { valueOf: function() { return this.firstName + ' ' + this.lastName; } }
    }
    
    var person = {
        firstName: 'First',
        lastName: 'Last'
    }

    I prefer to keep this logic outside of the template if possible, this could also be extended so the function has access to the Lightweight DOM and then you have every single edge case nailed without any special template syntax.

    from plates.

    mwawrusch avatar mwawrusch commented on September 5, 2024

    Hmm. I think this should be done at the data level, not at the template level. It is probably equally fast to run over the data set and apply the function there before running it through plate.

    from plates.

    appinsanity avatar appinsanity commented on September 5, 2024

    I'm not a fan of touching the data, it could be cached and could also be in use by multiple templates, I do however like the idea of extension functions over the data, even if it's not really prototyped, this could just be a little magic behind the scenes.

    Will hack together a working example for data transformation and template nesting using the pseudo code posted on the nesting issue and see how it feels.

    from plates.

    indutny avatar indutny commented on September 5, 2024

    Dot-notation should work anyway (there was bug in a parser), fixed in e58a836 .

    Thanks

    from plates.

    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.