atomic-fns 1.1.7 → 2.0.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.
Files changed (216) hide show
  1. package/README.md +405 -60
  2. package/dist/array/index.d.ts +9 -0
  3. package/dist/array/index.js +9 -0
  4. package/dist/array/list.d.ts +99 -0
  5. package/dist/array/list.js +133 -0
  6. package/dist/array/sets.d.ts +130 -0
  7. package/dist/array/sets.js +213 -0
  8. package/dist/async/index.d.ts +6 -0
  9. package/dist/async/index.js +6 -0
  10. package/dist/async/retry.d.ts +38 -0
  11. package/dist/async/retry.js +56 -0
  12. package/dist/async/sleep.d.ts +42 -0
  13. package/dist/async/sleep.js +76 -0
  14. package/dist/collections/bisect.d.ts +103 -0
  15. package/dist/collections/bisect.js +157 -0
  16. package/dist/collections/deque.d.ts +67 -97
  17. package/dist/collections/deque.js +197 -249
  18. package/dist/collections/entries.d.ts +89 -0
  19. package/dist/collections/entries.js +131 -0
  20. package/dist/collections/frozen-set.d.ts +42 -0
  21. package/dist/collections/frozen-set.js +64 -0
  22. package/dist/collections/group.d.ts +141 -0
  23. package/dist/collections/group.js +241 -0
  24. package/dist/collections/heap.d.ts +64 -0
  25. package/dist/collections/heap.js +205 -0
  26. package/dist/collections/index.d.ts +15 -642
  27. package/dist/collections/index.js +14 -716
  28. package/dist/collections/internal/arrayKeys.d.ts +19 -0
  29. package/dist/collections/internal/arrayKeys.js +83 -0
  30. package/dist/collections/internal/invariants.d.ts +4 -0
  31. package/dist/collections/internal/invariants.js +12 -0
  32. package/dist/collections/internal/iterable.d.ts +25 -0
  33. package/dist/collections/internal/iterable.js +62 -0
  34. package/dist/collections/iterate.d.ts +162 -0
  35. package/dist/collections/iterate.js +188 -0
  36. package/dist/collections/lru-cache.d.ts +58 -0
  37. package/dist/collections/lru-cache.js +164 -0
  38. package/dist/collections/order.d.ts +19 -0
  39. package/dist/collections/order.js +38 -0
  40. package/dist/collections/shape.d.ts +32 -0
  41. package/dist/collections/shape.js +86 -0
  42. package/dist/collections/sorted-map.d.ts +171 -0
  43. package/dist/collections/sorted-map.js +845 -0
  44. package/dist/collections/sorted-set.d.ts +103 -0
  45. package/dist/collections/sorted-set.js +147 -0
  46. package/dist/collections/splay-tree.d.ts +82 -0
  47. package/dist/collections/splay-tree.js +354 -0
  48. package/dist/collections/trie.d.ts +58 -0
  49. package/dist/collections/trie.js +196 -0
  50. package/dist/decimal/currency.d.ts +211 -0
  51. package/dist/decimal/currency.js +321 -0
  52. package/dist/decimal/decimal.d.ts +299 -0
  53. package/dist/decimal/decimal.js +660 -0
  54. package/dist/decimal/index.d.ts +11 -145
  55. package/dist/decimal/index.js +10 -374
  56. package/dist/decimal/internal/bits.d.ts +2 -0
  57. package/dist/decimal/internal/bits.js +7 -0
  58. package/dist/decimal/internal/echo.d.ts +4 -0
  59. package/dist/decimal/internal/echo.js +6 -0
  60. package/dist/decimal/internal/isqrt.d.ts +9 -0
  61. package/dist/decimal/internal/isqrt.js +34 -0
  62. package/dist/decimal/internal/locale.d.ts +7 -0
  63. package/dist/decimal/internal/locale.js +24 -0
  64. package/dist/decimal/internal/minor-units.d.ts +2 -0
  65. package/dist/decimal/internal/minor-units.js +33 -0
  66. package/dist/decimal/internal/pow10.d.ts +24 -0
  67. package/dist/decimal/internal/pow10.js +96 -0
  68. package/dist/encoding/base64.d.ts +39 -0
  69. package/dist/encoding/base64.js +53 -0
  70. package/dist/encoding/hex.d.ts +23 -0
  71. package/dist/encoding/hex.js +34 -0
  72. package/dist/encoding/index.d.ts +6 -0
  73. package/dist/encoding/index.js +6 -0
  74. package/dist/function/debounce.d.ts +68 -0
  75. package/dist/function/debounce.js +203 -0
  76. package/dist/function/index.d.ts +6 -0
  77. package/dist/function/index.js +6 -0
  78. package/dist/function/shared.d.ts +2 -0
  79. package/dist/function/shared.js +5 -0
  80. package/dist/function/wrap.d.ts +130 -0
  81. package/dist/function/wrap.js +113 -0
  82. package/dist/hash/digest.d.ts +18 -0
  83. package/dist/hash/digest.js +26 -0
  84. package/dist/hash/hash.d.ts +22 -0
  85. package/dist/hash/hash.js +252 -0
  86. package/dist/hash/hashString.d.ts +13 -0
  87. package/dist/hash/hashString.js +53 -0
  88. package/dist/hash/index.d.ts +8 -0
  89. package/dist/hash/index.js +8 -0
  90. package/dist/hash/stableStringify.d.ts +19 -0
  91. package/dist/hash/stableStringify.js +102 -0
  92. package/dist/id/index.d.ts +7 -0
  93. package/dist/id/index.js +7 -0
  94. package/dist/id/nanoid.d.ts +16 -0
  95. package/dist/id/nanoid.js +65 -0
  96. package/dist/id/uniqueId.d.ts +14 -0
  97. package/dist/id/uniqueId.js +20 -0
  98. package/dist/id/uuid.d.ts +25 -0
  99. package/dist/id/uuid.js +64 -0
  100. package/dist/index.d.ts +15 -8
  101. package/dist/index.js +15 -8
  102. package/dist/internal/bytes.d.ts +11 -0
  103. package/dist/internal/bytes.js +33 -0
  104. package/dist/internal/codec.d.ts +11 -0
  105. package/dist/internal/codec.js +84 -0
  106. package/dist/internal/compare.d.ts +10 -0
  107. package/dist/internal/compare.js +26 -0
  108. package/dist/internal/crypto.d.ts +5 -0
  109. package/dist/internal/crypto.js +11 -0
  110. package/dist/internal/keys.d.ts +12 -0
  111. package/dist/internal/keys.js +23 -0
  112. package/dist/internal/kind.d.ts +44 -0
  113. package/dist/internal/kind.js +139 -0
  114. package/dist/internal/sparse.d.ts +51 -0
  115. package/dist/internal/sparse.js +104 -0
  116. package/dist/internal/text.d.ts +7 -0
  117. package/dist/internal/text.js +15 -0
  118. package/dist/internal/timer.d.ts +10 -0
  119. package/dist/internal/timer.js +17 -0
  120. package/dist/internal/truncate.d.ts +10 -0
  121. package/dist/internal/truncate.js +22 -0
  122. package/dist/internal/walk.d.ts +47 -0
  123. package/dist/internal/walk.js +100 -0
  124. package/dist/is/index.d.ts +8 -0
  125. package/dist/is/index.js +8 -0
  126. package/dist/is/isArrayLike.d.ts +18 -0
  127. package/dist/is/isArrayLike.js +25 -0
  128. package/dist/is/isError.d.ts +13 -0
  129. package/dist/is/isError.js +18 -0
  130. package/dist/is/isNil.d.ts +12 -0
  131. package/dist/is/isNil.js +14 -0
  132. package/dist/is/isPlainObject.d.ts +15 -0
  133. package/dist/is/isPlainObject.js +34 -0
  134. package/dist/number/index.d.ts +7 -0
  135. package/dist/number/index.js +7 -0
  136. package/dist/number/round.d.ts +86 -0
  137. package/dist/number/round.js +130 -0
  138. package/dist/number/stats.d.ts +52 -0
  139. package/dist/number/stats.js +115 -0
  140. package/dist/object/cloneDeep.d.ts +28 -0
  141. package/dist/object/cloneDeep.js +200 -0
  142. package/dist/object/index.d.ts +14 -0
  143. package/dist/object/index.js +13 -0
  144. package/dist/object/isEqual.d.ts +64 -0
  145. package/dist/object/isEqual.js +289 -0
  146. package/dist/object/matches.d.ts +40 -0
  147. package/dist/object/matches.js +284 -0
  148. package/dist/object/merge.d.ts +66 -0
  149. package/dist/object/merge.js +272 -0
  150. package/dist/object/parsePath.d.ts +22 -0
  151. package/dist/object/parsePath.js +111 -0
  152. package/dist/object/path.d.ts +85 -0
  153. package/dist/object/path.js +208 -0
  154. package/dist/object/pick.d.ts +91 -0
  155. package/dist/object/pick.js +180 -0
  156. package/dist/object/reshape.d.ts +73 -0
  157. package/dist/object/reshape.js +144 -0
  158. package/dist/random/index.d.ts +96 -32
  159. package/dist/random/index.js +215 -50
  160. package/dist/string/case.d.ts +71 -0
  161. package/dist/string/case.js +152 -0
  162. package/dist/string/fold.d.ts +35 -0
  163. package/dist/string/fold.js +100 -0
  164. package/dist/string/index.d.ts +6 -187
  165. package/dist/string/index.js +6 -226
  166. package/dist/string/truncate.d.ts +25 -0
  167. package/dist/string/truncate.js +44 -0
  168. package/dist/string/words.d.ts +27 -0
  169. package/dist/string/words.js +241 -0
  170. package/package.json +101 -58
  171. package/dist/collections/BTree.d.ts +0 -229
  172. package/dist/collections/BTree.js +0 -1165
  173. package/dist/collections/Heap.d.ts +0 -69
  174. package/dist/collections/Heap.js +0 -181
  175. package/dist/collections/LRUCache.d.ts +0 -80
  176. package/dist/collections/LRUCache.js +0 -126
  177. package/dist/collections/SortedMap.d.ts +0 -92
  178. package/dist/collections/SortedMap.js +0 -131
  179. package/dist/collections/SortedSet.d.ts +0 -69
  180. package/dist/collections/SortedSet.js +0 -99
  181. package/dist/collections/SortedTree.d.ts +0 -103
  182. package/dist/collections/SortedTree.js +0 -141
  183. package/dist/collections/SplayTree.d.ts +0 -105
  184. package/dist/collections/SplayTree.js +0 -338
  185. package/dist/collections/Trie.d.ts +0 -42
  186. package/dist/collections/Trie.js +0 -104
  187. package/dist/collections/abc.d.ts +0 -152
  188. package/dist/collections/abc.js +0 -39
  189. package/dist/collections/frozenset.d.ts +0 -19
  190. package/dist/collections/frozenset.js +0 -30
  191. package/dist/functools/index.d.ts +0 -130
  192. package/dist/functools/index.js +0 -235
  193. package/dist/globals/index.d.ts +0 -285
  194. package/dist/globals/index.js +0 -463
  195. package/dist/i18n/currency.d.ts +0 -24
  196. package/dist/i18n/currency.js +0 -85
  197. package/dist/i18n/date/index.d.ts +0 -203
  198. package/dist/i18n/date/index.js +0 -531
  199. package/dist/i18n/date/utils.d.ts +0 -65
  200. package/dist/i18n/date/utils.js +0 -290
  201. package/dist/i18n/duration.d.ts +0 -112
  202. package/dist/i18n/duration.js +0 -392
  203. package/dist/i18n/format.d.ts +0 -31
  204. package/dist/i18n/format.js +0 -506
  205. package/dist/i18n/index.d.ts +0 -8
  206. package/dist/i18n/index.js +0 -8
  207. package/dist/itertools/index.d.ts +0 -255
  208. package/dist/itertools/index.js +0 -437
  209. package/dist/math/index.d.ts +0 -96
  210. package/dist/math/index.js +0 -98
  211. package/dist/mod.d.ts +0 -1
  212. package/dist/mod.js +0 -1
  213. package/dist/operators/index.d.ts +0 -152
  214. package/dist/operators/index.js +0 -305
  215. package/dist/types.d.ts +0 -19
  216. package/dist/types.js +0 -1
@@ -1,203 +0,0 @@
1
- import { Duration, DurationUnit, TDuration } from '../duration.js';
2
- import { asDate, formatDate, strftime } from '../format.js';
3
- import { DateObject, daysInMonth, daysInYear, isLeapYear, maxDate, minDate, weeksInYear } from './utils.js';
4
- export { asDate, daysInMonth, daysInYear, formatDate, isLeapYear, maxDate, minDate, strftime, weeksInYear };
5
- export { DateObject };
6
- export declare type DateLike = number | string | Date | IntlDate | DateObject;
7
- /**
8
- * Creates a date tied to a given locale (default system locale) which can be formatted in that locale's language using the native {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl Intl Apis} directly or using a formatting string.
9
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl Intl Apis}
10
- */
11
- export declare class IntlDate {
12
- private _date;
13
- readonly locale?: string;
14
- intlRelativeFormat: Intl.RelativeTimeFormat;
15
- /** Parses the provided value as UTC date or returns the current UTC date. */
16
- static UTC(value?: DateLike, locale?: string): IntlDate;
17
- /** Returns the current local date and time. */
18
- static now(): IntlDate;
19
- /** Creates a new date from a Unix timestamp (seconds since the unix epoch) */
20
- static unix(seconds: number): IntlDate;
21
- /**
22
- * Creates a new `IntlDate` in local time and specified locale (default is system locale).
23
- * **Note:** The allowed values for `month` start at 1, which is different from legacy `Date`
24
- * @param {DateLike} obj The date value (default is current local time)
25
- * @param {Object} opts The options for this date
26
- * @param {boolean?} opts.utc Converts input or current time to UTC
27
- * @param {string?} opts.locale A locale string to use for this date
28
- * @returns
29
- */
30
- constructor(obj?: DateLike, { locale, utc }?: any);
31
- /** Get the date's year. */
32
- get year(): number;
33
- /** Get the this date's month as a number from 1 to 12, inclusive. */
34
- get month(): number;
35
- /** Returns the weekday as a number between 1 and 7, inclusive, where Monday is 1 and Sunday is 7. */
36
- get dayOfWeek(): number;
37
- /** Get the this date's current day of the month. */
38
- get day(): number;
39
- /** Get the this date's current hour. */
40
- get hour(): number;
41
- /** Get the this date's current minute. */
42
- get minute(): number;
43
- /** Get the this date's current second. */
44
- get second(): number;
45
- /** Get the this date's current millisecond. */
46
- get millisecond(): number;
47
- isValid(): boolean;
48
- /** Get the number of days in this date's month. */
49
- daysInMonth(): number;
50
- /** Get the number of days in this date's year. */
51
- daysInYear(): number;
52
- dayOfYear(): number;
53
- /** Returns `true` if this date's year is a leap year. */
54
- isLeapYear(): boolean;
55
- /** Gets the number of weeks according to locale in the current year. */
56
- weeksInYear(): number;
57
- /** Gets the number of weeks in the current year, according to ISO weeks. */
58
- isoWeeksInYear(): number;
59
- /** Returns the current week of the year. */
60
- week(): number;
61
- /** Returns the ISO week of the year. */
62
- isoWeek(): number;
63
- /**
64
- * Returns a localized string representation of this date.
65
- * @param {Intl.DateTimeFormatOptions} opts The options to use for the format
66
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat Intl.DateTimeFormat()}
67
- */
68
- toString(opts?: Intl.DateTimeFormatOptions): string;
69
- /**
70
- * Returns a localized string representation of this date, according to the given format string. Format codes use the same specification as {@link https://momentjs.com/docs/#/displaying/format/ moment}.
71
- * @param {string} str The format string to use
72
- * @see {@link https://momentjs.com/docs/#/displaying/format/ List of formats}
73
- * @example
74
- ```js
75
- new IntlDate().format('MM/DD/YYYY') // '10/31/2022'
76
- ```
77
- */
78
- format(str: string): string;
79
- /**
80
- * Returns a new copy of the native `Date` object used by this instance.
81
- * @returns {Date} A new `Date` object
82
- */
83
- toDate(): Date;
84
- /**
85
- * Returns the number of seconds since the Unix Epoch (January 1, 1970 UTC).
86
- * @see {@link IntlDate.timestamp}
87
- * @see {@link IntlDate.unix}
88
- * @example
89
- ```js
90
- new IntlDate().toSeconds() // 1318874398
91
- ```
92
- */
93
- toSeconds(): number;
94
- /**
95
- * Returns the number of seconds since the Unix Epoch (January 1, 1970 UTC).
96
- * @see {@link IntlDate.toSeconds}
97
- * @see {@link IntlDate.unix}
98
- * @example
99
- ```js
100
- new IntlDate().timestamp() // 1318874398
101
- ```
102
- */
103
- timestamp(): number;
104
- /**
105
- * Returns the number of seconds since the Unix Epoch (January 1, 1970 UTC).
106
- * @see {@link IntlDate.toSeconds}
107
- * @see {@link IntlDate.timestamp}
108
- * @example
109
- ```js
110
- new IntlDate().unix() // 1318874398
111
- ```
112
- */
113
- unix(): number;
114
- /** Formats a string to the ISO8601 standard.
115
- * @example
116
- ```js
117
- new IntlDate().toISOString() // '2022-10-31T22:44:30.652Z'
118
- ```
119
- */
120
- toISOString(): string;
121
- /** Returns the date part formatted as ISO8601.
122
- * @example
123
- ```js
124
- new IntlDate().toISODate() // '2022-10-31'
125
- ```
126
- */
127
- toISODate(): string;
128
- /** Returns the time part formatted as ISO8601.
129
- * @example
130
- ```js
131
- new IntlDate().toISOTime() // 'T22:44:30.652Z'
132
- ```
133
- */
134
- toISOTime(): string;
135
- /**
136
- * Returns an object containing year, month, day-of-month, hours, minutes, seconds, milliseconds.
137
- * @returns {Object} An object like `{year, month, date, hours, minutes, seconds, ms}`
138
- */
139
- toObject(): DateObject;
140
- /** Returns the number of milliseconds since the Unix Epoch (January 1, 1970 UTC) */
141
- getTime(): number;
142
- /** Alias of {@link IntlDate.getTime} */
143
- valueOf(): number;
144
- /** Returns the timezone string name */
145
- zoneName(): string;
146
- /** Returns the timezone GMT offset as a string */
147
- zone(): string;
148
- /** Returns the difference in `minutes` between this date and UTC */
149
- utcOffset(): number;
150
- /**
151
- * Check if this date is before another date. The other value will be parsed as an `IntlDate` if not already so.
152
- * @param {DateLike} other Another date or date like object
153
- * @returns {boolean} Returns `true` if this date is before the given value
154
- */
155
- isBefore(other: DateLike): boolean;
156
- /**
157
- * Check if this date is strictly after the given `start` and before `stop` dates. The values will be parsed as an `IntlDate` if not already so.
158
- * @param {DateLike} start The smaller date
159
- * @param {DateLike} stop The larger date
160
- * @returns {boolean} Returns `true` if this date is greater than `start` and less than `stop`.
161
- */
162
- isBetween(start: DateLike, stop: DateLike): boolean;
163
- /**
164
- * Check if this date is after another date. The other value will be parsed as an `IntlDate` if not already so.
165
- * @param {DateLike} other Another date or date like object
166
- * @returns {boolean} Returns `true` if this date is after the given value
167
- */
168
- isAfter(other: DateLike): boolean;
169
- /**
170
- * Check if this date is the same as `other`.
171
- * @param other Another date object
172
- * @returns {boolean} Returns `true` if this date is the same as other
173
- */
174
- isSame(other: Date | IntlDate): boolean;
175
- lt(other: Date | IntlDate): boolean;
176
- eq(other: Date | IntlDate): boolean;
177
- compare(other: Date | IntlDate): number;
178
- set(values: DateObject): IntlDate;
179
- get relativeFormat(): Intl.RelativeTimeFormat;
180
- relativeTime(n: number, unit?: Intl.RelativeTimeFormatUnit): string;
181
- fromNow(unit?: Intl.RelativeTimeFormatUnit): string;
182
- from(other: DateLike, unit?: Intl.RelativeTimeFormatUnit): string;
183
- toNow(unit?: Intl.RelativeTimeFormatUnit): string;
184
- to(other: DateLike, unit?: Intl.RelativeTimeFormatUnit): string;
185
- diff(other: DateLike, unit?: DurationUnit, exact?: boolean): number;
186
- add(duration: TDuration, exact?: boolean): IntlDate;
187
- subtract(duration: TDuration, exact?: boolean): IntlDate;
188
- startOf(unit: DurationUnit): IntlDate;
189
- endOf(unit: DurationUnit): IntlDate;
190
- clone(date?: DateLike): IntlDate;
191
- static max(...args: any[]): any;
192
- static min(...args: any[]): any;
193
- inspect(): string;
194
- }
195
- export declare function addDuration(date: number | string | Date, duration: number | Duration | TDuration, exact?: boolean): Date;
196
- /**
197
- * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.
198
- * @param date
199
- * @param duration
200
- * @param exact
201
- * @returns
202
- */
203
- export declare function subDuration(date: number | string | Date, duration: number | Duration | TDuration, exact?: boolean): Date;