javascript-time-ago 2.3.13 → 2.5.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 +5 -0
- package/README.md +1 -1
- package/bin/create-commonjs-package-json.js +11 -0
- package/bin/generate-load-all-locales.js +38 -6
- package/bin/generate-locale-messages.js +106 -21
- 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/cache/index.cjs +2 -0
- package/cache/index.cjs.js +7 -0
- package/cache/index.js +1 -1
- package/cache/package.json +9 -3
- package/commonjs/LocaleDataStore.js +1 -1
- package/commonjs/LocaleDataStore.js.map +1 -1
- package/commonjs/PropTypes.js +26 -18
- package/commonjs/PropTypes.js.map +1 -1
- package/commonjs/TimeAgo.js +41 -48
- package/commonjs/TimeAgo.js.map +1 -1
- package/commonjs/TimeAgo.test.js +70 -70
- package/commonjs/TimeAgo.test.js.map +1 -1
- package/commonjs/cache.js +10 -14
- package/commonjs/cache.js.map +1 -1
- package/commonjs/cache.test.js +3 -3
- package/commonjs/cache.test.js.map +1 -1
- package/commonjs/isStyleObject.js +2 -2
- package/commonjs/isStyleObject.js.map +1 -1
- package/commonjs/isStyleObject.test.js +11 -11
- package/commonjs/isStyleObject.test.js.map +1 -1
- package/commonjs/locale.js +11 -16
- package/commonjs/locale.js.map +1 -1
- package/commonjs/locale.test.js +8 -4
- package/commonjs/locale.test.js.map +1 -1
- package/commonjs/package.json +5 -0
- package/commonjs/round.js +1 -1
- package/commonjs/round.js.map +1 -1
- package/commonjs/steps/approximate.js +3 -3
- package/commonjs/steps/approximate.js.map +1 -1
- package/commonjs/steps/approximate.test.js +5 -5
- package/commonjs/steps/approximate.test.js.map +1 -1
- package/commonjs/steps/getStep.js +10 -8
- package/commonjs/steps/getStep.js.map +1 -1
- package/commonjs/steps/getStep.test.js +16 -16
- package/commonjs/steps/getStep.test.js.map +1 -1
- package/commonjs/steps/getStepDenominator.js +2 -2
- package/commonjs/steps/getStepDenominator.js.map +1 -1
- package/commonjs/steps/getStepDenominator.test.js +4 -4
- package/commonjs/steps/getStepDenominator.test.js.map +1 -1
- package/commonjs/steps/getStepMinTime.js +5 -5
- package/commonjs/steps/getStepMinTime.js.map +1 -1
- package/commonjs/steps/getStepMinTime.test.js +4 -4
- package/commonjs/steps/getStepMinTime.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.js +8 -8
- package/commonjs/steps/getTimeToNextUpdate.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdate.test.js +18 -14
- package/commonjs/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.js +3 -3
- package/commonjs/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js +8 -8
- package/commonjs/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/commonjs/steps/helpers.js.map +1 -1
- package/commonjs/steps/helpers.test.js +1 -1
- package/commonjs/steps/helpers.test.js.map +1 -1
- package/commonjs/steps/index.js +24 -24
- package/commonjs/steps/index.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.js +8 -8
- package/commonjs/steps/renameLegacyProperties.js.map +1 -1
- package/commonjs/steps/renameLegacyProperties.test.js +6 -6
- package/commonjs/steps/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/steps/round.js +2 -2
- package/commonjs/steps/round.js.map +1 -1
- package/commonjs/steps/round.test.js +6 -6
- package/commonjs/steps/round.test.js.map +1 -1
- package/commonjs/steps/units.js +2 -1
- package/commonjs/steps/units.js.map +1 -1
- package/commonjs/style/approximate.js +5 -5
- package/commonjs/style/approximate.js.map +1 -1
- package/commonjs/style/approximateTime.js +5 -5
- package/commonjs/style/approximateTime.js.map +1 -1
- package/commonjs/style/approximateTime.test.js +13 -18
- package/commonjs/style/approximateTime.test.js.map +1 -1
- package/commonjs/style/getStyleByName.js +29 -29
- package/commonjs/style/getStyleByName.js.map +1 -1
- package/commonjs/style/mini.js +2 -2
- package/commonjs/style/mini.js.map +1 -1
- package/commonjs/style/mini.test.js +62 -60
- package/commonjs/style/mini.test.js.map +1 -1
- package/commonjs/style/miniMinute.js +9 -7
- package/commonjs/style/miniMinute.js.map +1 -1
- package/commonjs/style/miniMinute.test.js +30 -28
- package/commonjs/style/miniMinute.test.js.map +1 -1
- package/commonjs/style/miniMinuteNow.js +9 -7
- package/commonjs/style/miniMinuteNow.js.map +1 -1
- package/commonjs/style/miniMinuteNow.test.js +30 -28
- package/commonjs/style/miniMinuteNow.test.js.map +1 -1
- package/commonjs/style/miniNow.js +9 -7
- package/commonjs/style/miniNow.js.map +1 -1
- package/commonjs/style/miniNow.test.js +30 -28
- package/commonjs/style/miniNow.test.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.js +7 -5
- package/commonjs/style/renameLegacyProperties.js.map +1 -1
- package/commonjs/style/renameLegacyProperties.test.js +5 -5
- package/commonjs/style/renameLegacyProperties.test.js.map +1 -1
- package/commonjs/style/round.js +5 -5
- package/commonjs/style/round.js.map +1 -1
- package/commonjs/style/round.test.js +66 -60
- package/commonjs/style/round.test.js.map +1 -1
- package/commonjs/style/roundMinute.js +9 -7
- package/commonjs/style/roundMinute.js.map +1 -1
- package/commonjs/style/roundMinute.test.js +33 -31
- package/commonjs/style/roundMinute.test.js.map +1 -1
- package/commonjs/style/twitter.js +18 -18
- package/commonjs/style/twitter.js.map +1 -1
- package/commonjs/style/twitter.test.js +76 -74
- package/commonjs/style/twitter.test.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.js +11 -9
- package/commonjs/style/twitterFirstMinute.js.map +1 -1
- package/commonjs/style/twitterFirstMinute.test.js +35 -33
- package/commonjs/style/twitterFirstMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinute.js +9 -7
- package/commonjs/style/twitterMinute.js.map +1 -1
- package/commonjs/style/twitterMinute.test.js +36 -34
- package/commonjs/style/twitterMinute.test.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.js +9 -7
- package/commonjs/style/twitterMinuteNow.js.map +1 -1
- package/commonjs/style/twitterMinuteNow.test.js +36 -34
- package/commonjs/style/twitterMinuteNow.test.js.map +1 -1
- package/commonjs/style/twitterNow.js +9 -7
- package/commonjs/style/twitterNow.js.map +1 -1
- package/commonjs/style/twitterNow.test.js +35 -33
- package/commonjs/style/twitterNow.test.js.map +1 -1
- package/gradation/index.cjs +2 -0
- package/gradation/index.cjs.js +7 -0
- package/gradation/index.js +1 -1
- package/gradation/package.json +9 -3
- package/index.cjs +9 -0
- package/index.cjs.js +14 -0
- package/index.d.ts +6 -0
- package/index.js +2 -2
- package/load-all-locales/index.cjs +281 -0
- package/load-all-locales/index.cjs.js +286 -0
- package/load-all-locales/index.js +563 -0
- package/load-all-locales/package.json +18 -0
- package/locale/af/index.cjs +3 -0
- package/locale/af/index.cjs.js +3 -0
- package/locale/af/index.js +1 -3
- package/locale/af/package.json +14 -0
- package/locale/am/index.cjs +3 -0
- package/locale/am/index.cjs.js +3 -0
- package/locale/am/index.js +1 -3
- package/locale/am/package.json +14 -0
- package/locale/ar/index.cjs +3 -0
- package/locale/ar/index.cjs.js +3 -0
- package/locale/ar/index.js +1 -3
- package/locale/ar/package.json +14 -0
- package/locale/ar-AE/index.cjs +3 -0
- package/locale/ar-AE/index.cjs.js +3 -0
- package/locale/ar-AE/index.js +1 -3
- package/locale/ar-AE/package.json +14 -0
- package/locale/as/index.cjs +3 -0
- package/locale/as/index.cjs.js +3 -0
- package/locale/as/index.js +1 -3
- package/locale/as/package.json +14 -0
- package/locale/ast/index.cjs +3 -0
- package/locale/ast/index.cjs.js +3 -0
- package/locale/ast/index.js +1 -3
- package/locale/ast/package.json +14 -0
- package/locale/az/index.cjs +3 -0
- package/locale/az/index.cjs.js +3 -0
- package/locale/az/index.js +1 -3
- package/locale/az/package.json +14 -0
- package/locale/be/index.cjs +3 -0
- package/locale/be/index.cjs.js +3 -0
- package/locale/be/index.js +1 -3
- package/locale/be/package.json +14 -0
- package/locale/bg/index.cjs +3 -0
- package/locale/bg/index.cjs.js +3 -0
- package/locale/bg/index.js +1 -3
- package/locale/bg/package.json +14 -0
- package/locale/bn/index.cjs +3 -0
- package/locale/bn/index.cjs.js +3 -0
- package/locale/bn/index.js +1 -3
- package/locale/bn/package.json +14 -0
- package/locale/br/index.cjs +3 -0
- package/locale/br/index.cjs.js +3 -0
- package/locale/br/index.js +1 -3
- package/locale/br/package.json +14 -0
- package/locale/brx/index.cjs +3 -0
- package/locale/brx/index.cjs.js +3 -0
- package/locale/brx/index.js +1 -0
- package/locale/brx/package.json +14 -0
- package/locale/brx.json +159 -0
- package/locale/bs/index.cjs +3 -0
- package/locale/bs/index.cjs.js +3 -0
- package/locale/bs/index.js +1 -3
- package/locale/bs/package.json +14 -0
- package/locale/bs-Cyrl/index.cjs +3 -0
- package/locale/bs-Cyrl/index.cjs.js +3 -0
- package/locale/bs-Cyrl/index.js +1 -3
- package/locale/bs-Cyrl/package.json +14 -0
- package/locale/ca/index.cjs +3 -0
- package/locale/ca/index.cjs.js +3 -0
- package/locale/ca/index.js +1 -3
- package/locale/ca/package.json +14 -0
- package/locale/ccp/index.cjs +3 -0
- package/locale/ccp/index.cjs.js +3 -0
- package/locale/ccp/index.js +1 -3
- package/locale/ccp/package.json +14 -0
- package/locale/ce/index.cjs +3 -0
- package/locale/ce/index.cjs.js +3 -0
- package/locale/ce/index.js +1 -3
- package/locale/ce/package.json +14 -0
- package/locale/ceb/index.cjs +3 -0
- package/locale/ceb/index.cjs.js +3 -0
- package/locale/ceb/index.js +1 -3
- package/locale/ceb/package.json +14 -0
- package/locale/chr/index.cjs +3 -0
- package/locale/chr/index.cjs.js +3 -0
- package/locale/chr/index.js +1 -3
- package/locale/chr/package.json +14 -0
- package/locale/cs/index.cjs +3 -0
- package/locale/cs/index.cjs.js +3 -0
- package/locale/cs/index.js +1 -3
- package/locale/cs/package.json +14 -0
- package/locale/cy/index.cjs +3 -0
- package/locale/cy/index.cjs.js +3 -0
- package/locale/cy/index.js +1 -3
- package/locale/cy/package.json +14 -0
- package/locale/da/index.cjs +3 -0
- package/locale/da/index.cjs.js +3 -0
- package/locale/da/index.js +1 -3
- package/locale/da/package.json +14 -0
- package/locale/de/index.cjs +3 -0
- package/locale/de/index.cjs.js +3 -0
- package/locale/de/index.js +1 -3
- package/locale/de/package.json +14 -0
- package/locale/dsb/index.cjs +3 -0
- package/locale/dsb/index.cjs.js +3 -0
- package/locale/dsb/index.js +1 -3
- package/locale/dsb/package.json +14 -0
- package/locale/dz/index.cjs +3 -0
- package/locale/dz/index.cjs.js +3 -0
- package/locale/dz/index.js +1 -3
- package/locale/dz/package.json +14 -0
- package/locale/ee/index.cjs +3 -0
- package/locale/ee/index.cjs.js +3 -0
- package/locale/ee/index.js +1 -3
- package/locale/ee/package.json +14 -0
- package/locale/el/index.cjs +3 -0
- package/locale/el/index.cjs.js +3 -0
- package/locale/el/index.js +1 -3
- package/locale/el/package.json +14 -0
- package/locale/en/index.cjs +3 -0
- package/locale/en/index.cjs.js +3 -0
- package/locale/en/index.js +1 -3
- package/locale/en/package.json +14 -0
- package/locale/en-001/index.cjs +3 -0
- package/locale/en-001/index.cjs.js +3 -0
- package/locale/en-001/index.js +1 -3
- package/locale/en-001/package.json +14 -0
- package/locale/en-150/index.cjs +3 -0
- package/locale/en-150/index.cjs.js +3 -0
- package/locale/en-150/index.js +1 -3
- package/locale/en-150/package.json +14 -0
- package/locale/en-AG/index.cjs +3 -0
- package/locale/en-AG/index.cjs.js +3 -0
- package/locale/en-AG/index.js +1 -3
- package/locale/en-AG/package.json +14 -0
- package/locale/en-AI/index.cjs +3 -0
- package/locale/en-AI/index.cjs.js +3 -0
- package/locale/en-AI/index.js +1 -3
- package/locale/en-AI/package.json +14 -0
- package/locale/en-AT/index.cjs +3 -0
- package/locale/en-AT/index.cjs.js +3 -0
- package/locale/en-AT/index.js +1 -3
- package/locale/en-AT/package.json +14 -0
- package/locale/en-AU/index.cjs +3 -0
- package/locale/en-AU/index.cjs.js +3 -0
- package/locale/en-AU/index.js +1 -3
- package/locale/en-AU/package.json +14 -0
- package/locale/en-BB/index.cjs +3 -0
- package/locale/en-BB/index.cjs.js +3 -0
- package/locale/en-BB/index.js +1 -3
- package/locale/en-BB/package.json +14 -0
- package/locale/en-BE/index.cjs +3 -0
- package/locale/en-BE/index.cjs.js +3 -0
- package/locale/en-BE/index.js +1 -3
- package/locale/en-BE/package.json +14 -0
- package/locale/en-BM/index.cjs +3 -0
- package/locale/en-BM/index.cjs.js +3 -0
- package/locale/en-BM/index.js +1 -3
- package/locale/en-BM/package.json +14 -0
- package/locale/en-BS/index.cjs +3 -0
- package/locale/en-BS/index.cjs.js +3 -0
- package/locale/en-BS/index.js +1 -3
- package/locale/en-BS/package.json +14 -0
- package/locale/en-BW/index.cjs +3 -0
- package/locale/en-BW/index.cjs.js +3 -0
- package/locale/en-BW/index.js +1 -3
- package/locale/en-BW/package.json +14 -0
- package/locale/en-BZ/index.cjs +3 -0
- package/locale/en-BZ/index.cjs.js +3 -0
- package/locale/en-BZ/index.js +1 -3
- package/locale/en-BZ/package.json +14 -0
- package/locale/en-CA/index.cjs +3 -0
- package/locale/en-CA/index.cjs.js +3 -0
- package/locale/en-CA/index.js +1 -3
- package/locale/en-CA/package.json +14 -0
- package/locale/en-CC/index.cjs +3 -0
- package/locale/en-CC/index.cjs.js +3 -0
- package/locale/en-CC/index.js +1 -3
- package/locale/en-CC/package.json +14 -0
- package/locale/en-CH/index.cjs +3 -0
- package/locale/en-CH/index.cjs.js +3 -0
- package/locale/en-CH/index.js +1 -3
- package/locale/en-CH/package.json +14 -0
- package/locale/en-CK/index.cjs +3 -0
- package/locale/en-CK/index.cjs.js +3 -0
- package/locale/en-CK/index.js +1 -3
- package/locale/en-CK/package.json +14 -0
- package/locale/en-CM/index.cjs +3 -0
- package/locale/en-CM/index.cjs.js +3 -0
- package/locale/en-CM/index.js +1 -3
- package/locale/en-CM/package.json +14 -0
- package/locale/en-CX/index.cjs +3 -0
- package/locale/en-CX/index.cjs.js +3 -0
- package/locale/en-CX/index.js +1 -3
- package/locale/en-CX/package.json +14 -0
- package/locale/en-CY/index.cjs +3 -0
- package/locale/en-CY/index.cjs.js +3 -0
- package/locale/en-CY/index.js +1 -3
- package/locale/en-CY/package.json +14 -0
- package/locale/en-DE/index.cjs +3 -0
- package/locale/en-DE/index.cjs.js +3 -0
- package/locale/en-DE/index.js +1 -3
- package/locale/en-DE/package.json +14 -0
- package/locale/en-DG/index.cjs +3 -0
- package/locale/en-DG/index.cjs.js +3 -0
- package/locale/en-DG/index.js +1 -3
- package/locale/en-DG/package.json +14 -0
- package/locale/en-DK/index.cjs +3 -0
- package/locale/en-DK/index.cjs.js +3 -0
- package/locale/en-DK/index.js +1 -3
- package/locale/en-DK/package.json +14 -0
- package/locale/en-DM/index.cjs +3 -0
- package/locale/en-DM/index.cjs.js +3 -0
- package/locale/en-DM/index.js +1 -3
- package/locale/en-DM/package.json +14 -0
- package/locale/en-ER/index.cjs +3 -0
- package/locale/en-ER/index.cjs.js +3 -0
- package/locale/en-ER/index.js +1 -3
- package/locale/en-ER/package.json +14 -0
- package/locale/en-FI/index.cjs +3 -0
- package/locale/en-FI/index.cjs.js +3 -0
- package/locale/en-FI/index.js +1 -3
- package/locale/en-FI/package.json +14 -0
- package/locale/en-FJ/index.cjs +3 -0
- package/locale/en-FJ/index.cjs.js +3 -0
- package/locale/en-FJ/index.js +1 -3
- package/locale/en-FJ/package.json +14 -0
- package/locale/en-FK/index.cjs +3 -0
- package/locale/en-FK/index.cjs.js +3 -0
- package/locale/en-FK/index.js +1 -3
- package/locale/en-FK/package.json +14 -0
- package/locale/en-FM/index.cjs +3 -0
- package/locale/en-FM/index.cjs.js +3 -0
- package/locale/en-FM/index.js +1 -3
- package/locale/en-FM/package.json +14 -0
- package/locale/en-GB/index.cjs +3 -0
- package/locale/en-GB/index.cjs.js +3 -0
- package/locale/en-GB/index.js +1 -3
- package/locale/en-GB/package.json +14 -0
- package/locale/en-GD/index.cjs +3 -0
- package/locale/en-GD/index.cjs.js +3 -0
- package/locale/en-GD/index.js +1 -3
- package/locale/en-GD/package.json +14 -0
- package/locale/en-GG/index.cjs +3 -0
- package/locale/en-GG/index.cjs.js +3 -0
- package/locale/en-GG/index.js +1 -3
- package/locale/en-GG/package.json +14 -0
- package/locale/en-GH/index.cjs +3 -0
- package/locale/en-GH/index.cjs.js +3 -0
- package/locale/en-GH/index.js +1 -3
- package/locale/en-GH/package.json +14 -0
- package/locale/en-GI/index.cjs +3 -0
- package/locale/en-GI/index.cjs.js +3 -0
- package/locale/en-GI/index.js +1 -3
- package/locale/en-GI/package.json +14 -0
- package/locale/en-GM/index.cjs +3 -0
- package/locale/en-GM/index.cjs.js +3 -0
- package/locale/en-GM/index.js +1 -3
- package/locale/en-GM/package.json +14 -0
- package/locale/en-GY/index.cjs +3 -0
- package/locale/en-GY/index.cjs.js +3 -0
- package/locale/en-GY/index.js +1 -3
- package/locale/en-GY/package.json +14 -0
- package/locale/en-HK/index.cjs +3 -0
- package/locale/en-HK/index.cjs.js +3 -0
- package/locale/en-HK/index.js +1 -3
- package/locale/en-HK/package.json +14 -0
- package/locale/en-IE/index.cjs +3 -0
- package/locale/en-IE/index.cjs.js +3 -0
- package/locale/en-IE/index.js +1 -3
- package/locale/en-IE/package.json +14 -0
- package/locale/en-IL/index.cjs +3 -0
- package/locale/en-IL/index.cjs.js +3 -0
- package/locale/en-IL/index.js +1 -3
- package/locale/en-IL/package.json +14 -0
- package/locale/en-IM/index.cjs +3 -0
- package/locale/en-IM/index.cjs.js +3 -0
- package/locale/en-IM/index.js +1 -3
- package/locale/en-IM/package.json +14 -0
- package/locale/en-IN/index.cjs +3 -0
- package/locale/en-IN/index.cjs.js +3 -0
- package/locale/en-IN/index.js +1 -3
- package/locale/en-IN/package.json +14 -0
- package/locale/en-IO/index.cjs +3 -0
- package/locale/en-IO/index.cjs.js +3 -0
- package/locale/en-IO/index.js +1 -3
- package/locale/en-IO/package.json +14 -0
- package/locale/en-JE/index.cjs +3 -0
- package/locale/en-JE/index.cjs.js +3 -0
- package/locale/en-JE/index.js +1 -3
- package/locale/en-JE/package.json +14 -0
- package/locale/en-JM/index.cjs +3 -0
- package/locale/en-JM/index.cjs.js +3 -0
- package/locale/en-JM/index.js +1 -3
- package/locale/en-JM/package.json +14 -0
- package/locale/en-KE/index.cjs +3 -0
- package/locale/en-KE/index.cjs.js +3 -0
- package/locale/en-KE/index.js +1 -3
- package/locale/en-KE/package.json +14 -0
- package/locale/en-KI/index.cjs +3 -0
- package/locale/en-KI/index.cjs.js +3 -0
- package/locale/en-KI/index.js +1 -3
- package/locale/en-KI/package.json +14 -0
- package/locale/en-KN/index.cjs +3 -0
- package/locale/en-KN/index.cjs.js +3 -0
- package/locale/en-KN/index.js +1 -3
- package/locale/en-KN/package.json +14 -0
- package/locale/en-KY/index.cjs +3 -0
- package/locale/en-KY/index.cjs.js +3 -0
- package/locale/en-KY/index.js +1 -3
- package/locale/en-KY/package.json +14 -0
- package/locale/en-LC/index.cjs +3 -0
- package/locale/en-LC/index.cjs.js +3 -0
- package/locale/en-LC/index.js +1 -3
- package/locale/en-LC/package.json +14 -0
- package/locale/en-LR/index.cjs +3 -0
- package/locale/en-LR/index.cjs.js +3 -0
- package/locale/en-LR/index.js +1 -3
- package/locale/en-LR/package.json +14 -0
- package/locale/en-LS/index.cjs +3 -0
- package/locale/en-LS/index.cjs.js +3 -0
- package/locale/en-LS/index.js +1 -3
- package/locale/en-LS/package.json +14 -0
- package/locale/en-MG/index.cjs +3 -0
- package/locale/en-MG/index.cjs.js +3 -0
- package/locale/en-MG/index.js +1 -3
- package/locale/en-MG/package.json +14 -0
- package/locale/en-MO/index.cjs +3 -0
- package/locale/en-MO/index.cjs.js +3 -0
- package/locale/en-MO/index.js +1 -3
- package/locale/en-MO/package.json +14 -0
- package/locale/en-MS/index.cjs +3 -0
- package/locale/en-MS/index.cjs.js +3 -0
- package/locale/en-MS/index.js +1 -3
- package/locale/en-MS/package.json +14 -0
- package/locale/en-MT/index.cjs +3 -0
- package/locale/en-MT/index.cjs.js +3 -0
- package/locale/en-MT/index.js +1 -3
- package/locale/en-MT/package.json +14 -0
- package/locale/en-MU/index.cjs +3 -0
- package/locale/en-MU/index.cjs.js +3 -0
- package/locale/en-MU/index.js +1 -3
- package/locale/en-MU/package.json +14 -0
- package/locale/en-MV/index.cjs +3 -0
- package/locale/en-MV/index.cjs.js +3 -0
- package/locale/en-MV/index.js +1 -0
- package/locale/en-MV/package.json +14 -0
- package/locale/en-MV.json +219 -0
- package/locale/en-MW/index.cjs +3 -0
- package/locale/en-MW/index.cjs.js +3 -0
- package/locale/en-MW/index.js +1 -3
- package/locale/en-MW/package.json +14 -0
- package/locale/en-MY/index.cjs +3 -0
- package/locale/en-MY/index.cjs.js +3 -0
- package/locale/en-MY/index.js +1 -3
- package/locale/en-MY/package.json +14 -0
- package/locale/en-NA/index.cjs +3 -0
- package/locale/en-NA/index.cjs.js +3 -0
- package/locale/en-NA/index.js +1 -3
- package/locale/en-NA/package.json +14 -0
- package/locale/en-NF/index.cjs +3 -0
- package/locale/en-NF/index.cjs.js +3 -0
- package/locale/en-NF/index.js +1 -3
- package/locale/en-NF/package.json +14 -0
- package/locale/en-NG/index.cjs +3 -0
- package/locale/en-NG/index.cjs.js +3 -0
- package/locale/en-NG/index.js +1 -3
- package/locale/en-NG/package.json +14 -0
- package/locale/en-NL/index.cjs +3 -0
- package/locale/en-NL/index.cjs.js +3 -0
- package/locale/en-NL/index.js +1 -3
- package/locale/en-NL/package.json +14 -0
- package/locale/en-NR/index.cjs +3 -0
- package/locale/en-NR/index.cjs.js +3 -0
- package/locale/en-NR/index.js +1 -3
- package/locale/en-NR/package.json +14 -0
- package/locale/en-NU/index.cjs +3 -0
- package/locale/en-NU/index.cjs.js +3 -0
- package/locale/en-NU/index.js +1 -3
- package/locale/en-NU/package.json +14 -0
- package/locale/en-NZ/index.cjs +3 -0
- package/locale/en-NZ/index.cjs.js +3 -0
- package/locale/en-NZ/index.js +1 -3
- package/locale/en-NZ/package.json +14 -0
- package/locale/en-PG/index.cjs +3 -0
- package/locale/en-PG/index.cjs.js +3 -0
- package/locale/en-PG/index.js +1 -3
- package/locale/en-PG/package.json +14 -0
- package/locale/en-PK/index.cjs +3 -0
- package/locale/en-PK/index.cjs.js +3 -0
- package/locale/en-PK/index.js +1 -3
- package/locale/en-PK/package.json +14 -0
- package/locale/en-PN/index.cjs +3 -0
- package/locale/en-PN/index.cjs.js +3 -0
- package/locale/en-PN/index.js +1 -3
- package/locale/en-PN/package.json +14 -0
- package/locale/en-PW/index.cjs +3 -0
- package/locale/en-PW/index.cjs.js +3 -0
- package/locale/en-PW/index.js +1 -3
- package/locale/en-PW/package.json +14 -0
- package/locale/en-RW/index.cjs +3 -0
- package/locale/en-RW/index.cjs.js +3 -0
- package/locale/en-RW/index.js +1 -3
- package/locale/en-RW/package.json +14 -0
- package/locale/en-SB/index.cjs +3 -0
- package/locale/en-SB/index.cjs.js +3 -0
- package/locale/en-SB/index.js +1 -3
- package/locale/en-SB/package.json +14 -0
- package/locale/en-SC/index.cjs +3 -0
- package/locale/en-SC/index.cjs.js +3 -0
- package/locale/en-SC/index.js +1 -3
- package/locale/en-SC/package.json +14 -0
- package/locale/en-SD/index.cjs +3 -0
- package/locale/en-SD/index.cjs.js +3 -0
- package/locale/en-SD/index.js +1 -3
- package/locale/en-SD/package.json +14 -0
- package/locale/en-SE/index.cjs +3 -0
- package/locale/en-SE/index.cjs.js +3 -0
- package/locale/en-SE/index.js +1 -3
- package/locale/en-SE/package.json +14 -0
- package/locale/en-SG/index.cjs +3 -0
- package/locale/en-SG/index.cjs.js +3 -0
- package/locale/en-SG/index.js +1 -3
- package/locale/en-SG/package.json +14 -0
- package/locale/en-SH/index.cjs +3 -0
- package/locale/en-SH/index.cjs.js +3 -0
- package/locale/en-SH/index.js +1 -3
- package/locale/en-SH/package.json +14 -0
- package/locale/en-SI/index.cjs +3 -0
- package/locale/en-SI/index.cjs.js +3 -0
- package/locale/en-SI/index.js +1 -3
- package/locale/en-SI/package.json +14 -0
- package/locale/en-SL/index.cjs +3 -0
- package/locale/en-SL/index.cjs.js +3 -0
- package/locale/en-SL/index.js +1 -3
- package/locale/en-SL/package.json +14 -0
- package/locale/en-SS/index.cjs +3 -0
- package/locale/en-SS/index.cjs.js +3 -0
- package/locale/en-SS/index.js +1 -3
- package/locale/en-SS/package.json +14 -0
- package/locale/en-SX/index.cjs +3 -0
- package/locale/en-SX/index.cjs.js +3 -0
- package/locale/en-SX/index.js +1 -3
- package/locale/en-SX/package.json +14 -0
- package/locale/en-SZ/index.cjs +3 -0
- package/locale/en-SZ/index.cjs.js +3 -0
- package/locale/en-SZ/index.js +1 -3
- package/locale/en-SZ/package.json +14 -0
- package/locale/en-TC/index.cjs +3 -0
- package/locale/en-TC/index.cjs.js +3 -0
- package/locale/en-TC/index.js +1 -3
- package/locale/en-TC/package.json +14 -0
- package/locale/en-TK/index.cjs +3 -0
- package/locale/en-TK/index.cjs.js +3 -0
- package/locale/en-TK/index.js +1 -3
- package/locale/en-TK/package.json +14 -0
- package/locale/en-TO/index.cjs +3 -0
- package/locale/en-TO/index.cjs.js +3 -0
- package/locale/en-TO/index.js +1 -3
- package/locale/en-TO/package.json +14 -0
- package/locale/en-TT/index.cjs +3 -0
- package/locale/en-TT/index.cjs.js +3 -0
- package/locale/en-TT/index.js +1 -3
- package/locale/en-TT/package.json +14 -0
- package/locale/en-TV/index.cjs +3 -0
- package/locale/en-TV/index.cjs.js +3 -0
- package/locale/en-TV/index.js +1 -3
- package/locale/en-TV/package.json +14 -0
- package/locale/en-TZ/index.cjs +3 -0
- package/locale/en-TZ/index.cjs.js +3 -0
- package/locale/en-TZ/index.js +1 -3
- package/locale/en-TZ/package.json +14 -0
- package/locale/en-UG/index.cjs +3 -0
- package/locale/en-UG/index.cjs.js +3 -0
- package/locale/en-UG/index.js +1 -3
- package/locale/en-UG/package.json +14 -0
- package/locale/en-VC/index.cjs +3 -0
- package/locale/en-VC/index.cjs.js +3 -0
- package/locale/en-VC/index.js +1 -3
- package/locale/en-VC/package.json +14 -0
- package/locale/en-VG/index.cjs +3 -0
- package/locale/en-VG/index.cjs.js +3 -0
- package/locale/en-VG/index.js +1 -3
- package/locale/en-VG/package.json +14 -0
- package/locale/en-VU/index.cjs +3 -0
- package/locale/en-VU/index.cjs.js +3 -0
- package/locale/en-VU/index.js +1 -3
- package/locale/en-VU/package.json +14 -0
- package/locale/en-WS/index.cjs +3 -0
- package/locale/en-WS/index.cjs.js +3 -0
- package/locale/en-WS/index.js +1 -3
- package/locale/en-WS/package.json +14 -0
- package/locale/en-ZA/index.cjs +3 -0
- package/locale/en-ZA/index.cjs.js +3 -0
- package/locale/en-ZA/index.js +1 -3
- package/locale/en-ZA/package.json +14 -0
- package/locale/en-ZM/index.cjs +3 -0
- package/locale/en-ZM/index.cjs.js +3 -0
- package/locale/en-ZM/index.js +1 -3
- package/locale/en-ZM/package.json +14 -0
- package/locale/en-ZW/index.cjs +3 -0
- package/locale/en-ZW/index.cjs.js +3 -0
- package/locale/en-ZW/index.js +1 -3
- package/locale/en-ZW/package.json +14 -0
- package/locale/es/index.cjs +3 -0
- package/locale/es/index.cjs.js +3 -0
- package/locale/es/index.js +1 -3
- package/locale/es/package.json +14 -0
- package/locale/es-419/index.cjs +3 -0
- package/locale/es-419/index.cjs.js +3 -0
- package/locale/es-419/index.js +1 -3
- package/locale/es-419/package.json +14 -0
- package/locale/es-AR/index.cjs +3 -0
- package/locale/es-AR/index.cjs.js +3 -0
- package/locale/es-AR/index.js +1 -3
- package/locale/es-AR/package.json +14 -0
- package/locale/es-BO/index.cjs +3 -0
- package/locale/es-BO/index.cjs.js +3 -0
- package/locale/es-BO/index.js +1 -3
- package/locale/es-BO/package.json +14 -0
- package/locale/es-BR/index.cjs +3 -0
- package/locale/es-BR/index.cjs.js +3 -0
- package/locale/es-BR/index.js +1 -3
- package/locale/es-BR/package.json +14 -0
- package/locale/es-BZ/index.cjs +3 -0
- package/locale/es-BZ/index.cjs.js +3 -0
- package/locale/es-BZ/index.js +1 -3
- package/locale/es-BZ/package.json +14 -0
- package/locale/es-CL/index.cjs +3 -0
- package/locale/es-CL/index.cjs.js +3 -0
- package/locale/es-CL/index.js +1 -3
- package/locale/es-CL/package.json +14 -0
- package/locale/es-CO/index.cjs +3 -0
- package/locale/es-CO/index.cjs.js +3 -0
- package/locale/es-CO/index.js +1 -3
- package/locale/es-CO/package.json +14 -0
- package/locale/es-CR/index.cjs +3 -0
- package/locale/es-CR/index.cjs.js +3 -0
- package/locale/es-CR/index.js +1 -3
- package/locale/es-CR/package.json +14 -0
- package/locale/es-CU/index.cjs +3 -0
- package/locale/es-CU/index.cjs.js +3 -0
- package/locale/es-CU/index.js +1 -3
- package/locale/es-CU/package.json +14 -0
- package/locale/es-DO/index.cjs +3 -0
- package/locale/es-DO/index.cjs.js +3 -0
- package/locale/es-DO/index.js +1 -3
- package/locale/es-DO/package.json +14 -0
- package/locale/es-EC/index.cjs +3 -0
- package/locale/es-EC/index.cjs.js +3 -0
- package/locale/es-EC/index.js +1 -3
- package/locale/es-EC/package.json +14 -0
- package/locale/es-GT/index.cjs +3 -0
- package/locale/es-GT/index.cjs.js +3 -0
- package/locale/es-GT/index.js +1 -3
- package/locale/es-GT/package.json +14 -0
- package/locale/es-HN/index.cjs +3 -0
- package/locale/es-HN/index.cjs.js +3 -0
- package/locale/es-HN/index.js +1 -3
- package/locale/es-HN/package.json +14 -0
- package/locale/es-MX/index.cjs +3 -0
- package/locale/es-MX/index.cjs.js +3 -0
- package/locale/es-MX/index.js +1 -3
- package/locale/es-MX/package.json +14 -0
- package/locale/es-NI/index.cjs +3 -0
- package/locale/es-NI/index.cjs.js +3 -0
- package/locale/es-NI/index.js +1 -3
- package/locale/es-NI/package.json +14 -0
- package/locale/es-PA/index.cjs +3 -0
- package/locale/es-PA/index.cjs.js +3 -0
- package/locale/es-PA/index.js +1 -3
- package/locale/es-PA/package.json +14 -0
- package/locale/es-PE/index.cjs +3 -0
- package/locale/es-PE/index.cjs.js +3 -0
- package/locale/es-PE/index.js +1 -3
- package/locale/es-PE/package.json +14 -0
- package/locale/es-PR/index.cjs +3 -0
- package/locale/es-PR/index.cjs.js +3 -0
- package/locale/es-PR/index.js +1 -3
- package/locale/es-PR/package.json +14 -0
- package/locale/es-PY/index.cjs +3 -0
- package/locale/es-PY/index.cjs.js +3 -0
- package/locale/es-PY/index.js +1 -3
- package/locale/es-PY/package.json +14 -0
- package/locale/es-SV/index.cjs +3 -0
- package/locale/es-SV/index.cjs.js +3 -0
- package/locale/es-SV/index.js +1 -3
- package/locale/es-SV/package.json +14 -0
- package/locale/es-US/index.cjs +3 -0
- package/locale/es-US/index.cjs.js +3 -0
- package/locale/es-US/index.js +1 -3
- package/locale/es-US/package.json +14 -0
- package/locale/es-UY/index.cjs +3 -0
- package/locale/es-UY/index.cjs.js +3 -0
- package/locale/es-UY/index.js +1 -3
- package/locale/es-UY/package.json +14 -0
- package/locale/es-VE/index.cjs +3 -0
- package/locale/es-VE/index.cjs.js +3 -0
- package/locale/es-VE/index.js +1 -3
- package/locale/es-VE/package.json +14 -0
- package/locale/et/index.cjs +3 -0
- package/locale/et/index.cjs.js +3 -0
- package/locale/et/index.js +1 -3
- package/locale/et/package.json +14 -0
- package/locale/eu/index.cjs +3 -0
- package/locale/eu/index.cjs.js +3 -0
- package/locale/eu/index.js +1 -3
- package/locale/eu/package.json +14 -0
- package/locale/fa/index.cjs +3 -0
- package/locale/fa/index.cjs.js +3 -0
- package/locale/fa/index.js +1 -3
- package/locale/fa/package.json +14 -0
- package/locale/ff-Adlm/index.cjs +3 -0
- package/locale/ff-Adlm/index.cjs.js +3 -0
- package/locale/ff-Adlm/index.js +1 -3
- package/locale/ff-Adlm/package.json +14 -0
- package/locale/fi/index.cjs +3 -0
- package/locale/fi/index.cjs.js +3 -0
- package/locale/fi/index.js +1 -3
- package/locale/fi/package.json +14 -0
- package/locale/fil/index.cjs +3 -0
- package/locale/fil/index.cjs.js +3 -0
- package/locale/fil/index.js +1 -3
- package/locale/fil/package.json +14 -0
- package/locale/fo/index.cjs +3 -0
- package/locale/fo/index.cjs.js +3 -0
- package/locale/fo/index.js +1 -3
- package/locale/fo/package.json +14 -0
- package/locale/fr/index.cjs +3 -0
- package/locale/fr/index.cjs.js +3 -0
- package/locale/fr/index.js +1 -3
- package/locale/fr/package.json +14 -0
- package/locale/fr-CA/index.cjs +3 -0
- package/locale/fr-CA/index.cjs.js +3 -0
- package/locale/fr-CA/index.js +1 -3
- package/locale/fr-CA/package.json +14 -0
- package/locale/fur/index.cjs +3 -0
- package/locale/fur/index.cjs.js +3 -0
- package/locale/fur/index.js +1 -3
- package/locale/fur/package.json +14 -0
- package/locale/fy/index.cjs +3 -0
- package/locale/fy/index.cjs.js +3 -0
- package/locale/fy/index.js +1 -3
- package/locale/fy/package.json +14 -0
- package/locale/ga/index.cjs +3 -0
- package/locale/ga/index.cjs.js +3 -0
- package/locale/ga/index.js +1 -3
- package/locale/ga/package.json +14 -0
- package/locale/gd/index.cjs +3 -0
- package/locale/gd/index.cjs.js +3 -0
- package/locale/gd/index.js +1 -3
- package/locale/gd/package.json +14 -0
- package/locale/gl/index.cjs +3 -0
- package/locale/gl/index.cjs.js +3 -0
- package/locale/gl/index.js +1 -3
- package/locale/gl/package.json +14 -0
- package/locale/gu/index.cjs +3 -0
- package/locale/gu/index.cjs.js +3 -0
- package/locale/gu/index.js +1 -3
- package/locale/gu/package.json +14 -0
- package/locale/ha/index.cjs +3 -0
- package/locale/ha/index.cjs.js +3 -0
- package/locale/ha/index.js +1 -3
- package/locale/ha/package.json +14 -0
- package/locale/he/index.cjs +3 -0
- package/locale/he/index.cjs.js +3 -0
- package/locale/he/index.js +1 -3
- package/locale/he/package.json +14 -0
- package/locale/hi/index.cjs +3 -0
- package/locale/hi/index.cjs.js +3 -0
- package/locale/hi/index.js +1 -3
- package/locale/hi/package.json +14 -0
- package/locale/hi-Latn/index.cjs +3 -0
- package/locale/hi-Latn/index.cjs.js +3 -0
- package/locale/hi-Latn/index.js +1 -0
- package/locale/hi-Latn/package.json +14 -0
- package/locale/hi-Latn.json +183 -0
- package/locale/hr/index.cjs +3 -0
- package/locale/hr/index.cjs.js +3 -0
- package/locale/hr/index.js +1 -3
- package/locale/hr/package.json +14 -0
- package/locale/hsb/index.cjs +3 -0
- package/locale/hsb/index.cjs.js +3 -0
- package/locale/hsb/index.js +1 -3
- package/locale/hsb/package.json +14 -0
- package/locale/hu/index.cjs +3 -0
- package/locale/hu/index.cjs.js +3 -0
- package/locale/hu/index.js +1 -3
- package/locale/hu/package.json +14 -0
- package/locale/hy/index.cjs +3 -0
- package/locale/hy/index.cjs.js +3 -0
- package/locale/hy/index.js +1 -3
- package/locale/hy/package.json +14 -0
- package/locale/ia/index.cjs +3 -0
- package/locale/ia/index.cjs.js +3 -0
- package/locale/ia/index.js +1 -3
- package/locale/ia/package.json +14 -0
- package/locale/id/index.cjs +3 -0
- package/locale/id/index.cjs.js +3 -0
- package/locale/id/index.js +1 -3
- package/locale/id/package.json +14 -0
- package/locale/ig/index.cjs +3 -0
- package/locale/ig/index.cjs.js +3 -0
- package/locale/ig/index.js +1 -3
- package/locale/ig/package.json +14 -0
- package/locale/is/index.cjs +3 -0
- package/locale/is/index.cjs.js +3 -0
- package/locale/is/index.js +1 -3
- package/locale/is/package.json +14 -0
- package/locale/it/index.cjs +3 -0
- package/locale/it/index.cjs.js +3 -0
- package/locale/it/index.js +1 -3
- package/locale/it/package.json +14 -0
- package/locale/ja/index.cjs +3 -0
- package/locale/ja/index.cjs.js +3 -0
- package/locale/ja/index.js +1 -3
- package/locale/ja/package.json +14 -0
- package/locale/jgo/index.cjs +3 -0
- package/locale/jgo/index.cjs.js +3 -0
- package/locale/jgo/index.js +1 -3
- package/locale/jgo/package.json +14 -0
- package/locale/jv/index.cjs +3 -0
- package/locale/jv/index.cjs.js +3 -0
- package/locale/jv/index.js +1 -3
- package/locale/jv/package.json +14 -0
- package/locale/ka/index.cjs +3 -0
- package/locale/ka/index.cjs.js +3 -0
- package/locale/ka/index.js +1 -3
- package/locale/ka/package.json +14 -0
- package/locale/kea/index.cjs +3 -0
- package/locale/kea/index.cjs.js +3 -0
- package/locale/kea/index.js +1 -3
- package/locale/kea/package.json +14 -0
- package/locale/kgp/index.cjs +3 -0
- package/locale/kgp/index.cjs.js +3 -0
- package/locale/kgp/index.js +1 -3
- package/locale/kgp/package.json +14 -0
- package/locale/kk/index.cjs +3 -0
- package/locale/kk/index.cjs.js +3 -0
- package/locale/kk/index.js +1 -3
- package/locale/kk/package.json +14 -0
- package/locale/kl/index.cjs +3 -0
- package/locale/kl/index.cjs.js +3 -0
- package/locale/kl/index.js +1 -3
- package/locale/kl/package.json +14 -0
- package/locale/km/index.cjs +3 -0
- package/locale/km/index.cjs.js +3 -0
- package/locale/km/index.js +1 -3
- package/locale/km/package.json +14 -0
- package/locale/kn/index.cjs +3 -0
- package/locale/kn/index.cjs.js +3 -0
- package/locale/kn/index.js +1 -3
- package/locale/kn/package.json +14 -0
- package/locale/ko/index.cjs +3 -0
- package/locale/ko/index.cjs.js +3 -0
- package/locale/ko/index.js +1 -3
- package/locale/ko/package.json +14 -0
- package/locale/kok/index.cjs +3 -0
- package/locale/kok/index.cjs.js +3 -0
- package/locale/kok/index.js +1 -3
- package/locale/kok/package.json +14 -0
- package/locale/ksh/index.cjs +3 -0
- package/locale/ksh/index.cjs.js +3 -0
- package/locale/ksh/index.js +1 -3
- package/locale/ksh/package.json +14 -0
- package/locale/ku/index.cjs +3 -0
- package/locale/ku/index.cjs.js +3 -0
- package/locale/ku/index.js +1 -3
- package/locale/ku/package.json +14 -0
- package/locale/ky/index.cjs +3 -0
- package/locale/ky/index.cjs.js +3 -0
- package/locale/ky/index.js +1 -3
- package/locale/ky/package.json +14 -0
- package/locale/lb/index.cjs +3 -0
- package/locale/lb/index.cjs.js +3 -0
- package/locale/lb/index.js +1 -3
- package/locale/lb/package.json +14 -0
- package/locale/lkt/index.cjs +3 -0
- package/locale/lkt/index.cjs.js +3 -0
- package/locale/lkt/index.js +1 -3
- package/locale/lkt/package.json +14 -0
- package/locale/lo/index.cjs +3 -0
- package/locale/lo/index.cjs.js +3 -0
- package/locale/lo/index.js +1 -3
- package/locale/lo/package.json +14 -0
- package/locale/lt/index.cjs +3 -0
- package/locale/lt/index.cjs.js +3 -0
- package/locale/lt/index.js +1 -3
- package/locale/lt/package.json +14 -0
- package/locale/lv/index.cjs +3 -0
- package/locale/lv/index.cjs.js +3 -0
- package/locale/lv/index.js +1 -3
- package/locale/lv/package.json +14 -0
- package/locale/mk/index.cjs +3 -0
- package/locale/mk/index.cjs.js +3 -0
- package/locale/mk/index.js +1 -3
- package/locale/mk/package.json +14 -0
- package/locale/ml/index.cjs +3 -0
- package/locale/ml/index.cjs.js +3 -0
- package/locale/ml/index.js +1 -3
- package/locale/ml/package.json +14 -0
- package/locale/mn/index.cjs +3 -0
- package/locale/mn/index.cjs.js +3 -0
- package/locale/mn/index.js +1 -3
- package/locale/mn/package.json +14 -0
- package/locale/mni/index.cjs +3 -0
- package/locale/mni/index.cjs.js +3 -0
- package/locale/mni/index.js +1 -3
- package/locale/mni/package.json +14 -0
- package/locale/mr/index.cjs +3 -0
- package/locale/mr/index.cjs.js +3 -0
- package/locale/mr/index.js +1 -3
- package/locale/mr/package.json +14 -0
- package/locale/ms/index.cjs +3 -0
- package/locale/ms/index.cjs.js +3 -0
- package/locale/ms/index.js +1 -3
- package/locale/ms/package.json +14 -0
- package/locale/mt/index.cjs +3 -0
- package/locale/mt/index.cjs.js +3 -0
- package/locale/mt/index.js +1 -3
- package/locale/mt/package.json +14 -0
- package/locale/my/index.cjs +3 -0
- package/locale/my/index.cjs.js +3 -0
- package/locale/my/index.js +1 -3
- package/locale/my/package.json +14 -0
- package/locale/mzn/index.cjs +3 -0
- package/locale/mzn/index.cjs.js +3 -0
- package/locale/mzn/index.js +1 -3
- package/locale/mzn/package.json +14 -0
- package/locale/nb/index.cjs +3 -0
- package/locale/nb/index.cjs.js +3 -0
- package/locale/nb/index.js +1 -3
- package/locale/nb/package.json +14 -0
- package/locale/ne/index.cjs +3 -0
- package/locale/ne/index.cjs.js +3 -0
- package/locale/ne/index.js +1 -3
- package/locale/ne/package.json +14 -0
- package/locale/nl/index.cjs +3 -0
- package/locale/nl/index.cjs.js +3 -0
- package/locale/nl/index.js +1 -3
- package/locale/nl/package.json +14 -0
- package/locale/nn/index.cjs +3 -0
- package/locale/nn/index.cjs.js +3 -0
- package/locale/nn/index.js +1 -3
- package/locale/nn/package.json +14 -0
- package/locale/no/index.cjs +3 -0
- package/locale/no/index.cjs.js +3 -0
- package/locale/no/index.js +1 -3
- package/locale/no/package.json +14 -0
- package/locale/or/index.cjs +3 -0
- package/locale/or/index.cjs.js +3 -0
- package/locale/or/index.js +1 -3
- package/locale/or/package.json +14 -0
- package/locale/pa/index.cjs +3 -0
- package/locale/pa/index.cjs.js +3 -0
- package/locale/pa/index.js +1 -3
- package/locale/pa/package.json +14 -0
- package/locale/pcm/index.cjs +3 -0
- package/locale/pcm/index.cjs.js +3 -0
- package/locale/pcm/index.js +1 -3
- package/locale/pcm/package.json +14 -0
- package/locale/pl/index.cjs +3 -0
- package/locale/pl/index.cjs.js +3 -0
- package/locale/pl/index.js +1 -3
- package/locale/pl/package.json +14 -0
- package/locale/ps/index.cjs +3 -0
- package/locale/ps/index.cjs.js +3 -0
- package/locale/ps/index.js +1 -3
- package/locale/ps/package.json +14 -0
- package/locale/ps-PK/index.cjs +3 -0
- package/locale/ps-PK/index.cjs.js +3 -0
- package/locale/ps-PK/index.js +1 -3
- package/locale/ps-PK/package.json +14 -0
- package/locale/pt/index.cjs +3 -0
- package/locale/pt/index.cjs.js +3 -0
- package/locale/pt/index.js +1 -3
- package/locale/pt/package.json +14 -0
- package/locale/pt-AO/index.cjs +3 -0
- package/locale/pt-AO/index.cjs.js +3 -0
- package/locale/pt-AO/index.js +1 -3
- package/locale/pt-AO/package.json +14 -0
- package/locale/pt-CH/index.cjs +3 -0
- package/locale/pt-CH/index.cjs.js +3 -0
- package/locale/pt-CH/index.js +1 -3
- package/locale/pt-CH/package.json +14 -0
- package/locale/pt-CV/index.cjs +3 -0
- package/locale/pt-CV/index.cjs.js +3 -0
- package/locale/pt-CV/index.js +1 -3
- package/locale/pt-CV/package.json +14 -0
- package/locale/pt-GQ/index.cjs +3 -0
- package/locale/pt-GQ/index.cjs.js +3 -0
- package/locale/pt-GQ/index.js +1 -3
- package/locale/pt-GQ/package.json +14 -0
- package/locale/pt-GW/index.cjs +3 -0
- package/locale/pt-GW/index.cjs.js +3 -0
- package/locale/pt-GW/index.js +1 -3
- package/locale/pt-GW/package.json +14 -0
- package/locale/pt-LU/index.cjs +3 -0
- package/locale/pt-LU/index.cjs.js +3 -0
- package/locale/pt-LU/index.js +1 -3
- package/locale/pt-LU/package.json +14 -0
- package/locale/pt-MO/index.cjs +3 -0
- package/locale/pt-MO/index.cjs.js +3 -0
- package/locale/pt-MO/index.js +1 -3
- package/locale/pt-MO/package.json +14 -0
- package/locale/pt-MZ/index.cjs +3 -0
- package/locale/pt-MZ/index.cjs.js +3 -0
- package/locale/pt-MZ/index.js +1 -3
- package/locale/pt-MZ/package.json +14 -0
- package/locale/pt-PT/index.cjs +3 -0
- package/locale/pt-PT/index.cjs.js +3 -0
- package/locale/pt-PT/index.js +1 -3
- package/locale/pt-PT/package.json +14 -0
- package/locale/pt-ST/index.cjs +3 -0
- package/locale/pt-ST/index.cjs.js +3 -0
- package/locale/pt-ST/index.js +1 -3
- package/locale/pt-ST/package.json +14 -0
- package/locale/pt-TL/index.cjs +3 -0
- package/locale/pt-TL/index.cjs.js +3 -0
- package/locale/pt-TL/index.js +1 -3
- package/locale/pt-TL/package.json +14 -0
- package/locale/qu/index.cjs +3 -0
- package/locale/qu/index.cjs.js +3 -0
- package/locale/qu/index.js +1 -3
- package/locale/qu/package.json +14 -0
- package/locale/rm/index.cjs +3 -0
- package/locale/rm/index.cjs.js +3 -0
- package/locale/rm/index.js +1 -3
- package/locale/rm/package.json +14 -0
- package/locale/ro/index.cjs +3 -0
- package/locale/ro/index.cjs.js +3 -0
- package/locale/ro/index.js +1 -3
- package/locale/ro/package.json +14 -0
- package/locale/ru/index.cjs +3 -0
- package/locale/ru/index.cjs.js +3 -0
- package/locale/ru/index.js +1 -3
- package/locale/ru/package.json +14 -0
- package/locale/sah/index.cjs +3 -0
- package/locale/sah/index.cjs.js +3 -0
- package/locale/sah/index.js +1 -3
- package/locale/sah/package.json +14 -0
- package/locale/sc/index.cjs +3 -0
- package/locale/sc/index.cjs.js +3 -0
- package/locale/sc/index.js +1 -3
- package/locale/sc/package.json +14 -0
- package/locale/sd/index.cjs +3 -0
- package/locale/sd/index.cjs.js +3 -0
- package/locale/sd/index.js +1 -3
- package/locale/sd/package.json +14 -0
- package/locale/se/index.cjs +3 -0
- package/locale/se/index.cjs.js +3 -0
- package/locale/se/index.js +1 -3
- package/locale/se/package.json +14 -0
- package/locale/se-FI/index.cjs +3 -0
- package/locale/se-FI/index.cjs.js +3 -0
- package/locale/se-FI/index.js +1 -3
- package/locale/se-FI/package.json +14 -0
- package/locale/si/index.cjs +3 -0
- package/locale/si/index.cjs.js +3 -0
- package/locale/si/index.js +1 -3
- package/locale/si/package.json +14 -0
- package/locale/sk/index.cjs +3 -0
- package/locale/sk/index.cjs.js +3 -0
- package/locale/sk/index.js +1 -3
- package/locale/sk/package.json +14 -0
- package/locale/sl/index.cjs +3 -0
- package/locale/sl/index.cjs.js +3 -0
- package/locale/sl/index.js +1 -3
- package/locale/sl/package.json +14 -0
- package/locale/so/index.cjs +3 -0
- package/locale/so/index.cjs.js +3 -0
- package/locale/so/index.js +1 -3
- package/locale/so/package.json +14 -0
- package/locale/sq/index.cjs +3 -0
- package/locale/sq/index.cjs.js +3 -0
- package/locale/sq/index.js +1 -3
- package/locale/sq/package.json +14 -0
- package/locale/sr/index.cjs +3 -0
- package/locale/sr/index.cjs.js +3 -0
- package/locale/sr/index.js +1 -3
- package/locale/sr/package.json +14 -0
- package/locale/sr-Cyrl-BA/index.cjs +3 -0
- package/locale/sr-Cyrl-BA/index.cjs.js +3 -0
- package/locale/sr-Cyrl-BA/index.js +1 -3
- package/locale/sr-Cyrl-BA/package.json +14 -0
- package/locale/sr-Latn/index.cjs +3 -0
- package/locale/sr-Latn/index.cjs.js +3 -0
- package/locale/sr-Latn/index.js +1 -3
- package/locale/sr-Latn/package.json +14 -0
- package/locale/sr-Latn-BA/index.cjs +3 -0
- package/locale/sr-Latn-BA/index.cjs.js +3 -0
- package/locale/sr-Latn-BA/index.js +1 -3
- package/locale/sr-Latn-BA/package.json +14 -0
- package/locale/su/index.cjs +3 -0
- package/locale/su/index.cjs.js +3 -0
- package/locale/su/index.js +1 -3
- package/locale/su/package.json +14 -0
- package/locale/sv/index.cjs +3 -0
- package/locale/sv/index.cjs.js +3 -0
- package/locale/sv/index.js +1 -3
- package/locale/sv/package.json +14 -0
- package/locale/sw/index.cjs +3 -0
- package/locale/sw/index.cjs.js +3 -0
- package/locale/sw/index.js +1 -3
- package/locale/sw/package.json +14 -0
- package/locale/ta/index.cjs +3 -0
- package/locale/ta/index.cjs.js +3 -0
- package/locale/ta/index.js +1 -3
- package/locale/ta/package.json +14 -0
- package/locale/te/index.cjs +3 -0
- package/locale/te/index.cjs.js +3 -0
- package/locale/te/index.js +1 -3
- package/locale/te/package.json +14 -0
- package/locale/tg/index.cjs +3 -0
- package/locale/tg/index.cjs.js +3 -0
- package/locale/tg/index.js +1 -3
- package/locale/tg/package.json +14 -0
- package/locale/th/index.cjs +3 -0
- package/locale/th/index.cjs.js +3 -0
- package/locale/th/index.js +1 -3
- package/locale/th/package.json +14 -0
- package/locale/ti/index.cjs +3 -0
- package/locale/ti/index.cjs.js +3 -0
- package/locale/ti/index.js +1 -3
- package/locale/ti/package.json +14 -0
- package/locale/tk/index.cjs +3 -0
- package/locale/tk/index.cjs.js +3 -0
- package/locale/tk/index.js +1 -3
- package/locale/tk/package.json +14 -0
- package/locale/to/index.cjs +3 -0
- package/locale/to/index.cjs.js +3 -0
- package/locale/to/index.js +1 -3
- package/locale/to/package.json +14 -0
- package/locale/tr/index.cjs +3 -0
- package/locale/tr/index.cjs.js +3 -0
- package/locale/tr/index.js +1 -3
- package/locale/tr/package.json +14 -0
- package/locale/tt/index.cjs +3 -0
- package/locale/tt/index.cjs.js +3 -0
- package/locale/tt/index.js +1 -3
- package/locale/tt/package.json +14 -0
- package/locale/ug/index.cjs +3 -0
- package/locale/ug/index.cjs.js +3 -0
- package/locale/ug/index.js +1 -3
- package/locale/ug/package.json +14 -0
- package/locale/uk/index.cjs +3 -0
- package/locale/uk/index.cjs.js +3 -0
- package/locale/uk/index.js +1 -3
- package/locale/uk/package.json +14 -0
- package/locale/ur/index.cjs +3 -0
- package/locale/ur/index.cjs.js +3 -0
- package/locale/ur/index.js +1 -3
- package/locale/ur/package.json +14 -0
- package/locale/ur-IN/index.cjs +3 -0
- package/locale/ur-IN/index.cjs.js +3 -0
- package/locale/ur-IN/index.js +1 -3
- package/locale/ur-IN/package.json +14 -0
- package/locale/uz/index.cjs +3 -0
- package/locale/uz/index.cjs.js +3 -0
- package/locale/uz/index.js +1 -3
- package/locale/uz/package.json +14 -0
- package/locale/uz-Cyrl/index.cjs +3 -0
- package/locale/uz-Cyrl/index.cjs.js +3 -0
- package/locale/uz-Cyrl/index.js +1 -3
- package/locale/uz-Cyrl/package.json +14 -0
- package/locale/vi/index.cjs +3 -0
- package/locale/vi/index.cjs.js +3 -0
- package/locale/vi/index.js +1 -3
- package/locale/vi/package.json +14 -0
- package/locale/wae/index.cjs +3 -0
- package/locale/wae/index.cjs.js +3 -0
- package/locale/wae/index.js +1 -3
- package/locale/wae/package.json +14 -0
- package/locale/wo/index.cjs +3 -0
- package/locale/wo/index.cjs.js +3 -0
- package/locale/wo/index.js +1 -3
- package/locale/wo/package.json +14 -0
- package/locale/yi/index.cjs +3 -0
- package/locale/yi/index.cjs.js +3 -0
- package/locale/yi/index.js +1 -3
- package/locale/yi/package.json +14 -0
- package/locale/yo/index.cjs +3 -0
- package/locale/yo/index.cjs.js +3 -0
- package/locale/yo/index.js +1 -3
- package/locale/yo/package.json +14 -0
- package/locale/yo-BJ/index.cjs +3 -0
- package/locale/yo-BJ/index.cjs.js +3 -0
- package/locale/yo-BJ/index.js +1 -3
- package/locale/yo-BJ/package.json +14 -0
- package/locale/yrl/index.cjs +3 -0
- package/locale/yrl/index.cjs.js +3 -0
- package/locale/yrl/index.js +1 -3
- package/locale/yrl/package.json +14 -0
- package/locale/yue/index.cjs +3 -0
- package/locale/yue/index.cjs.js +3 -0
- package/locale/yue/index.js +1 -3
- package/locale/yue/package.json +14 -0
- package/locale/yue-Hans/index.cjs +3 -0
- package/locale/yue-Hans/index.cjs.js +3 -0
- package/locale/yue-Hans/index.js +1 -3
- package/locale/yue-Hans/package.json +14 -0
- package/locale/zh/index.cjs +3 -0
- package/locale/zh/index.cjs.js +3 -0
- package/locale/zh/index.js +1 -3
- package/locale/zh/package.json +14 -0
- package/locale/zh-Hans-HK/index.cjs +3 -0
- package/locale/zh-Hans-HK/index.cjs.js +3 -0
- package/locale/zh-Hans-HK/index.js +1 -3
- package/locale/zh-Hans-HK/package.json +14 -0
- package/locale/zh-Hans-MO/index.cjs +3 -0
- package/locale/zh-Hans-MO/index.cjs.js +3 -0
- package/locale/zh-Hans-MO/index.js +1 -3
- package/locale/zh-Hans-MO/package.json +14 -0
- package/locale/zh-Hans-SG/index.cjs +3 -0
- package/locale/zh-Hans-SG/index.cjs.js +3 -0
- package/locale/zh-Hans-SG/index.js +1 -3
- package/locale/zh-Hans-SG/package.json +14 -0
- package/locale/zh-Hant/index.cjs +3 -0
- package/locale/zh-Hant/index.cjs.js +3 -0
- package/locale/zh-Hant/index.js +1 -3
- package/locale/zh-Hant/package.json +14 -0
- package/locale/zh-Hant-HK/index.cjs +3 -0
- package/locale/zh-Hant-HK/index.cjs.js +3 -0
- package/locale/zh-Hant-HK/index.js +1 -3
- package/locale/zh-Hant-HK/package.json +14 -0
- package/locale/zh-Hant-MO/index.cjs +3 -0
- package/locale/zh-Hant-MO/index.cjs.js +3 -0
- package/locale/zh-Hant-MO/index.js +1 -3
- package/locale/zh-Hant-MO/package.json +14 -0
- package/locale/zu/index.cjs +3 -0
- package/locale/zu/index.cjs.js +3 -0
- package/locale/zu/index.js +1 -3
- package/locale/zu/package.json +14 -0
- package/modules/LocaleDataStore.js.map +1 -1
- package/modules/PropTypes.js +7 -1
- package/modules/PropTypes.js.map +1 -1
- package/modules/TimeAgo.js +25 -32
- package/modules/TimeAgo.js.map +1 -1
- package/modules/TimeAgo.test.js +7 -7
- package/modules/TimeAgo.test.js.map +1 -1
- package/modules/cache.js +8 -12
- package/modules/cache.js.map +1 -1
- package/modules/cache.test.js +1 -1
- package/modules/cache.test.js.map +1 -1
- package/modules/isStyleObject.js +1 -1
- package/modules/isStyleObject.js.map +1 -1
- package/modules/isStyleObject.test.js +1 -1
- package/modules/isStyleObject.test.js.map +1 -1
- package/modules/locale.js +9 -14
- package/modules/locale.js.map +1 -1
- package/modules/locale.test.js +2 -2
- package/modules/locale.test.js.map +1 -1
- package/modules/round.js.map +1 -1
- package/modules/steps/approximate.js +1 -1
- package/modules/steps/approximate.js.map +1 -1
- package/modules/steps/approximate.test.js +2 -2
- package/modules/steps/approximate.test.js.map +1 -1
- package/modules/steps/getStep.js +6 -4
- package/modules/steps/getStep.js.map +1 -1
- package/modules/steps/getStep.test.js +5 -5
- package/modules/steps/getStep.test.js.map +1 -1
- package/modules/steps/getStepDenominator.js +1 -1
- package/modules/steps/getStepDenominator.js.map +1 -1
- package/modules/steps/getStepDenominator.test.js +1 -1
- package/modules/steps/getStepDenominator.test.js.map +1 -1
- package/modules/steps/getStepMinTime.js +4 -4
- package/modules/steps/getStepMinTime.js.map +1 -1
- package/modules/steps/getStepMinTime.test.js +1 -1
- package/modules/steps/getStepMinTime.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.js +3 -3
- package/modules/steps/getTimeToNextUpdate.js.map +1 -1
- package/modules/steps/getTimeToNextUpdate.test.js +1 -1
- package/modules/steps/getTimeToNextUpdate.test.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.js +2 -2
- package/modules/steps/getTimeToNextUpdateForUnit.js.map +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.test.js +1 -1
- package/modules/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
- package/modules/steps/helpers.js.map +1 -1
- package/modules/steps/helpers.test.js +1 -1
- package/modules/steps/helpers.test.js.map +1 -1
- package/modules/steps/index.js +4 -4
- package/modules/steps/index.js.map +1 -1
- package/modules/steps/renameLegacyProperties.js +7 -7
- package/modules/steps/renameLegacyProperties.js.map +1 -1
- package/modules/steps/renameLegacyProperties.test.js +2 -2
- package/modules/steps/renameLegacyProperties.test.js.map +1 -1
- package/modules/steps/round.js.map +1 -1
- package/modules/steps/round.test.js +2 -2
- package/modules/steps/round.test.js.map +1 -1
- package/modules/steps/units.js.map +1 -1
- package/modules/style/approximate.js +1 -1
- package/modules/style/approximate.js.map +1 -1
- package/modules/style/approximateTime.js +1 -1
- package/modules/style/approximateTime.js.map +1 -1
- package/modules/style/approximateTime.test.js +11 -16
- package/modules/style/approximateTime.test.js.map +1 -1
- package/modules/style/getStyleByName.js +13 -13
- package/modules/style/getStyleByName.js.map +1 -1
- package/modules/style/mini.js.map +1 -1
- package/modules/style/mini.test.js +8 -6
- package/modules/style/mini.test.js.map +1 -1
- package/modules/style/miniMinute.js +5 -3
- package/modules/style/miniMinute.js.map +1 -1
- package/modules/style/miniMinute.test.js +8 -6
- package/modules/style/miniMinute.test.js.map +1 -1
- package/modules/style/miniMinuteNow.js +5 -3
- package/modules/style/miniMinuteNow.js.map +1 -1
- package/modules/style/miniMinuteNow.test.js +8 -6
- package/modules/style/miniMinuteNow.test.js.map +1 -1
- package/modules/style/miniNow.js +5 -3
- package/modules/style/miniNow.js.map +1 -1
- package/modules/style/miniNow.test.js +8 -6
- package/modules/style/miniNow.test.js.map +1 -1
- package/modules/style/renameLegacyProperties.js +4 -2
- package/modules/style/renameLegacyProperties.js.map +1 -1
- package/modules/style/renameLegacyProperties.test.js +2 -2
- package/modules/style/renameLegacyProperties.test.js.map +1 -1
- package/modules/style/round.js +1 -1
- package/modules/style/round.js.map +1 -1
- package/modules/style/round.test.js +17 -11
- package/modules/style/round.test.js.map +1 -1
- package/modules/style/roundMinute.js +5 -3
- package/modules/style/roundMinute.js.map +1 -1
- package/modules/style/roundMinute.test.js +8 -6
- package/modules/style/roundMinute.test.js.map +1 -1
- package/modules/style/twitter.js +13 -13
- package/modules/style/twitter.js.map +1 -1
- package/modules/style/twitter.test.js +9 -7
- package/modules/style/twitter.test.js.map +1 -1
- package/modules/style/twitterFirstMinute.js +7 -5
- package/modules/style/twitterFirstMinute.js.map +1 -1
- package/modules/style/twitterFirstMinute.test.js +10 -8
- package/modules/style/twitterFirstMinute.test.js.map +1 -1
- package/modules/style/twitterMinute.js +5 -3
- package/modules/style/twitterMinute.js.map +1 -1
- package/modules/style/twitterMinute.test.js +10 -8
- package/modules/style/twitterMinute.test.js.map +1 -1
- package/modules/style/twitterMinuteNow.js +5 -3
- package/modules/style/twitterMinuteNow.js.map +1 -1
- package/modules/style/twitterMinuteNow.test.js +10 -8
- package/modules/style/twitterMinuteNow.test.js.map +1 -1
- package/modules/style/twitterNow.js +5 -3
- package/modules/style/twitterNow.js.map +1 -1
- package/modules/style/twitterNow.test.js +10 -8
- package/modules/style/twitterNow.test.js.map +1 -1
- package/package.json +671 -75
- package/prop-types/index.cjs +2 -0
- package/prop-types/index.cjs.js +7 -0
- package/prop-types/index.js +1 -1
- package/prop-types/package.json +9 -3
- package/{rollup.config.js → rollup.config.mjs} +0 -0
- package/steps/index.cjs +1 -0
- package/steps/index.cjs.js +6 -0
- package/steps/index.js +1 -1
- package/steps/package.json +9 -3
- package/cache/index.commonjs.js +0 -2
- package/gradation/index.commonjs.js +0 -2
- package/index.commonjs.js +0 -9
- package/load-all-locales.js +0 -278
- package/prop-types/index.commonjs.js +0 -2
- package/steps/index.commonjs.js +0 -2
package/commonjs/round.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"round.js","names":["getRoundFunction","round","Math","floor","getDiffRatioToNextRoundedNumber"],"sources":["../source/round.js"],"sourcesContent":["export function getRoundFunction(round) {\r\n\tswitch (round) {\r\n\t\tcase 'floor':\r\n\t\t\treturn Math.floor\r\n\t\tdefault:\r\n\t\t\treturn Math.round\r\n\t}\r\n}\r\n\r\n// For non-negative numbers.\r\nexport function getDiffRatioToNextRoundedNumber(round) {\r\n\tswitch (round) {\r\n\t\tcase 'floor':\r\n\t\t\t// Math.floor(x) = x\r\n\t\t\t// Math.floor(x + 1) = x + 1\r\n\t\t\treturn 1\r\n\t\tdefault:\r\n\t\t\t// Math.round(x) = x\r\n\t\t\t// Math.round(x + 0.5) = x + 1\r\n\t\t\treturn 0.5\r\n\t}\r\n}"],"mappings":";;;;;;;;AAAO,SAASA,gBAAT,CAA0BC,KAA1B,EAAiC;EACvC,QAAQA,KAAR;IACC,KAAK,OAAL;MACC,OAAOC,IAAI,CAACC,KAAZ;;IACD;MACC,OAAOD,IAAI,CAACD,KAAZ;EAJF;AAMA,C,CAED;;;AACO,SAASG,+BAAT,CAAyCH,KAAzC,EAAgD;EACtD,QAAQA,KAAR;IACC,KAAK,OAAL;MACC;MACA;MACA,OAAO,CAAP;;IACD;MACC;MACA;MACA,OAAO,GAAP;EARF;AAUA"}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
-
var _units = require("./units");
|
|
8
|
+
var _units = require("./units.js");
|
|
9
9
|
|
|
10
10
|
// "factor" is a legacy property.
|
|
11
11
|
// Developers shouldn't need to use it in their custom steps.
|
|
@@ -129,5 +129,5 @@ var _default = [{
|
|
|
129
129
|
// "year" labels are used for formatting the output.
|
|
130
130
|
unit: 'year'
|
|
131
131
|
}];
|
|
132
|
-
exports
|
|
132
|
+
exports["default"] = _default;
|
|
133
133
|
//# sourceMappingURL=approximate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"approximate.js","names":["factor","unit","threshold","threshold_for_now","minute","granularity","hour","threshold_for_minute","day","week","month","year"],"sources":["../../source/steps/approximate.js"],"sourcesContent":["import { minute, hour, day, week, month, year } from './units.js'\r\n\r\n// \"factor\" is a legacy property.\r\n// Developers shouldn't need to use it in their custom steps.\r\n\r\n// \"threshold\" is a legacy name of \"min\".\r\n// Developers should use \"min\" property name instead of \"threshold\".\r\n\r\n// \"threshold_for_idOrUnit: value\" is a legacy way of specifying \"min: { id: value }\".\r\n// Developers should use \"min\" property instead of \"threshold\".\r\n\r\n// just now\r\n// 1 minute ago\r\n// 2 minutes ago\r\n// 5 minutes ago\r\n// 10 minutes ago\r\n// 15 minutes ago\r\n// 20 minutes ago\r\n// …\r\n// 50 minutes ago\r\n// an hour ago\r\n// 2 hours ago\r\n// …\r\n// 20 hours ago\r\n// a day ago\r\n// 2 days ago\r\n// 5 days ago\r\n// a week ago\r\n// 2 weeks ago\r\n// 3 weeks ago\r\n// a month ago\r\n// 2 months ago\r\n// 4 months ago\r\n// a year ago\r\n// 2 years ago\r\n// …\r\nexport default [\r\n\t{\r\n\t\t// This step returns the amount of seconds\r\n\t\t// by dividing the amount of seconds by `1`.\r\n\t\tfactor: 1,\r\n \t// \"now\" labels are used for formatting the output.\r\n\t\tunit: 'now'\r\n\t},\r\n\t{\r\n\t\t// When the language doesn't support `now` unit,\r\n\t\t// the first step is ignored, and it uses this `second` unit.\r\n\t\tthreshold: 1,\r\n\t\t// `threshold_for_now` should be the same as `threshold` on minutes.\r\n\t\tthreshold_for_now: 45.5,\r\n\t\t// This step returns the amount of seconds\r\n\t\t// by dividing the amount of seconds by `1`.\r\n\t\tfactor: 1,\r\n \t// \"second\" labels are used for formatting the output.\r\n\t\tunit: 'second'\r\n\t},\r\n\t{\r\n\t\t// `threshold` should be the same as `threshold_for_now` on seconds.\r\n\t\tthreshold: 45.5,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a minute.\r\n\t\tfactor: minute,\r\n \t// \"minute\" labels are used for formatting the output.\r\n\t\tunit: 'minute'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 2.5 minutes.\r\n\t\tthreshold: 2.5 * minute,\r\n\t\t// Allow only 5-minute increments of minutes starting from 2.5 minutes.\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\tgranularity: 5,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a minute.\r\n\t\tfactor: minute,\r\n\t\t// \"minute\" labels are used for formatting the output.\r\n\t\tunit: 'minute'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 22.5 minutes.\r\n\t\tthreshold: 22.5 * minute,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in half-an-hour.\r\n\t\tfactor: 0.5 * hour,\r\n\t\t// \"half-hour\" labels are used for formatting the output.\r\n\t\t// (if available, which is no longer the case)\r\n\t\tunit: 'half-hour'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 42.5 minutes.\r\n\t\tthreshold: 42.5 * minute,\r\n\t\tthreshold_for_minute: 52.5 * minute,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in an hour.\r\n\t\tfactor: hour,\r\n\t\t// \"hour\" labels are used for formatting the output.\r\n\t\tunit: 'hour'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 20.5 hours.\r\n\t\tthreshold: (20.5 / 24) * day,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a day.\r\n\t\tfactor: day,\r\n\t\t// \"day\" labels are used for formatting the output.\r\n\t\tunit: 'day'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 5.5 days.\r\n\t\tthreshold: 5.5 * day,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a week.\r\n\t\tfactor: week,\r\n\t\t// \"week\" labels are used for formatting the output.\r\n\t\tunit: 'week'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 3.5 weeks.\r\n\t\tthreshold: 3.5 * week,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a month.\r\n\t\tfactor: month,\r\n\t\t// \"month\" labels are used for formatting the output.\r\n\t\tunit: 'month'\r\n\t},\r\n\t{\r\n\t\t// This step is effective starting from 10.5 months.\r\n\t\tthreshold: 10.5 * month,\r\n\t\t// Return the amount of minutes by dividing the amount\r\n\t\t// of seconds by the amount of seconds in a year.\r\n\t\tfactor: year,\r\n\t\t// \"year\" labels are used for formatting the output.\r\n\t\tunit: 'year'\r\n\t}\r\n]"],"mappings":";;;;;;;AAAA;;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eACe,CACd;EACC;EACA;EACAA,MAAM,EAAE,CAHT;EAII;EACHC,IAAI,EAAE;AALP,CADc,EAQd;EACC;EACA;EACAC,SAAS,EAAE,CAHZ;EAIC;EACAC,iBAAiB,EAAE,IALpB;EAMC;EACA;EACAH,MAAM,EAAE,CART;EASI;EACHC,IAAI,EAAE;AAVP,CARc,EAoBd;EACC;EACAC,SAAS,EAAE,IAFZ;EAGC;EACA;EACAF,MAAM,EAAEI,aALT;EAMI;EACHH,IAAI,EAAE;AAPP,CApBc,EA6Bd;EACC;EACAC,SAAS,EAAE,MAAME,aAFlB;EAGC;EACA;EACA;EACA;EACA;EACA;EACAC,WAAW,EAAE,CATd;EAUC;EACA;EACAL,MAAM,EAAEI,aAZT;EAaC;EACAH,IAAI,EAAE;AAdP,CA7Bc,EA6Cd;EACC;EACAC,SAAS,EAAE,OAAOE,aAFnB;EAGC;EACA;EACAJ,MAAM,EAAE,MAAMM,WALf;EAMC;EACA;EACAL,IAAI,EAAE;AARP,CA7Cc,EAuDd;EACC;EACAC,SAAS,EAAE,OAAOE,aAFnB;EAGCG,oBAAoB,EAAE,OAAOH,aAH9B;EAIC;EACA;EACAJ,MAAM,EAAEM,WANT;EAOC;EACAL,IAAI,EAAE;AARP,CAvDc,EAiEd;EACC;EACAC,SAAS,EAAG,OAAO,EAAR,GAAcM,UAF1B;EAGC;EACA;EACAR,MAAM,EAAEQ,UALT;EAMC;EACAP,IAAI,EAAE;AAPP,CAjEc,EA0Ed;EACC;EACAC,SAAS,EAAE,MAAMM,UAFlB;EAGC;EACA;EACAR,MAAM,EAAES,WALT;EAMC;EACAR,IAAI,EAAE;AAPP,CA1Ec,EAmFd;EACC;EACAC,SAAS,EAAE,MAAMO,WAFlB;EAGC;EACA;EACAT,MAAM,EAAEU,YALT;EAMC;EACAT,IAAI,EAAE;AAPP,CAnFc,EA4Fd;EACC;EACAC,SAAS,EAAE,OAAOQ,YAFnB;EAGC;EACA;EACAV,MAAM,EAAEW,WALT;EAMC;EACAV,IAAI,EAAE;AAPP,CA5Fc,C"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _getStep = _interopRequireDefault(require("./getStep"));
|
|
3
|
+
var _getStep = _interopRequireDefault(require("./getStep.js"));
|
|
4
4
|
|
|
5
|
-
var _approximate = _interopRequireDefault(require("./approximate"));
|
|
5
|
+
var _approximate = _interopRequireDefault(require("./approximate.js"));
|
|
6
6
|
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
8
|
|
|
9
9
|
describe('steps/approximate', function () {
|
|
10
10
|
it('should get step correctly', function () {
|
|
11
11
|
var getStepFor = function getStepFor(secondsPassed) {
|
|
12
|
-
return (0, _getStep
|
|
12
|
+
return (0, _getStep["default"])(_approximate["default"], secondsPassed, {
|
|
13
13
|
now: 0,
|
|
14
14
|
units: ['now', 'second', 'minute', 'hour', 'day', 'week', 'month', 'year']
|
|
15
15
|
});
|
|
@@ -35,7 +35,7 @@ describe('steps/approximate', function () {
|
|
|
35
35
|
});
|
|
36
36
|
it('should get step correctly ("now" unit not allowed)', function () {
|
|
37
37
|
var getStepFor = function getStepFor(secondsPassed) {
|
|
38
|
-
return (0, _getStep
|
|
38
|
+
return (0, _getStep["default"])(_approximate["default"], secondsPassed, {
|
|
39
39
|
now: 0,
|
|
40
40
|
units: ['second', 'minute', 'hour', 'day', 'week', 'month', 'year']
|
|
41
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"approximate.test.js","names":["describe","it","getStepFor","secondsPassed","getStep","steps","now","units","expect","unit","to","equal","factor","granularity","be","undefined"],"sources":["../../source/steps/approximate.test.js"],"sourcesContent":["import getStep from './getStep.js'\r\nimport steps from './approximate.js'\r\n\r\ndescribe('steps/approximate', () => {\r\n\tit('should get step correctly', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'now',\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0).unit).to.equal('now')\r\n\t\texpect(getStepFor(1).unit).to.equal('now')\r\n\t\texpect(getStepFor(45).unit).to.equal('now')\r\n\r\n\t\texpect(getStepFor(46).unit).to.equal('minute')\r\n\t\texpect(getStepFor(46).factor).to.equal(60)\r\n\t\texpect(getStepFor(46).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60 - 1).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(52.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(52.5 * 60 - 1).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60).unit).to.equal('hour')\r\n\t\texpect(getStepFor(52.5 * 60).factor).to.equal(60 * 60)\r\n\t})\r\n\r\n\tit('should get step correctly (\"now\" unit not allowed)', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0)).to.be.undefined\r\n\t\texpect(getStepFor(1).unit).to.equal('second')\r\n\t\texpect(getStepFor(45).unit).to.equal('second')\r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V,EAAE,CAAC,oDAAD,EAAuD,YAAM;IAC9D,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,aAAD;MAAA,OAAmB,IAAAC,mBAAA,EAAQC,uBAAR,EAAeF,aAAf,EAA8B;QACnEG,GAAG,EAAE,CAD8D;QAEnEC,KAAK,EAAE,CACN,QADM,EAEN,QAFM,EAGN,MAHM,EAIN,KAJM,EAKN,MALM,EAMN,OANM,EAON,MAPM;MAF4D,CAA9B,CAAnB;IAAA,CAAnB;;IAaAC,MAAM,CAACN,UAAU,CAAC,CAAD,CAAX,CAAN,CAAsBQ,EAAtB,CAAyBI,EAAzB,CAA4BC,SAA5B;IACAP,MAAM,CAACN,UAAU,CAAC,CAAD,CAAV,CAAcO,IAAf,CAAN,CAA2BC,EAA3B,CAA8BC,KAA9B,CAAoC,QAApC;IACAH,MAAM,CAACN,UAAU,CAAC,EAAD,CAAV,CAAeO,IAAhB,CAAN,CAA4BC,EAA5B,CAA+BC,KAA/B,CAAqC,QAArC;IACAH,MAAM,CAACN,UAAU,CAAC,EAAD,CAAV,CAAeO,IAAhB,CAAN,CAA4BC,EAA5B,CAA+BC,KAA/B,CAAqC,QAArC;EACA,CAlBC,CAAF;AAmBA,CA3DO,CAAR"}
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = getStep;
|
|
7
7
|
|
|
8
|
-
var _getStepDenominator = _interopRequireDefault(require("./getStepDenominator"));
|
|
8
|
+
var _getStepDenominator = _interopRequireDefault(require("./getStepDenominator.js"));
|
|
9
9
|
|
|
10
|
-
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime"));
|
|
10
|
+
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime.js"));
|
|
11
11
|
|
|
12
|
-
var _round = require("../round");
|
|
12
|
+
var _round = require("../round.js");
|
|
13
13
|
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
19
|
|
|
18
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
21
|
|
|
@@ -95,7 +97,7 @@ function _getStep(steps, secondsPassed, _ref2) {
|
|
|
95
97
|
|
|
96
98
|
if (step.granularity) {
|
|
97
99
|
// Recalculate the amount of seconds passed based on `granularity`.
|
|
98
|
-
var secondsPassedGranular = (0, _round.getRoundFunction)(round)(Math.abs(secondsPassed) / (0, _getStepDenominator
|
|
100
|
+
var secondsPassedGranular = (0, _round.getRoundFunction)(round)(Math.abs(secondsPassed) / (0, _getStepDenominator["default"])(step) / step.granularity) * step.granularity; // If the granularity for this step is too high,
|
|
99
101
|
// then fall back to the previous step.
|
|
100
102
|
// (if there is any previous step)
|
|
101
103
|
|
|
@@ -119,7 +121,7 @@ function _getStep(steps, secondsPassed, _ref2) {
|
|
|
119
121
|
|
|
120
122
|
function getStepIndex(steps, secondsPassed, options) {
|
|
121
123
|
var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
122
|
-
var minTime = (0, _getStepMinTime
|
|
124
|
+
var minTime = (0, _getStepMinTime["default"])(steps[i], _objectSpread({
|
|
123
125
|
prevStep: steps[i - 1],
|
|
124
126
|
timestamp: options.now - secondsPassed * 1000
|
|
125
127
|
}, options)); // If `minTime` isn't defined or deduceable for this step, then stop.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStep.js","names":["getStep","steps","secondsPassed","now","future","round","units","getNextStep","filterStepsByUnits","step","_getStep","prevStep","indexOf","nextStep","undefined","length","i","getStepIndex","granularity","secondsPassedGranular","getRoundFunction","Math","abs","getStepDenominator","options","minTime","getStepMinTime","timestamp","filter","unit","formatAs"],"sources":["../../source/steps/getStep.js"],"sourcesContent":["import getStepDenominator from './getStepDenominator.js'\r\nimport getStepMinTime from './getStepMinTime.js'\r\nimport { getRoundFunction } from '../round.js'\r\n\r\n/**\r\n * Finds an appropriate `step` of `steps` for the time interval (in seconds).\r\n *\r\n * @param {Object[]} steps - Time formatting steps.\r\n *\r\n * @param {number} secondsPassed - Time interval (in seconds).\r\n * `< 0` for past dates and `> 0` for future dates.\r\n *\r\n * @param {number} options.now - Current timestamp.\r\n *\r\n * @param {boolean} [options.future] - Whether the date should be formatted as a future one\r\n * instead of a past one.\r\n *\r\n * @param {string} [options.round] - (undocumented) Rounding mechanism.\r\n *\r\n * @param {string[]} [options.units] - A list of allowed time units.\r\n * (Example: ['second', 'minute', 'hour', …])\r\n *\r\n * @param {boolean} [options.getNextStep] - Pass true to return `[step, nextStep]` instead of just `step`.\r\n *\r\n * @return {Object|Object[]} [step] — Either a `step` or `[prevStep, step, nextStep]`.\r\n */\r\nexport default function getStep(steps, secondsPassed, { now, future, round, units, getNextStep }) {\r\n\t// Ignore steps having not-supported time units in `formatAs`.\r\n\tsteps = filterStepsByUnits(steps, units)\r\n\tconst step = _getStep(steps, secondsPassed, { now, future, round })\r\n\tif (getNextStep) {\r\n\t\tif (step) {\r\n\t\t\tconst prevStep = steps[steps.indexOf(step) - 1]\r\n\t\t\tconst nextStep = steps[steps.indexOf(step) + 1]\r\n\t\t\treturn [prevStep, step, nextStep]\r\n\t\t}\r\n\t\treturn [undefined, undefined, steps[0]]\r\n\t}\r\n\treturn step\r\n}\r\n\r\nfunction _getStep(steps, secondsPassed, { now, future, round }) {\r\n\t// If no steps fit the conditions then return nothing.\r\n\tif (steps.length === 0) {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Find the most appropriate step.\r\n\tconst i = getStepIndex(steps, secondsPassed, {\r\n\t\tnow,\r\n\t\tfuture: future || secondsPassed < 0,\r\n\t\tround\r\n\t})\r\n\r\n\t// If no step is applicable the return nothing.\r\n\tif (i === -1) {\r\n\t\treturn\r\n\t}\r\n\r\n\tconst step = steps[i]\r\n\r\n\t// Apply granularity to the time amount\r\n\t// (and fall back to the previous step\r\n\t// if the first level of granularity\r\n\t// isn't met by this amount)\r\n\tif (step.granularity) {\r\n\t\t// Recalculate the amount of seconds passed based on `granularity`.\r\n\t\tconst secondsPassedGranular = getRoundFunction(round)((Math.abs(secondsPassed) / getStepDenominator(step)) / step.granularity) * step.granularity\r\n\t\t// If the granularity for this step is too high,\r\n\t\t// then fall back to the previous step.\r\n\t\t// (if there is any previous step)\r\n\t\tif (secondsPassedGranular === 0 && i > 0) {\r\n\t\t\treturn steps[i - 1]\r\n\t\t}\r\n\t}\r\n\r\n\treturn step\r\n}\r\n\r\n/**\r\n * Iterates through steps until it finds the maximum one satisfying the `minTime` threshold.\r\n * @param {Object} steps - Steps.\r\n * @param {number} secondsPassed - How much seconds have passed since the date till `now`.\r\n * @param {number} options.now - Current timestamp.\r\n * @param {boolean} options.future - Whether the time interval should be formatted as a future one.\r\n * @param {number} [i] - Gradation step currently being tested.\r\n * @return {number} Gradation step index.\r\n */\r\nfunction getStepIndex(steps, secondsPassed, options, i = 0) {\r\n\tconst minTime = getStepMinTime(steps[i], {\r\n\t\tprevStep: steps[i - 1],\r\n\t\ttimestamp: options.now - secondsPassed * 1000,\r\n\t\t...options\r\n\t})\r\n\t// If `minTime` isn't defined or deduceable for this step, then stop.\r\n\tif (minTime === undefined) {\r\n\t\treturn i - 1\r\n\t}\r\n\t// If the `minTime` threshold for moving from previous step\r\n\t// to this step is too high then return the previous step.\r\n\tif (Math.abs(secondsPassed) < minTime) {\r\n\t\treturn i - 1\r\n\t}\r\n\t// If it's the last step then return it.\r\n\tif (i === steps.length - 1) {\r\n\t\treturn i\r\n\t}\r\n\t// Move to the next step.\r\n\treturn getStepIndex(steps, secondsPassed, options, i + 1)\r\n}\r\n\r\n/**\r\n * Leaves only allowed steps.\r\n * @param {Object[]} steps\r\n * @param {string[]} units - Allowed time units.\r\n * @return {Object[]}\r\n */\r\nfunction filterStepsByUnits(steps, units) {\r\n\treturn steps.filter(({ unit, formatAs }) => {\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tunit = unit || formatAs\r\n\t\t// If this step has a `unit` defined\r\n\t\t// then this `unit` must be in the list of allowed `units`.\r\n\t\tif (unit) {\r\n\t\t\treturn units.indexOf(unit) >= 0\r\n\t\t}\r\n\t\t// A step is not required to specify a `unit`:\r\n\t\t// alternatively, it could specify `format()`.\r\n\t\t// (see \"twitter\" style for an example)\r\n\t\treturn true\r\n\t})\r\n}"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAT,CAAiBC,KAAjB,EAAwBC,aAAxB,QAAmF;EAAA,IAA1CC,GAA0C,QAA1CA,GAA0C;EAAA,IAArCC,MAAqC,QAArCA,MAAqC;EAAA,IAA7BC,KAA6B,QAA7BA,KAA6B;EAAA,IAAtBC,KAAsB,QAAtBA,KAAsB;EAAA,IAAfC,WAAe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;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASR,kBAAT,CAA4BP,KAA5B,EAAmCK,KAAnC,EAA0C;EACzC,OAAOL,KAAK,CAAC2B,MAAN,CAAa,iBAAwB;IAAA,IAArBC,IAAqB,SAArBA,IAAqB;IAAA,IAAfC,QAAe,SAAfA,QAAe;IAC3C;IACAD,IAAI,GAAGA,IAAI,IAAIC,QAAf,CAF2C,CAG3C;IACA;;IACA,IAAID,IAAJ,EAAU;MACT,OAAOvB,KAAK,CAACM,OAAN,CAAciB,IAAd,KAAuB,CAA9B;IACA,CAP0C,CAQ3C;IACA;IACA;;;IACA,OAAO,IAAP;EACA,CAZM,CAAP;AAaA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _getStep = _interopRequireDefault(require("./getStep"));
|
|
3
|
+
var _getStep = _interopRequireDefault(require("./getStep.js"));
|
|
4
4
|
|
|
5
|
-
var _round = _interopRequireDefault(require("./round"));
|
|
5
|
+
var _round = _interopRequireDefault(require("./round.js"));
|
|
6
6
|
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
8
|
|
|
9
9
|
describe('getStep', function () {
|
|
10
10
|
it('should return nothing if no time units are supported', function () {
|
|
11
|
-
expect((0, _getStep
|
|
11
|
+
expect((0, _getStep["default"])(_round["default"], 0, {
|
|
12
12
|
units: ['femtosecond']
|
|
13
13
|
})).to.be.undefined;
|
|
14
14
|
}); // it('should throw if a non-first step does not have a `minTime` or `test()`', () => {
|
|
@@ -22,18 +22,18 @@ describe('getStep', function () {
|
|
|
22
22
|
// })
|
|
23
23
|
|
|
24
24
|
it('should fall back to previous step if granularity is too high for the next step', function () {
|
|
25
|
-
var steps = _round
|
|
25
|
+
var steps = _round["default"].slice();
|
|
26
26
|
|
|
27
27
|
steps[1].formatAs.should.equal('second');
|
|
28
28
|
steps[1].granularity = 3;
|
|
29
|
-
(0, _getStep
|
|
29
|
+
(0, _getStep["default"])(steps, 1.49, {
|
|
30
30
|
now: 0,
|
|
31
31
|
units: ['now', 'second']
|
|
32
32
|
}).formatAs.should.equal('now'); // And if there's no previous step, then use the current one.
|
|
33
33
|
|
|
34
34
|
var firstStep = steps[0];
|
|
35
35
|
steps.splice(0, 1);
|
|
36
|
-
(0, _getStep
|
|
36
|
+
(0, _getStep["default"])(steps, 1.49, {
|
|
37
37
|
now: 0,
|
|
38
38
|
units: ['now', 'second']
|
|
39
39
|
}).formatAs.should.equal('second');
|
|
@@ -41,35 +41,35 @@ describe('getStep', function () {
|
|
|
41
41
|
delete steps[1].granularity;
|
|
42
42
|
});
|
|
43
43
|
it('should support `minTime` object', function () {
|
|
44
|
-
expect((0, _getStep
|
|
44
|
+
expect((0, _getStep["default"])([{
|
|
45
45
|
unit: 'second'
|
|
46
46
|
}, {
|
|
47
47
|
minTime: {
|
|
48
|
-
default: 10
|
|
48
|
+
"default": 10
|
|
49
49
|
},
|
|
50
50
|
unit: 'minute'
|
|
51
51
|
}], 5, {
|
|
52
52
|
now: 0,
|
|
53
53
|
units: ['second', 'minute']
|
|
54
54
|
}).unit).to.equal('second');
|
|
55
|
-
expect((0, _getStep
|
|
55
|
+
expect((0, _getStep["default"])([{
|
|
56
56
|
unit: 'second'
|
|
57
57
|
}, {
|
|
58
58
|
minTime: {
|
|
59
|
-
default: 10
|
|
59
|
+
"default": 10
|
|
60
60
|
},
|
|
61
61
|
unit: 'minute'
|
|
62
62
|
}], 10, {
|
|
63
63
|
now: 0,
|
|
64
64
|
units: ['second', 'minute']
|
|
65
65
|
}).unit).to.equal('minute');
|
|
66
|
-
expect((0, _getStep
|
|
66
|
+
expect((0, _getStep["default"])([{
|
|
67
67
|
id: 'seconds',
|
|
68
68
|
unit: 'second'
|
|
69
69
|
}, {
|
|
70
70
|
minTime: {
|
|
71
71
|
seconds: 20,
|
|
72
|
-
default: 10
|
|
72
|
+
"default": 10
|
|
73
73
|
},
|
|
74
74
|
unit: 'minute'
|
|
75
75
|
}], 10, {
|
|
@@ -78,7 +78,7 @@ describe('getStep', function () {
|
|
|
78
78
|
}).unit).to.equal('second');
|
|
79
79
|
});
|
|
80
80
|
it('should support legacy `threshold()` function', function () {
|
|
81
|
-
expect((0, _getStep
|
|
81
|
+
expect((0, _getStep["default"])([{
|
|
82
82
|
unit: 'second'
|
|
83
83
|
}, {
|
|
84
84
|
threshold: function threshold() {
|
|
@@ -89,7 +89,7 @@ describe('getStep', function () {
|
|
|
89
89
|
now: 0,
|
|
90
90
|
units: ['second', 'minute']
|
|
91
91
|
}).unit).to.equal('second');
|
|
92
|
-
expect((0, _getStep
|
|
92
|
+
expect((0, _getStep["default"])([{
|
|
93
93
|
unit: 'second'
|
|
94
94
|
}, {
|
|
95
95
|
threshold: function threshold() {
|
|
@@ -102,7 +102,7 @@ describe('getStep', function () {
|
|
|
102
102
|
}).unit).to.equal('minute');
|
|
103
103
|
});
|
|
104
104
|
it('should stop when reaching a step that has no "minTime" and for which "minTime" could not be deduced', function () {
|
|
105
|
-
expect((0, _getStep
|
|
105
|
+
expect((0, _getStep["default"])([{
|
|
106
106
|
formatAs: 'second'
|
|
107
107
|
}, {
|
|
108
108
|
formatAs: 'unsupported-time-unit'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStep.test.js","names":["describe","it","expect","getStep","round","units","to","be","undefined","steps","slice","formatAs","should","equal","granularity","now","firstStep","splice","unshift","unit","minTime","id","seconds","threshold"],"sources":["../../source/steps/getStep.test.js"],"sourcesContent":["import getStep from './getStep.js'\r\nimport round from './round.js'\r\n\r\ndescribe('getStep', () => {\r\n\tit('should return nothing if no time units are supported', () => {\r\n\t\texpect(getStep(round, 0, { units: ['femtosecond'] })).to.be.undefined\r\n\t})\r\n\r\n\t// it('should throw if a non-first step does not have a `minTime` or `test()`', () => {\r\n\t// \texpect(getStep([{ unit: 'second' }], 2, { units: ['second'] })).to.deep.equal({ unit: 'second' })\r\n\t//\r\n\t// \texpect(() => {\r\n\t// \t\tgetStep([{ unit: 'second' }, { unit: 'minute' }], 2, { units: ['second', 'minute'] })\r\n\t// \t}).to.throw(\r\n\t// \t\t'Each step must define either `minTime` or `test()`, except for the first one. Got \"undefined\", undefined. Step: {\"unit\":\"minute\"}'\r\n\t// \t)\r\n\t// })\r\n\r\n\tit('should fall back to previous step if granularity is too high for the next step', () => {\r\n\t\tconst steps = round.slice()\r\n\r\n\t\tsteps[1].formatAs.should.equal('second')\r\n\t\tsteps[1].granularity = 3\r\n\r\n\t\tgetStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs.should.equal('now')\r\n\r\n\t\t// And if there's no previous step, then use the current one.\r\n\r\n\t\tconst firstStep = steps[0]\r\n\t\tsteps.splice(0, 1)\r\n\r\n\t\tgetStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs.should.equal('second')\r\n\r\n\t\tsteps.unshift(firstStep)\r\n\r\n\t\tdelete steps[1].granularity\r\n\t})\r\n\r\n\tit('should support `minTime` object', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{\r\n\t\t\t\t\tid: 'seconds',\r\n\t\t\t\t\tunit: 'second'\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: {\r\n\t\t\t\t\t\tseconds: 20,\r\n\t\t\t\t\t\tdefault: 10\r\n\t\t\t\t\t},\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\t})\r\n\r\n\tit('should support legacy `threshold()` function', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\t})\r\n\r\n\tit('should stop when reaching a step that has no \"minTime\" and for which \"minTime\" could not be deduced', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ formatAs: 'second' },\r\n\t\t\t\t{ formatAs: 'unsupported-time-unit' }\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'unsupported-time-unit'] }\r\n\t\t).formatAs).to.equal('second')\r\n\t})\r\n})"],"mappings":";;AAAA;;AACA;;;;AAEAA,QAAQ,CAAC,SAAD,EAAY,YAAM;EACzBC,EAAE,CAAC,sDAAD,EAAyD,YAAM;IAChEC,MAAM,CAAC,IAAAC,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,EAVR,CAUWO,KAVX,CAUiB,QAVjB;IAYAX,MAAM,CAAC,IAAAC,mBAAA,EACN,CACC;MAAEgB,IAAI,EAAE;IAAR,CADD,EAEC;MACCI,SAAS,EAAE;QAAA,OAAM,EAAN;MAAA,CADZ;MAECJ,IAAI,EAAE;IAFP,CAFD,CADM,EAQN,EARM,EASN;MAAEJ,GAAG,EAAE,CAAP;MAAUV,KAAK,EAAE,CAAC,QAAD,EAAW,QAAX;IAAjB,CATM,EAULc,IAVI,CAAN,CAUQb,EAVR,CAUWO,KAVX,CAUiB,QAVjB;EAWA,CAxBC,CAAF;EA0BAZ,EAAE,CAAC,qGAAD,EAAwG,YAAM;IAC/GC,MAAM,CAAC,IAAAC,mBAAA,EACN,CACC;MAAEQ,QAAQ,EAAE;IAAZ,CADD,EAEC;MAAEA,QAAQ,EAAE;IAAZ,CAFD,CADM,EAKN,EALM,EAMN;MAAEI,GAAG,EAAE,CAAP;MAAUV,KAAK,EAAE,CAAC,QAAD,EAAW,uBAAX;IAAjB,CANM,EAOLM,QAPI,CAAN,CAOYL,EAPZ,CAOeO,KAPf,CAOqB,QAPrB;EAQA,CATC,CAAF;AAUA,CAnHO,CAAR"}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = getStepDenominator;
|
|
7
7
|
|
|
8
|
-
var _units = require("./units");
|
|
8
|
+
var _units = require("./units.js");
|
|
9
9
|
|
|
10
10
|
function getStepDenominator(step) {
|
|
11
11
|
// `factor` is a legacy property.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStepDenominator.js","names":["getStepDenominator","step","factor","undefined","getSecondsInUnit","unit","formatAs"],"sources":["../../source/steps/getStepDenominator.js"],"sourcesContent":["import { getSecondsInUnit } from './units.js'\r\n\r\nexport default function getStepDenominator(step) {\r\n\t// `factor` is a legacy property.\r\n\tif (step.factor !== undefined) {\r\n\t\treturn step.factor\r\n\t}\r\n\t// \"unit\" is now called \"formatAs\".\r\n\treturn getSecondsInUnit(step.unit || step.formatAs) || 1\r\n}"],"mappings":";;;;;;;AAAA;;AAEe,SAASA,kBAAT,CAA4BC,IAA5B,EAAkC;EAChD;EACA,IAAIA,IAAI,CAACC,MAAL,KAAgBC,SAApB,EAA+B;IAC9B,OAAOF,IAAI,CAACC,MAAZ;EACA,CAJ+C,CAKhD;;;EACA,OAAO,IAAAE,uBAAA,EAAiBH,IAAI,CAACI,IAAL,IAAaJ,IAAI,CAACK,QAAnC,KAAgD,CAAvD;AACA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _getStepDenominator = _interopRequireDefault(require("./getStepDenominator"));
|
|
3
|
+
var _getStepDenominator = _interopRequireDefault(require("./getStepDenominator.js"));
|
|
4
4
|
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
6
6
|
|
|
7
7
|
describe('getStepDenominator', function () {
|
|
8
8
|
it('should support the older "unit" name', function () {
|
|
9
|
-
(0, _getStepDenominator
|
|
9
|
+
(0, _getStepDenominator["default"])({
|
|
10
10
|
unit: 'minute'
|
|
11
11
|
}).should.equal(60);
|
|
12
12
|
});
|
|
13
13
|
it('should return 1 as a default "denominator"', function () {
|
|
14
|
-
(0, _getStepDenominator
|
|
14
|
+
(0, _getStepDenominator["default"])({
|
|
15
15
|
formatAs: 'exotic'
|
|
16
16
|
}).should.equal(1);
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStepDenominator.test.js","names":["describe","it","getStepDenominator","unit","should","equal","formatAs"],"sources":["../../source/steps/getStepDenominator.test.js"],"sourcesContent":["import getStepDenominator from './getStepDenominator.js'\r\n\r\ndescribe('getStepDenominator', () => {\r\n\tit('should support the older \"unit\" name', () => {\r\n\t\tgetStepDenominator({ unit: 'minute' }).should.equal(60)\r\n\t})\r\n\r\n\tit('should return 1 as a default \"denominator\"', () => {\r\n\t\tgetStepDenominator({ formatAs: 'exotic' }).should.equal(1)\r\n\t})\r\n})"],"mappings":";;AAAA;;;;AAEAA,QAAQ,CAAC,oBAAD,EAAuB,YAAM;EACpCC,EAAE,CAAC,sCAAD,EAAyC,YAAM;IAChD,IAAAC,8BAAA,EAAmB;MAAEC,IAAI,EAAE;IAAR,CAAnB,EAAuCC,MAAvC,CAA8CC,KAA9C,CAAoD,EAApD;EACA,CAFC,CAAF;EAIAJ,EAAE,CAAC,4CAAD,EAA+C,YAAM;IACtD,IAAAC,8BAAA,EAAmB;MAAEI,QAAQ,EAAE;IAAZ,CAAnB,EAA2CF,MAA3C,CAAkDC,KAAlD,CAAwD,CAAxD;EACA,CAFC,CAAF;AAGA,CARO,CAAR"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = getStepMinTime;
|
|
7
7
|
|
|
8
|
-
var _units = require("./units");
|
|
8
|
+
var _units = require("./units.js");
|
|
9
9
|
|
|
10
|
-
var _round = require("../round");
|
|
10
|
+
var _round = require("../round.js");
|
|
11
11
|
|
|
12
|
-
function _typeof(obj) {
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
13
|
|
|
14
14
|
function getStepMinTime(step, _ref) {
|
|
15
15
|
var prevStep = _ref.prevStep,
|
|
@@ -47,7 +47,7 @@ function getStepMinTime(step, _ref) {
|
|
|
47
47
|
if (prevStep && prevStep.id && minTime[prevStep.id] !== undefined) {
|
|
48
48
|
minTime = minTime[prevStep.id];
|
|
49
49
|
} else {
|
|
50
|
-
minTime = minTime
|
|
50
|
+
minTime = minTime["default"];
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStepMinTime.js","names":["getStepMinTime","step","prevStep","timestamp","now","future","round","minTime","id","unit","undefined","threshold","getMinTimeForUnit","toUnit","fromUnit","formatAs","test","console","warn","JSON","stringify","toUnitAmount","getSecondsInUnit","fromUnitAmount","getDiffRatioToNextRoundedNumber"],"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\" is a legacy property.\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\tif (minTime === undefined) {\r\n\t\t// \"threshold\" is a legacy property.\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\tif (minTime === undefined) {\r\n\t\tminTime = step.minTime\r\n\t}\r\n\t// A deprecated way of specifying a different threshold\r\n\t// depending on 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\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\t// Evaluate the `test()` function.\r\n\t// `test()` function 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\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\t// Warn if no `minTime` was defined or could be deduced.\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\treturn minTime\r\n}\r\n\r\nfunction getMinTimeForUnit(toUnit, fromUnit, { round }) {\r\n\tconst toUnitAmount = getSecondsInUnit(toUnit)\r\n\t// if (!fromUnit) {\r\n\t// \treturn toUnitAmount;\r\n\t// }\r\n\t// if (!fromUnit) {\r\n\t// \tfromUnit = getPreviousUnitFor(toUnit)\r\n\t// }\r\n\tlet fromUnitAmount\r\n\tif (fromUnit === 'now') {\r\n\t\tfromUnitAmount = getSecondsInUnit(toUnit)\r\n\t} else {\r\n\t\tfromUnitAmount = getSecondsInUnit(fromUnit)\r\n\t}\r\n\tif (toUnitAmount !== undefined && fromUnitAmount !== undefined) {\r\n\t\treturn toUnitAmount - fromUnitAmount * (1 - getDiffRatioToNextRoundedNumber(round))\r\n\t}\r\n}"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEe,SAASA,cAAT,CAAwBC,IAAxB,QAOZ;EAAA,IANFC,QAME,QANFA,QAME;EAAA,IALFC,SAKE,QALFA,SAKE;EAAA,IAHFC,GAGE,QAHFA,GAGE;EAAA,IAFFC,MAEE,QAFFA,MAEE;EAAA,IADFC,KACE,QADFA,KACE;EACF,IAAIC,OAAJ,CADE,CAEF;;EACA,IAAIL,QAAJ,EAAc;IACb,IAAIA,QAAQ,CAACM,EAAT,IAAeN,QAAQ,CAACO,IAA5B,EAAkC;MACjCF,OAAO,GAAGN,IAAI,yBAAkBC,QAAQ,CAACM,EAAT,IAAeN,QAAQ,CAACO,IAA1C,EAAd;IACA;EACD;;EACD,IAAIF,OAAO,KAAKG,SAAhB,EAA2B;IAC1B;IACA,IAAIT,IAAI,CAACU,SAAL,KAAmBD,SAAvB,EAAkC;MACjC;MACAH,OAAO,GAAGN,IAAI,CAACU,SAAf,CAFiC,CAGjC;;MACA,IAAI,OAAOJ,OAAP,KAAmB,UAAvB,EAAmC;QAClCA,OAAO,GAAGA,OAAO,CAACH,GAAD,EAAMC,MAAN,CAAjB;MACA;IACD;EACD;;EACD,IAAIE,OAAO,KAAKG,SAAhB,EAA2B;IAC1BH,OAAO,GAAGN,IAAI,CAACM,OAAf;EACA,CArBC,CAsBF;EACA;;;EACA,IAAI,QAAOA,OAAP,MAAmB,QAAvB,EAAiC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CAqEF;;;EACA,IAAIA,OAAO,KAAKG,SAAhB,EAA2B;IAC1BO,OAAO,CAACC,IAAR,CAAa,6DAA6DC,IAAI,CAACC,SAAL,CAAenB,IAAf,EAAqB,IAArB,EAA2B,CAA3B,CAA1E;EACA;;EACD,OAAOM,OAAP;AACA;;AAED,SAASK,kBAAT,CAA2BC,MAA3B,EAAmCC,QAAnC,SAAwD;EAAA,IAATR,KAAS,SAATA,KAAS;EACvD,IAAMe,YAAY,GAAG,IAAAC,uBAAA,EAAiBT,MAAjB,CAArB,CADuD,CAEvD;EACA;EACA;EACA;EACA;EACA;;EACA,IAAIU,cAAJ;;EACA,IAAIT,QAAQ,KAAK,KAAjB,EAAwB;IACvBS,cAAc,GAAG,IAAAD,uBAAA,EAAiBT,MAAjB,CAAjB;EACA,CAFD,MAEO;IACNU,cAAc,GAAG,IAAAD,uBAAA,EAAiBR,QAAjB,CAAjB;EACA;;EACD,IAAIO,YAAY,KAAKX,SAAjB,IAA8Ba,cAAc,KAAKb,SAArD,EAAgE;IAC/D,OAAOW,YAAY,GAAGE,cAAc,IAAI,IAAI,IAAAC,sCAAA,EAAgClB,KAAhC,CAAR,CAApC;EACA;AACD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime"));
|
|
3
|
+
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime.js"));
|
|
4
4
|
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
6
6
|
|
|
7
7
|
describe('getStepMinTime', function () {
|
|
8
8
|
it('should support `step.test()` function (returns true)', function () {
|
|
9
|
-
(0, _getStepMinTime
|
|
9
|
+
(0, _getStepMinTime["default"])({
|
|
10
10
|
test: function test() {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@ describe('getStepMinTime', function () {
|
|
|
17
17
|
}).should.equal(0);
|
|
18
18
|
});
|
|
19
19
|
it('should support `step.test()` function (returns false)', function () {
|
|
20
|
-
(0, _getStepMinTime
|
|
20
|
+
(0, _getStepMinTime["default"])({
|
|
21
21
|
test: function test() {
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getStepMinTime.test.js","names":["describe","it","getStepMinTime","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;;;;AAEAA,QAAQ,CAAC,gBAAD,EAAmB,YAAM;EAChCC,EAAE,CAAC,sDAAD,EAAyD,YAAM;IAChE,IAAAC,0BAAA,EAAe;MACdC,IAAI,EAAE;QAAA,OAAM,IAAN;MAAA;IADQ,CAAf,EAEG;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAX;IADR,CAFH,EAIGC,MAJH,CAIUC,KAJV,CAIgB,CAJhB;EAKA,CANC,CAAF;EAQAN,EAAE,CAAC,uDAAD,EAA0D,YAAM;IACjE,IAAAC,0BAAA,EAAe;MACdC,IAAI,EAAE;QAAA,OAAM,KAAN;MAAA;IADQ,CAAf,EAEG;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAX;IADR,CAFH,EAIGC,MAJH,CAIUC,KAJV,CAIgB,gBAJhB;EAKA,CANC,CAAF;AAOA,CAhBO,CAAR"}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.INFINITY = void 0;
|
|
7
|
+
exports["default"] = getTimeToNextUpdate;
|
|
7
8
|
exports.getStepChangesAt = getStepChangesAt;
|
|
8
9
|
exports.getTimeToStepChange = getTimeToStepChange;
|
|
9
|
-
exports.INFINITY = void 0;
|
|
10
10
|
|
|
11
|
-
var _getTimeToNextUpdateForUnit2 = _interopRequireDefault(require("./getTimeToNextUpdateForUnit"));
|
|
11
|
+
var _getTimeToNextUpdateForUnit2 = _interopRequireDefault(require("./getTimeToNextUpdateForUnit.js"));
|
|
12
12
|
|
|
13
|
-
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime"));
|
|
13
|
+
var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime.js"));
|
|
14
14
|
|
|
15
|
-
var _round = require("../round");
|
|
15
|
+
var _round = require("../round.js");
|
|
16
16
|
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
18
|
|
|
19
19
|
// A thousand years is practically a metaphor for "infinity".
|
|
20
20
|
var YEAR = 365 * 24 * 60 * 60 * 1000;
|
|
@@ -42,7 +42,7 @@ function getTimeToNextUpdate(date, step, _ref) {
|
|
|
42
42
|
var timestamp = date.getTime ? date.getTime() : date;
|
|
43
43
|
|
|
44
44
|
var getTimeToNextUpdateForUnit = function getTimeToNextUpdateForUnit(unit) {
|
|
45
|
-
return (0, _getTimeToNextUpdateForUnit2
|
|
45
|
+
return (0, _getTimeToNextUpdateForUnit2["default"])(unit, timestamp, {
|
|
46
46
|
now: now,
|
|
47
47
|
round: round
|
|
48
48
|
});
|
|
@@ -120,7 +120,7 @@ function getStepChangesAt(currentOrNextStep, timestamp, _ref2) {
|
|
|
120
120
|
// but it does change the wording when switching
|
|
121
121
|
// from "future" to "past": "in ..." -> "... ago".
|
|
122
122
|
// Therefore, the label should be updated at zero-point too.
|
|
123
|
-
var minTime = (0, _getStepMinTime
|
|
123
|
+
var minTime = (0, _getStepMinTime["default"])(currentOrNextStep, {
|
|
124
124
|
timestamp: timestamp,
|
|
125
125
|
now: now,
|
|
126
126
|
future: future,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getTimeToNextUpdate.js","names":["YEAR","INFINITY","getTimeToNextUpdate","date","step","prevStep","nextStep","now","future","round","timestamp","getTime","getTimeToNextUpdateForUnit","unit","_getTimeToNextUpdateForUnit","timeToStepChange","getTimeToStepChange","undefined","timeToNextUpdate","getRoundFunction","formatAs","Math","min","getStepChangesAt","currentOrNextStep","minTime","getStepMinTime","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 * Gets the time to next update for a date and a step.\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]\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\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\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;;AACA;;AACA;;;;AAEA;AACA,IAAMA,IAAI,GAAG,MAAM,EAAN,GAAW,EAAX,GAAgB,EAAhB,GAAqB,IAAlC;AACO,IAAMC,QAAQ,GAAG,OAAOD,IAAxB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACe,SAASE,mBAAT,CAA6BC,IAA7B,EAAmCC,IAAnC,QAAqF;EAAA,IAA1CC,QAA0C,QAA1CA,QAA0C;EAAA,IAAhCC,QAAgC,QAAhCA,QAAgC;EAAA,IAAtBC,GAAsB,QAAtBA,GAAsB;EAAA,IAAjBC,MAAiB,QAAjBA,MAAiB;EAAA,IAATC,KAAS,QAATA,KAAS;EACnG,IAAMC,SAAS,GAAGP,IAAI,CAACQ,OAAL,GAAeR,IAAI,CAACQ,OAAL,EAAf,GAAgCR,IAAlD;;EAEA,IAAMS,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,IAAD;IAAA,OAAU,IAAAC,uCAAA,EAA4BD,IAA5B,EAAkCH,SAAlC,EAA6C;MAAEH,GAAG,EAAHA,GAAF;MAAOE,KAAK,EAALA;IAAP,CAA7C,CAAV;EAAA,CAAnC,CAHmG,CAKnG;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;EACA,IAAMM,gBAAgB,GAAGC,mBAAmB,CAACR,MAAM,GAAGJ,IAAH,GAAUE,QAAjB,EAA2BI,SAA3B,EAAsC;IACjFF,MAAM,EAANA,MADiF;IAEjFD,GAAG,EAAHA,GAFiF;IAGjFE,KAAK,EAALA,KAHiF;IAIjFJ,QAAQ,EAAEG,MAAM,GAAGH,QAAH,GAAcD,IAJmD,CAKjF;;EALiF,CAAtC,CAA5C;;EA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