@ezez/utils 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/cap.d.ts.map +1 -1
  3. package/dist/cap.js.map +1 -1
  4. package/dist/capitalize.d.ts.map +1 -1
  5. package/dist/capitalize.js.map +1 -1
  6. package/dist/compareArrays.d.ts +4 -4
  7. package/dist/compareArrays.d.ts.map +1 -1
  8. package/dist/compareArrays.js.map +1 -1
  9. package/dist/ensureError.d.ts.map +1 -1
  10. package/dist/ensureError.js +3 -1
  11. package/dist/ensureError.js.map +1 -1
  12. package/dist/ensurePrefix.d.ts.map +1 -1
  13. package/dist/ensurePrefix.js.map +1 -1
  14. package/dist/ensureSuffix.d.ts.map +1 -1
  15. package/dist/ensureSuffix.js.map +1 -1
  16. package/dist/escapeRegExp.d.ts.map +1 -1
  17. package/dist/escapeRegExp.js.map +1 -1
  18. package/dist/formatDate.d.ts.map +1 -1
  19. package/dist/formatDate.js.map +1 -1
  20. package/dist/getMultiple.d.ts.map +1 -1
  21. package/dist/getMultiple.js.map +1 -1
  22. package/dist/ignore.d.ts +3 -0
  23. package/dist/ignore.d.ts.map +1 -0
  24. package/dist/ignore.js +16 -0
  25. package/dist/ignore.js.map +1 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/isEmpty.d.ts.map +1 -1
  31. package/dist/isEmpty.js +4 -4
  32. package/dist/isEmpty.js.map +1 -1
  33. package/dist/isNumericString.d.ts.map +1 -1
  34. package/dist/isNumericString.js.map +1 -1
  35. package/dist/isPlainObject.d.ts.map +1 -1
  36. package/dist/isPlainObject.js.map +1 -1
  37. package/dist/match.d.ts.map +1 -1
  38. package/dist/match.js.map +1 -1
  39. package/dist/memoize.d.ts.map +1 -1
  40. package/dist/memoize.js.map +1 -1
  41. package/dist/mostFrequent.d.ts.map +1 -1
  42. package/dist/mostFrequent.js.map +1 -1
  43. package/dist/noop.d.ts.map +1 -1
  44. package/dist/noop.js.map +1 -1
  45. package/dist/occurrences.d.ts.map +1 -1
  46. package/dist/occurrences.js.map +1 -1
  47. package/dist/removeCommonProperties.d.ts.map +1 -1
  48. package/dist/removeCommonProperties.js.map +1 -1
  49. package/dist/replace.d.ts.map +1 -1
  50. package/dist/replace.js.map +1 -1
  51. package/dist/rethrow.d.ts +1 -1
  52. package/dist/rethrow.d.ts.map +1 -1
  53. package/dist/rethrow.js.map +1 -1
  54. package/dist/round.d.ts.map +1 -1
  55. package/dist/round.js.map +1 -1
  56. package/dist/safe.d.ts.map +1 -1
  57. package/dist/safe.js.map +1 -1
  58. package/dist/scale.d.ts.map +1 -1
  59. package/dist/scale.js.map +1 -1
  60. package/dist/seq.d.ts.map +1 -1
  61. package/dist/seq.js +5 -1
  62. package/dist/seq.js.map +1 -1
  63. package/dist/serialize.d.ts.map +1 -1
  64. package/dist/serialize.js +2 -2
  65. package/dist/serialize.js.map +1 -1
  66. package/dist/serializeToBuffer/serializeToBuffer.d.ts.map +1 -1
  67. package/dist/serializeToBuffer/serializeToBuffer.js.map +1 -1
  68. package/dist/serializeToBuffer/unserializeFromBuffer.d.ts.map +1 -1
  69. package/dist/serializeToBuffer/unserializeFromBuffer.js.map +1 -1
  70. package/dist/setImmutable.js.map +1 -1
  71. package/dist/sortBy.d.ts +1 -1
  72. package/dist/sortBy.d.ts.map +1 -1
  73. package/dist/sortBy.js.map +1 -1
  74. package/dist/sortByMultiple.d.ts +1 -1
  75. package/dist/sortByMultiple.d.ts.map +1 -1
  76. package/dist/sortByMultiple.js.map +1 -1
  77. package/dist/trim.d.ts.map +1 -1
  78. package/dist/trim.js +1 -1
  79. package/dist/trim.js.map +1 -1
  80. package/dist/trimEnd.d.ts.map +1 -1
  81. package/dist/trimEnd.js.map +1 -1
  82. package/dist/trimStart.d.ts.map +1 -1
  83. package/dist/trimStart.js.map +1 -1
  84. package/dist/unique.d.ts +1 -1
  85. package/dist/unique.d.ts.map +1 -1
  86. package/dist/unique.js.map +1 -1
  87. package/dist/utils/utils.js +1 -0
  88. package/dist/utils/utils.js.map +1 -1
  89. package/dist/wait.d.ts.map +1 -1
  90. package/dist/wait.js.map +1 -1
  91. package/dist/waitFor.d.ts.map +1 -1
  92. package/dist/waitFor.js.map +1 -1
  93. package/dist/waitSync.d.ts.map +1 -1
  94. package/dist/waitSync.js.map +1 -1
  95. package/docs/assets/hierarchy.js +1 -0
  96. package/docs/assets/icons.js +1 -1
  97. package/docs/assets/icons.svg +1 -1
  98. package/docs/assets/main.js +5 -5
  99. package/docs/assets/navigation.js +1 -1
  100. package/docs/assets/search.js +1 -1
  101. package/docs/assets/style.css +1405 -1288
  102. package/docs/documents/Changelog.html +370 -0
  103. package/docs/functions/index.cap.html +3 -3
  104. package/docs/functions/index.capitalize.html +7 -7
  105. package/docs/functions/index.coalesce.html +8 -8
  106. package/docs/functions/index.compareArrays.html +5 -5
  107. package/docs/functions/index.compareProps.html +5 -5
  108. package/docs/functions/index.deserialize.html +4 -4
  109. package/docs/functions/index.ensureArray.html +3 -3
  110. package/docs/functions/index.ensureDate.html +6 -6
  111. package/docs/functions/index.ensureError.html +6 -6
  112. package/docs/functions/index.ensurePrefix.html +5 -5
  113. package/docs/functions/index.ensureSuffix.html +5 -5
  114. package/docs/functions/index.ensureTimestamp.html +6 -6
  115. package/docs/functions/index.escapeRegExp.html +5 -5
  116. package/docs/functions/index.formatDate.html +5 -2
  117. package/docs/functions/index.get.html +8 -8
  118. package/docs/functions/index.getMultiple.html +6 -6
  119. package/docs/functions/index.ignore.html +8 -0
  120. package/docs/functions/index.insertSeparator.html +5 -5
  121. package/docs/functions/index.isEmpty.html +12 -13
  122. package/docs/functions/index.isNumericString.html +3 -3
  123. package/docs/functions/index.isPlainObject.html +8 -8
  124. package/docs/functions/index.last.html +7 -7
  125. package/docs/functions/index.later-1.html +3 -3
  126. package/docs/functions/index.mapAsync.html +5 -5
  127. package/docs/functions/index.mapValues.html +7 -7
  128. package/docs/functions/index.match.html +4 -4
  129. package/docs/functions/index.memoize.html +4 -4
  130. package/docs/functions/index.merge.html +6 -6
  131. package/docs/functions/index.mostFrequent.html +2 -2
  132. package/docs/functions/index.noop.html +2 -2
  133. package/docs/functions/index.occurrences.html +7 -6
  134. package/docs/functions/index.omit.html +7 -7
  135. package/docs/functions/index.pick.html +7 -7
  136. package/docs/functions/index.pull.html +2 -2
  137. package/docs/functions/index.race.html +5 -5
  138. package/docs/functions/index.remove.html +2 -2
  139. package/docs/functions/index.removeCommonProperties.html +5 -5
  140. package/docs/functions/index.replace.html +6 -6
  141. package/docs/functions/index.replaceDeep.html +3 -3
  142. package/docs/functions/index.rethrow.html +2 -2
  143. package/docs/functions/index.retry.html +4 -4
  144. package/docs/functions/index.round.html +4 -4
  145. package/docs/functions/index.safe.html +5 -5
  146. package/docs/functions/index.sample.html +4 -4
  147. package/docs/functions/index.samples.html +3 -3
  148. package/docs/functions/index.scale.html +2 -2
  149. package/docs/functions/index.seq.html +7 -7
  150. package/docs/functions/index.seqEarlyBreak.html +6 -6
  151. package/docs/functions/index.serialize.html +3 -3
  152. package/docs/functions/index.serializeToBuffer.html +7 -7
  153. package/docs/functions/index.set.html +8 -8
  154. package/docs/functions/index.setImmutable.html +7 -7
  155. package/docs/functions/index.shuffle.html +3 -3
  156. package/docs/functions/index.sortBy.html +3 -3
  157. package/docs/functions/index.sortByMultiple.html +5 -5
  158. package/docs/functions/index.sortProps.html +4 -4
  159. package/docs/functions/index.stripPrefix.html +3 -3
  160. package/docs/functions/index.stripSuffix.html +3 -3
  161. package/docs/functions/index.throttle.html +4 -4
  162. package/docs/functions/index.toggle.html +4 -4
  163. package/docs/functions/index.trim.html +4 -4
  164. package/docs/functions/index.trimEnd.html +4 -4
  165. package/docs/functions/index.trimStart.html +4 -4
  166. package/docs/functions/index.truthy.html +4 -4
  167. package/docs/functions/index.unique.html +4 -4
  168. package/docs/functions/index.unserializeFromBuffer.html +6 -6
  169. package/docs/functions/index.wait.html +3 -3
  170. package/docs/functions/index.waitFor.html +4 -4
  171. package/docs/functions/index.waitSync.html +3 -3
  172. package/docs/index.html +16 -16
  173. package/docs/interfaces/index.ComparePropsOptions.html +4 -4
  174. package/docs/interfaces/index.GetMultipleSource.html +3 -3
  175. package/docs/interfaces/index.GetSource.html +3 -3
  176. package/docs/interfaces/index.IsNumericStringOptions.html +5 -5
  177. package/docs/interfaces/index.OccurencesOptions.html +2 -2
  178. package/docs/interfaces/index.SetImmutableSource.html +3 -3
  179. package/docs/interfaces/index.SetSource.html +3 -3
  180. package/docs/interfaces/index.ThrottleOptions.html +3 -3
  181. package/docs/interfaces/index.ThrottledFunctionExtras.html +4 -4
  182. package/docs/modules/index.html +1 -93
  183. package/docs/modules.html +1 -3
  184. package/docs/types/index.CustomDeserializers.html +1 -1
  185. package/docs/types/index.CustomSerializers.html +1 -1
  186. package/docs/types/index.Later.html +4 -4
  187. package/docs/types/index.MapValuesFn.html +7 -7
  188. package/docs/types/index.MatchCallback.html +1 -1
  189. package/docs/types/index.MergeTwo.html +2 -2
  190. package/docs/types/index.SeqEarlyBreaker.html +4 -4
  191. package/docs/types/index.SeqFn.html +3 -3
  192. package/docs/types/index.SeqFunctions.html +3 -3
  193. package/docs/types/index.SetImmutablePath.html +2 -2
  194. package/docs/types/index.ThrottledFunction.html +1 -1
  195. package/docs/variables/index.mapValuesUNSET.html +2 -2
  196. package/docs/variables/index.mergeUNSET.html +3 -3
  197. package/esm/cap.d.ts.map +1 -1
  198. package/esm/cap.js.map +1 -1
  199. package/esm/capitalize.d.ts.map +1 -1
  200. package/esm/capitalize.js.map +1 -1
  201. package/esm/compareArrays.d.ts +4 -4
  202. package/esm/compareArrays.d.ts.map +1 -1
  203. package/esm/compareArrays.js.map +1 -1
  204. package/esm/ensureError.d.ts.map +1 -1
  205. package/esm/ensureError.js +3 -1
  206. package/esm/ensureError.js.map +1 -1
  207. package/esm/ensurePrefix.d.ts.map +1 -1
  208. package/esm/ensurePrefix.js.map +1 -1
  209. package/esm/ensureSuffix.d.ts.map +1 -1
  210. package/esm/ensureSuffix.js.map +1 -1
  211. package/esm/escapeRegExp.d.ts.map +1 -1
  212. package/esm/escapeRegExp.js.map +1 -1
  213. package/esm/formatDate.d.ts.map +1 -1
  214. package/esm/formatDate.js.map +1 -1
  215. package/esm/getMultiple.d.ts.map +1 -1
  216. package/esm/getMultiple.js.map +1 -1
  217. package/esm/ignore.d.ts +3 -0
  218. package/esm/ignore.d.ts.map +1 -0
  219. package/esm/ignore.js +13 -0
  220. package/esm/ignore.js.map +1 -0
  221. package/esm/index.d.ts +1 -0
  222. package/esm/index.d.ts.map +1 -1
  223. package/esm/index.js +1 -0
  224. package/esm/index.js.map +1 -1
  225. package/esm/isEmpty.d.ts.map +1 -1
  226. package/esm/isEmpty.js +4 -4
  227. package/esm/isEmpty.js.map +1 -1
  228. package/esm/isNumericString.d.ts.map +1 -1
  229. package/esm/isNumericString.js.map +1 -1
  230. package/esm/isPlainObject.d.ts.map +1 -1
  231. package/esm/isPlainObject.js.map +1 -1
  232. package/esm/match.d.ts.map +1 -1
  233. package/esm/match.js.map +1 -1
  234. package/esm/memoize.d.ts.map +1 -1
  235. package/esm/memoize.js.map +1 -1
  236. package/esm/mostFrequent.d.ts.map +1 -1
  237. package/esm/mostFrequent.js.map +1 -1
  238. package/esm/noop.d.ts.map +1 -1
  239. package/esm/noop.js.map +1 -1
  240. package/esm/occurrences.d.ts.map +1 -1
  241. package/esm/occurrences.js.map +1 -1
  242. package/esm/removeCommonProperties.d.ts.map +1 -1
  243. package/esm/removeCommonProperties.js.map +1 -1
  244. package/esm/replace.d.ts.map +1 -1
  245. package/esm/replace.js.map +1 -1
  246. package/esm/rethrow.d.ts +1 -1
  247. package/esm/rethrow.d.ts.map +1 -1
  248. package/esm/rethrow.js.map +1 -1
  249. package/esm/round.d.ts.map +1 -1
  250. package/esm/round.js.map +1 -1
  251. package/esm/safe.d.ts.map +1 -1
  252. package/esm/safe.js.map +1 -1
  253. package/esm/scale.d.ts.map +1 -1
  254. package/esm/scale.js.map +1 -1
  255. package/esm/seq.d.ts.map +1 -1
  256. package/esm/seq.js +5 -1
  257. package/esm/seq.js.map +1 -1
  258. package/esm/serialize.d.ts.map +1 -1
  259. package/esm/serialize.js +2 -2
  260. package/esm/serialize.js.map +1 -1
  261. package/esm/serializeToBuffer/serializeToBuffer.d.ts.map +1 -1
  262. package/esm/serializeToBuffer/serializeToBuffer.js.map +1 -1
  263. package/esm/serializeToBuffer/unserializeFromBuffer.d.ts.map +1 -1
  264. package/esm/serializeToBuffer/unserializeFromBuffer.js.map +1 -1
  265. package/esm/setImmutable.js.map +1 -1
  266. package/esm/sortBy.d.ts +1 -1
  267. package/esm/sortBy.d.ts.map +1 -1
  268. package/esm/sortBy.js.map +1 -1
  269. package/esm/sortByMultiple.d.ts +1 -1
  270. package/esm/sortByMultiple.d.ts.map +1 -1
  271. package/esm/sortByMultiple.js.map +1 -1
  272. package/esm/trim.d.ts.map +1 -1
  273. package/esm/trim.js +1 -1
  274. package/esm/trim.js.map +1 -1
  275. package/esm/trimEnd.d.ts.map +1 -1
  276. package/esm/trimEnd.js.map +1 -1
  277. package/esm/trimStart.d.ts.map +1 -1
  278. package/esm/trimStart.js.map +1 -1
  279. package/esm/unique.d.ts +1 -1
  280. package/esm/unique.d.ts.map +1 -1
  281. package/esm/unique.js.map +1 -1
  282. package/esm/utils/utils.js +1 -0
  283. package/esm/utils/utils.js.map +1 -1
  284. package/esm/wait.d.ts.map +1 -1
  285. package/esm/wait.js.map +1 -1
  286. package/esm/waitFor.d.ts.map +1 -1
  287. package/esm/waitFor.js.map +1 -1
  288. package/esm/waitSync.d.ts.map +1 -1
  289. package/esm/waitSync.js.map +1 -1
  290. package/package.json +31 -34
  291. package/src/cap.ts +1 -1
  292. package/src/capitalize.ts +3 -3
  293. package/src/compareArrays.ts +2 -3
  294. package/src/deserialize.spec.ts +2 -1
  295. package/src/ensureError.ts +6 -2
  296. package/src/ensurePrefix.ts +1 -1
  297. package/src/ensureSuffix.ts +1 -1
  298. package/src/escapeRegExp.ts +1 -1
  299. package/src/formatDate.ts +7 -2
  300. package/src/get.spec.ts +0 -1
  301. package/src/getMultiple.ts +0 -1
  302. package/src/ignore.spec.ts +80 -0
  303. package/src/ignore.ts +38 -0
  304. package/src/index.ts +1 -0
  305. package/src/isEmpty.ts +9 -15
  306. package/src/isNumericString.ts +1 -1
  307. package/src/isPlainObject.ts +1 -1
  308. package/src/later.spec.ts +1 -0
  309. package/src/mapAsync.ts +4 -4
  310. package/src/match.ts +1 -1
  311. package/src/memoize.spec.ts +1 -1
  312. package/src/memoize.ts +1 -1
  313. package/src/mostFrequent.spec.ts +2 -0
  314. package/src/mostFrequent.ts +0 -1
  315. package/src/noop.ts +1 -1
  316. package/src/occurrences.ts +1 -1
  317. package/src/remove.spec.ts +1 -1
  318. package/src/removeCommonProperties.spec.ts +2 -0
  319. package/src/removeCommonProperties.ts +1 -1
  320. package/src/replace.ts +1 -1
  321. package/src/replaceDeep.spec.ts +2 -0
  322. package/src/replaceDeepByFn.spec.ts +2 -0
  323. package/src/rethrow.ts +1 -1
  324. package/src/round.ts +1 -1
  325. package/src/safe.ts +2 -1
  326. package/src/scale.ts +1 -1
  327. package/src/seq.ts +7 -3
  328. package/src/serialize.spec.ts +2 -1
  329. package/src/serialize.ts +3 -3
  330. package/src/serializeToBuffer/serialization.spec.ts +2 -2
  331. package/src/serializeToBuffer/serializeToBuffer.ts +0 -1
  332. package/src/serializeToBuffer/unserializeFromBuffer.ts +0 -1
  333. package/src/setImmutable.ts +1 -1
  334. package/src/sortBy.ts +3 -1
  335. package/src/sortByMultiple.ts +5 -3
  336. package/src/toggle.spec.ts +2 -0
  337. package/src/trim.spec.ts +2 -0
  338. package/src/trim.ts +3 -2
  339. package/src/trimEnd.spec.ts +2 -0
  340. package/src/trimEnd.ts +1 -1
  341. package/src/trimStart.spec.ts +2 -0
  342. package/src/trimStart.ts +1 -1
  343. package/src/unique.ts +2 -2
  344. package/src/wait.ts +1 -1
  345. package/src/waitFor.spec.ts +9 -8
  346. package/src/waitFor.ts +1 -1
  347. package/src/waitSync.spec.ts +2 -0
  348. package/src/waitSync.ts +1 -1
  349. package/.prettierignore +0 -3
  350. package/.prettierrc.json +0 -1
  351. package/docs/documents/CHANGELOG.html +0 -357
  352. package/pnpm-lock.yaml +0 -6529
  353. package/typedoc.cjs +0 -3
@@ -1,10 +1,10 @@
1
1
  // eslint-disable-next-line @typescript-eslint/no-shadow
2
2
  import must from "must";
3
3
 
4
+ // @ts-ignore
4
5
  import createSpy from "../test/createSpy";
5
-
6
- import { waitFor } from "./waitFor";
7
6
  import { wait } from "./wait";
7
+ import { waitFor } from "./waitFor";
8
8
 
9
9
  describe("waitFor", () => {
10
10
  it("calls function multiple times until it returns truthy value", async () => {
@@ -91,12 +91,13 @@ describe("waitFor", () => {
91
91
 
92
92
  it("crashes if check function crashes", async () => {
93
93
  await waitFor(() => {
94
+ // @ts-ignore
94
95
  throw new Error(5);
95
- }, 40).then(() => {
96
+ }, { interval: 40 }).then(() => {
96
97
  throw new Error("Should not resolve");
97
- }, (e) => {
98
+ }, (e: unknown) => {
98
99
  must(e).instanceOf(Error);
99
- must(e.message).equal("[waitFor] check function threw an error");
100
+ must((e as Error).message).equal("[waitFor] check function threw an error");
100
101
  });
101
102
  });
102
103
 
@@ -134,11 +135,11 @@ describe("waitFor", () => {
134
135
  it("by crashing if check function returns rejected promise", async () => {
135
136
  await waitFor(() => {
136
137
  return Promise.reject(new Error("oops"));
137
- }, 40).then(() => {
138
+ }, { interval: 40 }).then(() => {
138
139
  throw new Error("Should not resolve");
139
- }, (e) => {
140
+ }, (e: unknown) => {
140
141
  must(e).instanceOf(Error);
141
- must(e.message).equal("[waitFor] check function threw an error");
142
+ must((e as Error).message).equal("[waitFor] check function threw an error");
142
143
  });
143
144
  });
144
145
  });
package/src/waitFor.ts CHANGED
@@ -39,7 +39,7 @@ const defaultOptions: Required<Options> = {
39
39
  * @param fn - callback function
40
40
  * @param options - options object
41
41
  */
42
- const waitFor = <T>(fn: () => MaybePromise<T>, options: Options = defaultOptions) => {
42
+ const waitFor = <T>(fn: () => MaybePromise<T>, options: Options = defaultOptions): Promise<T> => {
43
43
  return new Promise<T>((resolve, reject) => {
44
44
  let intervalTimer: TTimeout, failTimer: TTimeout;
45
45
 
@@ -1,3 +1,5 @@
1
+ import must from "must"; // eslint-disable-line @typescript-eslint/no-shadow
2
+
1
3
  import { waitSync } from "./waitSync.js";
2
4
 
3
5
  describe("wait", () => {
package/src/waitSync.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @param {number} timeMs - time to wait
4
4
  * @returns {Promise<void>}
5
5
  */
6
- const waitSync = (timeMs = 0) => {
6
+ const waitSync = (timeMs = 0): void => {
7
7
  const s = Date.now();
8
8
  // eslint-disable-next-line no-empty
9
9
  while (Date.now() - s < timeMs) {}
package/.prettierignore DELETED
@@ -1,3 +0,0 @@
1
- *.js
2
- *.ts
3
- *.tsx
package/.prettierrc.json DELETED
@@ -1 +0,0 @@
1
- {}