@formatjs/ecma402-abstract 1.11.6 → 1.11.9

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.
Files changed (277) hide show
  1. package/262.ts +372 -0
  2. package/BUILD +97 -0
  3. package/CHANGELOG.md +709 -0
  4. package/CanonicalizeLocaleList.ts +8 -0
  5. package/CanonicalizeTimeZoneName.ts +29 -0
  6. package/CoerceOptionsToObject.ts +13 -0
  7. package/DefaultNumberOption.ts +28 -0
  8. package/GetNumberOption.ts +29 -0
  9. package/GetOption.ts +38 -0
  10. package/GetOptionsObject.ts +14 -0
  11. package/IsSanctionedSimpleUnitIdentifier.ts +66 -0
  12. package/IsValidTimeZoneName.ts +27 -0
  13. package/IsWellFormedCurrencyCode.ts +23 -0
  14. package/IsWellFormedUnitIdentifier.ts +32 -0
  15. package/LICENSE.md +0 -0
  16. package/NumberFormat/ComputeExponent.ts +49 -0
  17. package/NumberFormat/ComputeExponentForMagnitude.ts +71 -0
  18. package/NumberFormat/CurrencyDigits.ts +13 -0
  19. package/NumberFormat/FormatNumericToParts.ts +22 -0
  20. package/NumberFormat/FormatNumericToString.ts +71 -0
  21. package/NumberFormat/InitializeNumberFormat.ts +147 -0
  22. package/NumberFormat/PartitionNumberPattern.ts +86 -0
  23. package/NumberFormat/SetNumberFormatDigitOptions.ts +45 -0
  24. package/NumberFormat/SetNumberFormatUnitOptions.ts +77 -0
  25. package/NumberFormat/ToRawFixed.ts +56 -0
  26. package/NumberFormat/ToRawPrecision.ts +86 -0
  27. package/NumberFormat/digit-mapping.generated.ts +1 -0
  28. package/NumberFormat/format_to_parts.ts +571 -0
  29. package/PartitionPattern.ts +38 -0
  30. package/README.md +0 -0
  31. package/SupportedLocales.ts +31 -0
  32. package/data.ts +9 -0
  33. package/index.ts +45 -0
  34. package/package.json +3 -3
  35. package/regex.generated.ts +2 -0
  36. package/scripts/digit-mapping.ts +109 -0
  37. package/scripts/regex-gen.ts +19 -0
  38. package/tests/PartitionPattern.test.ts +38 -0
  39. package/tests/ToRawFixed.test.tsx +41 -0
  40. package/tests/ToRawPrecision.test.tsx +65 -0
  41. package/tsconfig.json +5 -0
  42. package/types/core.ts +11 -0
  43. package/types/date-time.ts +199 -0
  44. package/types/displaynames.ts +48 -0
  45. package/types/list.ts +22 -0
  46. package/types/number.ts +240 -0
  47. package/types/plural-rules.ts +18 -0
  48. package/types/relative-time.ts +74 -0
  49. package/utils.ts +128 -0
  50. package/262.d.ts +0 -92
  51. package/262.d.ts.map +0 -1
  52. package/262.js +0 -362
  53. package/CanonicalizeLocaleList.d.ts +0 -6
  54. package/CanonicalizeLocaleList.d.ts.map +0 -1
  55. package/CanonicalizeLocaleList.js +0 -12
  56. package/CanonicalizeTimeZoneName.d.ts +0 -9
  57. package/CanonicalizeTimeZoneName.d.ts.map +0 -1
  58. package/CanonicalizeTimeZoneName.js +0 -21
  59. package/CoerceOptionsToObject.d.ts +0 -7
  60. package/CoerceOptionsToObject.d.ts.map +0 -1
  61. package/CoerceOptionsToObject.js +0 -16
  62. package/DefaultNumberOption.d.ts +0 -9
  63. package/DefaultNumberOption.d.ts.map +0 -1
  64. package/DefaultNumberOption.js +0 -14
  65. package/GetNumberOption.d.ts +0 -10
  66. package/GetNumberOption.d.ts.map +0 -1
  67. package/GetNumberOption.js +0 -18
  68. package/GetOption.d.ts +0 -10
  69. package/GetOption.d.ts.map +0 -1
  70. package/GetOption.js +0 -35
  71. package/GetOptionsObject.d.ts +0 -7
  72. package/GetOptionsObject.d.ts.map +0 -1
  73. package/GetOptionsObject.js +0 -18
  74. package/IsSanctionedSimpleUnitIdentifier.d.ts +0 -14
  75. package/IsSanctionedSimpleUnitIdentifier.d.ts.map +0 -1
  76. package/IsSanctionedSimpleUnitIdentifier.js +0 -68
  77. package/IsValidTimeZoneName.d.ts +0 -10
  78. package/IsValidTimeZoneName.d.ts.map +0 -1
  79. package/IsValidTimeZoneName.js +0 -23
  80. package/IsWellFormedCurrencyCode.d.ts +0 -5
  81. package/IsWellFormedCurrencyCode.d.ts.map +0 -1
  82. package/IsWellFormedCurrencyCode.js +0 -25
  83. package/IsWellFormedUnitIdentifier.d.ts +0 -6
  84. package/IsWellFormedUnitIdentifier.d.ts.map +0 -1
  85. package/IsWellFormedUnitIdentifier.js +0 -32
  86. package/NumberFormat/ComputeExponent.d.ts +0 -12
  87. package/NumberFormat/ComputeExponent.d.ts.map +0 -1
  88. package/NumberFormat/ComputeExponent.js +0 -43
  89. package/NumberFormat/ComputeExponentForMagnitude.d.ts +0 -10
  90. package/NumberFormat/ComputeExponentForMagnitude.d.ts.map +0 -1
  91. package/NumberFormat/ComputeExponentForMagnitude.js +0 -64
  92. package/NumberFormat/CurrencyDigits.d.ts +0 -7
  93. package/NumberFormat/CurrencyDigits.d.ts.map +0 -1
  94. package/NumberFormat/CurrencyDigits.js +0 -14
  95. package/NumberFormat/FormatNumericToParts.d.ts +0 -5
  96. package/NumberFormat/FormatNumericToParts.d.ts.map +0 -1
  97. package/NumberFormat/FormatNumericToParts.js +0 -18
  98. package/NumberFormat/FormatNumericToString.d.ts +0 -9
  99. package/NumberFormat/FormatNumericToString.d.ts.map +0 -1
  100. package/NumberFormat/FormatNumericToString.js +0 -45
  101. package/NumberFormat/InitializeNumberFormat.d.ts +0 -13
  102. package/NumberFormat/InitializeNumberFormat.d.ts.map +0 -1
  103. package/NumberFormat/InitializeNumberFormat.js +0 -68
  104. package/NumberFormat/PartitionNumberPattern.d.ts +0 -8
  105. package/NumberFormat/PartitionNumberPattern.d.ts.map +0 -1
  106. package/NumberFormat/PartitionNumberPattern.js +0 -80
  107. package/NumberFormat/SetNumberFormatDigitOptions.d.ts +0 -6
  108. package/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +0 -1
  109. package/NumberFormat/SetNumberFormatDigitOptions.js +0 -40
  110. package/NumberFormat/SetNumberFormatUnitOptions.d.ts +0 -8
  111. package/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +0 -1
  112. package/NumberFormat/SetNumberFormatUnitOptions.js +0 -43
  113. package/NumberFormat/ToRawFixed.d.ts +0 -10
  114. package/NumberFormat/ToRawFixed.d.ts.map +0 -1
  115. package/NumberFormat/ToRawFixed.js +0 -55
  116. package/NumberFormat/ToRawPrecision.d.ts +0 -3
  117. package/NumberFormat/ToRawPrecision.d.ts.map +0 -1
  118. package/NumberFormat/ToRawPrecision.js +0 -78
  119. package/NumberFormat/digit-mapping.generated.d.ts +0 -2
  120. package/NumberFormat/digit-mapping.generated.d.ts.map +0 -1
  121. package/NumberFormat/digit-mapping.generated.js +0 -4
  122. package/NumberFormat/format_to_parts.d.ts +0 -22
  123. package/NumberFormat/format_to_parts.d.ts.map +0 -1
  124. package/NumberFormat/format_to_parts.js +0 -424
  125. package/PartitionPattern.d.ts +0 -9
  126. package/PartitionPattern.d.ts.map +0 -1
  127. package/PartitionPattern.js +0 -39
  128. package/SupportedLocales.d.ts +0 -10
  129. package/SupportedLocales.d.ts.map +0 -1
  130. package/SupportedLocales.js +0 -24
  131. package/data.d.ts +0 -6
  132. package/data.d.ts.map +0 -1
  133. package/data.js +0 -17
  134. package/index.d.ts +0 -37
  135. package/index.d.ts.map +0 -1
  136. package/index.js +0 -48
  137. package/lib/262.d.ts +0 -92
  138. package/lib/262.d.ts.map +0 -1
  139. package/lib/262.js +0 -336
  140. package/lib/CanonicalizeLocaleList.d.ts +0 -6
  141. package/lib/CanonicalizeLocaleList.d.ts.map +0 -1
  142. package/lib/CanonicalizeLocaleList.js +0 -8
  143. package/lib/CanonicalizeTimeZoneName.d.ts +0 -9
  144. package/lib/CanonicalizeTimeZoneName.d.ts.map +0 -1
  145. package/lib/CanonicalizeTimeZoneName.js +0 -17
  146. package/lib/CoerceOptionsToObject.d.ts +0 -7
  147. package/lib/CoerceOptionsToObject.d.ts.map +0 -1
  148. package/lib/CoerceOptionsToObject.js +0 -12
  149. package/lib/DefaultNumberOption.d.ts +0 -9
  150. package/lib/DefaultNumberOption.d.ts.map +0 -1
  151. package/lib/DefaultNumberOption.js +0 -10
  152. package/lib/GetNumberOption.d.ts +0 -10
  153. package/lib/GetNumberOption.d.ts.map +0 -1
  154. package/lib/GetNumberOption.js +0 -14
  155. package/lib/GetOption.d.ts +0 -10
  156. package/lib/GetOption.d.ts.map +0 -1
  157. package/lib/GetOption.js +0 -31
  158. package/lib/GetOptionsObject.d.ts +0 -7
  159. package/lib/GetOptionsObject.d.ts.map +0 -1
  160. package/lib/GetOptionsObject.js +0 -14
  161. package/lib/IsSanctionedSimpleUnitIdentifier.d.ts +0 -14
  162. package/lib/IsSanctionedSimpleUnitIdentifier.d.ts.map +0 -1
  163. package/lib/IsSanctionedSimpleUnitIdentifier.js +0 -63
  164. package/lib/IsValidTimeZoneName.d.ts +0 -10
  165. package/lib/IsValidTimeZoneName.d.ts.map +0 -1
  166. package/lib/IsValidTimeZoneName.js +0 -19
  167. package/lib/IsWellFormedCurrencyCode.d.ts +0 -5
  168. package/lib/IsWellFormedCurrencyCode.d.ts.map +0 -1
  169. package/lib/IsWellFormedCurrencyCode.js +0 -21
  170. package/lib/IsWellFormedUnitIdentifier.d.ts +0 -6
  171. package/lib/IsWellFormedUnitIdentifier.d.ts.map +0 -1
  172. package/lib/IsWellFormedUnitIdentifier.js +0 -28
  173. package/lib/NumberFormat/ComputeExponent.d.ts +0 -12
  174. package/lib/NumberFormat/ComputeExponent.d.ts.map +0 -1
  175. package/lib/NumberFormat/ComputeExponent.js +0 -39
  176. package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts +0 -10
  177. package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts.map +0 -1
  178. package/lib/NumberFormat/ComputeExponentForMagnitude.js +0 -60
  179. package/lib/NumberFormat/CurrencyDigits.d.ts +0 -7
  180. package/lib/NumberFormat/CurrencyDigits.d.ts.map +0 -1
  181. package/lib/NumberFormat/CurrencyDigits.js +0 -10
  182. package/lib/NumberFormat/FormatNumericToParts.d.ts +0 -5
  183. package/lib/NumberFormat/FormatNumericToParts.d.ts.map +0 -1
  184. package/lib/NumberFormat/FormatNumericToParts.js +0 -14
  185. package/lib/NumberFormat/FormatNumericToString.d.ts +0 -9
  186. package/lib/NumberFormat/FormatNumericToString.d.ts.map +0 -1
  187. package/lib/NumberFormat/FormatNumericToString.js +0 -41
  188. package/lib/NumberFormat/InitializeNumberFormat.d.ts +0 -13
  189. package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +0 -1
  190. package/lib/NumberFormat/InitializeNumberFormat.js +0 -64
  191. package/lib/NumberFormat/PartitionNumberPattern.d.ts +0 -8
  192. package/lib/NumberFormat/PartitionNumberPattern.d.ts.map +0 -1
  193. package/lib/NumberFormat/PartitionNumberPattern.js +0 -75
  194. package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts +0 -6
  195. package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +0 -1
  196. package/lib/NumberFormat/SetNumberFormatDigitOptions.js +0 -36
  197. package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts +0 -8
  198. package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +0 -1
  199. package/lib/NumberFormat/SetNumberFormatUnitOptions.js +0 -39
  200. package/lib/NumberFormat/ToRawFixed.d.ts +0 -10
  201. package/lib/NumberFormat/ToRawFixed.d.ts.map +0 -1
  202. package/lib/NumberFormat/ToRawFixed.js +0 -51
  203. package/lib/NumberFormat/ToRawPrecision.d.ts +0 -3
  204. package/lib/NumberFormat/ToRawPrecision.d.ts.map +0 -1
  205. package/lib/NumberFormat/ToRawPrecision.js +0 -74
  206. package/lib/NumberFormat/digit-mapping.generated.d.ts +0 -2
  207. package/lib/NumberFormat/digit-mapping.generated.d.ts.map +0 -1
  208. package/lib/NumberFormat/digit-mapping.generated.js +0 -1
  209. package/lib/NumberFormat/format_to_parts.d.ts +0 -22
  210. package/lib/NumberFormat/format_to_parts.d.ts.map +0 -1
  211. package/lib/NumberFormat/format_to_parts.js +0 -421
  212. package/lib/PartitionPattern.d.ts +0 -9
  213. package/lib/PartitionPattern.d.ts.map +0 -1
  214. package/lib/PartitionPattern.js +0 -35
  215. package/lib/SupportedLocales.d.ts +0 -10
  216. package/lib/SupportedLocales.d.ts.map +0 -1
  217. package/lib/SupportedLocales.js +0 -20
  218. package/lib/data.d.ts +0 -6
  219. package/lib/data.d.ts.map +0 -1
  220. package/lib/data.js +0 -13
  221. package/lib/index.d.ts +0 -37
  222. package/lib/index.d.ts.map +0 -1
  223. package/lib/index.js +0 -34
  224. package/lib/regex.generated.d.ts +0 -2
  225. package/lib/regex.generated.d.ts.map +0 -1
  226. package/lib/regex.generated.js +0 -2
  227. package/lib/types/core.d.ts +0 -11
  228. package/lib/types/core.d.ts.map +0 -1
  229. package/lib/types/core.js +0 -1
  230. package/lib/types/date-time.d.ts +0 -135
  231. package/lib/types/date-time.d.ts.map +0 -1
  232. package/lib/types/date-time.js +0 -6
  233. package/lib/types/displaynames.d.ts +0 -47
  234. package/lib/types/displaynames.d.ts.map +0 -1
  235. package/lib/types/displaynames.js +0 -1
  236. package/lib/types/list.d.ts +0 -19
  237. package/lib/types/list.d.ts.map +0 -1
  238. package/lib/types/list.js +0 -1
  239. package/lib/types/number.d.ts +0 -147
  240. package/lib/types/number.d.ts.map +0 -1
  241. package/lib/types/number.js +0 -1
  242. package/lib/types/plural-rules.d.ts +0 -17
  243. package/lib/types/plural-rules.d.ts.map +0 -1
  244. package/lib/types/plural-rules.js +0 -1
  245. package/lib/types/relative-time.d.ts +0 -41
  246. package/lib/types/relative-time.d.ts.map +0 -1
  247. package/lib/types/relative-time.js +0 -1
  248. package/lib/utils.d.ts +0 -24
  249. package/lib/utils.d.ts.map +0 -1
  250. package/lib/utils.js +0 -78
  251. package/regex.generated.d.ts +0 -2
  252. package/regex.generated.d.ts.map +0 -1
  253. package/regex.generated.js +0 -5
  254. package/types/core.d.ts +0 -11
  255. package/types/core.d.ts.map +0 -1
  256. package/types/core.js +0 -2
  257. package/types/date-time.d.ts +0 -135
  258. package/types/date-time.d.ts.map +0 -1
  259. package/types/date-time.js +0 -9
  260. package/types/displaynames.d.ts +0 -47
  261. package/types/displaynames.d.ts.map +0 -1
  262. package/types/displaynames.js +0 -2
  263. package/types/list.d.ts +0 -19
  264. package/types/list.d.ts.map +0 -1
  265. package/types/list.js +0 -2
  266. package/types/number.d.ts +0 -147
  267. package/types/number.d.ts.map +0 -1
  268. package/types/number.js +0 -2
  269. package/types/plural-rules.d.ts +0 -17
  270. package/types/plural-rules.d.ts.map +0 -1
  271. package/types/plural-rules.js +0 -2
  272. package/types/relative-time.d.ts +0 -41
  273. package/types/relative-time.d.ts.map +0 -1
  274. package/types/relative-time.js +0 -2
  275. package/utils.d.ts +0 -24
  276. package/utils.d.ts.map +0 -1
  277. package/utils.js +0 -90
package/lib/262.d.ts DELETED
@@ -1,92 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma262/#sec-tostring
3
- */
4
- export declare function ToString(o: unknown): string;
5
- /**
6
- * https://tc39.es/ecma262/#sec-tonumber
7
- * @param val
8
- */
9
- export declare function ToNumber(val: any): number;
10
- /**
11
- * https://tc39.es/ecma262/#sec-timeclip
12
- * @param time
13
- */
14
- export declare function TimeClip(time: number): number;
15
- /**
16
- * https://tc39.es/ecma262/#sec-toobject
17
- * @param arg
18
- */
19
- export declare function ToObject<T>(arg: T): T extends null ? never : T extends undefined ? never : T;
20
- /**
21
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-samevalue
22
- * @param x
23
- * @param y
24
- */
25
- export declare function SameValue(x: any, y: any): boolean;
26
- /**
27
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-arraycreate
28
- * @param len
29
- */
30
- export declare function ArrayCreate(len: number): any[];
31
- /**
32
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-hasownproperty
33
- * @param o
34
- * @param prop
35
- */
36
- export declare function HasOwnProperty(o: object, prop: string): boolean;
37
- /**
38
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
39
- * @param x
40
- */
41
- export declare function Type(x: any): "Null" | "Undefined" | "Object" | "Number" | "Boolean" | "String" | "Symbol" | "BigInt" | undefined;
42
- /**
43
- * https://tc39.es/ecma262/#eqn-Day
44
- * @param t
45
- */
46
- export declare function Day(t: number): number;
47
- /**
48
- * https://tc39.es/ecma262/#sec-week-day
49
- * @param t
50
- */
51
- export declare function WeekDay(t: number): number;
52
- /**
53
- * https://tc39.es/ecma262/#sec-year-number
54
- * @param y
55
- */
56
- export declare function DayFromYear(y: number): number;
57
- /**
58
- * https://tc39.es/ecma262/#sec-year-number
59
- * @param y
60
- */
61
- export declare function TimeFromYear(y: number): number;
62
- /**
63
- * https://tc39.es/ecma262/#sec-year-number
64
- * @param t
65
- */
66
- export declare function YearFromTime(t: number): number;
67
- export declare function DaysInYear(y: number): 365 | 366;
68
- export declare function DayWithinYear(t: number): number;
69
- export declare function InLeapYear(t: number): 0 | 1;
70
- /**
71
- * https://tc39.es/ecma262/#sec-month-number
72
- * @param t
73
- */
74
- export declare function MonthFromTime(t: number): 0 | 1 | 2 | 3 | 4 | 7 | 5 | 6 | 8 | 9 | 10 | 11;
75
- export declare function DateFromTime(t: number): number;
76
- export declare function HourFromTime(t: number): number;
77
- export declare function MinFromTime(t: number): number;
78
- export declare function SecFromTime(t: number): number;
79
- /**
80
- * The abstract operation OrdinaryHasInstance implements
81
- * the default algorithm for determining if an object O
82
- * inherits from the instance object inheritance path
83
- * provided by constructor C.
84
- * @param C class
85
- * @param O object
86
- * @param internalSlots internalSlots
87
- */
88
- export declare function OrdinaryHasInstance(C: Object, O: any, internalSlots?: {
89
- boundTargetFunction: any;
90
- }): boolean;
91
- export declare function msFromTime(t: number): number;
92
- //# sourceMappingURL=262.d.ts.map
package/lib/262.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"262.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/262.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAM3C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAiBzC;AAwBD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,UAQpC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,GAAG,EAAE,CAAC,GACL,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAK1D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,WAYvC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,SAEtC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAErD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,uGAyB1B;AAcD;;;GAGG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,UAE5B;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,UAEhC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,UAEpC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAErC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAErC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,aAWnC;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,UAEtC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,CAE3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,mDAwCtC;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAyCrC;AASD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,UAErC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,UAEpC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,UAEpC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,GAAG,EACN,aAAa,CAAC,EAAE;IAAC,mBAAmB,EAAE,GAAG,CAAA;CAAC,WAmB3C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C"}
package/lib/262.js DELETED
@@ -1,336 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma262/#sec-tostring
3
- */
4
- export function ToString(o) {
5
- // Only symbol is irregular...
6
- if (typeof o === 'symbol') {
7
- throw TypeError('Cannot convert a Symbol value to a string');
8
- }
9
- return String(o);
10
- }
11
- /**
12
- * https://tc39.es/ecma262/#sec-tonumber
13
- * @param val
14
- */
15
- export function ToNumber(val) {
16
- if (val === undefined) {
17
- return NaN;
18
- }
19
- if (val === null) {
20
- return +0;
21
- }
22
- if (typeof val === 'boolean') {
23
- return val ? 1 : +0;
24
- }
25
- if (typeof val === 'number') {
26
- return val;
27
- }
28
- if (typeof val === 'symbol' || typeof val === 'bigint') {
29
- throw new TypeError('Cannot convert symbol/bigint to number');
30
- }
31
- return Number(val);
32
- }
33
- /**
34
- * https://tc39.es/ecma262/#sec-tointeger
35
- * @param n
36
- */
37
- function ToInteger(n) {
38
- var number = ToNumber(n);
39
- if (isNaN(number) || SameValue(number, -0)) {
40
- return 0;
41
- }
42
- if (isFinite(number)) {
43
- return number;
44
- }
45
- var integer = Math.floor(Math.abs(number));
46
- if (number < 0) {
47
- integer = -integer;
48
- }
49
- if (SameValue(integer, -0)) {
50
- return 0;
51
- }
52
- return integer;
53
- }
54
- /**
55
- * https://tc39.es/ecma262/#sec-timeclip
56
- * @param time
57
- */
58
- export function TimeClip(time) {
59
- if (!isFinite(time)) {
60
- return NaN;
61
- }
62
- if (Math.abs(time) > 8.64 * 1e15) {
63
- return NaN;
64
- }
65
- return ToInteger(time);
66
- }
67
- /**
68
- * https://tc39.es/ecma262/#sec-toobject
69
- * @param arg
70
- */
71
- export function ToObject(arg) {
72
- if (arg == null) {
73
- throw new TypeError('undefined/null cannot be converted to object');
74
- }
75
- return Object(arg);
76
- }
77
- /**
78
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-samevalue
79
- * @param x
80
- * @param y
81
- */
82
- export function SameValue(x, y) {
83
- if (Object.is) {
84
- return Object.is(x, y);
85
- }
86
- // SameValue algorithm
87
- if (x === y) {
88
- // Steps 1-5, 7-10
89
- // Steps 6.b-6.e: +0 != -0
90
- return x !== 0 || 1 / x === 1 / y;
91
- }
92
- // Step 6.a: NaN == NaN
93
- return x !== x && y !== y;
94
- }
95
- /**
96
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-arraycreate
97
- * @param len
98
- */
99
- export function ArrayCreate(len) {
100
- return new Array(len);
101
- }
102
- /**
103
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-hasownproperty
104
- * @param o
105
- * @param prop
106
- */
107
- export function HasOwnProperty(o, prop) {
108
- return Object.prototype.hasOwnProperty.call(o, prop);
109
- }
110
- /**
111
- * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
112
- * @param x
113
- */
114
- export function Type(x) {
115
- if (x === null) {
116
- return 'Null';
117
- }
118
- if (typeof x === 'undefined') {
119
- return 'Undefined';
120
- }
121
- if (typeof x === 'function' || typeof x === 'object') {
122
- return 'Object';
123
- }
124
- if (typeof x === 'number') {
125
- return 'Number';
126
- }
127
- if (typeof x === 'boolean') {
128
- return 'Boolean';
129
- }
130
- if (typeof x === 'string') {
131
- return 'String';
132
- }
133
- if (typeof x === 'symbol') {
134
- return 'Symbol';
135
- }
136
- if (typeof x === 'bigint') {
137
- return 'BigInt';
138
- }
139
- }
140
- var MS_PER_DAY = 86400000;
141
- /**
142
- * https://www.ecma-international.org/ecma-262/11.0/index.html#eqn-modulo
143
- * @param x
144
- * @param y
145
- * @return k of the same sign as y
146
- */
147
- function mod(x, y) {
148
- return x - Math.floor(x / y) * y;
149
- }
150
- /**
151
- * https://tc39.es/ecma262/#eqn-Day
152
- * @param t
153
- */
154
- export function Day(t) {
155
- return Math.floor(t / MS_PER_DAY);
156
- }
157
- /**
158
- * https://tc39.es/ecma262/#sec-week-day
159
- * @param t
160
- */
161
- export function WeekDay(t) {
162
- return mod(Day(t) + 4, 7);
163
- }
164
- /**
165
- * https://tc39.es/ecma262/#sec-year-number
166
- * @param y
167
- */
168
- export function DayFromYear(y) {
169
- return Date.UTC(y, 0) / MS_PER_DAY;
170
- }
171
- /**
172
- * https://tc39.es/ecma262/#sec-year-number
173
- * @param y
174
- */
175
- export function TimeFromYear(y) {
176
- return Date.UTC(y, 0);
177
- }
178
- /**
179
- * https://tc39.es/ecma262/#sec-year-number
180
- * @param t
181
- */
182
- export function YearFromTime(t) {
183
- return new Date(t).getUTCFullYear();
184
- }
185
- export function DaysInYear(y) {
186
- if (y % 4 !== 0) {
187
- return 365;
188
- }
189
- if (y % 100 !== 0) {
190
- return 366;
191
- }
192
- if (y % 400 !== 0) {
193
- return 365;
194
- }
195
- return 366;
196
- }
197
- export function DayWithinYear(t) {
198
- return Day(t) - DayFromYear(YearFromTime(t));
199
- }
200
- export function InLeapYear(t) {
201
- return DaysInYear(YearFromTime(t)) === 365 ? 0 : 1;
202
- }
203
- /**
204
- * https://tc39.es/ecma262/#sec-month-number
205
- * @param t
206
- */
207
- export function MonthFromTime(t) {
208
- var dwy = DayWithinYear(t);
209
- var leap = InLeapYear(t);
210
- if (dwy >= 0 && dwy < 31) {
211
- return 0;
212
- }
213
- if (dwy < 59 + leap) {
214
- return 1;
215
- }
216
- if (dwy < 90 + leap) {
217
- return 2;
218
- }
219
- if (dwy < 120 + leap) {
220
- return 3;
221
- }
222
- if (dwy < 151 + leap) {
223
- return 4;
224
- }
225
- if (dwy < 181 + leap) {
226
- return 5;
227
- }
228
- if (dwy < 212 + leap) {
229
- return 6;
230
- }
231
- if (dwy < 243 + leap) {
232
- return 7;
233
- }
234
- if (dwy < 273 + leap) {
235
- return 8;
236
- }
237
- if (dwy < 304 + leap) {
238
- return 9;
239
- }
240
- if (dwy < 334 + leap) {
241
- return 10;
242
- }
243
- if (dwy < 365 + leap) {
244
- return 11;
245
- }
246
- throw new Error('Invalid time');
247
- }
248
- export function DateFromTime(t) {
249
- var dwy = DayWithinYear(t);
250
- var mft = MonthFromTime(t);
251
- var leap = InLeapYear(t);
252
- if (mft === 0) {
253
- return dwy + 1;
254
- }
255
- if (mft === 1) {
256
- return dwy - 30;
257
- }
258
- if (mft === 2) {
259
- return dwy - 58 - leap;
260
- }
261
- if (mft === 3) {
262
- return dwy - 89 - leap;
263
- }
264
- if (mft === 4) {
265
- return dwy - 119 - leap;
266
- }
267
- if (mft === 5) {
268
- return dwy - 150 - leap;
269
- }
270
- if (mft === 6) {
271
- return dwy - 180 - leap;
272
- }
273
- if (mft === 7) {
274
- return dwy - 211 - leap;
275
- }
276
- if (mft === 8) {
277
- return dwy - 242 - leap;
278
- }
279
- if (mft === 9) {
280
- return dwy - 272 - leap;
281
- }
282
- if (mft === 10) {
283
- return dwy - 303 - leap;
284
- }
285
- if (mft === 11) {
286
- return dwy - 333 - leap;
287
- }
288
- throw new Error('Invalid time');
289
- }
290
- var HOURS_PER_DAY = 24;
291
- var MINUTES_PER_HOUR = 60;
292
- var SECONDS_PER_MINUTE = 60;
293
- var MS_PER_SECOND = 1e3;
294
- var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
295
- var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
296
- export function HourFromTime(t) {
297
- return mod(Math.floor(t / MS_PER_HOUR), HOURS_PER_DAY);
298
- }
299
- export function MinFromTime(t) {
300
- return mod(Math.floor(t / MS_PER_MINUTE), MINUTES_PER_HOUR);
301
- }
302
- export function SecFromTime(t) {
303
- return mod(Math.floor(t / MS_PER_SECOND), SECONDS_PER_MINUTE);
304
- }
305
- function IsCallable(fn) {
306
- return typeof fn === 'function';
307
- }
308
- /**
309
- * The abstract operation OrdinaryHasInstance implements
310
- * the default algorithm for determining if an object O
311
- * inherits from the instance object inheritance path
312
- * provided by constructor C.
313
- * @param C class
314
- * @param O object
315
- * @param internalSlots internalSlots
316
- */
317
- export function OrdinaryHasInstance(C, O, internalSlots) {
318
- if (!IsCallable(C)) {
319
- return false;
320
- }
321
- if (internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction) {
322
- var BC = internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction;
323
- return O instanceof BC;
324
- }
325
- if (typeof O !== 'object') {
326
- return false;
327
- }
328
- var P = C.prototype;
329
- if (typeof P !== 'object') {
330
- throw new TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
331
- }
332
- return Object.prototype.isPrototypeOf.call(P, O);
333
- }
334
- export function msFromTime(t) {
335
- return mod(t, MS_PER_SECOND);
336
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
3
- * @param locales
4
- */
5
- export declare function CanonicalizeLocaleList(locales?: string | string[]): string[];
6
- //# sourceMappingURL=CanonicalizeLocaleList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CanonicalizeLocaleList.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/CanonicalizeLocaleList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAG5E"}
@@ -1,8 +0,0 @@
1
- /**
2
- * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
3
- * @param locales
4
- */
5
- export function CanonicalizeLocaleList(locales) {
6
- // TODO
7
- return Intl.getCanonicalLocales(locales);
8
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-canonicalizetimezonename
3
- * @param tz
4
- */
5
- export declare function CanonicalizeTimeZoneName(tz: string, { tzData, uppercaseLinks, }: {
6
- tzData: Record<string, unknown>;
7
- uppercaseLinks: Record<string, string>;
8
- }): string;
9
- //# sourceMappingURL=CanonicalizeTimeZoneName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CanonicalizeTimeZoneName.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/CanonicalizeTimeZoneName.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,EACV,EACE,MAAM,EACN,cAAc,GACf,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,UAgBF"}
@@ -1,17 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-canonicalizetimezonename
3
- * @param tz
4
- */
5
- export function CanonicalizeTimeZoneName(tz, _a) {
6
- var tzData = _a.tzData, uppercaseLinks = _a.uppercaseLinks;
7
- var uppercasedTz = tz.toUpperCase();
8
- var uppercasedZones = Object.keys(tzData).reduce(function (all, z) {
9
- all[z.toUpperCase()] = z;
10
- return all;
11
- }, {});
12
- var ianaTimeZone = uppercaseLinks[uppercasedTz] || uppercasedZones[uppercasedTz];
13
- if (ianaTimeZone === 'Etc/UTC' || ianaTimeZone === 'Etc/GMT') {
14
- return 'UTC';
15
- }
16
- return ianaTimeZone;
17
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-coerceoptionstoobject
3
- * @param options
4
- * @returns
5
- */
6
- export declare function CoerceOptionsToObject<T>(options?: T): T;
7
- //# sourceMappingURL=CoerceOptionsToObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoerceOptionsToObject.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/CoerceOptionsToObject.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAKvD"}
@@ -1,12 +0,0 @@
1
- import { ToObject } from './262';
2
- /**
3
- * https://tc39.es/ecma402/#sec-coerceoptionstoobject
4
- * @param options
5
- * @returns
6
- */
7
- export function CoerceOptionsToObject(options) {
8
- if (typeof options === 'undefined') {
9
- return Object.create(null);
10
- }
11
- return ToObject(options);
12
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-defaultnumberoption
3
- * @param val
4
- * @param min
5
- * @param max
6
- * @param fallback
7
- */
8
- export declare function DefaultNumberOption(val: any, min: number, max: number, fallback: number): number;
9
- //# sourceMappingURL=DefaultNumberOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultNumberOption.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DefaultNumberOption.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAAA"}
@@ -1,10 +0,0 @@
1
- export function DefaultNumberOption(val, min, max, fallback) {
2
- if (val !== undefined) {
3
- val = Number(val);
4
- if (isNaN(val) || val < min || val > max) {
5
- throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
6
- }
7
- return Math.floor(val);
8
- }
9
- return fallback;
10
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-getnumberoption
3
- * @param options
4
- * @param property
5
- * @param min
6
- * @param max
7
- * @param fallback
8
- */
9
- export declare function GetNumberOption<T extends object, K extends keyof T>(options: T, property: K, minimum: number, maximum: number, fallback: number): number;
10
- //# sourceMappingURL=GetNumberOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetNumberOption.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/GetNumberOption.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EACjE,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CAAA"}
@@ -1,14 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-getnumberoption
3
- * @param options
4
- * @param property
5
- * @param min
6
- * @param max
7
- * @param fallback
8
- */
9
- import { DefaultNumberOption } from './DefaultNumberOption';
10
- export function GetNumberOption(options, property, minimum, maximum, fallback) {
11
- var val = options[property];
12
- // @ts-expect-error
13
- return DefaultNumberOption(val, minimum, maximum, fallback);
14
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-getoption
3
- * @param opts
4
- * @param prop
5
- * @param type
6
- * @param values
7
- * @param fallback
8
- */
9
- export declare function GetOption<T extends object, K extends keyof T, F>(opts: T, prop: K, type: 'string' | 'boolean', values: T[K][] | undefined, fallback: F): Exclude<T[K], undefined> | F;
10
- //# sourceMappingURL=GetOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetOption.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/GetOption.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,EAC9D,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAC1B,QAAQ,EAAE,CAAC,GACV,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAqB9B"}
package/lib/GetOption.js DELETED
@@ -1,31 +0,0 @@
1
- import { ToString } from './262';
2
- /**
3
- * https://tc39.es/ecma402/#sec-getoption
4
- * @param opts
5
- * @param prop
6
- * @param type
7
- * @param values
8
- * @param fallback
9
- */
10
- export function GetOption(opts, prop, type, values, fallback) {
11
- if (typeof opts !== 'object') {
12
- throw new TypeError('Options must be an object');
13
- }
14
- var value = opts[prop];
15
- if (value !== undefined) {
16
- if (type !== 'boolean' && type !== 'string') {
17
- throw new TypeError('invalid type');
18
- }
19
- if (type === 'boolean') {
20
- value = Boolean(value);
21
- }
22
- if (type === 'string') {
23
- value = ToString(value);
24
- }
25
- if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
26
- throw new RangeError("".concat(value, " is not within ").concat(values.join(', ')));
27
- }
28
- return value;
29
- }
30
- return fallback;
31
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-getoptionsobject
3
- * @param options
4
- * @returns
5
- */
6
- export declare function GetOptionsObject<T extends object>(options?: T): T;
7
- //# sourceMappingURL=GetOptionsObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetOptionsObject.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/GetOptionsObject.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAQjE"}
@@ -1,14 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-getoptionsobject
3
- * @param options
4
- * @returns
5
- */
6
- export function GetOptionsObject(options) {
7
- if (typeof options === 'undefined') {
8
- return Object.create(null);
9
- }
10
- if (typeof options === 'object') {
11
- return options;
12
- }
13
- throw new TypeError('Options must be an object');
14
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
3
- */
4
- export declare const SANCTIONED_UNITS: string[];
5
- export declare function removeUnitNamespace(unit: string): string;
6
- /**
7
- * https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
8
- */
9
- export declare const SIMPLE_UNITS: string[];
10
- /**
11
- * https://tc39.es/ecma402/#sec-issanctionedsimpleunitidentifier
12
- */
13
- export declare function IsSanctionedSimpleUnitIdentifier(unitIdentifier: string): boolean;
14
- //# sourceMappingURL=IsSanctionedSimpleUnitIdentifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IsSanctionedSimpleUnitIdentifier.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/IsSanctionedSimpleUnitIdentifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB,UA4C5B,CAAA;AAID,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,UAE/C;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,UAA4C,CAAA;AAErE;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,cAAc,EAAE,MAAM,WAEtE"}