File tree Expand file tree Collapse file tree 5 files changed +8
-9
lines changed
Expand file tree Collapse file tree 5 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -119,8 +119,8 @@ function getStatus(st, response) {
119119 if ( ! ( st || response ) ) {
120120 return ;
121121 }
122- response = response || { } ;
123- response . status = response . status || st ;
122+ response ??= { } ;
123+ response . status ||= st ;
124124 // 401 Unauthorized, 429 Too Many Requests
125125 if ( st === 401 || st === 429 ) {
126126 // we exceeded the limit
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export default function init(options) {
4444 throw ERROR ;
4545 }
4646
47- query . path = query . path || pathType . none ;
47+ query . path ||= pathType . none ;
4848 let req = options . prepareRequest ( query ) ;
4949 if ( ! req ) {
5050 return ;
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ export default function init(options) {
130130 req . avoids = [ 'Limited Access' ] ;
131131 }
132132 if ( query . avoidTolls ) {
133- req . avoids = req . avoids || [ ] ;
133+ req . avoids ??= [ ] ;
134134 req . avoids . push ( 'Toll Road' ) ;
135135 }
136136 if ( query . begin ) {
Original file line number Diff line number Diff line change @@ -190,8 +190,8 @@ export default function init(options) {
190190 function avoidFeature ( result , flag ) {
191191 const { query, req } = result ;
192192 if ( query [ flag ] ) {
193- req . options = req . options || { } ;
194- req . options . avoid_features = req . options . avoid_features || [ ] ;
193+ req . options ??= { } ;
194+ req . options . avoid_features ??= [ ] ;
195195 req . options . avoid_features . push ( avoidFeatures [ flag ] ) ;
196196 }
197197 return result ;
Original file line number Diff line number Diff line change @@ -49,13 +49,12 @@ export function isFuture(time) {
4949}
5050
5151// like normal join but with optional filter fn
52- export function join ( arr , conn , fn ) {
53- fn = fn || ( it => it ) ;
52+ export function join ( arr , conn , fn = it => it ) {
5453 return arr . filter ( fn ) . join ( conn ) ;
5554}
5655
5756export function last ( arr ) {
58- return arr [ arr . length - 1 ] ;
57+ return arr . at ( - 1 ) ;
5958}
6059
6160export function split2object ( str , conn , obj ) {
You can’t perform that action at this time.
0 commit comments