Function
sortPluginList
(plugins:PackageData[], property:string, /* ASC?*/dir:string)
Source from the content-addressed store, hash-verified
| 148 | * @return {Object[]} |
| 149 | */ |
| 150 | const sortPluginList = (plugins:PackageData[], property:string, /* ASC?*/dir:string): PackageData[] => plugins.sort((a, b) => { |
| 151 | // @ts-ignore |
| 152 | if (a[property] < b[property]) { |
| 153 | return dir ? -1 : 1; |
| 154 | } |
| 155 | |
| 156 | // @ts-ignore |
| 157 | if (a[property] > b[property]) { |
| 158 | return dir ? 1 : -1; |
| 159 | } |
| 160 | |
| 161 | // a must be equal to b |
| 162 | return 0; |
| 163 | }); |
Tested by
no test coverage detected