@@ -20,27 +20,27 @@ import { Temporal } from '..';
20
20
21
21
export class Duration implements Temporal . Duration {
22
22
constructor (
23
- years = 0 ,
24
- months = 0 ,
25
- weeks = 0 ,
26
- days = 0 ,
27
- hours = 0 ,
28
- minutes = 0 ,
29
- seconds = 0 ,
30
- milliseconds = 0 ,
31
- microseconds = 0 ,
32
- nanoseconds = 0
23
+ yearsParam = 0 ,
24
+ monthsParam = 0 ,
25
+ weeksParam = 0 ,
26
+ daysParam = 0 ,
27
+ hoursParam = 0 ,
28
+ minutesParam = 0 ,
29
+ secondsParam = 0 ,
30
+ millisecondsParam = 0 ,
31
+ microsecondsParam = 0 ,
32
+ nanosecondsParam = 0
33
33
) {
34
- years = ES . ToIntegerThrowOnInfinity ( years ) ;
35
- months = ES . ToIntegerThrowOnInfinity ( months ) ;
36
- weeks = ES . ToIntegerThrowOnInfinity ( weeks ) ;
37
- days = ES . ToIntegerThrowOnInfinity ( days ) ;
38
- hours = ES . ToIntegerThrowOnInfinity ( hours ) ;
39
- minutes = ES . ToIntegerThrowOnInfinity ( minutes ) ;
40
- seconds = ES . ToIntegerThrowOnInfinity ( seconds ) ;
41
- milliseconds = ES . ToIntegerThrowOnInfinity ( milliseconds ) ;
42
- microseconds = ES . ToIntegerThrowOnInfinity ( microseconds ) ;
43
- nanoseconds = ES . ToIntegerThrowOnInfinity ( nanoseconds ) ;
34
+ const years = ES . ToIntegerThrowOnInfinity ( yearsParam ) ;
35
+ const months = ES . ToIntegerThrowOnInfinity ( monthsParam ) ;
36
+ const weeks = ES . ToIntegerThrowOnInfinity ( weeksParam ) ;
37
+ const days = ES . ToIntegerThrowOnInfinity ( daysParam ) ;
38
+ const hours = ES . ToIntegerThrowOnInfinity ( hoursParam ) ;
39
+ const minutes = ES . ToIntegerThrowOnInfinity ( minutesParam ) ;
40
+ const seconds = ES . ToIntegerThrowOnInfinity ( secondsParam ) ;
41
+ const milliseconds = ES . ToIntegerThrowOnInfinity ( millisecondsParam ) ;
42
+ const microseconds = ES . ToIntegerThrowOnInfinity ( microsecondsParam ) ;
43
+ const nanoseconds = ES . ToIntegerThrowOnInfinity ( nanosecondsParam ) ;
44
44
45
45
const sign = ES . DurationSign (
46
46
years ,
@@ -203,11 +203,11 @@ export class Duration implements Temporal.Duration {
203
203
Math . abs ( GetSlot ( this , NANOSECONDS ) )
204
204
) ;
205
205
}
206
- add ( other , options = undefined ) {
206
+ add ( other , optionsParam = undefined ) {
207
207
if ( ! ES . IsTemporalDuration ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
208
208
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
209
209
ES . ToLimitedTemporalDuration ( other ) ;
210
- options = ES . GetOptionsObject ( options ) ;
210
+ const options = ES . GetOptionsObject ( optionsParam ) ;
211
211
const relativeTo = ES . ToRelativeTemporalObject ( options ) ;
212
212
( { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES . AddDuration (
213
213
GetSlot ( this , YEARS ) ,
@@ -234,11 +234,11 @@ export class Duration implements Temporal.Duration {
234
234
) ) ;
235
235
return new Duration ( years , months , weeks , days , hours , minutes , seconds , milliseconds , microseconds , nanoseconds ) ;
236
236
}
237
- subtract ( other , options = undefined ) {
237
+ subtract ( other , optionsParam = undefined ) {
238
238
if ( ! ES . IsTemporalDuration ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
239
239
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
240
240
ES . ToLimitedTemporalDuration ( other ) ;
241
- options = ES . GetOptionsObject ( options ) ;
241
+ const options = ES . GetOptionsObject ( optionsParam ) ;
242
242
const relativeTo = ES . ToRelativeTemporalObject ( options ) ;
243
243
( { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES . AddDuration (
244
244
GetSlot ( this , YEARS ) ,
@@ -265,9 +265,9 @@ export class Duration implements Temporal.Duration {
265
265
) ) ;
266
266
return new Duration ( years , months , weeks , days , hours , minutes , seconds , milliseconds , microseconds , nanoseconds ) ;
267
267
}
268
- round ( options ) {
268
+ round ( optionsParam ) {
269
269
if ( ! ES . IsTemporalDuration ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
270
- if ( options === undefined ) throw new TypeError ( 'options parameter is required' ) ;
270
+ if ( optionsParam === undefined ) throw new TypeError ( 'options parameter is required' ) ;
271
271
let years = GetSlot ( this , YEARS ) ;
272
272
let months = GetSlot ( this , MONTHS ) ;
273
273
let weeks = GetSlot ( this , WEEKS ) ;
@@ -291,7 +291,7 @@ export class Duration implements Temporal.Duration {
291
291
microseconds ,
292
292
nanoseconds
293
293
) ;
294
- options = ES . GetOptionsObject ( options ) ;
294
+ const options = ES . GetOptionsObject ( optionsParam ) ;
295
295
let smallestUnit = ES . ToSmallestTemporalUnit ( options , undefined ) ;
296
296
let smallestUnitPresent = true ;
297
297
if ( ! smallestUnit ) {
@@ -374,7 +374,7 @@ export class Duration implements Temporal.Duration {
374
374
375
375
return new Duration ( years , months , weeks , days , hours , minutes , seconds , milliseconds , microseconds , nanoseconds ) ;
376
376
}
377
- total ( options ) {
377
+ total ( optionsParam ) {
378
378
if ( ! ES . IsTemporalDuration ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
379
379
let years = GetSlot ( this , YEARS ) ;
380
380
let months = GetSlot ( this , MONTHS ) ;
@@ -387,8 +387,8 @@ export class Duration implements Temporal.Duration {
387
387
let microseconds = GetSlot ( this , MICROSECONDS ) ;
388
388
let nanoseconds = GetSlot ( this , NANOSECONDS ) ;
389
389
390
- if ( options === undefined ) throw new TypeError ( 'options argument is required' ) ;
391
- options = ES . GetOptionsObject ( options ) ;
390
+ if ( optionsParam === undefined ) throw new TypeError ( 'options argument is required' ) ;
391
+ const options = ES . GetOptionsObject ( optionsParam ) ;
392
392
const unit = ES . ToTemporalDurationTotalUnit ( options ) ;
393
393
if ( unit === undefined ) throw new RangeError ( 'unit option is required' ) ;
394
394
const relativeTo = ES . ToRelativeTemporalObject ( options ) ;
@@ -430,9 +430,9 @@ export class Duration implements Temporal.Duration {
430
430
) ;
431
431
return total ;
432
432
}
433
- toString ( options = undefined ) {
433
+ toString ( optionsParam = undefined ) {
434
434
if ( ! ES . IsTemporalDuration ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
435
- options = ES . GetOptionsObject ( options ) ;
435
+ const options = ES . GetOptionsObject ( optionsParam ) ;
436
436
const { precision, unit, increment } = ES . ToSecondsStringPrecision ( options ) ;
437
437
if ( precision === 'minute' ) throw new RangeError ( 'smallestUnit must not be "minute"' ) ;
438
438
const roundingMode = ES . ToTemporalRoundingMode ( options , 'trunc' ) ;
@@ -470,10 +470,10 @@ export class Duration implements Temporal.Duration {
470
470
}
471
471
return ES . ToTemporalDuration ( item ) ;
472
472
}
473
- static compare ( one , two , options = undefined ) {
474
- one = ES . ToTemporalDuration ( one ) ;
475
- two = ES . ToTemporalDuration ( two ) ;
476
- options = ES . GetOptionsObject ( options ) ;
473
+ static compare ( oneParam , twoParam , optionsParam = undefined ) {
474
+ const one = ES . ToTemporalDuration ( oneParam ) ;
475
+ const two = ES . ToTemporalDuration ( twoParam ) ;
476
+ const options = ES . GetOptionsObject ( optionsParam ) ;
477
477
const relativeTo = ES . ToRelativeTemporalObject ( options ) ;
478
478
const y1 = GetSlot ( one , YEARS ) ;
479
479
const mon1 = GetSlot ( one , MONTHS ) ;
0 commit comments