@@ -6,7 +6,10 @@ import { CALENDAR_ID, ISO_YEAR, ISO_MONTH, ISO_DAY, CreateSlots, GetSlot, HasSlo
66
77const ArrayIncludes = Array . prototype . includes ;
88const ArrayPrototypePush = Array . prototype . push ;
9+ const MathAbs = Math . abs ;
10+ const MathFloor = Math . floor ;
911const ObjectAssign = Object . assign ;
12+ const ObjectEntries = Object . entries ;
1013
1114const impl = { } ;
1215
@@ -763,7 +766,7 @@ const nonIsoHelperBase = {
763766 } ,
764767 addMonthsCalendar ( calendarDate , months , overflow , cache ) {
765768 const { day } = calendarDate ;
766- for ( let i = 0 , absMonths = Math . abs ( months ) ; i < absMonths ; i ++ ) {
769+ for ( let i = 0 , absMonths = MathAbs ( months ) ; i < absMonths ; i ++ ) {
767770 const days = months < 0 ? - this . daysInPreviousMonth ( calendarDate , cache ) : this . daysInMonth ( calendarDate , cache ) ;
768771 const isoDate = this . calendarToIsoDate ( calendarDate , 'constrain' , cache ) ;
769772 const addedIso = this . addDaysIso ( isoDate , days , cache ) ;
@@ -970,7 +973,7 @@ const helperHebrew = ObjectAssign({}, nonIsoHelperBase, {
970973 minMaxMonthLength ( calendarDate , minOrMax ) {
971974 const { month, year } = calendarDate ;
972975 const monthCode = this . getMonthCode ( year , month ) ;
973- const monthInfo = Object . entries ( this . months ) . find ( ( m ) => m [ 1 ] . monthCode === monthCode ) ;
976+ const monthInfo = ObjectEntries ( this . months ) . find ( ( m ) => m [ 1 ] . monthCode === monthCode ) ;
974977 if ( monthInfo === undefined ) throw new RangeError ( `unmatched Hebrew month: ${ month } ` ) ;
975978 const daysInMonth = monthInfo [ 1 ] . days ;
976979 return typeof daysInMonth === 'number' ? daysInMonth : daysInMonth [ minOrMax ] ;
@@ -1096,7 +1099,7 @@ const helperIslamic = ObjectAssign({}, nonIsoHelperBase, {
10961099 constantEra : 'ah' ,
10971100 estimateIsoDate ( calendarDate ) {
10981101 const { year } = this . adjustCalendarDate ( calendarDate ) ;
1099- return { year : Math . floor ( ( year * this . DAYS_PER_ISLAMIC_YEAR ) / this . DAYS_PER_ISO_YEAR ) + 622 , month : 1 , day : 1 } ;
1102+ return { year : MathFloor ( ( year * this . DAYS_PER_ISLAMIC_YEAR ) / this . DAYS_PER_ISO_YEAR ) + 622 , month : 1 , day : 1 } ;
11001103 }
11011104} ) ;
11021105
@@ -1587,7 +1590,7 @@ const helperChinese = ObjectAssign({}, nonIsoHelperBase, {
15871590 calendarType : 'lunisolar' ,
15881591 inLeapYear ( calendarDate , cache ) {
15891592 const months = this . getMonthList ( calendarDate . year , cache ) ;
1590- return Object . entries ( months ) . length === 13 ;
1593+ return ObjectEntries ( months ) . length === 13 ;
15911594 } ,
15921595 monthsInYear ( calendarDate , cache ) {
15931596 return this . inLeapYear ( calendarDate , cache ) ? 13 : 12 ;
@@ -1723,7 +1726,7 @@ const helperChinese = ObjectAssign({}, nonIsoHelperBase, {
17231726 }
17241727 } else if ( monthCode === undefined ) {
17251728 const months = this . getMonthList ( year , cache ) ;
1726- const monthEntries = Object . entries ( months ) ;
1729+ const monthEntries = ObjectEntries ( months ) ;
17271730 const largestMonth = monthEntries . length ;
17281731 if ( overflow === 'reject' ) {
17291732 ES . RejectToRange ( month , 1 , largestMonth ) ;
0 commit comments