javascript-time-ago 2.5.11 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/README.md +410 -272
- package/bundle/javascript-time-ago.js +1 -1
- package/bundle/javascript-time-ago.js.map +1 -1
- package/bundle/javascript-time-ago.min.js +1 -1
- package/bundle/javascript-time-ago.min.js.map +1 -1
- package/commonjs/FullDateFormatter.js +72 -0
- package/commonjs/FullDateFormatter.js.map +1 -0
- package/commonjs/FullDateFormatter.test.js +26 -0
- package/commonjs/FullDateFormatter.test.js.map +1 -0
- package/commonjs/LocaleDataStore.js +2 -5
- package/commonjs/LocaleDataStore.js.map +1 -1
- package/commonjs/PropTypes.js +12 -12
- package/commonjs/PropTypes.js.map +1 -1
- package/commonjs/TimeAgo.js +300 -253
- package/commonjs/TimeAgo.js.map +1 -1
- package/commonjs/TimeAgo.test.js +214 -135
- package/commonjs/TimeAgo.test.js.map +1 -1
- package/commonjs/cache.js +7 -25
- package/commonjs/cache.js.map +1 -1
- package/commonjs/cache.test.js +1 -3
- package/commonjs/cache.test.js.map +1 -1
- package/commonjs/isStyleObject.js +9 -9
- package/commonjs/isStyleObject.js.map +1 -1
- package/commonjs/isStyleObject.test.js +1 -3
- package/commonjs/isStyleObject.test.js.map +1 -1
- package/commonjs/locale.js +6 -19
- package/commonjs/locale.js.map +1 -1
- package/commonjs/locale.test.js +2 -11
- package/commonjs/locale.test.js.map +1 -1
- package/commonjs/round.js +2 -5
- package/commonjs/round.js.map +1 -1
- package/commonjs/steps/approximate.js +1 -4
- package/commonjs/steps/approximate.js.map +1 -1
- package/commonjs/steps/approximate.test.js +1 -6
- package/commonjs/steps/approximate.test.js.map +1 -1
- package/commonjs/steps/getStep.js +36 -53
- package/commonjs/steps/getStep.js.map +1 -1
- package/commonjs/steps/getStep.test.js +7 -7
- package/commonjs/steps/getStep.test.js.map +1 -1
- package/commonjs/steps/getStepDenominator.js +2 -5
- package/commonjs/steps/getStepDenominator.js.map +1 -1
- package/commonjs/steps/getStepDenominator.test.js +1 -3
- package/commonjs/steps/getStepDenominator.test.js.map +1 -1
- package/commonjs/steps/getStepMinTime.js +31 -39
- package/commonjs/steps/getStepMinTime.js.map +1 -1
- package/commonjs/steps/getStepMinTime.test.js +1 -3
- package/commonjs/steps/getStepMinTime.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.js +27 -41
- package/commonjs/steps/getTimeToNextUpdate.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.test.js +29 -25
- package/commonjs/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.js +3 -12
- package/commonjs/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js +1 -7
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/commonjs/steps/helpers.js +1 -2
- package/commonjs/steps/helpers.js.map +1 -1
- package/commonjs/steps/helpers.test.js +0 -1
- package/commonjs/steps/helpers.test.js.map +1 -1
- package/commonjs/steps/index.js +1 -6
- package/commonjs/steps/index.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.js +6 -14
- package/commonjs/steps/renameLegacyProperties.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.test.js +1 -3
- package/commonjs/steps/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/steps/round.js +1 -2
- package/commonjs/steps/round.js.map +1 -1
- package/commonjs/steps/round.test.js +1 -7
- package/commonjs/steps/round.test.js.map +1 -1
- package/commonjs/steps/units.js +10 -21
- package/commonjs/steps/units.js.map +1 -1
- package/commonjs/style/approximate.js +2 -6
- package/commonjs/style/approximate.js.map +1 -1
- package/commonjs/style/approximateTime.js +2 -6
- package/commonjs/style/approximateTime.js.map +1 -1
- package/commonjs/style/approximateTime.test.js +116 -75
- package/commonjs/style/approximateTime.test.js.map +1 -1
- package/commonjs/style/getStyleByName.js +3 -29
- package/commonjs/style/getStyleByName.js.map +1 -1
- package/commonjs/style/mini.js +9 -6
- package/commonjs/style/mini.js.map +1 -1
- package/commonjs/style/mini.test.js +15 -25
- package/commonjs/style/mini.test.js.map +1 -1
- package/commonjs/style/miniMinute.js +8 -13
- package/commonjs/style/miniMinute.js.map +1 -1
- package/commonjs/style/miniMinute.test.js +11 -17
- package/commonjs/style/miniMinute.test.js.map +1 -1
- package/commonjs/style/miniMinuteNow.js +8 -13
- package/commonjs/style/miniMinuteNow.js.map +1 -1
- package/commonjs/style/miniMinuteNow.test.js +11 -17
- package/commonjs/style/miniMinuteNow.test.js.map +1 -1
- package/commonjs/style/miniNow.js +8 -13
- package/commonjs/style/miniNow.js.map +1 -1
- package/commonjs/style/miniNow.test.js +11 -17
- package/commonjs/style/miniNow.test.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.js +7 -13
- package/commonjs/style/renameLegacyProperties.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.test.js +1 -4
- package/commonjs/style/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/style/round.js +2 -6
- package/commonjs/style/round.js.map +1 -1
- package/commonjs/style/round.test.js +51 -67
- package/commonjs/style/round.test.js.map +1 -1
- package/commonjs/style/roundMinute.js +8 -13
- package/commonjs/style/roundMinute.js.map +1 -1
- package/commonjs/style/roundMinute.test.js +20 -27
- package/commonjs/style/roundMinute.test.js.map +1 -1
- package/commonjs/style/twitter.js +34 -39
- package/commonjs/style/twitter.js.map +1 -1
- package/commonjs/style/twitter.test.js +54 -57
- package/commonjs/style/twitter.test.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.js +10 -15
- package/commonjs/style/twitterFirstMinute.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.test.js +16 -23
- package/commonjs/style/twitterFirstMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinute.js +8 -13
- package/commonjs/style/twitterMinute.js.map +1 -1
- package/commonjs/style/twitterMinute.test.js +20 -25
- package/commonjs/style/twitterMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.js +8 -13
- package/commonjs/style/twitterMinuteNow.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.test.js +20 -25
- package/commonjs/style/twitterMinuteNow.test.js.map +1 -1
- package/commonjs/style/twitterNow.js +8 -13
- package/commonjs/style/twitterNow.js.map +1 -1
- package/commonjs/style/twitterNow.test.js +18 -24
- package/commonjs/style/twitterNow.test.js.map +1 -1
- package/full-date-formatter/index.cjs +4 -0
- package/full-date-formatter/index.cjs.js +9 -0
- package/full-date-formatter/index.d.ts +6 -0
- package/full-date-formatter/index.js +1 -0
- package/full-date-formatter/package.json +15 -0
- package/index.cjs +1 -1
- package/index.cjs.js +2 -2
- package/index.d.ts +14 -4
- package/index.js +3 -1
- package/load-all-locales/index.cjs +32 -0
- package/load-all-locales/index.cjs.js +32 -0
- package/load-all-locales/index.js +64 -0
- package/locale/ak/package.json +16 -0
- package/locale/ak.json +267 -0
- package/locale/ak.json.d.ts +4 -0
- package/locale/ak.json.js +267 -0
- package/locale/bal-Latn/package.json +16 -0
- package/locale/bal-Latn.json +240 -0
- package/locale/bal-Latn.json.d.ts +4 -0
- package/locale/bal-Latn.json.js +240 -0
- package/locale/be-tarask/package.json +16 -0
- package/locale/be-tarask.json +259 -0
- package/locale/be-tarask.json.d.ts +4 -0
- package/locale/be-tarask.json.js +259 -0
- package/locale/blo/package.json +16 -0
- package/locale/blo.json +159 -0
- package/locale/blo.json.d.ts +4 -0
- package/locale/blo.json.js +159 -0
- package/locale/bn.json +5 -2
- package/locale/bn.json.js +5 -2
- package/locale/bs.json +8 -2
- package/locale/bs.json.js +8 -2
- package/locale/ccp.json +2 -8
- package/locale/ccp.json.js +2 -8
- package/locale/csw/package.json +16 -0
- package/locale/csw.json +180 -0
- package/locale/csw.json.d.ts +4 -0
- package/locale/csw.json.js +180 -0
- package/locale/cy.json +6 -12
- package/locale/cy.json.js +6 -12
- package/locale/doi/package.json +16 -0
- package/locale/doi.json +159 -0
- package/locale/doi.json.d.ts +4 -0
- package/locale/doi.json.js +159 -0
- package/locale/en-AU.json +12 -12
- package/locale/en-AU.json.js +12 -12
- package/locale/en-CZ/package.json +16 -0
- package/locale/en-CZ.json +219 -0
- package/locale/en-CZ.json.d.ts +4 -0
- package/locale/en-CZ.json.js +219 -0
- package/locale/en-ES/package.json +16 -0
- package/locale/en-ES.json +219 -0
- package/locale/en-ES.json.d.ts +4 -0
- package/locale/en-ES.json.js +219 -0
- package/locale/en-FR/package.json +16 -0
- package/locale/en-FR.json +219 -0
- package/locale/en-FR.json.d.ts +4 -0
- package/locale/en-FR.json.js +219 -0
- package/locale/en-GS/package.json +16 -0
- package/locale/en-GS.json +219 -0
- package/locale/en-GS.json.d.ts +4 -0
- package/locale/en-GS.json.js +219 -0
- package/locale/en-HU/package.json +16 -0
- package/locale/en-HU.json +219 -0
- package/locale/en-HU.json.d.ts +4 -0
- package/locale/en-HU.json.js +219 -0
- package/locale/en-ID/package.json +16 -0
- package/locale/en-ID.json +219 -0
- package/locale/en-ID.json.d.ts +4 -0
- package/locale/en-ID.json.js +219 -0
- package/locale/en-IT/package.json +16 -0
- package/locale/en-IT.json +219 -0
- package/locale/en-IT.json.d.ts +4 -0
- package/locale/en-IT.json.js +219 -0
- package/locale/en-NO/package.json +16 -0
- package/locale/en-NO.json +219 -0
- package/locale/en-NO.json.d.ts +4 -0
- package/locale/en-NO.json.js +219 -0
- package/locale/en-PL/package.json +16 -0
- package/locale/en-PL.json +219 -0
- package/locale/en-PL.json.d.ts +4 -0
- package/locale/en-PL.json.js +219 -0
- package/locale/en-PT/package.json +16 -0
- package/locale/en-PT.json +219 -0
- package/locale/en-PT.json.d.ts +4 -0
- package/locale/en-PT.json.js +219 -0
- package/locale/en-RO/package.json +16 -0
- package/locale/en-RO.json +219 -0
- package/locale/en-RO.json.d.ts +4 -0
- package/locale/en-RO.json.js +219 -0
- package/locale/en-SK/package.json +16 -0
- package/locale/en-SK.json +219 -0
- package/locale/en-SK.json.d.ts +4 -0
- package/locale/en-SK.json.js +219 -0
- package/locale/es-MX.json +12 -9
- package/locale/es-MX.json.js +12 -9
- package/locale/es-SV.json +2 -2
- package/locale/es-SV.json.js +2 -2
- package/locale/eu.json +24 -24
- package/locale/eu.json.js +24 -24
- package/locale/ha.json +119 -65
- package/locale/ha.json.js +119 -65
- package/locale/he.json +0 -6
- package/locale/he.json.js +0 -6
- package/locale/hi-Latn.json +2 -2
- package/locale/hi-Latn.json.js +2 -2
- package/locale/ht/package.json +16 -0
- package/locale/ht.json +207 -0
- package/locale/ht.json.d.ts +4 -0
- package/locale/ht.json.js +207 -0
- package/locale/id.json +1 -1
- package/locale/id.json.js +1 -1
- package/locale/ie/package.json +16 -0
- package/locale/ie.json +159 -0
- package/locale/ie.json.d.ts +4 -0
- package/locale/ie.json.js +159 -0
- package/locale/ig.json +17 -17
- package/locale/ig.json.js +17 -17
- package/locale/ii/package.json +16 -0
- package/locale/ii.json +165 -0
- package/locale/ii.json.d.ts +4 -0
- package/locale/ii.json.js +165 -0
- package/locale/is.json +4 -1
- package/locale/is.json.js +4 -1
- package/locale/kaa/package.json +16 -0
- package/locale/kaa.json +159 -0
- package/locale/kaa.json.d.ts +4 -0
- package/locale/kaa.json.js +159 -0
- package/locale/kok-Latn/package.json +16 -0
- package/locale/kok-Latn.json +159 -0
- package/locale/kok-Latn.json.d.ts +4 -0
- package/locale/kok-Latn.json.js +159 -0
- package/locale/kok.json +8 -8
- package/locale/kok.json.js +8 -8
- package/locale/ks.json +9 -9
- package/locale/ks.json.js +9 -9
- package/locale/ku.json +55 -46
- package/locale/ku.json.js +55 -46
- package/locale/lld/package.json +16 -0
- package/locale/lld.json +291 -0
- package/locale/lld.json.d.ts +4 -0
- package/locale/lld.json.js +291 -0
- package/locale/mi.json +22 -22
- package/locale/mi.json.js +22 -22
- package/locale/ms-Arab/package.json +16 -0
- package/locale/ms-Arab.json +159 -0
- package/locale/ms-Arab.json.d.ts +4 -0
- package/locale/ms-Arab.json.js +159 -0
- package/locale/nb.json +2 -2
- package/locale/nb.json.js +2 -2
- package/locale/ne.json +1 -1
- package/locale/ne.json.js +1 -1
- package/locale/nn.json +4 -4
- package/locale/nn.json.js +4 -4
- package/locale/no.json +2 -2
- package/locale/no.json.js +2 -2
- package/locale/nqo/package.json +16 -0
- package/locale/nqo.json +159 -0
- package/locale/nqo.json.d.ts +4 -0
- package/locale/nqo.json.js +159 -0
- package/locale/om/package.json +16 -0
- package/locale/om.json +213 -0
- package/locale/om.json.d.ts +4 -0
- package/locale/om.json.js +213 -0
- package/locale/or.json +1 -1
- package/locale/or.json.js +1 -1
- package/locale/qu.json +46 -46
- package/locale/qu.json.js +46 -46
- package/locale/rhg/package.json +16 -0
- package/locale/rhg.json +159 -0
- package/locale/rhg.json.d.ts +4 -0
- package/locale/rhg.json.js +159 -0
- package/locale/sl.json +12 -12
- package/locale/sl.json.js +12 -12
- package/locale/sr-Cyrl-BA.json +2 -2
- package/locale/sr-Cyrl-BA.json.js +2 -2
- package/locale/sr-Latn-BA.json +2 -2
- package/locale/sr-Latn-BA.json.js +2 -2
- package/locale/sv.json +1 -1
- package/locale/sv.json.js +1 -1
- package/locale/syr/package.json +16 -0
- package/locale/syr.json +303 -0
- package/locale/syr.json.d.ts +4 -0
- package/locale/syr.json.js +303 -0
- package/locale/ti.json +6 -6
- package/locale/ti.json.js +6 -6
- package/locale/tn/package.json +16 -0
- package/locale/tn.json +159 -0
- package/locale/tn.json.d.ts +4 -0
- package/locale/tn.json.js +159 -0
- package/locale/to.json +26 -26
- package/locale/to.json.js +26 -26
- package/locale/uk.json +1 -1
- package/locale/uk.json.js +1 -1
- package/locale/ur-IN.json +9 -6
- package/locale/ur-IN.json.js +9 -6
- package/locale/vec/package.json +16 -0
- package/locale/vec.json +267 -0
- package/locale/vec.json.d.ts +4 -0
- package/locale/vec.json.js +267 -0
- package/locale/xnr/package.json +16 -0
- package/locale/xnr.json +159 -0
- package/locale/xnr.json.d.ts +4 -0
- package/locale/xnr.json.js +159 -0
- package/locale/yo-BJ.json +17 -17
- package/locale/yo-BJ.json.js +17 -17
- package/locale/yo.json +17 -17
- package/locale/yo.json.js +17 -17
- package/modules/FullDateFormatter.js +67 -0
- package/modules/FullDateFormatter.js.map +1 -0
- package/modules/FullDateFormatter.test.js +22 -0
- package/modules/FullDateFormatter.test.js.map +1 -0
- package/modules/LocaleDataStore.js +2 -3
- package/modules/LocaleDataStore.js.map +1 -1
- package/modules/PropTypes.js +11 -7
- package/modules/PropTypes.js.map +1 -1
- package/modules/TimeAgo.js +299 -237
- package/modules/TimeAgo.js.map +1 -1
- package/modules/TimeAgo.test.js +217 -119
- package/modules/TimeAgo.test.js.map +1 -1
- package/modules/cache.js +6 -22
- package/modules/cache.js.map +1 -1
- package/modules/cache.test.js.map +1 -1
- package/modules/isStyleObject.js +9 -7
- package/modules/isStyleObject.js.map +1 -1
- package/modules/isStyleObject.test.js.map +1 -1
- package/modules/locale.js +6 -16
- package/modules/locale.js.map +1 -1
- package/modules/locale.test.js +0 -4
- package/modules/locale.test.js.map +1 -1
- package/modules/round.js +2 -3
- package/modules/round.js.map +1 -1
- package/modules/steps/approximate.js +6 -2
- package/modules/steps/approximate.js.map +1 -1
- package/modules/steps/approximate.test.js +0 -2
- package/modules/steps/approximate.test.js.map +1 -1
- package/modules/steps/getStep.js +36 -48
- package/modules/steps/getStep.js.map +1 -1
- package/modules/steps/getStep.test.js +6 -2
- package/modules/steps/getStep.test.js.map +1 -1
- package/modules/steps/getStepDenominator.js +2 -3
- package/modules/steps/getStepDenominator.js.map +1 -1
- package/modules/steps/getStepDenominator.test.js.map +1 -1
- package/modules/steps/getStepMinTime.js +31 -36
- package/modules/steps/getStepMinTime.js.map +1 -1
- package/modules/steps/getStepMinTime.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.js +28 -32
- package/modules/steps/getTimeToNextUpdate.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.test.js +27 -18
- package/modules/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.js +4 -10
- package/modules/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.test.js +0 -4
- package/modules/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/modules/steps/helpers.js +1 -1
- package/modules/steps/helpers.js.map +1 -1
- package/modules/steps/helpers.test.js.map +1 -1
- package/modules/steps/index.js +2 -1
- package/modules/steps/index.js.map +1 -1
- package/modules/steps/renameLegacyProperties.js +6 -13
- package/modules/steps/renameLegacyProperties.js.map +1 -1
- package/modules/steps/renameLegacyProperties.test.js.map +1 -1
- package/modules/steps/round.js.map +1 -1
- package/modules/steps/round.test.js +0 -3
- package/modules/steps/round.test.js.map +1 -1
- package/modules/steps/units.js +5 -9
- package/modules/steps/units.js.map +1 -1
- package/modules/style/approximate.js +5 -1
- package/modules/style/approximate.js.map +1 -1
- package/modules/style/approximateTime.js +6 -2
- package/modules/style/approximateTime.js.map +1 -1
- package/modules/style/approximateTime.test.js +115 -70
- package/modules/style/approximateTime.test.js.map +1 -1
- package/modules/style/getStyleByName.js +4 -17
- package/modules/style/getStyleByName.js.map +1 -1
- package/modules/style/mini.js +8 -4
- package/modules/style/mini.js.map +1 -1
- package/modules/style/mini.test.js +14 -20
- package/modules/style/mini.test.js.map +1 -1
- package/modules/style/miniMinute.js +6 -6
- package/modules/style/miniMinute.js.map +1 -1
- package/modules/style/miniMinute.test.js +10 -12
- package/modules/style/miniMinute.test.js.map +1 -1
- package/modules/style/miniMinuteNow.js +6 -6
- package/modules/style/miniMinuteNow.js.map +1 -1
- package/modules/style/miniMinuteNow.test.js +10 -12
- package/modules/style/miniMinuteNow.test.js.map +1 -1
- package/modules/style/miniNow.js +6 -6
- package/modules/style/miniNow.js.map +1 -1
- package/modules/style/miniNow.test.js +10 -12
- package/modules/style/miniNow.test.js.map +1 -1
- package/modules/style/renameLegacyProperties.js +8 -10
- package/modules/style/renameLegacyProperties.js.map +1 -1
- package/modules/style/renameLegacyProperties.test.js +0 -1
- package/modules/style/renameLegacyProperties.test.js.map +1 -1
- package/modules/style/round.js +3 -2
- package/modules/style/round.js.map +1 -1
- package/modules/style/round.test.js +50 -62
- package/modules/style/round.test.js.map +1 -1
- package/modules/style/roundMinute.js +8 -7
- package/modules/style/roundMinute.js.map +1 -1
- package/modules/style/roundMinute.test.js +19 -22
- package/modules/style/roundMinute.test.js.map +1 -1
- package/modules/style/twitter.js +36 -33
- package/modules/style/twitter.js.map +1 -1
- package/modules/style/twitter.test.js +53 -52
- package/modules/style/twitter.test.js.map +1 -1
- package/modules/style/twitterFirstMinute.js +8 -7
- package/modules/style/twitterFirstMinute.js.map +1 -1
- package/modules/style/twitterFirstMinute.test.js +15 -18
- package/modules/style/twitterFirstMinute.test.js.map +1 -1
- package/modules/style/twitterMinute.js +6 -6
- package/modules/style/twitterMinute.js.map +1 -1
- package/modules/style/twitterMinute.test.js +19 -20
- package/modules/style/twitterMinute.test.js.map +1 -1
- package/modules/style/twitterMinuteNow.js +6 -6
- package/modules/style/twitterMinuteNow.js.map +1 -1
- package/modules/style/twitterMinuteNow.test.js +19 -20
- package/modules/style/twitterMinuteNow.test.js.map +1 -1
- package/modules/style/twitterNow.js +6 -6
- package/modules/style/twitterNow.js.map +1 -1
- package/modules/style/twitterNow.test.js +17 -19
- package/modules/style/twitterNow.test.js.map +1 -1
- package/package.json +275 -13
|
@@ -1,39 +1,45 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
2
|
import { getSecondsInUnit } from './units.js';
|
|
4
3
|
import { getDiffRatioToNextRoundedNumber } from '../round.js';
|
|
5
4
|
export default function getStepMinTime(step, _ref) {
|
|
6
5
|
var prevStep = _ref.prevStep,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var minTime;
|
|
12
|
-
|
|
6
|
+
timestamp = _ref.timestamp,
|
|
7
|
+
now = _ref.now,
|
|
8
|
+
future = _ref.future,
|
|
9
|
+
round = _ref.round;
|
|
10
|
+
var minTime;
|
|
11
|
+
|
|
12
|
+
// (deprecated)
|
|
13
|
+
// Get `minTime` from "threshold_for_xxx" property of the `step`.
|
|
14
|
+
// "threshold_for_xxx" property of a `step` is deprecated.
|
|
13
15
|
if (prevStep) {
|
|
14
16
|
if (prevStep.id || prevStep.unit) {
|
|
15
17
|
minTime = step["threshold_for_".concat(prevStep.id || prevStep.unit)];
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
// (deprecated)
|
|
22
|
+
// Get `minTime` from "threshold" property of the `step`.
|
|
23
|
+
// "threshold" property of a `step` is deprecated.
|
|
19
24
|
if (minTime === undefined) {
|
|
20
|
-
// "threshold" is a legacy property.
|
|
21
25
|
if (step.threshold !== undefined) {
|
|
22
26
|
// "threshold" is a legacy name for "minTime".
|
|
23
|
-
minTime = step.threshold;
|
|
24
|
-
|
|
27
|
+
minTime = step.threshold;
|
|
28
|
+
// "threshold" function is deprecated.
|
|
25
29
|
if (typeof minTime === 'function') {
|
|
26
30
|
minTime = minTime(now, future);
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
// Get `minTime` from `minTime` property of the `step`.
|
|
36
|
+
// This is the only non-deprecated source for the `minTime` property.
|
|
31
37
|
if (minTime === undefined) {
|
|
32
38
|
minTime = step.minTime;
|
|
33
|
-
}
|
|
34
|
-
// depending on the previous step's unit.
|
|
35
|
-
|
|
39
|
+
}
|
|
36
40
|
|
|
41
|
+
// (deprecated)
|
|
42
|
+
// If `minTime` is an object, calculate `minTime` from the previous step's `unit`.
|
|
37
43
|
if (_typeof(minTime) === 'object') {
|
|
38
44
|
if (prevStep && prevStep.id && minTime[prevStep.id] !== undefined) {
|
|
39
45
|
minTime = minTime[prevStep.id];
|
|
@@ -42,6 +48,7 @@ export default function getStepMinTime(step, _ref) {
|
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
|
|
51
|
+
// If `minTime` is a function, call it with certain arguments.
|
|
45
52
|
if (typeof minTime === 'function') {
|
|
46
53
|
minTime = minTime(timestamp, {
|
|
47
54
|
future: future,
|
|
@@ -51,10 +58,11 @@ export default function getStepMinTime(step, _ref) {
|
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
60
|
});
|
|
54
|
-
}
|
|
55
|
-
// `test()` function is deprecated.
|
|
56
|
-
|
|
61
|
+
}
|
|
57
62
|
|
|
63
|
+
// (deprecated)
|
|
64
|
+
// Get `minTime` from `step.test()` function property.
|
|
65
|
+
// `step.test` property is deprecated.
|
|
58
66
|
if (minTime === undefined) {
|
|
59
67
|
if (step.test) {
|
|
60
68
|
if (step.test(timestamp, {
|
|
@@ -70,6 +78,8 @@ export default function getStepMinTime(step, _ref) {
|
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
|
|
81
|
+
// If `minTime` is `undefined`, calculate it from the previous `step`.
|
|
82
|
+
// If it's the first step and there's no previous one, the `minTime` is assumed `0`.
|
|
73
83
|
if (minTime === undefined) {
|
|
74
84
|
if (prevStep) {
|
|
75
85
|
if (step.formatAs && prevStep.formatAs) {
|
|
@@ -81,33 +91,18 @@ export default function getStepMinTime(step, _ref) {
|
|
|
81
91
|
// The first step's `minTime` is `0` by default.
|
|
82
92
|
minTime = 0;
|
|
83
93
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
94
|
+
}
|
|
86
95
|
|
|
96
|
+
// Warn if no `minTime` is defined for this step.
|
|
87
97
|
if (minTime === undefined) {
|
|
88
98
|
console.warn('[javascript-time-ago] A step should specify `minTime`:\n' + JSON.stringify(step, null, 2));
|
|
89
99
|
}
|
|
90
|
-
|
|
91
100
|
return minTime;
|
|
92
101
|
}
|
|
93
|
-
|
|
94
102
|
function _getMinTimeForUnit(toUnit, fromUnit, _ref2) {
|
|
95
103
|
var round = _ref2.round;
|
|
96
|
-
var toUnitAmount = getSecondsInUnit(toUnit);
|
|
97
|
-
|
|
98
|
-
// }
|
|
99
|
-
// if (!fromUnit) {
|
|
100
|
-
// fromUnit = getPreviousUnitFor(toUnit)
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
|
-
var fromUnitAmount;
|
|
104
|
-
|
|
105
|
-
if (fromUnit === 'now') {
|
|
106
|
-
fromUnitAmount = getSecondsInUnit(toUnit);
|
|
107
|
-
} else {
|
|
108
|
-
fromUnitAmount = getSecondsInUnit(fromUnit);
|
|
109
|
-
}
|
|
110
|
-
|
|
104
|
+
var toUnitAmount = getSecondsInUnit(toUnit);
|
|
105
|
+
var fromUnitAmount = fromUnit === 'now' ? getSecondsInUnit(toUnit) : getSecondsInUnit(fromUnit);
|
|
111
106
|
if (toUnitAmount !== undefined && fromUnitAmount !== undefined) {
|
|
112
107
|
return toUnitAmount - fromUnitAmount * (1 - getDiffRatioToNextRoundedNumber(round));
|
|
113
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStepMinTime.js","names":["getSecondsInUnit","getDiffRatioToNextRoundedNumber","getStepMinTime","step","prevStep","timestamp","now","future","round","minTime","id","unit","undefined","threshold","getMinTimeForUnit","toUnit","fromUnit","formatAs","test","console","warn","JSON","stringify","toUnitAmount","fromUnitAmount"],"sources":["../../source/steps/getStepMinTime.js"],"sourcesContent":["import { getSecondsInUnit } from './units.js'\r\nimport { getDiffRatioToNextRoundedNumber } from '../round.js'\r\n\r\nexport default function getStepMinTime(step, {\r\n\tprevStep,\r\n\ttimestamp,\r\n\t// `now` argument is used in a deprecated `step.test()` function.\r\n\tnow,\r\n\tfuture,\r\n\tround\r\n}) {\r\n\tlet minTime\r\n\t// \"threshold_for_xxx\"
|
|
1
|
+
{"version":3,"file":"getStepMinTime.js","names":["getSecondsInUnit","getDiffRatioToNextRoundedNumber","getStepMinTime","step","_ref","prevStep","timestamp","now","future","round","minTime","id","unit","concat","undefined","threshold","_typeof","getMinTimeForUnit","toUnit","fromUnit","formatAs","test","console","warn","JSON","stringify","_ref2","toUnitAmount","fromUnitAmount"],"sources":["../../source/steps/getStepMinTime.js"],"sourcesContent":["import { getSecondsInUnit } from './units.js'\r\nimport { getDiffRatioToNextRoundedNumber } from '../round.js'\r\n\r\nexport default function getStepMinTime(step, {\r\n\tprevStep,\r\n\ttimestamp,\r\n\t// `now` argument is used in a deprecated `step.test()` function.\r\n\tnow,\r\n\tfuture,\r\n\tround\r\n}) {\r\n\tlet minTime\r\n\r\n\t// (deprecated)\r\n\t// Get `minTime` from \"threshold_for_xxx\" property of the `step`.\r\n\t// \"threshold_for_xxx\" property of a `step` is deprecated.\r\n\tif (prevStep) {\r\n\t\tif (prevStep.id || prevStep.unit) {\r\n\t\t\tminTime = step[`threshold_for_${prevStep.id || prevStep.unit}`]\r\n\t\t}\r\n\t}\r\n\r\n\t// (deprecated)\r\n\t// Get `minTime` from \"threshold\" property of the `step`.\r\n\t// \"threshold\" property of a `step` is deprecated.\r\n\tif (minTime === undefined) {\r\n\t\tif (step.threshold !== undefined) {\r\n\t\t\t// \"threshold\" is a legacy name for \"minTime\".\r\n\t\t\tminTime = step.threshold\r\n\t\t\t// \"threshold\" function is deprecated.\r\n\t\t\tif (typeof minTime === 'function') {\r\n\t\t\t\tminTime = minTime(now, future)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Get `minTime` from `minTime` property of the `step`.\r\n\t// This is the only non-deprecated source for the `minTime` property.\r\n\tif (minTime === undefined) {\r\n\t\tminTime = step.minTime\r\n\t}\r\n\r\n\t// (deprecated)\r\n\t// If `minTime` is an object, calculate `minTime` from the previous step's `unit`.\r\n\tif (typeof minTime === 'object') {\r\n\t\tif (prevStep && prevStep.id && minTime[prevStep.id] !== undefined) {\r\n\t\t\tminTime = minTime[prevStep.id]\r\n\t\t} else {\r\n\t\t\tminTime = minTime.default\r\n\t\t}\r\n\t}\r\n\r\n\t// If `minTime` is a function, call it with certain arguments.\r\n\tif (typeof minTime === 'function') {\r\n\t\tminTime = minTime(timestamp, {\r\n\t\t\tfuture,\r\n\t\t\tgetMinTimeForUnit(toUnit, fromUnit) {\r\n\t\t\t\treturn getMinTimeForUnit(\r\n\t\t\t\t\ttoUnit,\r\n\t\t\t\t\tfromUnit || prevStep && prevStep.formatAs,\r\n\t\t\t\t\t{ round }\r\n\t\t\t\t)\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\t// (deprecated)\r\n\t// Get `minTime` from `step.test()` function property.\r\n\t// `step.test` property is deprecated.\r\n\tif (minTime === undefined) {\r\n\t\tif (step.test) {\r\n\t\t\tif (step.test(timestamp, {\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})) {\r\n\t\t\t\t// `0` threshold always passes.\r\n\t\t\t\tminTime = 0\r\n\t\t\t} else {\r\n\t\t\t\t// `MAX_SAFE_INTEGER` threshold won't ever pass in real life.\r\n\t\t\t\tminTime = 9007199254740991 // Number.MAX_SAFE_INTEGER\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// If `minTime` is `undefined`, calculate it from the previous `step`.\r\n\t// If it's the first step and there's no previous one, the `minTime` is assumed `0`.\r\n\tif (minTime === undefined) {\r\n\t\tif (prevStep) {\r\n\t\t\tif (step.formatAs && prevStep.formatAs) {\r\n\t\t\t\tminTime = getMinTimeForUnit(step.formatAs, prevStep.formatAs, { round })\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// The first step's `minTime` is `0` by default.\r\n\t\t\tminTime = 0\r\n\t\t}\r\n\t}\r\n\r\n\t// Warn if no `minTime` is defined for this step.\r\n\tif (minTime === undefined) {\r\n\t\tconsole.warn('[javascript-time-ago] A step should specify `minTime`:\\n' + JSON.stringify(step, null, 2))\r\n\t}\r\n\r\n\treturn minTime\r\n}\r\n\r\nfunction getMinTimeForUnit(toUnit, fromUnit, { round }) {\r\n\tconst toUnitAmount = getSecondsInUnit(toUnit)\r\n\tconst fromUnitAmount = fromUnit === 'now' ? getSecondsInUnit(toUnit) : getSecondsInUnit(fromUnit)\r\n\tif (toUnitAmount !== undefined && fromUnitAmount !== undefined) {\r\n\t\treturn toUnitAmount - fromUnitAmount * (1 - getDiffRatioToNextRoundedNumber(round))\r\n\t}\r\n}"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,+BAA+B,QAAQ,aAAa;AAE7D,eAAe,SAASC,cAAcA,CAACC,IAAI,EAAAC,IAAA,EAOxC;EAAA,IANFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAETC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACHC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,KAAK,GAAAL,IAAA,CAALK,KAAK;EAEL,IAAIC,OAAO;;EAEX;EACA;EACA;EACA,IAAIL,QAAQ,EAAE;IACb,IAAIA,QAAQ,CAACM,EAAE,IAAIN,QAAQ,CAACO,IAAI,EAAE;MACjCF,OAAO,GAAGP,IAAI,kBAAAU,MAAA,CAAkBR,QAAQ,CAACM,EAAE,IAAIN,QAAQ,CAACO,IAAI,EAAG;IAChE;EACD;;EAEA;EACA;EACA;EACA,IAAIF,OAAO,KAAKI,SAAS,EAAE;IAC1B,IAAIX,IAAI,CAACY,SAAS,KAAKD,SAAS,EAAE;MACjC;MACAJ,OAAO,GAAGP,IAAI,CAACY,SAAS;MACxB;MACA,IAAI,OAAOL,OAAO,KAAK,UAAU,EAAE;QAClCA,OAAO,GAAGA,OAAO,CAACH,GAAG,EAAEC,MAAM,CAAC;MAC/B;IACD;EACD;;EAEA;EACA;EACA,IAAIE,OAAO,KAAKI,SAAS,EAAE;IAC1BJ,OAAO,GAAGP,IAAI,CAACO,OAAO;EACvB;;EAEA;EACA;EACA,IAA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G,CAAC;IACZ;EACD;;EAEA;EACA,IAAIA,OAAO,KAAKI,SAAS,EAAE;IAC1BQ,OAAO,CAACC,IAAI,CAAC,0DAA0D,GAAGC,IAAI,CAACC,SAAS,CAACtB,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;EACzG;EAEA,OAAOO,OAAO;AACf;AAEA,SAASO,kBAAiBA,CAACC,MAAM,EAAEC,QAAQ,EAAAO,KAAA,EAAa;EAAA,IAATjB,KAAK,GAAAiB,KAAA,CAALjB,KAAK;EACnD,IAAMkB,YAAY,GAAG3B,gBAAgB,CAACkB,MAAM,CAAC;EAC7C,IAAMU,cAAc,GAAGT,QAAQ,KAAK,KAAK,GAAGnB,gBAAgB,CAACkB,MAAM,CAAC,GAAGlB,gBAAgB,CAACmB,QAAQ,CAAC;EACjG,IAAIQ,YAAY,KAAKb,SAAS,IAAIc,cAAc,KAAKd,SAAS,EAAE;IAC/D,OAAOa,YAAY,GAAGC,cAAc,IAAI,CAAC,GAAG3B,+BAA+B,CAACQ,KAAK,CAAC,CAAC;EACpF;AACD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStepMinTime.test.js","names":["getStepMinTime","describe","it","test","prevStep","minTime","should","equal"],"sources":["../../source/steps/getStepMinTime.test.js"],"sourcesContent":["import getStepMinTime from './getStepMinTime.js'\r\n\r\ndescribe('getStepMinTime', () => {\r\n\tit('should support `step.test()` function (returns true)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => true\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(0)\r\n\t})\r\n\r\n\tit('should support `step.test()` function (returns false)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => false\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(9007199254740991)\r\n\t})\r\n})"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"getStepMinTime.test.js","names":["getStepMinTime","describe","it","test","prevStep","minTime","should","equal"],"sources":["../../source/steps/getStepMinTime.test.js"],"sourcesContent":["import getStepMinTime from './getStepMinTime.js'\r\n\r\ndescribe('getStepMinTime', () => {\r\n\tit('should support `step.test()` function (returns true)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => true\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(0)\r\n\t})\r\n\r\n\tit('should support `step.test()` function (returns false)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => false\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(9007199254740991)\r\n\t})\r\n})"],"mappings":"AAAA,OAAOA,cAAc,MAAM,qBAAqB;AAEhDC,QAAQ,CAAC,gBAAgB,EAAE,YAAM;EAChCC,EAAE,CAAC,sDAAsD,EAAE,YAAM;IAChEF,cAAc,CAAC;MACdG,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,IAAI;MAAA;IACjB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFL,EAAE,CAAC,uDAAuD,EAAE,YAAM;IACjEF,cAAc,CAAC;MACdG,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,KAAK;MAAA;IAClB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAAC,gBAAgB,CAAC;EAClC,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _getTimeToNextUpdateForUnit from './getTimeToNextUpdateForUnit.js';
|
|
2
2
|
import getStepMinTime from './getStepMinTime.js';
|
|
3
|
-
import { getRoundFunction } from '../round.js';
|
|
3
|
+
import { getRoundFunction } from '../round.js';
|
|
4
4
|
|
|
5
|
+
// A thousand years is practically a metaphor for "infinity".
|
|
5
6
|
var YEAR = 365 * 24 * 60 * 60 * 1000;
|
|
7
|
+
// It can't really return `Infinity` in order to not screw any potential calculations performed with it.
|
|
8
|
+
// Hence, it emulates `Infinity` with a really large number that is "practically infinite".
|
|
6
9
|
export var INFINITY = 1000 * YEAR;
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
12
|
+
* Returns the time (in milliseconds) after which the formatted date label should be refreshed.
|
|
9
13
|
* @param {number} date — The date passed to `.format()`, converted to a timestamp.
|
|
10
14
|
* @param {object} step
|
|
11
15
|
* @param {object} [options.previousStep]
|
|
@@ -13,23 +17,23 @@ export var INFINITY = 1000 * YEAR;
|
|
|
13
17
|
* @param {number} options.now
|
|
14
18
|
* @param {boolean} options.future
|
|
15
19
|
* @param {string} [options.round] - (undocumented) Rounding mechanism.
|
|
16
|
-
* @return {number} [timeToNextUpdate]
|
|
20
|
+
* @return {number} [timeToNextUpdate] Returns the time to next update. Returns `undefined` when it can't determine time to next update. That could only happen when the "style" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README).
|
|
17
21
|
*/
|
|
18
|
-
|
|
19
22
|
export default function getTimeToNextUpdate(date, step, _ref) {
|
|
20
23
|
var prevStep = _ref.prevStep,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
nextStep = _ref.nextStep,
|
|
25
|
+
now = _ref.now,
|
|
26
|
+
future = _ref.future,
|
|
27
|
+
round = _ref.round;
|
|
25
28
|
var timestamp = date.getTime ? date.getTime() : date;
|
|
26
|
-
|
|
27
29
|
var getTimeToNextUpdateForUnit = function getTimeToNextUpdateForUnit(unit) {
|
|
28
30
|
return _getTimeToNextUpdateForUnit(unit, timestamp, {
|
|
29
31
|
now: now,
|
|
30
32
|
round: round
|
|
31
33
|
});
|
|
32
|
-
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// For future dates, steps move from the last one to the first one,
|
|
33
37
|
// while for past dates, steps move from the first one to the last one,
|
|
34
38
|
// due to the fact that time flows in one direction,
|
|
35
39
|
// and future dates' interval naturally becomes smaller
|
|
@@ -43,24 +47,22 @@ export default function getTimeToNextUpdate(date, step, _ref) {
|
|
|
43
47
|
// from the current step to the next step,
|
|
44
48
|
// therefore check the `minTime` of the next step.
|
|
45
49
|
//
|
|
46
|
-
|
|
47
|
-
|
|
48
50
|
var timeToStepChange = getTimeToStepChange(future ? step : nextStep, timestamp, {
|
|
49
51
|
future: future,
|
|
50
52
|
now: now,
|
|
51
53
|
round: round,
|
|
52
|
-
prevStep: future ? prevStep : step
|
|
53
|
-
|
|
54
|
+
prevStep: future ? prevStep : step
|
|
55
|
+
// isFirstStep: future && isFirstStep
|
|
54
56
|
});
|
|
55
57
|
|
|
58
|
+
// If the "style" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README)
|
|
59
|
+
// then `timeToStepChange` will be `undefined`. In that case, just return `undefined`.
|
|
56
60
|
if (timeToStepChange === undefined) {
|
|
57
61
|
// Can't reliably determine "time to next update"
|
|
58
62
|
// if not all of the steps provide `minTime`.
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
61
|
-
|
|
62
65
|
var timeToNextUpdate;
|
|
63
|
-
|
|
64
66
|
if (step) {
|
|
65
67
|
if (step.getTimeToNextUpdate) {
|
|
66
68
|
timeToNextUpdate = step.getTimeToNextUpdate(timestamp, {
|
|
@@ -71,11 +73,9 @@ export default function getTimeToNextUpdate(date, step, _ref) {
|
|
|
71
73
|
round: round
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
|
-
|
|
75
76
|
if (timeToNextUpdate === undefined) {
|
|
76
77
|
// "unit" is now called "formatAs".
|
|
77
78
|
var unit = step.unit || step.formatAs;
|
|
78
|
-
|
|
79
79
|
if (unit) {
|
|
80
80
|
// For some units, like "now", there's no defined amount of seconds in them.
|
|
81
81
|
// In such cases, `getTimeToNextUpdateForUnit()` returns `undefined`,
|
|
@@ -85,18 +85,19 @@ export default function getTimeToNextUpdate(date, step, _ref) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
89
88
|
if (timeToNextUpdate === undefined) {
|
|
90
89
|
return timeToStepChange;
|
|
91
90
|
}
|
|
92
|
-
|
|
93
91
|
return Math.min(timeToNextUpdate, timeToStepChange);
|
|
94
92
|
}
|
|
93
|
+
|
|
94
|
+
// Returns the timestamp at which it'll move to the next step.
|
|
95
|
+
// Returns `undefined` when it can't determine when it'll move to the next stemp. That could only happen when the "style" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README).
|
|
95
96
|
export function getStepChangesAt(currentOrNextStep, timestamp, _ref2) {
|
|
96
97
|
var now = _ref2.now,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
future = _ref2.future,
|
|
99
|
+
round = _ref2.round,
|
|
100
|
+
prevStep = _ref2.prevStep;
|
|
100
101
|
// The first step's `minTime` is `0` by default.
|
|
101
102
|
// It doesn't "change" steps at zero point
|
|
102
103
|
// but it does change the wording when switching
|
|
@@ -109,11 +110,9 @@ export function getStepChangesAt(currentOrNextStep, timestamp, _ref2) {
|
|
|
109
110
|
round: round,
|
|
110
111
|
prevStep: prevStep
|
|
111
112
|
});
|
|
112
|
-
|
|
113
113
|
if (minTime === undefined) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
|
|
117
116
|
if (future) {
|
|
118
117
|
// The step changes to the previous step
|
|
119
118
|
// as soon as `timestamp - now` becomes
|
|
@@ -127,20 +126,19 @@ export function getStepChangesAt(currentOrNextStep, timestamp, _ref2) {
|
|
|
127
126
|
// equal to `minTime` of the next step:
|
|
128
127
|
// `now - timestamp === minTime`
|
|
129
128
|
// => `now === timestamp + minTime`.
|
|
129
|
+
|
|
130
130
|
// This is a special case when double-update could be skipped.
|
|
131
131
|
if (minTime === 0 && timestamp === now) {
|
|
132
132
|
return INFINITY;
|
|
133
133
|
}
|
|
134
|
-
|
|
135
134
|
return timestamp + minTime * 1000;
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
export function getTimeToStepChange(step, timestamp, _ref3) {
|
|
139
138
|
var now = _ref3.now,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
future = _ref3.future,
|
|
140
|
+
round = _ref3.round,
|
|
141
|
+
prevStep = _ref3.prevStep;
|
|
144
142
|
if (step) {
|
|
145
143
|
var stepChangesAt = getStepChangesAt(step, timestamp, {
|
|
146
144
|
now: now,
|
|
@@ -148,11 +146,9 @@ export function getTimeToStepChange(step, timestamp, _ref3) {
|
|
|
148
146
|
round: round,
|
|
149
147
|
prevStep: prevStep
|
|
150
148
|
});
|
|
151
|
-
|
|
152
149
|
if (stepChangesAt === undefined) {
|
|
153
150
|
return;
|
|
154
151
|
}
|
|
155
|
-
|
|
156
152
|
return stepChangesAt - now;
|
|
157
153
|
} else {
|
|
158
154
|
if (future) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTimeToNextUpdate.js","names":["_getTimeToNextUpdateForUnit","getStepMinTime","getRoundFunction","YEAR","INFINITY","getTimeToNextUpdate","date","step","prevStep","nextStep","now","future","round","timestamp","getTime","getTimeToNextUpdateForUnit","unit","timeToStepChange","getTimeToStepChange","undefined","timeToNextUpdate","formatAs","Math","min","getStepChangesAt","currentOrNextStep","minTime","stepChangesAt"],"sources":["../../source/steps/getTimeToNextUpdate.js"],"sourcesContent":["import _getTimeToNextUpdateForUnit from './getTimeToNextUpdateForUnit.js'\r\nimport getStepMinTime from './getStepMinTime.js'\r\nimport { getRoundFunction } from '../round.js'\r\n\r\n// A thousand years is practically a metaphor for \"infinity\".\r\nconst YEAR = 365 * 24 * 60 * 60 * 1000\r\nexport const INFINITY = 1000 * YEAR\r\n\r\n/**\r\n *
|
|
1
|
+
{"version":3,"file":"getTimeToNextUpdate.js","names":["_getTimeToNextUpdateForUnit","getStepMinTime","getRoundFunction","YEAR","INFINITY","getTimeToNextUpdate","date","step","_ref","prevStep","nextStep","now","future","round","timestamp","getTime","getTimeToNextUpdateForUnit","unit","timeToStepChange","getTimeToStepChange","undefined","timeToNextUpdate","formatAs","Math","min","getStepChangesAt","currentOrNextStep","_ref2","minTime","_ref3","stepChangesAt"],"sources":["../../source/steps/getTimeToNextUpdate.js"],"sourcesContent":["import _getTimeToNextUpdateForUnit from './getTimeToNextUpdateForUnit.js'\r\nimport getStepMinTime from './getStepMinTime.js'\r\nimport { getRoundFunction } from '../round.js'\r\n\r\n// A thousand years is practically a metaphor for \"infinity\".\r\nconst YEAR = 365 * 24 * 60 * 60 * 1000\r\n// It can't really return `Infinity` in order to not screw any potential calculations performed with it.\r\n// Hence, it emulates `Infinity` with a really large number that is \"practically infinite\".\r\nexport const INFINITY = 1000 * YEAR\r\n\r\n/**\r\n * Returns the time (in milliseconds) after which the formatted date label should be refreshed.\r\n * @param {number} date — The date passed to `.format()`, converted to a timestamp.\r\n * @param {object} step\r\n * @param {object} [options.previousStep]\r\n * @param {object} [options.nextStep]\r\n * @param {number} options.now\r\n * @param {boolean} options.future\r\n * @param {string} [options.round] - (undocumented) Rounding mechanism.\r\n * @return {number} [timeToNextUpdate] Returns the time to next update. Returns `undefined` when it can't determine time to next update. That could only happen when the \"style\" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README).\r\n */\r\nexport default function getTimeToNextUpdate(date, step, { prevStep, nextStep, now, future, round }) {\r\n\tconst timestamp = date.getTime ? date.getTime() : date\r\n\r\n\tconst getTimeToNextUpdateForUnit = (unit) => _getTimeToNextUpdateForUnit(unit, timestamp, { now, round })\r\n\r\n\t// For future dates, steps move from the last one to the first one,\r\n\t// while for past dates, steps move from the first one to the last one,\r\n\t// due to the fact that time flows in one direction,\r\n\t// and future dates' interval naturally becomes smaller\r\n\t// while past dates' interval naturally grows larger.\r\n\t//\r\n\t// For future dates, it's the transition\r\n\t// from the current step to the previous step,\r\n\t// therefore check the `minTime` of the current step.\r\n\t//\r\n\t// For past dates, it's the transition\r\n\t// from the current step to the next step,\r\n\t// therefore check the `minTime` of the next step.\r\n\t//\r\n\tconst timeToStepChange = getTimeToStepChange(future ? step : nextStep, timestamp, {\r\n\t\tfuture,\r\n\t\tnow,\r\n\t\tround,\r\n\t\tprevStep: future ? prevStep : step,\r\n\t\t// isFirstStep: future && isFirstStep\r\n\t})\r\n\r\n\t// If the \"style\" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README)\r\n\t// then `timeToStepChange` will be `undefined`. In that case, just return `undefined`.\r\n\tif (timeToStepChange === undefined) {\r\n\t\t// Can't reliably determine \"time to next update\"\r\n\t\t// if not all of the steps provide `minTime`.\r\n\t\treturn\r\n\t}\r\n\r\n\tlet timeToNextUpdate\r\n\r\n\tif (step) {\r\n\t\tif (step.getTimeToNextUpdate) {\r\n\t\t\ttimeToNextUpdate = step.getTimeToNextUpdate(timestamp, {\r\n\t\t\t\tgetTimeToNextUpdateForUnit,\r\n\t\t\t\tgetRoundFunction,\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture,\r\n\t\t\t\tround\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tif (timeToNextUpdate === undefined) {\r\n\t\t\t// \"unit\" is now called \"formatAs\".\r\n\t\t\tconst unit = step.unit || step.formatAs\r\n\t\t\tif (unit) {\r\n\t\t\t\t// For some units, like \"now\", there's no defined amount of seconds in them.\r\n\t\t\t\t// In such cases, `getTimeToNextUpdateForUnit()` returns `undefined`,\r\n\t\t\t\t// and the next step's `minTime` could be used to calculate the update interval:\r\n\t\t\t\t// it will just assume that the label never changes for this step.\r\n\t\t\t\ttimeToNextUpdate = getTimeToNextUpdateForUnit(unit)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (timeToNextUpdate === undefined) {\r\n\t\treturn timeToStepChange\r\n\t}\r\n\r\n\treturn Math.min(timeToNextUpdate, timeToStepChange)\r\n}\r\n\r\n// Returns the timestamp at which it'll move to the next step.\r\n// Returns `undefined` when it can't determine when it'll move to the next stemp. That could only happen when the \"style\" doesn't meet the minimum requirements for `getTimeToNextUpdate: true` feature (see README).\r\nexport function getStepChangesAt(currentOrNextStep, timestamp, { now, future, round, prevStep }) {\r\n\t// The first step's `minTime` is `0` by default.\r\n\t// It doesn't \"change\" steps at zero point\r\n\t// but it does change the wording when switching\r\n\t// from \"future\" to \"past\": \"in ...\" -> \"... ago\".\r\n\t// Therefore, the label should be updated at zero-point too.\r\n\tconst minTime = getStepMinTime(currentOrNextStep, { timestamp, now, future, round, prevStep })\r\n\tif (minTime === undefined) {\r\n\t\treturn\r\n\t}\r\n\tif (future) {\r\n\t\t// The step changes to the previous step\r\n\t\t// as soon as `timestamp - now` becomes\r\n\t\t// less than the `minTime` of the current step:\r\n\t\t// `timestamp - now === minTime - 1`\r\n\t\t// => `now === timestamp - minTime + 1`.\r\n\t\treturn timestamp - minTime * 1000 + 1\r\n\t} else {\r\n\t\t// The step changes to the next step\r\n\t\t// as soon as `now - timestamp` becomes\r\n\t\t// equal to `minTime` of the next step:\r\n\t\t// `now - timestamp === minTime`\r\n\t\t// => `now === timestamp + minTime`.\r\n\r\n\t\t// This is a special case when double-update could be skipped.\r\n\t\tif (minTime === 0 && timestamp === now) {\r\n\t\t\treturn INFINITY\r\n\t\t}\r\n\r\n\t\treturn timestamp + minTime * 1000\r\n\t}\r\n}\r\n\r\nexport function getTimeToStepChange(step, timestamp, {\r\n\tnow,\r\n\tfuture,\r\n\tround,\r\n\tprevStep\r\n}) {\r\n\tif (step) {\r\n\t\tconst stepChangesAt = getStepChangesAt(step, timestamp, {\r\n\t\t\tnow,\r\n\t\t\tfuture,\r\n\t\t\tround,\r\n\t\t\tprevStep\r\n\t\t})\r\n\t\tif (stepChangesAt === undefined) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\treturn stepChangesAt - now\r\n\t} else {\r\n\t\tif (future) {\r\n\t\t\t// No step.\r\n\t\t\t// Update right after zero point, when it changes from \"future\" to \"past\".\r\n\t\t\treturn timestamp - now + 1\r\n\t\t} else {\r\n\t\t\t// The last step doesn't ever change when `date` is in the past.\r\n\t\t\treturn INFINITY\r\n\t\t}\r\n\t}\r\n}"],"mappings":"AAAA,OAAOA,2BAA2B,MAAM,iCAAiC;AACzE,OAAOC,cAAc,MAAM,qBAAqB;AAChD,SAASC,gBAAgB,QAAQ,aAAa;;AAE9C;AACA,IAAMC,IAAI,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AACtC;AACA;AACA,OAAO,IAAMC,QAAQ,GAAG,IAAI,GAAGD,IAAI;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASE,mBAAmBA,CAACC,IAAI,EAAEC,IAAI,EAAAC,IAAA,EAA8C;EAAA,IAA1CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IAAEC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAEC,KAAK,GAAAL,IAAA,CAALK,KAAK;EAC/F,IAAMC,SAAS,GAAGR,IAAI,CAACS,OAAO,GAAGT,IAAI,CAACS,OAAO,CAAC,CAAC,GAAGT,IAAI;EAEtD,IAAMU,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAIC,IAAI;IAAA,OAAKjB,2BAA2B,CAACiB,IAAI,EAAEH,SAAS,EAAE;MAAEH,GAAG,EAAHA,GAAG;MAAEE,KAAK,EAALA;IAAM,CAAC,CAAC;EAAA;;EAEzG;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMK,gBAAgB,GAAGC,mBAAmB,CAACP,MAAM,GAAGL,IAAI,GAAGG,QAAQ,EAAEI,SAAS,EAAE;IACjFF,MAAM,EAANA,MAAM;IACND,GAAG,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future: false,
|
|
168
168
|
prevStep: undefined
|
|
169
|
-
}).should.equal(INFINITY);
|
|
169
|
+
}).should.equal(INFINITY);
|
|
170
|
+
|
|
171
|
+
// Past.
|
|
170
172
|
// Is at zero point.
|
|
171
173
|
// The next step is seconds.
|
|
172
174
|
// Updates at the next step.
|
|
173
|
-
|
|
174
175
|
getStepChangesAt({
|
|
175
176
|
unit: 'second',
|
|
176
177
|
minTime: 1
|
|
@@ -178,32 +179,35 @@ describe('getStepChangesAt', function () {
|
|
|
178
179
|
now: 0,
|
|
179
180
|
future: false,
|
|
180
181
|
prevStep: {}
|
|
181
|
-
}).should.equal(1 * 1000);
|
|
182
|
+
}).should.equal(1 * 1000);
|
|
183
|
+
|
|
184
|
+
// Future.
|
|
182
185
|
// Inside the first step.
|
|
183
186
|
// Updates after zero point.
|
|
184
|
-
|
|
185
187
|
getStepChangesAt({
|
|
186
188
|
unit: 'now'
|
|
187
189
|
}, 0.9 * 1000, {
|
|
188
190
|
now: 0,
|
|
189
191
|
future: true,
|
|
190
192
|
prevStep: undefined
|
|
191
|
-
}).should.equal(0.9 * 1000 + 1);
|
|
193
|
+
}).should.equal(0.9 * 1000 + 1);
|
|
194
|
+
|
|
195
|
+
// Future.
|
|
192
196
|
// The first step doesn't start at 0.
|
|
193
197
|
// Outside of the first step.
|
|
194
198
|
// Updates right after zero point.
|
|
195
|
-
|
|
196
199
|
getTimeToStepChange(undefined, 0.9 * 1000, {
|
|
197
200
|
now: 0,
|
|
198
201
|
future: true,
|
|
199
202
|
prevStep: undefined
|
|
200
|
-
}).should.equal(0.9 * 1000 + 1);
|
|
203
|
+
}).should.equal(0.9 * 1000 + 1);
|
|
204
|
+
|
|
205
|
+
// Past.
|
|
201
206
|
// The current step is `undefined`.
|
|
202
207
|
// The next step is the first step.
|
|
203
208
|
// The first step doesn't start at 0.
|
|
204
209
|
// Outside of the first step.
|
|
205
210
|
// Updates at entering the first step.
|
|
206
|
-
|
|
207
211
|
getStepChangesAt({
|
|
208
212
|
minTime: 1,
|
|
209
213
|
unit: 'second'
|
|
@@ -211,10 +215,11 @@ describe('getStepChangesAt', function () {
|
|
|
211
215
|
now: 0,
|
|
212
216
|
future: false,
|
|
213
217
|
prevStep: {}
|
|
214
|
-
}).should.equal(0.1 * 1000);
|
|
218
|
+
}).should.equal(0.1 * 1000);
|
|
219
|
+
|
|
220
|
+
// Future.
|
|
215
221
|
// The first step doesn't start at 0.
|
|
216
222
|
// Will output empty string after it exits the current step.
|
|
217
|
-
|
|
218
223
|
getStepChangesAt({
|
|
219
224
|
minTime: 1,
|
|
220
225
|
unit: 'second'
|
|
@@ -222,39 +227,43 @@ describe('getStepChangesAt', function () {
|
|
|
222
227
|
now: 0,
|
|
223
228
|
future: true,
|
|
224
229
|
prevStep: undefined
|
|
225
|
-
}).should.equal(0.1 * 1000 + 1);
|
|
230
|
+
}).should.equal(0.1 * 1000 + 1);
|
|
231
|
+
|
|
232
|
+
// Past.
|
|
226
233
|
// Next step is seconds.
|
|
227
234
|
// The "next" step doesn't have `minTime`,
|
|
228
235
|
// so "time to next update" couldn't be determined.
|
|
229
|
-
|
|
230
236
|
expect(getStepChangesAt({
|
|
231
237
|
unit: 'unknown-time-unit'
|
|
232
238
|
}, 0, {
|
|
233
239
|
now: 0,
|
|
234
240
|
future: false,
|
|
235
241
|
prevStep: {}
|
|
236
|
-
})).to.be.undefined;
|
|
242
|
+
})).to.be.undefined;
|
|
243
|
+
|
|
244
|
+
// Past.
|
|
237
245
|
// No next step.
|
|
238
246
|
// The last step never changes.
|
|
239
|
-
|
|
240
247
|
getTimeToStepChange(undefined, 0, {
|
|
241
248
|
now: 0,
|
|
242
249
|
future: false,
|
|
243
250
|
isFirstStep: undefined
|
|
244
|
-
}).should.equal(INFINITY);
|
|
251
|
+
}).should.equal(INFINITY);
|
|
252
|
+
|
|
253
|
+
// Future.
|
|
245
254
|
// Current step is seconds.
|
|
246
255
|
// Updates after zero point.
|
|
247
|
-
|
|
248
256
|
getStepChangesAt({
|
|
249
257
|
unit: 'second'
|
|
250
258
|
}, 0, {
|
|
251
259
|
now: 0,
|
|
252
260
|
future: true,
|
|
253
261
|
prevStep: undefined
|
|
254
|
-
}).should.equal(1);
|
|
262
|
+
}).should.equal(1);
|
|
263
|
+
|
|
264
|
+
// Past.
|
|
255
265
|
// Next step is minutes.
|
|
256
266
|
// Already at zero point, so no need to update at zero point.
|
|
257
|
-
|
|
258
267
|
getStepChangesAt({
|
|
259
268
|
minTime: 60,
|
|
260
269
|
formatAs: 'minute'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTimeToNextUpdate.test.js","names":["getTimeToNextUpdate","INFINITY","getStepChangesAt","getTimeToStepChange","describe","it","expect","minTime","format","now","future","isFirstStep","to","equal","Date","nextStep","formatAs","be","undefined","should","test","unit","prevStep"],"sources":["../../source/steps/getTimeToNextUpdate.test.js"],"sourcesContent":["import getTimeToNextUpdate, { INFINITY, getStepChangesAt, getTimeToStepChange } from './getTimeToNextUpdate.js'\r\n\r\ndescribe('getTimeToNextUpdate', () => {\r\n\tit('should return infinity when there are no more steps, and it does not format as a unit (past)', () => {\r\n\t\texpect(getTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tminTime: 59.5,\r\n\t\t\tformat: () => ''\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t})).to.equal(INFINITY)\r\n\t})\r\n\r\n\tit('should support date argument', () => {\r\n\t\texpect(getTimeToNextUpdate(new Date(4 * 60 * 1000), {\r\n\t\t\tminTime: 60\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {}\r\n\t\t})).to.equal(3 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should return this step\\'s \"minTime\" timestamp (future)', () => {\r\n\t\texpect(getTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tminTime: 60,\r\n\t\t\tformat: () => ''\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformat: () => ''\r\n\t\t\t}\r\n\t\t})).to.equal(3 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should return undefined when there is a next step and time to next update can not be reliably determined (formatAs) (past)', () => {\r\n\t\texpect(getTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tminTime: 60,\r\n\t\t\tformatAs: 'minute'\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'unknown-time-unit'\r\n\t\t\t}\r\n\t\t})).to.be.undefined\r\n\t})\r\n\r\n\tit('should get time to next update (no next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (no next step) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.5 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should get time to next update (has prev/next step without `minTime`) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\ttest: () => false\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should get time to next update (has `getTimeToNextUpdate`) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5,\r\n\t\t\tgetTimeToNextUpdate: () => 0.25 * 60 * 1000\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.25 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has `getTimeToNextUpdate`) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5,\r\n\t\t\tgetTimeToNextUpdate: () => 0.25 * 60 * 1000\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.25 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has both unit and prev/next steps with `minTime`) (returns time to \"minTime\" of next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-59 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\tminTime: 59.5 * 60\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has no unit but has prev/next step with `minTime`) (returns time to \"minTime\" of next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-59 * 60 * 1000, {\r\n\t\t\tformat: () => {},\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\tminTime: 59.5 * 60\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (will be outside of the first step) (future)', () => {\r\n\t\tgetTimeToNextUpdate(60 * 60 * 1000, {\r\n\t\t\tformatAs: 'hour',\r\n\t\t\tminTime: 60 * 60\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(1)\r\n\t})\r\n})\r\n\r\ndescribe('getStepChangesAt', () => {\r\n\tit('should work for \"round\" steps', () => {\r\n\t\t// Future.\r\n\t\t// Is at zero point.\r\n\t\t// No next step.\r\n\t\t// No tickable unit.\r\n\t\t// Doesn't update.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'now'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(INFINITY)\r\n\r\n\t\t// Past.\r\n\t\t// Is at zero point.\r\n\t\t// The next step is seconds.\r\n\t\t// Updates at the next step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'second',\r\n\t\t\tminTime: 1\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(1 * 1000)\r\n\r\n\t\t// Future.\r\n\t\t// Inside the first step.\r\n\t\t// Updates after zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'now'\r\n\t\t}, 0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.9 * 1000 + 1)\r\n\r\n\t\t// Future.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates right after zero point.\r\n\t\tgetTimeToStepChange(undefined, 0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.9 * 1000 + 1)\r\n\r\n\t\t// Past.\r\n\t\t// The current step is `undefined`.\r\n\t\t// The next step is the first step.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates at entering the first step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 1,\r\n\t\t\tunit: 'second'\r\n\t\t}, -0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(0.1 * 1000)\r\n\r\n\t\t// Future.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Will output empty string after it exits the current step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 1,\r\n\t\t\tunit: 'second'\r\n\t\t}, 1.1 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.1 * 1000 + 1)\r\n\r\n\t\t// Past.\r\n\t\t// Next step is seconds.\r\n\t\t// The \"next\" step doesn't have `minTime`,\r\n\t\t// so \"time to next update\" couldn't be determined.\r\n\t\texpect(getStepChangesAt({\r\n\t\t\tunit: 'unknown-time-unit'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t})).to.be.undefined\r\n\r\n\t\t// Past.\r\n\t\t// No next step.\r\n\t\t// The last step never changes.\r\n\t\tgetTimeToStepChange(undefined, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: undefined\r\n\t\t}).should.equal(INFINITY)\r\n\r\n\t\t// Future.\r\n\t\t// Current step is seconds.\r\n\t\t// Updates after zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'second'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(1)\r\n\r\n\t\t// Past.\r\n\t\t// Next step is minutes.\r\n\t\t// Already at zero point, so no need to update at zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 60,\r\n\t\t\tformatAs: 'minute'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(60 * 1000)\r\n\t})\r\n})"],"mappings":"AAAA,OAAOA,mBAAP,IAA8BC,QAA9B,EAAwCC,gBAAxC,EAA0DC,mBAA1D,QAAqF,0BAArF;AAEAC,QAAQ,CAAC,qBAAD,EAAwB,YAAM;EACrCC,EAAE,CAAC,8FAAD,EAAiG,YAAM;IACxGC,MAAM,CAACN,mBAAmB,CAAC,CAAC,CAAD,GAAK,EAAL,GAAU,IAAX,EAAiB;MAC1CO,OAAO,EAAE,IADiC;MAE1CC,MAAM,EAAE;QAAA,OAAM,EAAN;MAAA;IAFkC,CAAjB,EAGvB;MACFC,GAAG,EAAE,CADH;MAEFC,MAAM,EAAE,KAFN;MAGFC,WAAW,EAAE;IAHX,CAHuB,CAApB,CAAN,CAOIC,EAPJ,CAOOC,KAPP,CAOaZ,QAPb;EAQA,CATC,CAAF;EAWAI,EAAE,CAAC,8BAAD,EAAiC,YAAM;IACxCC,MAAM,CAACN,mBAAmB,CAAC,IAAIc,IAAJ,CAAS,IAAI,EAAJ,GAAS,IAAlB,CAAD,EAA0B;MACnDP,OAAO,EAAE;IAD0C,CAA1B,EAEvB;MACFE,GAAG,EAAE,CADH;MAEFC,MAAM,EAAE,IAFN;MAGFC,WAAW,EAAE,IAHX;MAIFI,QAAQ,EAAE;IAJR,CAFuB,CAApB,CAAN,CAOIH,EAPJ,CAOOC,KAPP,CAOa,IAAI,EAAJ,GAAS,IAAT,GAAgB,CAP7B;EA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AFa,EAEV;MACLZ,GAAG,EAAE,CADA;MAELC,MAAM,EAAE,IAFH;MAGLY,QAAQ,EAAEJ;IAHL,CAFU,CAAhB,CAMGC,MANH,CAMUN,KANV,CAMgB,CANhB,EAnGyC,CA2GzC;IACA;IACA;;IACAX,gBAAgB,CAAC;MAChBK,OAAO,EAAE,EADO;MAEhBS,QAAQ,EAAE;IAFM,CAAD,EAGb,CAHa,EAGV;MACLP,GAAG,EAAE,CADA;MAELC,MAAM,EAAE,KAFH;MAGLY,QAAQ,EAAE;IAHL,CAHU,CAAhB,CAOGH,MAPH,CAOUN,KAPV,CAOgB,KAAK,IAPrB;EAQA,CAtHC,CAAF;AAuHA,CAxHO,CAAR"}
|
|
1
|
+
{"version":3,"file":"getTimeToNextUpdate.test.js","names":["getTimeToNextUpdate","INFINITY","getStepChangesAt","getTimeToStepChange","describe","it","expect","minTime","format","now","future","isFirstStep","to","equal","Date","nextStep","formatAs","be","undefined","should","test","unit","prevStep"],"sources":["../../source/steps/getTimeToNextUpdate.test.js"],"sourcesContent":["import getTimeToNextUpdate, { INFINITY, getStepChangesAt, getTimeToStepChange } from './getTimeToNextUpdate.js'\r\n\r\ndescribe('getTimeToNextUpdate', () => {\r\n\tit('should return infinity when there are no more steps, and it does not format as a unit (past)', () => {\r\n\t\texpect(getTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tminTime: 59.5,\r\n\t\t\tformat: () => ''\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t})).to.equal(INFINITY)\r\n\t})\r\n\r\n\tit('should support date argument', () => {\r\n\t\texpect(getTimeToNextUpdate(new Date(4 * 60 * 1000), {\r\n\t\t\tminTime: 60\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {}\r\n\t\t})).to.equal(3 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should return this step\\'s \"minTime\" timestamp (future)', () => {\r\n\t\texpect(getTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tminTime: 60,\r\n\t\t\tformat: () => ''\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformat: () => ''\r\n\t\t\t}\r\n\t\t})).to.equal(3 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should return undefined when there is a next step and time to next update can not be reliably determined (formatAs) (past)', () => {\r\n\t\texpect(getTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tminTime: 60,\r\n\t\t\tformatAs: 'minute'\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'unknown-time-unit'\r\n\t\t\t}\r\n\t\t})).to.be.undefined\r\n\t})\r\n\r\n\tit('should get time to next update (no next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (no next step) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.5 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should get time to next update (has prev/next step without `minTime`) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\ttest: () => false\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000 + 1)\r\n\t})\r\n\r\n\tit('should get time to next update (has `getTimeToNextUpdate`) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5,\r\n\t\t\tgetTimeToNextUpdate: () => 0.25 * 60 * 1000\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.25 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has `getTimeToNextUpdate`) (future)', () => {\r\n\t\tgetTimeToNextUpdate(4 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5,\r\n\t\t\tgetTimeToNextUpdate: () => 0.25 * 60 * 1000\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(0.25 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has both unit and prev/next steps with `minTime`) (returns time to \"minTime\" of next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-59 * 60 * 1000, {\r\n\t\t\tformatAs: 'minute',\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\tminTime: 59.5 * 60\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (has no unit but has prev/next step with `minTime`) (returns time to \"minTime\" of next step) (past)', () => {\r\n\t\tgetTimeToNextUpdate(-59 * 60 * 1000, {\r\n\t\t\tformat: () => {},\r\n\t\t\tminTime: 59.5\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: true,\r\n\t\t\tnextStep: {\r\n\t\t\t\tformatAs: 'hour',\r\n\t\t\t\tminTime: 59.5 * 60\r\n\t\t\t}\r\n\t\t}).should.equal(0.5 * 60 * 1000)\r\n\t})\r\n\r\n\tit('should get time to next update (will be outside of the first step) (future)', () => {\r\n\t\tgetTimeToNextUpdate(60 * 60 * 1000, {\r\n\t\t\tformatAs: 'hour',\r\n\t\t\tminTime: 60 * 60\r\n\t\t}, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tisFirstStep: true\r\n\t\t}).should.equal(1)\r\n\t})\r\n})\r\n\r\ndescribe('getStepChangesAt', () => {\r\n\tit('should work for \"round\" steps', () => {\r\n\t\t// Future.\r\n\t\t// Is at zero point.\r\n\t\t// No next step.\r\n\t\t// No tickable unit.\r\n\t\t// Doesn't update.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'now'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(INFINITY)\r\n\r\n\t\t// Past.\r\n\t\t// Is at zero point.\r\n\t\t// The next step is seconds.\r\n\t\t// Updates at the next step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'second',\r\n\t\t\tminTime: 1\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(1 * 1000)\r\n\r\n\t\t// Future.\r\n\t\t// Inside the first step.\r\n\t\t// Updates after zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'now'\r\n\t\t}, 0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.9 * 1000 + 1)\r\n\r\n\t\t// Future.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates right after zero point.\r\n\t\tgetTimeToStepChange(undefined, 0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.9 * 1000 + 1)\r\n\r\n\t\t// Past.\r\n\t\t// The current step is `undefined`.\r\n\t\t// The next step is the first step.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Outside of the first step.\r\n\t\t// Updates at entering the first step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 1,\r\n\t\t\tunit: 'second'\r\n\t\t}, -0.9 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(0.1 * 1000)\r\n\r\n\t\t// Future.\r\n\t\t// The first step doesn't start at 0.\r\n\t\t// Will output empty string after it exits the current step.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 1,\r\n\t\t\tunit: 'second'\r\n\t\t}, 1.1 * 1000, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(0.1 * 1000 + 1)\r\n\r\n\t\t// Past.\r\n\t\t// Next step is seconds.\r\n\t\t// The \"next\" step doesn't have `minTime`,\r\n\t\t// so \"time to next update\" couldn't be determined.\r\n\t\texpect(getStepChangesAt({\r\n\t\t\tunit: 'unknown-time-unit'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t})).to.be.undefined\r\n\r\n\t\t// Past.\r\n\t\t// No next step.\r\n\t\t// The last step never changes.\r\n\t\tgetTimeToStepChange(undefined, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tisFirstStep: undefined\r\n\t\t}).should.equal(INFINITY)\r\n\r\n\t\t// Future.\r\n\t\t// Current step is seconds.\r\n\t\t// Updates after zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tunit: 'second'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: true,\r\n\t\t\tprevStep: undefined\r\n\t\t}).should.equal(1)\r\n\r\n\t\t// Past.\r\n\t\t// Next step is minutes.\r\n\t\t// Already at zero point, so no need to update at zero point.\r\n\t\tgetStepChangesAt({\r\n\t\t\tminTime: 60,\r\n\t\t\tformatAs: 'minute'\r\n\t\t}, 0, {\r\n\t\t\tnow: 0,\r\n\t\t\tfuture: false,\r\n\t\t\tprevStep: {}\r\n\t\t}).should.equal(60 * 1000)\r\n\t})\r\n})"],"mappings":"AAAA,OAAOA,mBAAmB,IAAIC,QAAQ,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ,0BAA0B;AAE/GC,QAAQ,CAAC,qBAAqB,EAAE,YAAM;EACrCC,EAAE,CAAC,8FAA8F,EAAE,YAAM;IACxGC,MAAM,CAACN,mBAAmB,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE;MAC1CO,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,SAAAA,OAAA;QAAA,OAAM,EAAE;MAAA;IACjB,CAAC,EAAE;MACFC,GAAG,EAAE,CAAC;MACNC,MAAM,EAAE,KAAK;MACbC,WAAW,EAAE;IACd,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAACZ,QAAQ,CAAC;EACvB,CAAC,CAAC;EAEFI,EAAE,CAAC,8BAA8B,EAAE,YAAM;IACxCC,MAAM,CAACN,mBAAmB,CAAC,IAAIc,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE;MACnDP,OAAO,EAAE;IACV,CAAC,EAAE;MACFE,GAAG,EAAE,CAAC;MACNC,MAAM,EAAE,IAAI;MACZC,WAAW,EAAE,IAAI;MACjBI,QAAQ,EAAE,CA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