-
Is there a Mustache / Handlebars way of looping through an object properties?
So with
var o = { bob : 'For sure' roger: 'Unknown', donkey: 'What an ass' }
Can I then do something in the template engine that would be equivalent to
…for(var prop in o) { //
-
Since 1.0.6, looping in two dimensional arrays using #each is broken #278
naholyr posted onI was using
#each
to browse an array of arrays (i.e.[[1, 2],[3,4]]
).With this kind of template for example:
<table> {{#each rows}} <tr> {{#each .}}<td>{{.}}</td>{{/each}} </tr> {{/each}} </table>
Quite classical, and I find
#each
more explanatory than#.
in this case, that's why I use it.It suddenly broke itself when updating today (from 1.0.5beta to 1.0.6).
Sample code:
var handlebars = require('handlebars') // Using each var each = handlebars.compile('{{#each arrays}} [ {{#each .}} ( {{.}} ) {{/each}} ] {{/each}}') // Using implicit loops var loop = handlebars.compile('{{#each arrays}} [ {{#.}} ( {{.}} ) {{/.}} ] {{/each}}') // In 1.0.5beta each({arrays:[[1, 2, 3], [4, 5, 6], [7, 8, 9]]}) === ' [ ( 1 ) ( 2 ) ( 3 ) ] [ ( 4 ) ( 5 ) ( 6 ) ] [ ( 7 ) ( 8 ) ( 9 ) ] ' loop({arrays:[[1, 2, 3], [4, 5, 6], [7, 8, 9]]}) === ' [ ( 1 ) ( 2 ) ( 3 ) ] [ ( 4 ) ( 5 ) ( 6 ) ] [ ( 7 ) ( 8 ) ( 9 ) ] ' // In 1.0.6 each({arrays:[[1, 2, 3], [4, 5, 6], [7, 8, 9]]}) === ' [ ] [ ] [ ] ' // DAFUQ ?? loop({arrays:[[1, 2, 3], [4, 5, 6], [7, 8, 9]]}) === ' [ ( 1 ) ( 2 ) ( 3 ) ] [ ( 4 ) ( 5 ) ( 6 ) ] [ ( 7 ) ( 8 ) ( 9 ) ] '
No PR attached sorry, no time to dig in the code right now
- nodejs xlsx module leading 0
I'm using npm i xlsx for reading xlsx file. so my questions here ... in my xlsx sheet i given Indian standard date (DD/MM/YYYY) like 24/09/2020 so it's giving same value... if I give 03/09/2020 it's giving number 43898 like this. set cellDates:true it's giving 2020-03-09T00:00:00.000Z so here date take…
Vuex - State Management
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)