Thursday, 18 May 2017

sort or shuffle list during pug iteration?

I am trying to perform array operations such as concat, shuffle, and sort during pug iteration.

from pug documentation, this is possible:

ul
  each val in [1, 2, 3, 4, 5]
    li= val

But what about something like:

ul
  each val in sort(list_obj1 + list_obj2) // i would also like to shuffle a list here...
    li= val

In my case, list_obj1 and list_obj2 are sent from a node js server. I know I can compute the sorted concatenated list on the server side. But for various implementation reasons I need it to be computed client-side.

How can I accomplish this? Also, Is it possible use underscore for the array operations?



via A.D

No comments:

Post a Comment