@webdeveric/utils 0.83.1 → 0.83.3

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 (637) hide show
  1. package/dist/cjs/asArray.js +9 -0
  2. package/dist/cjs/asError.js +9 -0
  3. package/dist/cjs/assertion/assertExhaustive.js +19 -0
  4. package/dist/cjs/assertion/assertIsAsyncIterable.js +13 -0
  5. package/dist/cjs/assertion/assertIsBigInt.js +9 -0
  6. package/dist/cjs/assertion/assertIsBigIntArray.js +9 -0
  7. package/dist/cjs/assertion/assertIsBoolean.js +9 -0
  8. package/dist/cjs/assertion/assertIsBooleanArray.js +9 -0
  9. package/dist/cjs/assertion/assertIsDigitsString.js +9 -0
  10. package/dist/cjs/assertion/assertIsFiniteNumber.js +9 -0
  11. package/dist/cjs/assertion/assertIsFunction.js +9 -0
  12. package/dist/cjs/assertion/assertIsInt32.js +9 -0
  13. package/dist/cjs/assertion/assertIsIntString.js +9 -0
  14. package/dist/cjs/assertion/assertIsInteger.js +9 -0
  15. package/dist/cjs/assertion/assertIsIterable.js +9 -0
  16. package/dist/cjs/assertion/assertIsLengthAware.js +9 -0
  17. package/dist/cjs/assertion/assertIsNull.js +9 -0
  18. package/dist/cjs/assertion/assertIsNullArray.js +9 -0
  19. package/dist/cjs/assertion/assertIsNumber.js +9 -0
  20. package/dist/cjs/assertion/assertIsNumberArray.js +9 -0
  21. package/dist/cjs/assertion/assertIsNumberGTEOne.js +9 -0
  22. package/dist/cjs/assertion/assertIsNumericString.js +9 -0
  23. package/dist/cjs/assertion/assertIsNumericValue.js +11 -0
  24. package/dist/cjs/assertion/assertIsNumericValueArray.js +9 -0
  25. package/dist/cjs/assertion/assertIsObject.js +10 -0
  26. package/dist/cjs/assertion/assertIsOptionalBigInt.js +10 -0
  27. package/dist/cjs/assertion/assertIsOptionalBoolean.js +10 -0
  28. package/dist/cjs/assertion/assertIsOptionalNull.js +10 -0
  29. package/dist/cjs/assertion/assertIsOptionalNumber.js +10 -0
  30. package/dist/cjs/assertion/assertIsOptionalString.js +10 -0
  31. package/dist/cjs/assertion/assertIsOptionalSymbol.js +10 -0
  32. package/dist/cjs/assertion/assertIsPositiveFiniteNumber.js +9 -0
  33. package/dist/cjs/assertion/assertIsPositiveInteger.js +9 -0
  34. package/dist/cjs/assertion/assertIsPrimitive.js +9 -0
  35. package/dist/cjs/assertion/assertIsPromiseFulfilledResult.js +11 -0
  36. package/dist/cjs/assertion/assertIsPromiseRejectedResult.js +11 -0
  37. package/dist/cjs/assertion/assertIsPropertyKey.js +11 -0
  38. package/dist/cjs/assertion/assertIsSafeInteger.js +9 -0
  39. package/dist/cjs/assertion/assertIsSizeAware.js +9 -0
  40. package/dist/cjs/assertion/assertIsString.js +9 -0
  41. package/dist/cjs/assertion/assertIsStringArray.js +9 -0
  42. package/dist/cjs/assertion/assertIsStringMatching.js +9 -0
  43. package/dist/cjs/assertion/assertIsStringRecord.js +9 -0
  44. package/dist/cjs/assertion/assertIsStringWithLength.js +9 -0
  45. package/dist/cjs/assertion/assertIsSymbol.js +9 -0
  46. package/dist/cjs/assertion/assertIsSymbolArray.js +9 -0
  47. package/dist/cjs/assertion/assertIsUndefined.js +9 -0
  48. package/dist/cjs/assertion/assertIsUndefinedArray.js +9 -0
  49. package/dist/cjs/assertion/assertPathExists.js +12 -0
  50. package/dist/cjs/assertion/assertPredicate.js +11 -0
  51. package/dist/cjs/assertion/getError.js +9 -0
  52. package/dist/cjs/capitalize.js +8 -0
  53. package/dist/cjs/cartesian.js +10 -0
  54. package/dist/cjs/chunk.js +8 -0
  55. package/dist/cjs/clamp.js +9 -0
  56. package/dist/cjs/combinations.js +8 -0
  57. package/dist/cjs/comment.js +11 -0
  58. package/dist/cjs/compose.js +11 -0
  59. package/dist/cjs/constants.js +2 -0
  60. package/dist/cjs/convert.js +8 -0
  61. package/dist/cjs/countCharCode.js +8 -0
  62. package/dist/cjs/countCharacter.js +8 -0
  63. package/dist/cjs/counter.js +8 -0
  64. package/dist/cjs/dedent.js +14 -0
  65. package/dist/cjs/deepDecodeURI.js +8 -0
  66. package/dist/cjs/deepFreeze.js +13 -0
  67. package/dist/cjs/delay.js +14 -0
  68. package/dist/cjs/delayAnimationFrame.js +9 -0
  69. package/dist/cjs/delayAnimationFrames.js +9 -0
  70. package/dist/cjs/describeInput.js +12 -0
  71. package/dist/cjs/escapeRegExp.js +8 -0
  72. package/dist/cjs/findIndentation.js +8 -0
  73. package/dist/cjs/get.js +9 -0
  74. package/dist/cjs/getDateString.js +8 -0
  75. package/dist/cjs/getISODateString.js +8 -0
  76. package/dist/cjs/getMaxValue.js +8 -0
  77. package/dist/cjs/getMilliseconds.js +9 -0
  78. package/dist/cjs/getMinValue.js +8 -0
  79. package/dist/cjs/getOwnKeys.js +8 -0
  80. package/dist/cjs/getOwnPaths.js +8 -0
  81. package/dist/cjs/getOwnProperties.js +8 -0
  82. package/dist/cjs/getPackageName.js +9 -0
  83. package/dist/cjs/getPaths.js +8 -0
  84. package/dist/cjs/getRandomItem.js +8 -0
  85. package/dist/cjs/getSortedObject.js +8 -0
  86. package/dist/cjs/getType.js +9 -0
  87. package/dist/cjs/has.js +9 -0
  88. package/dist/cjs/hasAdditionalProperties.js +9 -0
  89. package/dist/cjs/inRange.js +9 -0
  90. package/dist/cjs/index.js +2 -0
  91. package/dist/cjs/isEmpty.js +9 -0
  92. package/dist/cjs/iterateForever.js +13 -0
  93. package/dist/cjs/joinStrings.js +8 -0
  94. package/dist/cjs/jsonParse.js +8 -0
  95. package/dist/cjs/looksLikeURL.js +10 -0
  96. package/dist/cjs/normalize.js +17 -0
  97. package/dist/cjs/numbers.js +3 -3
  98. package/dist/cjs/parseNumber.js +9 -0
  99. package/dist/cjs/pathParts.js +8 -0
  100. package/dist/cjs/predicate/assume.js +14 -0
  101. package/dist/cjs/predicate/factory/allOf.js +11 -0
  102. package/dist/cjs/predicate/factory/anyOf.js +11 -0
  103. package/dist/cjs/predicate/factory/everyItem.js +11 -0
  104. package/dist/cjs/predicate/factory/fromEnum.js +20 -0
  105. package/dist/cjs/predicate/factory/instanceOf.js +10 -0
  106. package/dist/cjs/predicate/factory/is.js +10 -0
  107. package/dist/cjs/predicate/factory/literal.js +10 -0
  108. package/dist/cjs/predicate/factory/matching.js +10 -0
  109. package/dist/cjs/predicate/factory/maybeArray.js +11 -0
  110. package/dist/cjs/predicate/factory/nonNullable.js +13 -0
  111. package/dist/cjs/predicate/factory/nullable.js +11 -0
  112. package/dist/cjs/predicate/factory/nullish.js +12 -0
  113. package/dist/cjs/predicate/factory/optional.js +11 -0
  114. package/dist/cjs/predicate/factory/range.js +10 -0
  115. package/dist/cjs/predicate/factory/shape.js +13 -0
  116. package/dist/cjs/predicate/factory/simple.js +10 -0
  117. package/dist/cjs/predicate/factory/stringLength.js +11 -0
  118. package/dist/cjs/predicate/factory/tuple.js +11 -0
  119. package/dist/cjs/predicate/factory/typeOf.js +11 -0
  120. package/dist/cjs/predicate/factory/withLength.js +15 -0
  121. package/dist/cjs/predicate/factory/withSize.js +14 -0
  122. package/dist/cjs/predicate/index.js +0 -1
  123. package/dist/cjs/predicate/isAny.js +10 -0
  124. package/dist/cjs/predicate/isAnyObject.js +9 -0
  125. package/dist/cjs/predicate/isAnyObjectWith.js +9 -0
  126. package/dist/cjs/predicate/isAnyObjectWithOwn.js +9 -0
  127. package/dist/cjs/predicate/isArray.js +9 -0
  128. package/dist/cjs/predicate/isAsyncIterable.js +12 -0
  129. package/dist/cjs/predicate/isBigInt.js +9 -0
  130. package/dist/cjs/predicate/isBigIntArray.js +9 -0
  131. package/dist/cjs/predicate/isBinaryNumberString.js +11 -0
  132. package/dist/cjs/predicate/isBoolean.js +9 -0
  133. package/dist/cjs/predicate/isBooleanArray.js +9 -0
  134. package/dist/cjs/predicate/isDateInputString.js +9 -0
  135. package/dist/cjs/predicate/isDigitsString.js +9 -0
  136. package/dist/cjs/predicate/isFiniteNumber.js +9 -0
  137. package/dist/cjs/predicate/isFunction.js +9 -0
  138. package/dist/cjs/predicate/isHexNumberString.js +11 -0
  139. package/dist/cjs/predicate/isISODateString.js +12 -0
  140. package/dist/cjs/predicate/isInt32.js +9 -0
  141. package/dist/cjs/predicate/isIntString.js +9 -0
  142. package/dist/cjs/predicate/isInteger.js +9 -0
  143. package/dist/cjs/predicate/isIterable.js +9 -0
  144. package/dist/cjs/predicate/isJSONable.js +11 -1
  145. package/dist/cjs/predicate/isLengthAware.js +9 -0
  146. package/dist/cjs/predicate/isNonNullable.js +9 -0
  147. package/dist/cjs/predicate/isNull.js +9 -0
  148. package/dist/cjs/predicate/isNullArray.js +9 -0
  149. package/dist/cjs/predicate/isNullish.js +9 -0
  150. package/dist/cjs/predicate/isNumber.js +9 -0
  151. package/dist/cjs/predicate/isNumberArray.js +9 -0
  152. package/dist/cjs/predicate/isNumericString.js +9 -0
  153. package/dist/cjs/predicate/isNumericValue.js +9 -0
  154. package/dist/cjs/predicate/isNumericValueArray.js +9 -0
  155. package/dist/cjs/predicate/isObject.js +9 -0
  156. package/dist/cjs/predicate/isObjectLiteral.js +9 -0
  157. package/dist/cjs/predicate/isObjectWith.js +9 -0
  158. package/dist/cjs/predicate/isOctalNumberString.js +11 -0
  159. package/dist/cjs/predicate/isOptionalArray.js +9 -0
  160. package/dist/cjs/predicate/isOptionalBigInt.js +9 -0
  161. package/dist/cjs/predicate/isOptionalBoolean.js +9 -0
  162. package/dist/cjs/predicate/isOptionalISODateString.js +9 -0
  163. package/dist/cjs/predicate/isOptionalNull.js +9 -0
  164. package/dist/cjs/predicate/isOptionalNumber.js +9 -0
  165. package/dist/cjs/predicate/isOptionalObject.js +9 -0
  166. package/dist/cjs/predicate/isOptionalString.js +9 -0
  167. package/dist/cjs/predicate/isOptionalSymbol.js +9 -0
  168. package/dist/cjs/predicate/isPositiveFiniteNumber.js +9 -0
  169. package/dist/cjs/predicate/isPositiveInteger.js +9 -0
  170. package/dist/cjs/predicate/isPrimitive.js +9 -0
  171. package/dist/cjs/predicate/isPromiseFulfilledResult.js +9 -0
  172. package/dist/cjs/predicate/isPromiseLike.js +9 -0
  173. package/dist/cjs/predicate/isPromiseRejectedResult.js +9 -0
  174. package/dist/cjs/predicate/isPropertyKey.js +9 -0
  175. package/dist/cjs/predicate/isSafeInteger.js +9 -0
  176. package/dist/cjs/predicate/isSizeAware.js +9 -0
  177. package/dist/cjs/predicate/isString.js +9 -0
  178. package/dist/cjs/predicate/isStringArray.js +9 -0
  179. package/dist/cjs/predicate/isStringRecord.js +9 -0
  180. package/dist/cjs/predicate/isStringWithLength.js +9 -0
  181. package/dist/cjs/predicate/isSymbol.js +9 -0
  182. package/dist/cjs/predicate/isSymbolArray.js +9 -0
  183. package/dist/cjs/predicate/isTimeoutError.js +13 -0
  184. package/dist/cjs/predicate/isUInt32.js +9 -0
  185. package/dist/cjs/predicate/isUndefined.js +9 -0
  186. package/dist/cjs/predicate/isUndefinedArray.js +9 -0
  187. package/dist/cjs/predicate/isUnknown.js +9 -0
  188. package/dist/cjs/predicate/isUrlString.js +9 -0
  189. package/dist/cjs/prefix.js +9 -0
  190. package/dist/cjs/randomInt.js +9 -0
  191. package/dist/cjs/redactCredentialsInURL.js +8 -0
  192. package/dist/cjs/resultify.js +25 -0
  193. package/dist/cjs/secToString.js +9 -0
  194. package/dist/cjs/set.js +13 -0
  195. package/dist/cjs/sort/byLocaleCompare.js +8 -0
  196. package/dist/cjs/sort/byRandom.js +9 -1
  197. package/dist/cjs/sort/bySimpleComparison.js +8 -0
  198. package/dist/cjs/sort/bySubtraction.js +8 -0
  199. package/dist/cjs/sort/byTimestamp.js +8 -0
  200. package/dist/cjs/sort/factory/byProperty.js +8 -0
  201. package/dist/cjs/sort/factory/byReverseOf.js +8 -0
  202. package/dist/cjs/stripIndent.js +8 -0
  203. package/dist/cjs/stripWhitespace.js +8 -0
  204. package/dist/cjs/suffix.js +9 -0
  205. package/dist/cjs/toPascalCase.js +10 -0
  206. package/dist/cjs/trimEnd.js +9 -0
  207. package/dist/cjs/trimIndentation.js +8 -0
  208. package/dist/cjs/trimStart.js +9 -0
  209. package/dist/cjs/tryFn.js +11 -0
  210. package/dist/cjs/tryIt.js +9 -0
  211. package/dist/cjs/types/common.js +1 -0
  212. package/dist/cjs/types/utils.js +1 -0
  213. package/dist/cjs/unique.js +8 -0
  214. package/dist/cjs/uniqueItems.js +8 -0
  215. package/dist/cjs/until.js +35 -0
  216. package/dist/mjs/asArray.js +9 -0
  217. package/dist/mjs/asError.js +9 -0
  218. package/dist/mjs/assertion/assertExhaustive.js +19 -0
  219. package/dist/mjs/assertion/assertIsAsyncIterable.js +13 -0
  220. package/dist/mjs/assertion/assertIsBigInt.js +9 -0
  221. package/dist/mjs/assertion/assertIsBigIntArray.js +9 -0
  222. package/dist/mjs/assertion/assertIsBoolean.js +9 -0
  223. package/dist/mjs/assertion/assertIsBooleanArray.js +9 -0
  224. package/dist/mjs/assertion/assertIsDigitsString.js +9 -0
  225. package/dist/mjs/assertion/assertIsFiniteNumber.js +9 -0
  226. package/dist/mjs/assertion/assertIsFunction.js +9 -0
  227. package/dist/mjs/assertion/assertIsInt32.js +9 -0
  228. package/dist/mjs/assertion/assertIsIntString.js +9 -0
  229. package/dist/mjs/assertion/assertIsInteger.js +9 -0
  230. package/dist/mjs/assertion/assertIsIterable.js +9 -0
  231. package/dist/mjs/assertion/assertIsLengthAware.js +9 -0
  232. package/dist/mjs/assertion/assertIsNull.js +9 -0
  233. package/dist/mjs/assertion/assertIsNullArray.js +9 -0
  234. package/dist/mjs/assertion/assertIsNumber.js +9 -0
  235. package/dist/mjs/assertion/assertIsNumberArray.js +9 -0
  236. package/dist/mjs/assertion/assertIsNumberGTEOne.js +9 -0
  237. package/dist/mjs/assertion/assertIsNumericString.js +9 -0
  238. package/dist/mjs/assertion/assertIsNumericValue.js +11 -0
  239. package/dist/mjs/assertion/assertIsNumericValueArray.js +9 -0
  240. package/dist/mjs/assertion/assertIsObject.js +10 -0
  241. package/dist/mjs/assertion/assertIsOptionalBigInt.js +10 -0
  242. package/dist/mjs/assertion/assertIsOptionalBoolean.js +10 -0
  243. package/dist/mjs/assertion/assertIsOptionalNull.js +10 -0
  244. package/dist/mjs/assertion/assertIsOptionalNumber.js +10 -0
  245. package/dist/mjs/assertion/assertIsOptionalString.js +10 -0
  246. package/dist/mjs/assertion/assertIsOptionalSymbol.js +10 -0
  247. package/dist/mjs/assertion/assertIsPositiveFiniteNumber.js +9 -0
  248. package/dist/mjs/assertion/assertIsPositiveInteger.js +9 -0
  249. package/dist/mjs/assertion/assertIsPrimitive.js +9 -0
  250. package/dist/mjs/assertion/assertIsPromiseFulfilledResult.js +11 -0
  251. package/dist/mjs/assertion/assertIsPromiseRejectedResult.js +11 -0
  252. package/dist/mjs/assertion/assertIsPropertyKey.js +11 -0
  253. package/dist/mjs/assertion/assertIsSafeInteger.js +9 -0
  254. package/dist/mjs/assertion/assertIsSizeAware.js +9 -0
  255. package/dist/mjs/assertion/assertIsString.js +9 -0
  256. package/dist/mjs/assertion/assertIsStringArray.js +9 -0
  257. package/dist/mjs/assertion/assertIsStringMatching.js +9 -0
  258. package/dist/mjs/assertion/assertIsStringRecord.js +9 -0
  259. package/dist/mjs/assertion/assertIsStringWithLength.js +9 -0
  260. package/dist/mjs/assertion/assertIsSymbol.js +9 -0
  261. package/dist/mjs/assertion/assertIsSymbolArray.js +9 -0
  262. package/dist/mjs/assertion/assertIsUndefined.js +9 -0
  263. package/dist/mjs/assertion/assertIsUndefinedArray.js +9 -0
  264. package/dist/mjs/assertion/assertPathExists.js +12 -0
  265. package/dist/mjs/assertion/assertPredicate.js +11 -0
  266. package/dist/mjs/assertion/getError.js +9 -0
  267. package/dist/mjs/capitalize.js +8 -0
  268. package/dist/mjs/cartesian.js +10 -0
  269. package/dist/mjs/chunk.js +8 -0
  270. package/dist/mjs/clamp.js +9 -0
  271. package/dist/mjs/combinations.js +8 -0
  272. package/dist/mjs/comment.js +11 -0
  273. package/dist/mjs/compose.js +11 -0
  274. package/dist/mjs/constants.js +2 -0
  275. package/dist/mjs/convert.js +8 -0
  276. package/dist/mjs/countCharCode.js +8 -0
  277. package/dist/mjs/countCharacter.js +8 -0
  278. package/dist/mjs/counter.js +8 -0
  279. package/dist/mjs/dedent.js +14 -0
  280. package/dist/mjs/deepDecodeURI.js +8 -0
  281. package/dist/mjs/deepFreeze.js +13 -0
  282. package/dist/mjs/delay.js +14 -0
  283. package/dist/mjs/delayAnimationFrame.js +9 -0
  284. package/dist/mjs/delayAnimationFrames.js +9 -0
  285. package/dist/mjs/describeInput.js +12 -0
  286. package/dist/mjs/escapeRegExp.js +8 -0
  287. package/dist/mjs/findIndentation.js +8 -0
  288. package/dist/mjs/get.js +9 -0
  289. package/dist/mjs/getDateString.js +8 -0
  290. package/dist/mjs/getISODateString.js +8 -0
  291. package/dist/mjs/getMaxValue.js +8 -0
  292. package/dist/mjs/getMilliseconds.js +9 -0
  293. package/dist/mjs/getMinValue.js +8 -0
  294. package/dist/mjs/getOwnKeys.js +8 -0
  295. package/dist/mjs/getOwnPaths.js +8 -0
  296. package/dist/mjs/getOwnProperties.js +8 -0
  297. package/dist/mjs/getPackageName.js +9 -0
  298. package/dist/mjs/getPaths.js +8 -0
  299. package/dist/mjs/getRandomItem.js +8 -0
  300. package/dist/mjs/getSortedObject.js +8 -0
  301. package/dist/mjs/getType.js +9 -0
  302. package/dist/mjs/has.js +9 -0
  303. package/dist/mjs/hasAdditionalProperties.js +9 -0
  304. package/dist/mjs/inRange.js +9 -0
  305. package/dist/mjs/index.js +2 -0
  306. package/dist/mjs/isEmpty.js +9 -0
  307. package/dist/mjs/iterateForever.js +13 -0
  308. package/dist/mjs/joinStrings.js +8 -0
  309. package/dist/mjs/jsonParse.js +8 -0
  310. package/dist/mjs/looksLikeURL.js +10 -0
  311. package/dist/mjs/normalize.js +17 -0
  312. package/dist/mjs/numbers.js +3 -3
  313. package/dist/mjs/parseNumber.js +9 -0
  314. package/dist/mjs/pathParts.js +8 -0
  315. package/dist/mjs/predicate/assume.js +14 -0
  316. package/dist/mjs/predicate/factory/allOf.js +11 -0
  317. package/dist/mjs/predicate/factory/anyOf.js +11 -0
  318. package/dist/mjs/predicate/factory/everyItem.js +11 -0
  319. package/dist/mjs/predicate/factory/fromEnum.js +20 -0
  320. package/dist/mjs/predicate/factory/instanceOf.js +10 -0
  321. package/dist/mjs/predicate/factory/is.js +10 -0
  322. package/dist/mjs/predicate/factory/literal.js +10 -0
  323. package/dist/mjs/predicate/factory/matching.js +10 -0
  324. package/dist/mjs/predicate/factory/maybeArray.js +11 -0
  325. package/dist/mjs/predicate/factory/nonNullable.js +13 -0
  326. package/dist/mjs/predicate/factory/nullable.js +11 -0
  327. package/dist/mjs/predicate/factory/nullish.js +12 -0
  328. package/dist/mjs/predicate/factory/optional.js +11 -0
  329. package/dist/mjs/predicate/factory/range.js +10 -0
  330. package/dist/mjs/predicate/factory/shape.js +13 -0
  331. package/dist/mjs/predicate/factory/simple.js +10 -0
  332. package/dist/mjs/predicate/factory/stringLength.js +11 -0
  333. package/dist/mjs/predicate/factory/tuple.js +11 -0
  334. package/dist/mjs/predicate/factory/typeOf.js +11 -0
  335. package/dist/mjs/predicate/factory/withLength.js +15 -0
  336. package/dist/mjs/predicate/factory/withSize.js +14 -0
  337. package/dist/mjs/predicate/index.js +0 -1
  338. package/dist/mjs/predicate/isAny.js +10 -0
  339. package/dist/mjs/predicate/isAnyObject.js +9 -0
  340. package/dist/mjs/predicate/isAnyObjectWith.js +9 -0
  341. package/dist/mjs/predicate/isAnyObjectWithOwn.js +9 -0
  342. package/dist/mjs/predicate/isArray.js +9 -0
  343. package/dist/mjs/predicate/isAsyncIterable.js +12 -0
  344. package/dist/mjs/predicate/isBigInt.js +9 -0
  345. package/dist/mjs/predicate/isBigIntArray.js +9 -0
  346. package/dist/mjs/predicate/isBinaryNumberString.js +11 -0
  347. package/dist/mjs/predicate/isBoolean.js +9 -0
  348. package/dist/mjs/predicate/isBooleanArray.js +9 -0
  349. package/dist/mjs/predicate/isDateInputString.js +9 -0
  350. package/dist/mjs/predicate/isDigitsString.js +9 -0
  351. package/dist/mjs/predicate/isFiniteNumber.js +9 -0
  352. package/dist/mjs/predicate/isFunction.js +9 -0
  353. package/dist/mjs/predicate/isHexNumberString.js +11 -0
  354. package/dist/mjs/predicate/isISODateString.js +12 -0
  355. package/dist/mjs/predicate/isInt32.js +9 -0
  356. package/dist/mjs/predicate/isIntString.js +9 -0
  357. package/dist/mjs/predicate/isInteger.js +9 -0
  358. package/dist/mjs/predicate/isIterable.js +9 -0
  359. package/dist/mjs/predicate/isJSONable.js +11 -1
  360. package/dist/mjs/predicate/isLengthAware.js +9 -0
  361. package/dist/mjs/predicate/isNonNullable.js +9 -0
  362. package/dist/mjs/predicate/isNull.js +9 -0
  363. package/dist/mjs/predicate/isNullArray.js +9 -0
  364. package/dist/mjs/predicate/isNullish.js +9 -0
  365. package/dist/mjs/predicate/isNumber.js +9 -0
  366. package/dist/mjs/predicate/isNumberArray.js +9 -0
  367. package/dist/mjs/predicate/isNumericString.js +9 -0
  368. package/dist/mjs/predicate/isNumericValue.js +9 -0
  369. package/dist/mjs/predicate/isNumericValueArray.js +9 -0
  370. package/dist/mjs/predicate/isObject.js +9 -0
  371. package/dist/mjs/predicate/isObjectLiteral.js +9 -0
  372. package/dist/mjs/predicate/isObjectWith.js +9 -0
  373. package/dist/mjs/predicate/isOctalNumberString.js +11 -0
  374. package/dist/mjs/predicate/isOptionalArray.js +9 -0
  375. package/dist/mjs/predicate/isOptionalBigInt.js +9 -0
  376. package/dist/mjs/predicate/isOptionalBoolean.js +9 -0
  377. package/dist/mjs/predicate/isOptionalISODateString.js +9 -0
  378. package/dist/mjs/predicate/isOptionalNull.js +9 -0
  379. package/dist/mjs/predicate/isOptionalNumber.js +9 -0
  380. package/dist/mjs/predicate/isOptionalObject.js +9 -0
  381. package/dist/mjs/predicate/isOptionalString.js +9 -0
  382. package/dist/mjs/predicate/isOptionalSymbol.js +9 -0
  383. package/dist/mjs/predicate/isPositiveFiniteNumber.js +9 -0
  384. package/dist/mjs/predicate/isPositiveInteger.js +9 -0
  385. package/dist/mjs/predicate/isPrimitive.js +9 -0
  386. package/dist/mjs/predicate/isPromiseFulfilledResult.js +9 -0
  387. package/dist/mjs/predicate/isPromiseLike.js +9 -0
  388. package/dist/mjs/predicate/isPromiseRejectedResult.js +9 -0
  389. package/dist/mjs/predicate/isPropertyKey.js +9 -0
  390. package/dist/mjs/predicate/isSafeInteger.js +9 -0
  391. package/dist/mjs/predicate/isSizeAware.js +9 -0
  392. package/dist/mjs/predicate/isString.js +9 -0
  393. package/dist/mjs/predicate/isStringArray.js +9 -0
  394. package/dist/mjs/predicate/isStringRecord.js +9 -0
  395. package/dist/mjs/predicate/isStringWithLength.js +9 -0
  396. package/dist/mjs/predicate/isSymbol.js +9 -0
  397. package/dist/mjs/predicate/isSymbolArray.js +9 -0
  398. package/dist/mjs/predicate/isTimeoutError.js +13 -0
  399. package/dist/mjs/predicate/isUInt32.js +9 -0
  400. package/dist/mjs/predicate/isUndefined.js +9 -0
  401. package/dist/mjs/predicate/isUndefinedArray.js +9 -0
  402. package/dist/mjs/predicate/isUnknown.js +9 -0
  403. package/dist/mjs/predicate/isUrlString.js +9 -0
  404. package/dist/mjs/prefix.js +9 -0
  405. package/dist/mjs/randomInt.js +9 -0
  406. package/dist/mjs/redactCredentialsInURL.js +8 -0
  407. package/dist/mjs/resultify.js +25 -0
  408. package/dist/mjs/secToString.js +9 -0
  409. package/dist/mjs/set.js +13 -0
  410. package/dist/mjs/sort/byLocaleCompare.js +8 -0
  411. package/dist/mjs/sort/byRandom.js +9 -1
  412. package/dist/mjs/sort/bySimpleComparison.js +8 -0
  413. package/dist/mjs/sort/bySubtraction.js +8 -0
  414. package/dist/mjs/sort/byTimestamp.js +8 -0
  415. package/dist/mjs/sort/factory/byProperty.js +8 -0
  416. package/dist/mjs/sort/factory/byReverseOf.js +8 -0
  417. package/dist/mjs/stripIndent.js +8 -0
  418. package/dist/mjs/stripWhitespace.js +8 -0
  419. package/dist/mjs/suffix.js +9 -0
  420. package/dist/mjs/toPascalCase.js +10 -0
  421. package/dist/mjs/trimEnd.js +9 -0
  422. package/dist/mjs/trimIndentation.js +8 -0
  423. package/dist/mjs/trimStart.js +9 -0
  424. package/dist/mjs/tryFn.js +11 -0
  425. package/dist/mjs/tryIt.js +9 -0
  426. package/dist/mjs/types/common.js +1 -0
  427. package/dist/mjs/types/utils.js +1 -0
  428. package/dist/mjs/unique.js +8 -0
  429. package/dist/mjs/uniqueItems.js +8 -0
  430. package/dist/mjs/until.js +35 -0
  431. package/dist/types/asArray.d.ts +9 -0
  432. package/dist/types/asError.d.ts +9 -0
  433. package/dist/types/assertion/assertExhaustive.d.ts +19 -0
  434. package/dist/types/assertion/assertIsAsyncIterable.d.ts +13 -0
  435. package/dist/types/assertion/assertIsBigInt.d.ts +9 -0
  436. package/dist/types/assertion/assertIsBigIntArray.d.ts +9 -0
  437. package/dist/types/assertion/assertIsBoolean.d.ts +9 -0
  438. package/dist/types/assertion/assertIsBooleanArray.d.ts +9 -0
  439. package/dist/types/assertion/assertIsDigitsString.d.ts +9 -0
  440. package/dist/types/assertion/assertIsFiniteNumber.d.ts +9 -0
  441. package/dist/types/assertion/assertIsFunction.d.ts +9 -0
  442. package/dist/types/assertion/assertIsInt32.d.ts +9 -0
  443. package/dist/types/assertion/assertIsIntString.d.ts +9 -0
  444. package/dist/types/assertion/assertIsInteger.d.ts +9 -0
  445. package/dist/types/assertion/assertIsIterable.d.ts +9 -0
  446. package/dist/types/assertion/assertIsLengthAware.d.ts +9 -0
  447. package/dist/types/assertion/assertIsNull.d.ts +9 -0
  448. package/dist/types/assertion/assertIsNullArray.d.ts +9 -0
  449. package/dist/types/assertion/assertIsNumber.d.ts +9 -0
  450. package/dist/types/assertion/assertIsNumberArray.d.ts +9 -0
  451. package/dist/types/assertion/assertIsNumberGTEOne.d.ts +9 -0
  452. package/dist/types/assertion/assertIsNumericString.d.ts +9 -0
  453. package/dist/types/assertion/assertIsNumericValue.d.ts +11 -0
  454. package/dist/types/assertion/assertIsNumericValueArray.d.ts +9 -0
  455. package/dist/types/assertion/assertIsObject.d.ts +10 -0
  456. package/dist/types/assertion/assertIsOptionalBigInt.d.ts +10 -0
  457. package/dist/types/assertion/assertIsOptionalBoolean.d.ts +10 -0
  458. package/dist/types/assertion/assertIsOptionalNull.d.ts +10 -0
  459. package/dist/types/assertion/assertIsOptionalNumber.d.ts +10 -0
  460. package/dist/types/assertion/assertIsOptionalString.d.ts +10 -0
  461. package/dist/types/assertion/assertIsOptionalSymbol.d.ts +10 -0
  462. package/dist/types/assertion/assertIsPositiveFiniteNumber.d.ts +9 -0
  463. package/dist/types/assertion/assertIsPositiveInteger.d.ts +9 -0
  464. package/dist/types/assertion/assertIsPrimitive.d.ts +9 -0
  465. package/dist/types/assertion/assertIsPromiseFulfilledResult.d.ts +11 -0
  466. package/dist/types/assertion/assertIsPromiseRejectedResult.d.ts +11 -0
  467. package/dist/types/assertion/assertIsPropertyKey.d.ts +11 -0
  468. package/dist/types/assertion/assertIsSafeInteger.d.ts +9 -0
  469. package/dist/types/assertion/assertIsSizeAware.d.ts +9 -0
  470. package/dist/types/assertion/assertIsString.d.ts +9 -0
  471. package/dist/types/assertion/assertIsStringArray.d.ts +9 -0
  472. package/dist/types/assertion/assertIsStringMatching.d.ts +9 -0
  473. package/dist/types/assertion/assertIsStringRecord.d.ts +9 -0
  474. package/dist/types/assertion/assertIsStringWithLength.d.ts +9 -0
  475. package/dist/types/assertion/assertIsSymbol.d.ts +9 -0
  476. package/dist/types/assertion/assertIsSymbolArray.d.ts +9 -0
  477. package/dist/types/assertion/assertIsUndefined.d.ts +9 -0
  478. package/dist/types/assertion/assertIsUndefinedArray.d.ts +9 -0
  479. package/dist/types/assertion/assertPredicate.d.ts +11 -0
  480. package/dist/types/assertion/getError.d.ts +9 -0
  481. package/dist/types/capitalize.d.ts +9 -1
  482. package/dist/types/cartesian.d.ts +10 -0
  483. package/dist/types/chunk.d.ts +8 -0
  484. package/dist/types/clamp.d.ts +9 -0
  485. package/dist/types/combinations.d.ts +8 -0
  486. package/dist/types/comment.d.ts +8 -0
  487. package/dist/types/compose.d.ts +11 -0
  488. package/dist/types/convert.d.ts +8 -0
  489. package/dist/types/countCharCode.d.ts +8 -0
  490. package/dist/types/countCharacter.d.ts +8 -0
  491. package/dist/types/counter.d.ts +8 -0
  492. package/dist/types/dedent.d.ts +14 -0
  493. package/dist/types/deepDecodeURI.d.ts +8 -0
  494. package/dist/types/deepFreeze.d.ts +13 -0
  495. package/dist/types/describeInput.d.ts +10 -0
  496. package/dist/types/escapeRegExp.d.ts +8 -0
  497. package/dist/types/findIndentation.d.ts +8 -0
  498. package/dist/types/getDateString.d.ts +8 -0
  499. package/dist/types/getISODateString.d.ts +8 -0
  500. package/dist/types/getMaxValue.d.ts +8 -0
  501. package/dist/types/getMilliseconds.d.ts +9 -0
  502. package/dist/types/getMinValue.d.ts +8 -0
  503. package/dist/types/getOwnKeys.d.ts +8 -0
  504. package/dist/types/getOwnPaths.d.ts +8 -0
  505. package/dist/types/getOwnProperties.d.ts +8 -0
  506. package/dist/types/getPackageName.d.ts +9 -0
  507. package/dist/types/getPaths.d.ts +8 -0
  508. package/dist/types/getType.d.ts +9 -0
  509. package/dist/types/hasAdditionalProperties.d.ts +9 -0
  510. package/dist/types/inRange.d.ts +9 -0
  511. package/dist/types/isEmpty.d.ts +9 -0
  512. package/dist/types/iterateForever.d.ts +13 -0
  513. package/dist/types/joinStrings.d.ts +8 -0
  514. package/dist/types/looksLikeURL.d.ts +9 -0
  515. package/dist/types/memo.d.ts +14 -0
  516. package/dist/types/parseNumber.d.ts +9 -0
  517. package/dist/types/pathParts.d.ts +8 -0
  518. package/dist/types/predicate/assume.d.ts +13 -0
  519. package/dist/types/predicate/factory/allOf.d.ts +11 -0
  520. package/dist/types/predicate/factory/anyOf.d.ts +11 -0
  521. package/dist/types/predicate/factory/everyItem.d.ts +11 -0
  522. package/dist/types/predicate/factory/fromEnum.d.ts +17 -0
  523. package/dist/types/predicate/factory/instanceOf.d.ts +10 -0
  524. package/dist/types/predicate/factory/is.d.ts +10 -0
  525. package/dist/types/predicate/factory/literal.d.ts +10 -0
  526. package/dist/types/predicate/factory/matching.d.ts +10 -0
  527. package/dist/types/predicate/factory/maybeArray.d.ts +11 -0
  528. package/dist/types/predicate/factory/nonNullable.d.ts +13 -0
  529. package/dist/types/predicate/factory/nullable.d.ts +11 -0
  530. package/dist/types/predicate/factory/nullish.d.ts +12 -0
  531. package/dist/types/predicate/factory/optional.d.ts +11 -0
  532. package/dist/types/predicate/factory/shape.d.ts +13 -0
  533. package/dist/types/predicate/factory/simple.d.ts +10 -0
  534. package/dist/types/predicate/factory/stringLength.d.ts +11 -0
  535. package/dist/types/predicate/factory/tuple.d.ts +11 -0
  536. package/dist/types/predicate/factory/typeOf.d.ts +11 -0
  537. package/dist/types/predicate/index.d.ts +0 -1
  538. package/dist/types/predicate/isAny.d.ts +9 -0
  539. package/dist/types/predicate/isAnyObject.d.ts +9 -0
  540. package/dist/types/predicate/isAnyObjectWith.d.ts +9 -0
  541. package/dist/types/predicate/isAnyObjectWithOwn.d.ts +9 -0
  542. package/dist/types/predicate/isArray.d.ts +9 -0
  543. package/dist/types/predicate/isAsyncIterable.d.ts +12 -0
  544. package/dist/types/predicate/isBigInt.d.ts +9 -0
  545. package/dist/types/predicate/isBigIntArray.d.ts +9 -0
  546. package/dist/types/predicate/isBinaryNumberString.d.ts +11 -0
  547. package/dist/types/predicate/isBoolean.d.ts +9 -0
  548. package/dist/types/predicate/isBooleanArray.d.ts +9 -0
  549. package/dist/types/predicate/isDateInputString.d.ts +9 -0
  550. package/dist/types/predicate/isDigitsString.d.ts +9 -0
  551. package/dist/types/predicate/isFiniteNumber.d.ts +9 -0
  552. package/dist/types/predicate/isFunction.d.ts +9 -0
  553. package/dist/types/predicate/isHexNumberString.d.ts +11 -0
  554. package/dist/types/predicate/isISODateString.d.ts +12 -0
  555. package/dist/types/predicate/isInt32.d.ts +9 -0
  556. package/dist/types/predicate/isIntString.d.ts +9 -0
  557. package/dist/types/predicate/isInteger.d.ts +9 -0
  558. package/dist/types/predicate/isIterable.d.ts +9 -0
  559. package/dist/types/predicate/isJSONable.d.ts +9 -0
  560. package/dist/types/predicate/isLengthAware.d.ts +9 -0
  561. package/dist/types/predicate/isNonNullable.d.ts +9 -0
  562. package/dist/types/predicate/isNull.d.ts +9 -0
  563. package/dist/types/predicate/isNullArray.d.ts +9 -0
  564. package/dist/types/predicate/isNullish.d.ts +9 -0
  565. package/dist/types/predicate/isNumber.d.ts +9 -0
  566. package/dist/types/predicate/isNumberArray.d.ts +9 -0
  567. package/dist/types/predicate/isNumericString.d.ts +9 -0
  568. package/dist/types/predicate/isNumericValue.d.ts +9 -0
  569. package/dist/types/predicate/isNumericValueArray.d.ts +9 -0
  570. package/dist/types/predicate/isObject.d.ts +9 -0
  571. package/dist/types/predicate/isObjectLiteral.d.ts +9 -0
  572. package/dist/types/predicate/isObjectWith.d.ts +9 -0
  573. package/dist/types/predicate/isOctalNumberString.d.ts +11 -0
  574. package/dist/types/predicate/isOptionalArray.d.ts +9 -0
  575. package/dist/types/predicate/isOptionalBigInt.d.ts +9 -0
  576. package/dist/types/predicate/isOptionalBoolean.d.ts +9 -0
  577. package/dist/types/predicate/isOptionalISODateString.d.ts +9 -0
  578. package/dist/types/predicate/isOptionalNull.d.ts +9 -0
  579. package/dist/types/predicate/isOptionalNumber.d.ts +9 -0
  580. package/dist/types/predicate/isOptionalObject.d.ts +9 -0
  581. package/dist/types/predicate/isOptionalString.d.ts +9 -0
  582. package/dist/types/predicate/isOptionalSymbol.d.ts +9 -0
  583. package/dist/types/predicate/isPositiveFiniteNumber.d.ts +9 -0
  584. package/dist/types/predicate/isPositiveInteger.d.ts +9 -0
  585. package/dist/types/predicate/isPrimitive.d.ts +9 -0
  586. package/dist/types/predicate/isPromiseFulfilledResult.d.ts +9 -0
  587. package/dist/types/predicate/isPromiseLike.d.ts +9 -0
  588. package/dist/types/predicate/isPromiseRejectedResult.d.ts +9 -0
  589. package/dist/types/predicate/isPropertyKey.d.ts +9 -0
  590. package/dist/types/predicate/isSafeInteger.d.ts +9 -0
  591. package/dist/types/predicate/isSizeAware.d.ts +9 -0
  592. package/dist/types/predicate/isString.d.ts +9 -0
  593. package/dist/types/predicate/isStringArray.d.ts +9 -0
  594. package/dist/types/predicate/isStringRecord.d.ts +9 -0
  595. package/dist/types/predicate/isStringWithLength.d.ts +9 -0
  596. package/dist/types/predicate/isSymbol.d.ts +9 -0
  597. package/dist/types/predicate/isSymbolArray.d.ts +9 -0
  598. package/dist/types/predicate/isTimeoutError.d.ts +13 -0
  599. package/dist/types/predicate/isUInt32.d.ts +9 -0
  600. package/dist/types/predicate/isUndefined.d.ts +9 -0
  601. package/dist/types/predicate/isUndefinedArray.d.ts +9 -0
  602. package/dist/types/predicate/isUnknown.d.ts +9 -0
  603. package/dist/types/predicate/isUrlString.d.ts +9 -0
  604. package/dist/types/prefix.d.ts +9 -0
  605. package/dist/types/redactCredentialsInURL.d.ts +8 -0
  606. package/dist/types/resultify.d.ts +25 -0
  607. package/dist/types/secToString.d.ts +8 -0
  608. package/dist/types/sort/byLocaleCompare.d.ts +8 -0
  609. package/dist/types/sort/byRandom.d.ts +8 -0
  610. package/dist/types/sort/bySimpleComparison.d.ts +8 -0
  611. package/dist/types/sort/bySubtraction.d.ts +8 -0
  612. package/dist/types/sort/byTimestamp.d.ts +8 -0
  613. package/dist/types/sort/factory/byProperty.d.ts +8 -0
  614. package/dist/types/sort/factory/byReverseOf.d.ts +8 -0
  615. package/dist/types/stripIndent.d.ts +8 -0
  616. package/dist/types/stripWhitespace.d.ts +8 -0
  617. package/dist/types/suffix.d.ts +9 -0
  618. package/dist/types/toPascalCase.d.ts +9 -0
  619. package/dist/types/trimEnd.d.ts +9 -0
  620. package/dist/types/trimIndentation.d.ts +8 -0
  621. package/dist/types/trimStart.d.ts +9 -0
  622. package/dist/types/types/arrays.d.ts +3 -0
  623. package/dist/types/types/common.d.ts +3 -0
  624. package/dist/types/types/date-time.d.ts +9 -0
  625. package/dist/types/types/functions.d.ts +7 -0
  626. package/dist/types/types/numbers.d.ts +21 -0
  627. package/dist/types/types/objects.d.ts +74 -0
  628. package/dist/types/types/records.d.ts +5 -0
  629. package/dist/types/types/utils.d.ts +24 -0
  630. package/dist/types/unique.d.ts +18 -0
  631. package/dist/types/uniqueItems.d.ts +8 -0
  632. package/dist/types/until.d.ts +33 -0
  633. package/package.json +4 -2
  634. package/readme.md +11 -1
  635. package/dist/cjs/predicate/isDateString.js +0 -5
  636. package/dist/mjs/predicate/isDateString.js +0 -2
  637. package/dist/types/predicate/isDateString.d.ts +0 -2
@@ -1,5 +1,14 @@
1
1
  import { isInt32 } from '../predicate/isInt32.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a 32-bit integer.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsInt32(42); // does not throw
9
+ * assertIsInt32(2 ** 31); // throws TypeError: input is not an Int32
10
+ * ```
11
+ */
3
12
  export function assertIsInt32(input, error = 'input is not an Int32') {
4
13
  if (!isInt32(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isIntString } from '../predicate/isIntString.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a string representing an integer.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsIntString('42'); // does not throw
9
+ * assertIsIntString('42.5'); // throws TypeError: input is not an integer string
10
+ * ```
11
+ */
3
12
  export function assertIsIntString(input, error = 'input is not an integer string') {
4
13
  if (!isIntString(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isInteger } from '../predicate/isInteger.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an integer.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsInteger(42); // does not throw
9
+ * assertIsInteger(42.5); // throws TypeError: input is not an integer
10
+ * ```
11
+ */
3
12
  export function assertIsInteger(input, error = 'input is not an integer') {
4
13
  if (!isInteger(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isIterable } from '../predicate/isIterable.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an `Iterable`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsIterable<number>([1, 2, 3]); // does not throw
9
+ * assertIsIterable(42); // throws TypeError: input is not an Iterable
10
+ * ```
11
+ */
3
12
  export function assertIsIterable(input, error = 'input is not an Iterable') {
4
13
  if (!isIterable(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isLengthAware } from '../predicate/isLengthAware.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` has a numeric `length` property.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsLengthAware('hello'); // does not throw, strings have a numeric length
9
+ * assertIsLengthAware(42); // throws TypeError: input is not length aware
10
+ * ```
11
+ */
3
12
  export function assertIsLengthAware(input, error = 'input is not length aware') {
4
13
  if (!isLengthAware(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNull } from '../predicate/isNull.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is `null`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNull(null); // does not throw
9
+ * assertIsNull(undefined); // throws TypeError: input is not null
10
+ * ```
11
+ */
3
12
  export function assertIsNull(input, error = 'input is not null') {
4
13
  if (!isNull(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNullArray } from '../predicate/isNullArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of `null` values.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNullArray([null, null]); // does not throw
9
+ * assertIsNullArray([null, undefined]); // throws TypeError: input is not an array of null
10
+ * ```
11
+ */
3
12
  export function assertIsNullArray(input, error = 'input is not an array of null') {
4
13
  if (!isNullArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNumber } from '../predicate/isNumber.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a number.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumber(42); // does not throw
9
+ * assertIsNumber('42'); // throws TypeError: input is not a number
10
+ * ```
11
+ */
3
12
  export function assertIsNumber(input, error = 'input is not a number') {
4
13
  if (!isNumber(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNumberArray } from '../predicate/isNumberArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of numbers.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumberArray([1, 2, 3]); // does not throw
9
+ * assertIsNumberArray([1, '2', 3]); // throws TypeError: input is not an array of number
10
+ * ```
11
+ */
3
12
  export function assertIsNumberArray(input, error = 'input is not an array of number') {
4
13
  if (!isNumberArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isPositiveFiniteNumber } from '../predicate/isPositiveFiniteNumber.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a finite number greater than or equal to 1.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumberGTEOne(1); // does not throw
9
+ * assertIsNumberGTEOne(0.5); // throws TypeError: input is not a number >= 1
10
+ * ```
11
+ */
3
12
  export function assertIsNumberGTEOne(input, error = 'input is not a number >= 1') {
4
13
  if (!isPositiveFiniteNumber(input) || input < 1) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNumericString } from '../predicate/isNumericString.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a string representing a numeric value.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumericString('3.14'); // does not throw
9
+ * assertIsNumericString('abc'); // throws TypeError: input is not a numeric string
10
+ * ```
11
+ */
3
12
  export function assertIsNumericString(input, error = 'input is not a numeric string') {
4
13
  if (!isNumericString(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,16 @@
1
1
  import { isNumericValue } from '../predicate/isNumericValue.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a number, bigint, or numeric string.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumericValue(42); // does not throw
9
+ * assertIsNumericValue('42'); // does not throw
10
+ * assertIsNumericValue(42n); // does not throw
11
+ * assertIsNumericValue('abc'); // throws TypeError: input is not a numerical value
12
+ * ```
13
+ */
3
14
  export function assertIsNumericValue(input, error = 'input is not a numerical value') {
4
15
  if (!isNumericValue(input)) {
5
16
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isNumericValueArray } from '../predicate/isNumericValueArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of numbers, bigints, or numeric strings.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsNumericValueArray([1, '2', 3n]); // does not throw
9
+ * assertIsNumericValueArray([1, 'abc']); // throws TypeError: input is not a numerical value array
10
+ * ```
11
+ */
3
12
  export function assertIsNumericValueArray(input, error = 'input is not a numerical value array') {
4
13
  if (!isNumericValueArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isObject } from '../predicate/isObject.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an object.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsObject({ a: 1 }); // does not throw
9
+ * assertIsObject(null); // throws TypeError: input is not an object
10
+ * assertIsObject([1, 2, 3]); // throws TypeError: input is not an object
11
+ * ```
12
+ */
3
13
  export function assertIsObject(input, error = 'input is not an object') {
4
14
  if (!isObject(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalBigInt } from '../predicate/isOptionalBigInt.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a `bigint` or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalBigInt(10n); // does not throw
9
+ * assertIsOptionalBigInt(undefined); // does not throw
10
+ * assertIsOptionalBigInt(10); // throws TypeError: input is not an optional bigint
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalBigInt(input, error = 'input is not an optional bigint') {
4
14
  if (!isOptionalBigInt(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalBoolean } from '../predicate/isOptionalBoolean.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a boolean or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalBoolean(true); // does not throw
9
+ * assertIsOptionalBoolean(undefined); // does not throw
10
+ * assertIsOptionalBoolean('true'); // throws TypeError: input is not an optional boolean
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalBoolean(input, error = 'input is not an optional boolean') {
4
14
  if (!isOptionalBoolean(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalNull } from '../predicate/isOptionalNull.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is `null` or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalNull(null); // does not throw
9
+ * assertIsOptionalNull(undefined); // does not throw
10
+ * assertIsOptionalNull(0); // throws TypeError: input is not an optional null
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalNull(input, error = 'input is not an optional null') {
4
14
  if (!isOptionalNull(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalNumber } from '../predicate/isOptionalNumber.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a number or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalNumber(42); // does not throw
9
+ * assertIsOptionalNumber(undefined); // does not throw
10
+ * assertIsOptionalNumber('42'); // throws TypeError: input is not an optional number
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalNumber(input, error = 'input is not an optional number') {
4
14
  if (!isOptionalNumber(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalString } from '../predicate/isOptionalString.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a string or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalString('hello'); // does not throw
9
+ * assertIsOptionalString(undefined); // does not throw
10
+ * assertIsOptionalString(42); // throws TypeError: input is not an optional string
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalString(input, error = 'input is not an optional string') {
4
14
  if (!isOptionalString(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,15 @@
1
1
  import { isOptionalSymbol } from '../predicate/isOptionalSymbol.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a symbol or `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsOptionalSymbol(Symbol('id')); // does not throw
9
+ * assertIsOptionalSymbol(undefined); // does not throw
10
+ * assertIsOptionalSymbol('id'); // throws TypeError: input is not an optional symbol
11
+ * ```
12
+ */
3
13
  export function assertIsOptionalSymbol(input, error = 'input is not an optional symbol') {
4
14
  if (!isOptionalSymbol(input)) {
5
15
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isPositiveFiniteNumber } from '../predicate/isPositiveFiniteNumber.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a positive, finite number.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsPositiveFiniteNumber(42); // does not throw
9
+ * assertIsPositiveFiniteNumber(-1); // throws TypeError: input is not a positive finite number
10
+ * ```
11
+ */
3
12
  export function assertIsPositiveFiniteNumber(input, error = 'input is not a positive finite number') {
4
13
  if (!isPositiveFiniteNumber(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isPositiveInteger } from '../predicate/isPositiveInteger.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a positive integer.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsPositiveInteger(42); // does not throw
9
+ * assertIsPositiveInteger(-1); // throws TypeError: input is not a positive integer
10
+ * ```
11
+ */
3
12
  export function assertIsPositiveInteger(input, error = 'input is not a positive integer') {
4
13
  if (!isPositiveInteger(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isPrimitive } from '../predicate/isPrimitive.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a primitive value.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsPrimitive('hello'); // does not throw
9
+ * assertIsPrimitive({}); // throws TypeError: input is not primitive
10
+ * ```
11
+ */
3
12
  export function assertIsPrimitive(input, error = 'input is not primitive') {
4
13
  if (!isPrimitive(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,16 @@
1
1
  import { isPromiseFulfilledResult } from '../predicate/isPromiseFulfilledResult.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a fulfilled `Promise` result.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const [result] = await Promise.allSettled([Promise.resolve(42)]);
9
+ *
10
+ * assertIsPromiseFulfilledResult<number>(result); // does not throw
11
+ * assertIsPromiseFulfilledResult({ status: 'rejected' }); // throws TypeError: input is not a promise fulfilled result
12
+ * ```
13
+ */
3
14
  export function assertIsPromiseFulfilledResult(input, error = 'input is not a promise fulfilled result') {
4
15
  if (!isPromiseFulfilledResult(input)) {
5
16
  throw getError(error);
@@ -1,5 +1,16 @@
1
1
  import { isPromiseRejectedResult } from '../predicate/isPromiseRejectedResult.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a rejected `Promise` result.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const [result] = await Promise.allSettled([Promise.reject(new Error('fail'))]);
9
+ *
10
+ * assertIsPromiseRejectedResult(result); // does not throw
11
+ * assertIsPromiseRejectedResult({ status: 'fulfilled' }); // throws TypeError: input is not a promise rejected result
12
+ * ```
13
+ */
3
14
  export function assertIsPromiseRejectedResult(input, error = 'input is not a promise rejected result') {
4
15
  if (!isPromiseRejectedResult(input)) {
5
16
  throw getError(error);
@@ -1,5 +1,16 @@
1
1
  import { isPropertyKey } from '../predicate/isPropertyKey.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a valid property key: a string, number, or symbol.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsPropertyKey('key'); // does not throw
9
+ * assertIsPropertyKey(42); // does not throw
10
+ * assertIsPropertyKey(Symbol('key')); // does not throw
11
+ * assertIsPropertyKey({}); // throws TypeError: input is not a property key
12
+ * ```
13
+ */
3
14
  export function assertIsPropertyKey(input, error = 'input is not a property key') {
4
15
  if (!isPropertyKey(input)) {
5
16
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isSafeInteger } from '../predicate/isSafeInteger.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a safe integer.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsSafeInteger(42); // does not throw
9
+ * assertIsSafeInteger(2 ** 53); // throws TypeError: input is not a safe integer
10
+ * ```
11
+ */
3
12
  export function assertIsSafeInteger(input, error = 'input is not a safe integer') {
4
13
  if (!isSafeInteger(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isSizeAware } from '../predicate/isSizeAware.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` has a numeric `size` property.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsSizeAware(new Set([1, 2, 3])); // does not throw
9
+ * assertIsSizeAware(42); // throws TypeError: input is not size aware
10
+ * ```
11
+ */
3
12
  export function assertIsSizeAware(input, error = 'input is not size aware') {
4
13
  if (!isSizeAware(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isString } from '../predicate/isString.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a string.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsString('hello'); // does not throw
9
+ * assertIsString(42); // throws TypeError: input is not a string
10
+ * ```
11
+ */
3
12
  export function assertIsString(input, error = 'input is not a string') {
4
13
  if (!isString(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isStringArray } from '../predicate/isStringArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of strings.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsStringArray(['a', 'b']); // does not throw
9
+ * assertIsStringArray(['a', 42]); // throws TypeError: input is not an array of string
10
+ * ```
11
+ */
3
12
  export function assertIsStringArray(input, error = 'input is not an array of string') {
4
13
  if (!isStringArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { matching } from '../predicate/factory/matching.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a string that matches the given `pattern`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsStringMatching('hello', /^h/); // does not throw
9
+ * assertIsStringMatching('world', /^h/); // throws TypeError: input is not a string that matches the pattern
10
+ * ```
11
+ */
3
12
  export function assertIsStringMatching(input, pattern, error = 'input is not a string that matches the pattern') {
4
13
  if (!matching(pattern)(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isStringRecord } from '../predicate/isStringRecord.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an object whose own properties all have string values.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsStringRecord({ a: '1', b: '2' }); // does not throw
9
+ * assertIsStringRecord({ a: 1 }); // throws TypeError: input is not a string record
10
+ * ```
11
+ */
3
12
  export function assertIsStringRecord(input, error = 'input is not a string record') {
4
13
  if (!isStringRecord(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isStringWithLength } from '../predicate/isStringWithLength.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a non-empty string.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsStringWithLength('hello'); // does not throw
9
+ * assertIsStringWithLength(''); // throws TypeError: input is not a string with length
10
+ * ```
11
+ */
3
12
  export function assertIsStringWithLength(input, error = 'input is not a string with length') {
4
13
  if (!isStringWithLength(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isSymbol } from '../predicate/isSymbol.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is a symbol.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsSymbol(Symbol('id')); // does not throw
9
+ * assertIsSymbol('id'); // throws TypeError: input is not a symbol
10
+ * ```
11
+ */
3
12
  export function assertIsSymbol(input, error = 'input is not a symbol') {
4
13
  if (!isSymbol(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isSymbolArray } from '../predicate/isSymbolArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of symbols.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsSymbolArray([Symbol('a'), Symbol('b')]); // does not throw
9
+ * assertIsSymbolArray([Symbol('a'), 'b']); // throws TypeError: input is not an array of symbol
10
+ * ```
11
+ */
3
12
  export function assertIsSymbolArray(input, error = 'input is not an array of symbol') {
4
13
  if (!isSymbolArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isUndefined } from '../predicate/isUndefined.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is `undefined`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsUndefined(undefined); // does not throw
9
+ * assertIsUndefined(null); // throws TypeError: input is not undefined
10
+ * ```
11
+ */
3
12
  export function assertIsUndefined(input, error = 'input is not undefined') {
4
13
  if (!isUndefined(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,14 @@
1
1
  import { isUndefinedArray } from '../predicate/isUndefinedArray.js';
2
2
  import { getError } from './getError.js';
3
+ /**
4
+ * Assert that `input` is an array of `undefined` values.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * assertIsUndefinedArray([undefined, undefined]); // does not throw
9
+ * assertIsUndefinedArray([undefined, null]); // throws TypeError: input is not an array of undefined
10
+ * ```
11
+ */
3
12
  export function assertIsUndefinedArray(input, error = 'input is not an array of undefined') {
4
13
  if (!isUndefinedArray(input)) {
5
14
  throw getError(error);
@@ -1,5 +1,17 @@
1
1
  import { get } from '../get.js';
2
2
  import { has } from '../has.js';
3
+ /**
4
+ * Assert that `path` exists on `input`, optionally checking the value at that path with `predicate`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const input = { a: { b: 1 } };
9
+ *
10
+ * assertPathExists(input, 'a.b'); // does not throw
11
+ * assertPathExists(input, 'a.b', (value): value is number => typeof value === 'number'); // does not throw
12
+ * assertPathExists(input, 'c'); // throws Error: object path (c) does not exist on input
13
+ * ```
14
+ */
3
15
  export function assertPathExists(input, path, predicate) {
4
16
  if (!has(input, path)) {
5
17
  throw new Error(`object path (${path}) does not exist on input`);
@@ -1,4 +1,15 @@
1
1
  import { getError } from './getError.js';
2
+ /**
3
+ * Assert that `input` satisfies the given `predicate`.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const isNumber = (value: unknown): value is number => typeof value === 'number';
8
+ *
9
+ * assertPredicate(42, isNumber); // does not throw
10
+ * assertPredicate('42', isNumber); // throws TypeError: invalid input
11
+ * ```
12
+ */
2
13
  export function assertPredicate(input, predicate, error = 'invalid input') {
3
14
  if (!predicate(input)) {
4
15
  throw typeof error === 'function' ? error(input) : getError(error);
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Get an `Error` instance from `error`, wrapping a string in a `TypeError`.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * getError('Something went wrong'); // returns new TypeError('Something went wrong')
7
+ * getError(new RangeError('Out of range')); // returns the same RangeError instance
8
+ * ```
9
+ */
1
10
  export function getError(error) {
2
11
  return error instanceof Error ? error : new TypeError(error);
3
12
  }