File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
6
6
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
7
7
8
+ ## [ 0.5.0] - 2022-05-20
9
+
10
+ ### Changed
11
+
12
+ - Used map instead of foreach/push in api.js file
13
+
8
14
## [ 0.5.0] - 2022-05-18
9
15
10
16
### Added
Original file line number Diff line number Diff line change @@ -184,16 +184,16 @@ const extractSortby = function (params) {
184
184
if ( sortby ) {
185
185
if ( typeof sortby === 'string' ) {
186
186
// GET request - different syntax
187
- sortbyRules = [ ]
188
187
const sortbys = sortby . split ( ',' )
189
- sortbys . forEach ( ( sortbyRule ) => {
188
+
189
+ sortbyRules = sortbys . map ( ( sortbyRule ) => {
190
190
if ( sortbyRule [ 0 ] === '-' ) {
191
- sortbyRules . push ( { field : sortbyRule . slice ( 1 ) , direction : 'desc' } )
192
- } else if ( sortbyRule [ 0 ] === '+' ) {
193
- sortbyRules . push ( { field : sortbyRule . slice ( 1 ) , direction : 'asc' } )
194
- } else {
195
- sortbyRules . push ( { field : sortbyRule , direction : 'asc' } )
191
+ return { field : sortbyRule . slice ( 1 ) , direction : 'desc' }
192
+ }
193
+ if ( sortbyRule [ 0 ] === '+' ) {
194
+ return { field : sortbyRule . slice ( 1 ) , direction : 'asc' }
196
195
}
196
+ return { field : sortbyRule , direction : 'asc' }
197
197
} )
198
198
} else {
199
199
// POST request
You can’t perform that action at this time.
0 commit comments