File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : _
22version : ~
33title : fuquery
4+ index : 0
5+ extra :
6+ index : 1
47nav :
58- modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ module . exports = ( collection , field = 'name' ) => {
4+ if ( ! collection ) return [ ]
5+
6+ let arr = [ ]
7+
8+ if ( Array . isArray ( collection ) ) {
9+ arr = collection . slice ( )
10+ } else if ( typeof collection === 'object' ) {
11+ arr = Object . keys ( collection ) . map ( key => collection [ key ] )
12+ } else {
13+ return [ ]
14+ }
15+
16+ arr . sort ( ( a , b ) => {
17+ const va = ( a [ field ] || '' ) . toString ( ) . toLowerCase ( )
18+ const vb = ( b [ field ] || '' ) . toString ( ) . toLowerCase ( )
19+ return va < vb ? - 1 : va > vb ? 1 : 0
20+ } )
21+
22+ return arr
23+ }
Original file line number Diff line number Diff line change 66 </div >
77 {{ /if }}
88 <ul class =" components" >
9- {{ #each site.components }}
9+ {{ #each ( sort-by site.components ' name ' ) }}
1010 <li class =" component{{ #if (eq this @root.page.component )}} is-current{{ /if }} " >
1111 <div class =" title" ><a href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a ></div >
1212 {{ #if (or ./versions .[1 ] ./versions .[0 ].version (ne ./versions .[0 ].displayVersion ' default' ))}}
You can’t perform that action at this time.
0 commit comments