@leyyo/type 1.3.1 → 1.3.4

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 (516) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -3
  3. package/dist/error/index.d.ts +17 -58
  4. package/dist/error/index.js +17 -75
  5. package/dist/error/invalid-array.error.js +4 -7
  6. package/dist/error/invalid-boolean.error.js +4 -7
  7. package/dist/error/invalid-date.error.js +4 -7
  8. package/dist/error/invalid-delimited.error.js +4 -7
  9. package/dist/error/invalid-enum-map.error.js +4 -7
  10. package/dist/error/invalid-enum-value.error.js +4 -7
  11. package/dist/error/invalid-integer.error.js +4 -7
  12. package/dist/error/invalid-list.error.js +4 -7
  13. package/dist/error/invalid-literal-items.error.js +4 -7
  14. package/dist/error/invalid-literal-value.error.js +4 -7
  15. package/dist/error/invalid-map.error.js +4 -7
  16. package/dist/error/invalid-number.error.js +4 -7
  17. package/dist/error/invalid-object.error.js +4 -7
  18. package/dist/error/invalid-real-value.error.js +4 -7
  19. package/dist/error/invalid-set.error.js +4 -7
  20. package/dist/error/invalid-string.error.js +4 -7
  21. package/dist/error/invalid-text.error.js +4 -7
  22. package/dist/index.d.ts +6 -10
  23. package/dist/index.foretell.js +30 -14
  24. package/dist/index.js +6 -27
  25. package/dist/index.loader.js +8 -14
  26. package/dist/internal.js +1 -5
  27. package/dist/is/index.d.ts +25 -25
  28. package/dist/is/index.js +25 -42
  29. package/dist/is/index.types.js +1 -3
  30. package/dist/is/is-another-object.js +3 -7
  31. package/dist/is/is-array-like.js +1 -5
  32. package/dist/is/is-bare-object.js +3 -7
  33. package/dist/is/is-boolean-like.js +3 -7
  34. package/dist/is/is-empty-object.js +3 -7
  35. package/dist/is/is-enum.d.ts +3 -3
  36. package/dist/is/is-enum.js +5 -9
  37. package/dist/is/is-false-like.js +3 -7
  38. package/dist/is/is-instance-of.js +3 -7
  39. package/dist/is/is-key-value.js +3 -7
  40. package/dist/is/is-literal.d.ts +3 -3
  41. package/dist/is/is-literal.js +5 -9
  42. package/dist/is/is-non-negative-integer.js +1 -5
  43. package/dist/is/is-non-negative-number.js +3 -7
  44. package/dist/is/is-not-empty.js +3 -7
  45. package/dist/is/is-positive-integer.js +1 -5
  46. package/dist/is/is-positive-number.js +3 -7
  47. package/dist/is/is-primitive.js +3 -7
  48. package/dist/is/is-real-value.js +3 -7
  49. package/dist/is/is-safe-integer.js +1 -5
  50. package/dist/is/is-sys-class.js +3 -7
  51. package/dist/is/is-sys-function.js +3 -7
  52. package/dist/is/is-true-like.js +3 -7
  53. package/dist/is/is-type-of.js +3 -7
  54. package/dist/is/is-valid-integer.js +3 -7
  55. package/dist/is/is-valid-number.js +1 -5
  56. package/dist/literal/basic-type.d.ts +1 -2
  57. package/dist/literal/basic-type.js +6 -8
  58. package/dist/literal/defined-type.d.ts +7 -0
  59. package/dist/literal/defined-type.js +5 -0
  60. package/dist/literal/extended-type.d.ts +5 -0
  61. package/dist/literal/extended-type.js +12 -0
  62. package/dist/literal/false-weak.js +4 -5
  63. package/dist/literal/index.d.ts +7 -5
  64. package/dist/literal/index.js +7 -22
  65. package/dist/literal/sys-class.js +4 -5
  66. package/dist/literal/sys-function.js +4 -5
  67. package/dist/literal/true-weak.js +4 -5
  68. package/dist/to/index.d.ts +15 -16
  69. package/dist/to/index.js +15 -33
  70. package/dist/to/index.types.d.ts +5 -5
  71. package/dist/to/index.types.js +1 -3
  72. package/dist/to/to-array-value.d.ts +1 -1
  73. package/dist/to/to-array-value.js +16 -20
  74. package/dist/to/to-boolean-value.d.ts +1 -1
  75. package/dist/to/to-boolean-value.js +14 -18
  76. package/dist/to/to-date-value.d.ts +1 -1
  77. package/dist/to/to-date-value.js +15 -19
  78. package/dist/to/to-delimited-value.d.ts +1 -1
  79. package/dist/to/to-delimited-value.js +14 -18
  80. package/dist/to/to-enum-value.d.ts +1 -1
  81. package/dist/to/to-enum-value.js +26 -30
  82. package/dist/to/to-integer-value.d.ts +1 -1
  83. package/dist/to/to-integer-value.js +13 -17
  84. package/dist/to/to-list-value.d.ts +1 -1
  85. package/dist/to/to-list-value.js +15 -19
  86. package/dist/to/to-literal-value.d.ts +1 -1
  87. package/dist/to/to-literal-value.js +25 -29
  88. package/dist/to/to-map-value.d.ts +1 -1
  89. package/dist/to/to-map-value.js +13 -17
  90. package/dist/to/to-number-value.d.ts +1 -1
  91. package/dist/to/to-number-value.js +12 -16
  92. package/dist/to/to-object-value.d.ts +5 -4
  93. package/dist/to/to-object-value.js +129 -8
  94. package/dist/to/to-set-value.d.ts +1 -1
  95. package/dist/to/to-set-value.js +13 -17
  96. package/dist/to/to-string-value.d.ts +1 -1
  97. package/dist/to/to-string-value.js +10 -14
  98. package/dist/to/to-text-value.d.ts +1 -1
  99. package/dist/to/to-text-value.js +11 -15
  100. package/dist/to/util.d.ts +4 -4
  101. package/dist/to/util.js +21 -32
  102. package/package.json +11 -6
  103. package/dist/assets/.gitkeep +0 -0
  104. package/dist/basic/assert-another-object.d.ts +0 -2
  105. package/dist/basic/assert-another-object.js +0 -19
  106. package/dist/basic/assert-another-object.js.map +0 -1
  107. package/dist/basic/assert-array-like.d.ts +0 -2
  108. package/dist/basic/assert-array-like.js +0 -19
  109. package/dist/basic/assert-array-like.js.map +0 -1
  110. package/dist/basic/assert-array.d.ts +0 -2
  111. package/dist/basic/assert-array.js +0 -19
  112. package/dist/basic/assert-array.js.map +0 -1
  113. package/dist/basic/assert-bare-object.d.ts +0 -2
  114. package/dist/basic/assert-bare-object.js +0 -19
  115. package/dist/basic/assert-bare-object.js.map +0 -1
  116. package/dist/basic/assert-bigint.d.ts +0 -2
  117. package/dist/basic/assert-bigint.js +0 -19
  118. package/dist/basic/assert-bigint.js.map +0 -1
  119. package/dist/basic/assert-boolean-like.d.ts +0 -2
  120. package/dist/basic/assert-boolean-like.js +0 -19
  121. package/dist/basic/assert-boolean-like.js.map +0 -1
  122. package/dist/basic/assert-boolean.d.ts +0 -2
  123. package/dist/basic/assert-boolean.js +0 -18
  124. package/dist/basic/assert-boolean.js.map +0 -1
  125. package/dist/basic/assert-class.d.ts +0 -2
  126. package/dist/basic/assert-class.js +0 -18
  127. package/dist/basic/assert-class.js.map +0 -1
  128. package/dist/basic/assert-empty.d.ts +0 -2
  129. package/dist/basic/assert-empty.js +0 -21
  130. package/dist/basic/assert-empty.js.map +0 -1
  131. package/dist/basic/assert-false-like.d.ts +0 -2
  132. package/dist/basic/assert-false-like.js +0 -19
  133. package/dist/basic/assert-false-like.js.map +0 -1
  134. package/dist/basic/assert-false.d.ts +0 -2
  135. package/dist/basic/assert-false.js +0 -18
  136. package/dist/basic/assert-false.js.map +0 -1
  137. package/dist/basic/assert-filled-array.d.ts +0 -2
  138. package/dist/basic/assert-filled-array.js +0 -18
  139. package/dist/basic/assert-filled-array.js.map +0 -1
  140. package/dist/basic/assert-filled-object.d.ts +0 -2
  141. package/dist/basic/assert-filled-object.js +0 -18
  142. package/dist/basic/assert-filled-object.js.map +0 -1
  143. package/dist/basic/assert-function.d.ts +0 -2
  144. package/dist/basic/assert-function.js +0 -18
  145. package/dist/basic/assert-function.js.map +0 -1
  146. package/dist/basic/assert-integer.d.ts +0 -2
  147. package/dist/basic/assert-integer.js +0 -19
  148. package/dist/basic/assert-integer.js.map +0 -1
  149. package/dist/basic/assert-key-value.d.ts +0 -2
  150. package/dist/basic/assert-key-value.js +0 -19
  151. package/dist/basic/assert-key-value.js.map +0 -1
  152. package/dist/basic/assert-list.d.ts +0 -2
  153. package/dist/basic/assert-list.js +0 -18
  154. package/dist/basic/assert-list.js.map +0 -1
  155. package/dist/basic/assert-map.d.ts +0 -2
  156. package/dist/basic/assert-map.js +0 -18
  157. package/dist/basic/assert-map.js.map +0 -1
  158. package/dist/basic/assert-message.d.ts +0 -2
  159. package/dist/basic/assert-message.js +0 -10
  160. package/dist/basic/assert-message.js.map +0 -1
  161. package/dist/basic/assert-non-negative-integer.d.ts +0 -2
  162. package/dist/basic/assert-non-negative-integer.js +0 -19
  163. package/dist/basic/assert-non-negative-integer.js.map +0 -1
  164. package/dist/basic/assert-non-negative-number.d.ts +0 -2
  165. package/dist/basic/assert-non-negative-number.js +0 -19
  166. package/dist/basic/assert-non-negative-number.js.map +0 -1
  167. package/dist/basic/assert-not-empty.d.ts +0 -2
  168. package/dist/basic/assert-not-empty.js +0 -19
  169. package/dist/basic/assert-not-empty.js.map +0 -1
  170. package/dist/basic/assert-not-null.d.ts +0 -2
  171. package/dist/basic/assert-not-null.js +0 -18
  172. package/dist/basic/assert-not-null.js.map +0 -1
  173. package/dist/basic/assert-not-system-class.d.ts +0 -2
  174. package/dist/basic/assert-not-system-class.js +0 -19
  175. package/dist/basic/assert-not-system-class.js.map +0 -1
  176. package/dist/basic/assert-not-system-function.d.ts +0 -2
  177. package/dist/basic/assert-not-system-function.js +0 -19
  178. package/dist/basic/assert-not-system-function.js.map +0 -1
  179. package/dist/basic/assert-not-undefined.d.ts +0 -2
  180. package/dist/basic/assert-not-undefined.js +0 -18
  181. package/dist/basic/assert-not-undefined.js.map +0 -1
  182. package/dist/basic/assert-null.d.ts +0 -2
  183. package/dist/basic/assert-null.js +0 -18
  184. package/dist/basic/assert-null.js.map +0 -1
  185. package/dist/basic/assert-number.d.ts +0 -2
  186. package/dist/basic/assert-number.js +0 -19
  187. package/dist/basic/assert-number.js.map +0 -1
  188. package/dist/basic/assert-object.d.ts +0 -2
  189. package/dist/basic/assert-object.js +0 -18
  190. package/dist/basic/assert-object.js.map +0 -1
  191. package/dist/basic/assert-positive-integer.d.ts +0 -2
  192. package/dist/basic/assert-positive-integer.js +0 -19
  193. package/dist/basic/assert-positive-integer.js.map +0 -1
  194. package/dist/basic/assert-positive-number.d.ts +0 -2
  195. package/dist/basic/assert-positive-number.js +0 -19
  196. package/dist/basic/assert-positive-number.js.map +0 -1
  197. package/dist/basic/assert-real-value.d.ts +0 -2
  198. package/dist/basic/assert-real-value.js +0 -19
  199. package/dist/basic/assert-real-value.js.map +0 -1
  200. package/dist/basic/assert-safe-integer.d.ts +0 -2
  201. package/dist/basic/assert-safe-integer.js +0 -19
  202. package/dist/basic/assert-safe-integer.js.map +0 -1
  203. package/dist/basic/assert-set.d.ts +0 -2
  204. package/dist/basic/assert-set.js +0 -18
  205. package/dist/basic/assert-set.js.map +0 -1
  206. package/dist/basic/assert-string.d.ts +0 -2
  207. package/dist/basic/assert-string.js +0 -18
  208. package/dist/basic/assert-string.js.map +0 -1
  209. package/dist/basic/assert-symbol.d.ts +0 -2
  210. package/dist/basic/assert-symbol.js +0 -18
  211. package/dist/basic/assert-symbol.js.map +0 -1
  212. package/dist/basic/assert-text.d.ts +0 -2
  213. package/dist/basic/assert-text.js +0 -18
  214. package/dist/basic/assert-text.js.map +0 -1
  215. package/dist/basic/assert-true-like.d.ts +0 -2
  216. package/dist/basic/assert-true-like.js +0 -19
  217. package/dist/basic/assert-true-like.js.map +0 -1
  218. package/dist/basic/assert-true.d.ts +0 -2
  219. package/dist/basic/assert-true.js +0 -18
  220. package/dist/basic/assert-true.js.map +0 -1
  221. package/dist/basic/assert-undefined.d.ts +0 -2
  222. package/dist/basic/assert-undefined.js +0 -18
  223. package/dist/basic/assert-undefined.js.map +0 -1
  224. package/dist/basic/fnc.d.ts +0 -12
  225. package/dist/basic/fnc.js +0 -37
  226. package/dist/basic/fnc.js.map +0 -1
  227. package/dist/basic/index.d.ts +0 -43
  228. package/dist/basic/index.foretell.d.ts +0 -1
  229. package/dist/basic/index.foretell.js +0 -48
  230. package/dist/basic/index.foretell.js.map +0 -1
  231. package/dist/basic/index.js +0 -60
  232. package/dist/basic/index.js.map +0 -1
  233. package/dist/basic/index.loader.d.ts +0 -1
  234. package/dist/basic/index.loader.js +0 -43
  235. package/dist/basic/index.loader.js.map +0 -1
  236. package/dist/basic/index.types.d.ts +0 -4
  237. package/dist/basic/index.types.js +0 -4
  238. package/dist/basic/index.types.js.map +0 -1
  239. package/dist/complex/assert-all-of.d.ts +0 -7
  240. package/dist/complex/assert-all-of.js +0 -39
  241. package/dist/complex/assert-all-of.js.map +0 -1
  242. package/dist/complex/assert-array-of.d.ts +0 -6
  243. package/dist/complex/assert-array-of.js +0 -40
  244. package/dist/complex/assert-array-of.js.map +0 -1
  245. package/dist/complex/assert-enum-of.d.ts +0 -6
  246. package/dist/complex/assert-enum-of.js +0 -84
  247. package/dist/complex/assert-enum-of.js.map +0 -1
  248. package/dist/complex/assert-i18n-of.d.ts +0 -6
  249. package/dist/complex/assert-i18n-of.js +0 -29
  250. package/dist/complex/assert-i18n-of.js.map +0 -1
  251. package/dist/complex/assert-instance-of.d.ts +0 -6
  252. package/dist/complex/assert-instance-of.js +0 -56
  253. package/dist/complex/assert-instance-of.js.map +0 -1
  254. package/dist/complex/assert-it.d.ts +0 -4
  255. package/dist/complex/assert-it.js +0 -68
  256. package/dist/complex/assert-it.js.map +0 -1
  257. package/dist/complex/assert-list-of.d.ts +0 -6
  258. package/dist/complex/assert-list-of.js +0 -40
  259. package/dist/complex/assert-list-of.js.map +0 -1
  260. package/dist/complex/assert-literal-of.d.ts +0 -6
  261. package/dist/complex/assert-literal-of.js +0 -81
  262. package/dist/complex/assert-literal-of.js.map +0 -1
  263. package/dist/complex/assert-map-of.d.ts +0 -6
  264. package/dist/complex/assert-map-of.js +0 -56
  265. package/dist/complex/assert-map-of.js.map +0 -1
  266. package/dist/complex/assert-number-of.d.ts +0 -6
  267. package/dist/complex/assert-number-of.js +0 -33
  268. package/dist/complex/assert-number-of.js.map +0 -1
  269. package/dist/complex/assert-one-of.d.ts +0 -6
  270. package/dist/complex/assert-one-of.js +0 -67
  271. package/dist/complex/assert-one-of.js.map +0 -1
  272. package/dist/complex/assert-optional.d.ts +0 -6
  273. package/dist/complex/assert-optional.js +0 -31
  274. package/dist/complex/assert-optional.js.map +0 -1
  275. package/dist/complex/assert-record-of.d.ts +0 -6
  276. package/dist/complex/assert-record-of.js +0 -53
  277. package/dist/complex/assert-record-of.js.map +0 -1
  278. package/dist/complex/assert-set-of.d.ts +0 -6
  279. package/dist/complex/assert-set-of.js +0 -40
  280. package/dist/complex/assert-set-of.js.map +0 -1
  281. package/dist/complex/assert-string-of.d.ts +0 -6
  282. package/dist/complex/assert-string-of.js +0 -25
  283. package/dist/complex/assert-string-of.js.map +0 -1
  284. package/dist/complex/assert-tuple-of.d.ts +0 -6
  285. package/dist/complex/assert-tuple-of.js +0 -43
  286. package/dist/complex/assert-tuple-of.js.map +0 -1
  287. package/dist/complex/assert-type-of.d.ts +0 -6
  288. package/dist/complex/assert-type-of.js +0 -58
  289. package/dist/complex/assert-type-of.js.map +0 -1
  290. package/dist/complex/fnc.d.ts +0 -10
  291. package/dist/complex/fnc.js +0 -38
  292. package/dist/complex/fnc.js.map +0 -1
  293. package/dist/complex/index.d.ts +0 -20
  294. package/dist/complex/index.foretell.d.ts +0 -1
  295. package/dist/complex/index.foretell.js +0 -48
  296. package/dist/complex/index.foretell.js.map +0 -1
  297. package/dist/complex/index.js +0 -37
  298. package/dist/complex/index.js.map +0 -1
  299. package/dist/complex/index.loader.d.ts +0 -1
  300. package/dist/complex/index.loader.js +0 -43
  301. package/dist/complex/index.loader.js.map +0 -1
  302. package/dist/complex/index.types.d.ts +0 -91
  303. package/dist/complex/index.types.js +0 -3
  304. package/dist/complex/index.types.js.map +0 -1
  305. package/dist/complex/util.d.ts +0 -9
  306. package/dist/complex/util.js +0 -60
  307. package/dist/complex/util.js.map +0 -1
  308. package/dist/error/assert-message.error.d.ts +0 -3
  309. package/dist/error/assert-message.error.js +0 -8
  310. package/dist/error/assert-message.error.js.map +0 -1
  311. package/dist/error/index.foretell.d.ts +0 -1
  312. package/dist/error/index.foretell.js +0 -49
  313. package/dist/error/index.foretell.js.map +0 -1
  314. package/dist/error/index.js.map +0 -1
  315. package/dist/error/index.loader.d.ts +0 -1
  316. package/dist/error/index.loader.js +0 -43
  317. package/dist/error/index.loader.js.map +0 -1
  318. package/dist/error/invalid-another-object.error.d.ts +0 -3
  319. package/dist/error/invalid-another-object.error.js +0 -8
  320. package/dist/error/invalid-another-object.error.js.map +0 -1
  321. package/dist/error/invalid-array-like.error.d.ts +0 -3
  322. package/dist/error/invalid-array-like.error.js +0 -8
  323. package/dist/error/invalid-array-like.error.js.map +0 -1
  324. package/dist/error/invalid-array.error.js.map +0 -1
  325. package/dist/error/invalid-assert-all-of.error.d.ts +0 -3
  326. package/dist/error/invalid-assert-all-of.error.js +0 -8
  327. package/dist/error/invalid-assert-all-of.error.js.map +0 -1
  328. package/dist/error/invalid-assert-one-of.error.d.ts +0 -3
  329. package/dist/error/invalid-assert-one-of.error.js +0 -8
  330. package/dist/error/invalid-assert-one-of.error.js.map +0 -1
  331. package/dist/error/invalid-assert-payload.error.d.ts +0 -3
  332. package/dist/error/invalid-assert-payload.error.js +0 -8
  333. package/dist/error/invalid-assert-payload.error.js.map +0 -1
  334. package/dist/error/invalid-bare-object.error.d.ts +0 -3
  335. package/dist/error/invalid-bare-object.error.js +0 -8
  336. package/dist/error/invalid-bare-object.error.js.map +0 -1
  337. package/dist/error/invalid-bigint.error.d.ts +0 -3
  338. package/dist/error/invalid-bigint.error.js +0 -8
  339. package/dist/error/invalid-bigint.error.js.map +0 -1
  340. package/dist/error/invalid-boolean-like.error.d.ts +0 -3
  341. package/dist/error/invalid-boolean-like.error.js +0 -8
  342. package/dist/error/invalid-boolean-like.error.js.map +0 -1
  343. package/dist/error/invalid-boolean.error.js.map +0 -1
  344. package/dist/error/invalid-class.error.d.ts +0 -3
  345. package/dist/error/invalid-class.error.js +0 -8
  346. package/dist/error/invalid-class.error.js.map +0 -1
  347. package/dist/error/invalid-date.error.js.map +0 -1
  348. package/dist/error/invalid-delimited.error.js.map +0 -1
  349. package/dist/error/invalid-enum-map.error.js.map +0 -1
  350. package/dist/error/invalid-enum-not-found.error.d.ts +0 -4
  351. package/dist/error/invalid-enum-not-found.error.js +0 -11
  352. package/dist/error/invalid-enum-not-found.error.js.map +0 -1
  353. package/dist/error/invalid-enum-value.error.js.map +0 -1
  354. package/dist/error/invalid-false-like.error.d.ts +0 -3
  355. package/dist/error/invalid-false-like.error.js +0 -8
  356. package/dist/error/invalid-false-like.error.js.map +0 -1
  357. package/dist/error/invalid-false.error.d.ts +0 -3
  358. package/dist/error/invalid-false.error.js +0 -8
  359. package/dist/error/invalid-false.error.js.map +0 -1
  360. package/dist/error/invalid-filled-array.error.d.ts +0 -3
  361. package/dist/error/invalid-filled-array.error.js +0 -8
  362. package/dist/error/invalid-filled-array.error.js.map +0 -1
  363. package/dist/error/invalid-filled-object.error.d.ts +0 -3
  364. package/dist/error/invalid-filled-object.error.js +0 -8
  365. package/dist/error/invalid-filled-object.error.js.map +0 -1
  366. package/dist/error/invalid-function.error.d.ts +0 -3
  367. package/dist/error/invalid-function.error.js +0 -8
  368. package/dist/error/invalid-function.error.js.map +0 -1
  369. package/dist/error/invalid-instance-of-class.error.d.ts +0 -3
  370. package/dist/error/invalid-instance-of-class.error.js +0 -8
  371. package/dist/error/invalid-instance-of-class.error.js.map +0 -1
  372. package/dist/error/invalid-instance-of.error.d.ts +0 -3
  373. package/dist/error/invalid-instance-of.error.js +0 -8
  374. package/dist/error/invalid-instance-of.error.js.map +0 -1
  375. package/dist/error/invalid-integer.error.js.map +0 -1
  376. package/dist/error/invalid-key-value.error.d.ts +0 -3
  377. package/dist/error/invalid-key-value.error.js +0 -8
  378. package/dist/error/invalid-key-value.error.js.map +0 -1
  379. package/dist/error/invalid-list.error.js.map +0 -1
  380. package/dist/error/invalid-literal-items.error.js.map +0 -1
  381. package/dist/error/invalid-literal-not-found.error.d.ts +0 -4
  382. package/dist/error/invalid-literal-not-found.error.js +0 -11
  383. package/dist/error/invalid-literal-not-found.error.js.map +0 -1
  384. package/dist/error/invalid-literal-value.error.js.map +0 -1
  385. package/dist/error/invalid-map.error.js.map +0 -1
  386. package/dist/error/invalid-non-negative-integer.error.d.ts +0 -3
  387. package/dist/error/invalid-non-negative-integer.error.js +0 -8
  388. package/dist/error/invalid-non-negative-integer.error.js.map +0 -1
  389. package/dist/error/invalid-non-negative-number.error.d.ts +0 -3
  390. package/dist/error/invalid-non-negative-number.error.js +0 -8
  391. package/dist/error/invalid-non-negative-number.error.js.map +0 -1
  392. package/dist/error/invalid-not-system-class.error.d.ts +0 -3
  393. package/dist/error/invalid-not-system-class.error.js +0 -8
  394. package/dist/error/invalid-not-system-class.error.js.map +0 -1
  395. package/dist/error/invalid-not-system-function.error.d.ts +0 -3
  396. package/dist/error/invalid-not-system-function.error.js +0 -8
  397. package/dist/error/invalid-not-system-function.error.js.map +0 -1
  398. package/dist/error/invalid-number.error.js.map +0 -1
  399. package/dist/error/invalid-object.error.js.map +0 -1
  400. package/dist/error/invalid-positive-integer.error.d.ts +0 -3
  401. package/dist/error/invalid-positive-integer.error.js +0 -8
  402. package/dist/error/invalid-positive-integer.error.js.map +0 -1
  403. package/dist/error/invalid-positive-number.error.d.ts +0 -3
  404. package/dist/error/invalid-positive-number.error.js +0 -8
  405. package/dist/error/invalid-positive-number.error.js.map +0 -1
  406. package/dist/error/invalid-real-value.error.js.map +0 -1
  407. package/dist/error/invalid-safe-integer.error.d.ts +0 -3
  408. package/dist/error/invalid-safe-integer.error.js +0 -8
  409. package/dist/error/invalid-safe-integer.error.js.map +0 -1
  410. package/dist/error/invalid-set.error.js.map +0 -1
  411. package/dist/error/invalid-string.error.js.map +0 -1
  412. package/dist/error/invalid-symbol.error.d.ts +0 -3
  413. package/dist/error/invalid-symbol.error.js +0 -8
  414. package/dist/error/invalid-symbol.error.js.map +0 -1
  415. package/dist/error/invalid-text.error.js.map +0 -1
  416. package/dist/error/invalid-true-like.error.d.ts +0 -3
  417. package/dist/error/invalid-true-like.error.js +0 -8
  418. package/dist/error/invalid-true-like.error.js.map +0 -1
  419. package/dist/error/invalid-true.error.d.ts +0 -3
  420. package/dist/error/invalid-true.error.js +0 -8
  421. package/dist/error/invalid-true.error.js.map +0 -1
  422. package/dist/error/invalid-tuple.error.d.ts +0 -3
  423. package/dist/error/invalid-tuple.error.js +0 -8
  424. package/dist/error/invalid-tuple.error.js.map +0 -1
  425. package/dist/error/invalid-type-of-type.error.d.ts +0 -3
  426. package/dist/error/invalid-type-of-type.error.js +0 -8
  427. package/dist/error/invalid-type-of-type.error.js.map +0 -1
  428. package/dist/error/invalid-type-of.error.d.ts +0 -3
  429. package/dist/error/invalid-type-of.error.js +0 -8
  430. package/dist/error/invalid-type-of.error.js.map +0 -1
  431. package/dist/error/value-empty.error.d.ts +0 -3
  432. package/dist/error/value-empty.error.js +0 -8
  433. package/dist/error/value-empty.error.js.map +0 -1
  434. package/dist/error/value-not-empty.error.d.ts +0 -3
  435. package/dist/error/value-not-empty.error.js +0 -8
  436. package/dist/error/value-not-empty.error.js.map +0 -1
  437. package/dist/error/value-not-null.error.d.ts +0 -3
  438. package/dist/error/value-not-null.error.js +0 -8
  439. package/dist/error/value-not-null.error.js.map +0 -1
  440. package/dist/error/value-not-undefined.error.d.ts +0 -3
  441. package/dist/error/value-not-undefined.error.js +0 -8
  442. package/dist/error/value-not-undefined.error.js.map +0 -1
  443. package/dist/error/value-null.error.d.ts +0 -3
  444. package/dist/error/value-null.error.js +0 -8
  445. package/dist/error/value-null.error.js.map +0 -1
  446. package/dist/error/value-undefined.error.d.ts +0 -3
  447. package/dist/error/value-undefined.error.js +0 -8
  448. package/dist/error/value-undefined.error.js.map +0 -1
  449. package/dist/handler/assert.handler.d.ts +0 -2
  450. package/dist/handler/assert.handler.js +0 -53
  451. package/dist/handler/assert.handler.js.map +0 -1
  452. package/dist/handler/index.d.ts +0 -2
  453. package/dist/handler/index.js +0 -19
  454. package/dist/handler/index.js.map +0 -1
  455. package/dist/handler/index.types.d.ts +0 -9
  456. package/dist/handler/index.types.js +0 -3
  457. package/dist/handler/index.types.js.map +0 -1
  458. package/dist/index.foretell.js.map +0 -1
  459. package/dist/index.js.map +0 -1
  460. package/dist/index.loader.js.map +0 -1
  461. package/dist/internal.js.map +0 -1
  462. package/dist/is/index.js.map +0 -1
  463. package/dist/is/index.types.js.map +0 -1
  464. package/dist/is/is-another-object.js.map +0 -1
  465. package/dist/is/is-array-like.js.map +0 -1
  466. package/dist/is/is-bare-object.js.map +0 -1
  467. package/dist/is/is-boolean-like.js.map +0 -1
  468. package/dist/is/is-empty-object.js.map +0 -1
  469. package/dist/is/is-enum.js.map +0 -1
  470. package/dist/is/is-false-like.js.map +0 -1
  471. package/dist/is/is-instance-of.js.map +0 -1
  472. package/dist/is/is-key-value.js.map +0 -1
  473. package/dist/is/is-literal.js.map +0 -1
  474. package/dist/is/is-non-negative-integer.js.map +0 -1
  475. package/dist/is/is-non-negative-number.js.map +0 -1
  476. package/dist/is/is-not-empty.js.map +0 -1
  477. package/dist/is/is-positive-integer.js.map +0 -1
  478. package/dist/is/is-positive-number.js.map +0 -1
  479. package/dist/is/is-primitive.js.map +0 -1
  480. package/dist/is/is-real-value.js.map +0 -1
  481. package/dist/is/is-safe-integer.js.map +0 -1
  482. package/dist/is/is-sys-class.js.map +0 -1
  483. package/dist/is/is-sys-function.js.map +0 -1
  484. package/dist/is/is-true-like.js.map +0 -1
  485. package/dist/is/is-type-of.js.map +0 -1
  486. package/dist/is/is-valid-integer.js.map +0 -1
  487. package/dist/is/is-valid-number.js.map +0 -1
  488. package/dist/literal/basic-type.js.map +0 -1
  489. package/dist/literal/false-weak.js.map +0 -1
  490. package/dist/literal/index.js.map +0 -1
  491. package/dist/literal/sys-class.js.map +0 -1
  492. package/dist/literal/sys-function.js.map +0 -1
  493. package/dist/literal/true-weak.js.map +0 -1
  494. package/dist/opt/index.d.ts +0 -9
  495. package/dist/opt/index.js +0 -3
  496. package/dist/opt/index.js.map +0 -1
  497. package/dist/to/index.js.map +0 -1
  498. package/dist/to/index.types.js.map +0 -1
  499. package/dist/to/to-array-value.js.map +0 -1
  500. package/dist/to/to-bare-object.d.ts +0 -10
  501. package/dist/to/to-bare-object.js +0 -140
  502. package/dist/to/to-bare-object.js.map +0 -1
  503. package/dist/to/to-boolean-value.js.map +0 -1
  504. package/dist/to/to-date-value.js.map +0 -1
  505. package/dist/to/to-delimited-value.js.map +0 -1
  506. package/dist/to/to-enum-value.js.map +0 -1
  507. package/dist/to/to-integer-value.js.map +0 -1
  508. package/dist/to/to-list-value.js.map +0 -1
  509. package/dist/to/to-literal-value.js.map +0 -1
  510. package/dist/to/to-map-value.js.map +0 -1
  511. package/dist/to/to-number-value.js.map +0 -1
  512. package/dist/to/to-object-value.js.map +0 -1
  513. package/dist/to/to-set-value.js.map +0 -1
  514. package/dist/to/to-string-value.js.map +0 -1
  515. package/dist/to/to-text-value.js.map +0 -1
  516. package/dist/to/util.js.map +0 -1
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidNumber = isValidNumber;
4
1
  /**
5
2
  * Checks value is number (float or integer) or not?
6
3
  *
@@ -9,7 +6,6 @@ exports.isValidNumber = isValidNumber;
9
6
  *
10
7
  * Note: NaN and infinite values are not evaluated as a number
11
8
  * */
12
- function isValidNumber(value) {
9
+ export function isValidNumber(value) {
13
10
  return (typeof value === 'number') && !isNaN(value) && isFinite(value);
14
11
  }
15
- //# sourceMappingURL=is-valid-number.js.map
@@ -1,6 +1,5 @@
1
1
  import { BasicType } from "@leyyo/common";
2
- export declare const BasicTypeDefined: ReadonlyArray<BasicType>;
3
2
  /**
4
- * JS Types
3
+ * JS Type without `undefined`
5
4
  * */
6
5
  export declare const BasicTypeItems: ReadonlyArray<BasicType>;
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BasicTypeItems = exports.BasicTypeDefined = void 0;
4
- exports.BasicTypeDefined = ['string', 'object', 'number', 'boolean', 'function', 'symbol', 'bigint'];
5
- // noinspection JSUnusedGlobalSymbols
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
3
+ const literals = ['string', 'object', 'number', 'boolean', 'function', 'symbol', 'bigint', 'undefined'];
6
4
  /**
7
- * JS Types
5
+ * JS Type without `undefined`
8
6
  * */
9
- exports.BasicTypeItems = [...exports.BasicTypeDefined, 'undefined'];
10
- //# sourceMappingURL=basic-type.js.map
7
+ export const BasicTypeItems = literals;
8
+ literalPool.define(FQN, 'BasicType', BasicTypeItems, { i18n: true, aliases: [] });
@@ -0,0 +1,7 @@
1
+ declare const literals: readonly ["string", "object", "number", "boolean", "function", "symbol", "bigint"];
2
+ /**
3
+ * JS Type without `undefined`
4
+ * */
5
+ export type DefinedType = typeof literals[number];
6
+ export declare const DefinedTypeItems: ReadonlyArray<DefinedType>;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
3
+ const literals = ['string', 'object', 'number', 'boolean', 'function', 'symbol', 'bigint'];
4
+ export const DefinedTypeItems = literals;
5
+ literalPool.define(FQN, 'DefinedType', DefinedTypeItems, { i18n: true, aliases: [] });
@@ -0,0 +1,5 @@
1
+ import { ExtendedType } from "@leyyo/common";
2
+ /**
3
+ * JS Types with custom types
4
+ * */
5
+ export declare const ExtendedTypeItems: ReadonlyArray<ExtendedType>;
@@ -0,0 +1,12 @@
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
3
+ const literals = [
4
+ 'string', 'object', 'number', 'boolean', 'function', 'symbol', 'bigint', 'undefined',
5
+ 'array', 'null', 'enum-map', 'literal-items', 'class', 'empty', 'text',
6
+ 'nan', 'integer', 'date', 'map', 'set', 'list'
7
+ ];
8
+ /**
9
+ * JS Types with custom types
10
+ * */
11
+ export const ExtendedTypeItems = literals;
12
+ literalPool.define(FQN, 'ExtendedType', ExtendedTypeItems, { i18n: true, aliases: [] });
@@ -1,6 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FalseWeakItems = void 0;
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
4
3
  const literals = ['0', '-1', 'false', 'f', 'no', 'n', 'off'];
5
- exports.FalseWeakItems = literals;
6
- //# sourceMappingURL=false-weak.js.map
4
+ export const FalseWeakItems = literals;
5
+ literalPool.define(FQN, 'FalseWeak', FalseWeakItems, { i18n: true, aliases: ['FalseLike'] });
@@ -1,5 +1,7 @@
1
- export * from './basic-type';
2
- export * from './false-weak';
3
- export * from './sys-class';
4
- export * from './sys-function';
5
- export * from './true-weak';
1
+ export * from './basic-type.js';
2
+ export * from './defined-type.js';
3
+ export * from './extended-type.js';
4
+ export * from './false-weak.js';
5
+ export * from './sys-class.js';
6
+ export * from './sys-function.js';
7
+ export * from './true-weak.js';
@@ -1,22 +1,7 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./basic-type"), exports);
18
- __exportStar(require("./false-weak"), exports);
19
- __exportStar(require("./sys-class"), exports);
20
- __exportStar(require("./sys-function"), exports);
21
- __exportStar(require("./true-weak"), exports);
22
- //# sourceMappingURL=index.js.map
1
+ export * from './basic-type.js';
2
+ export * from './defined-type.js';
3
+ export * from './extended-type.js';
4
+ export * from './false-weak.js';
5
+ export * from './sys-class.js';
6
+ export * from './sys-function.js';
7
+ export * from './true-weak.js';
@@ -1,6 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SysClassItems = void 0;
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
4
3
  const literals = [
5
4
  'Function', 'Object', 'Boolean', 'Symbol',
6
5
  'Error', 'AggregateError', 'EvalError', 'InternalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
@@ -17,5 +16,5 @@ const literals = [
17
16
  'WebAssembly', 'WebAssembly.Module', 'WebAssembly.Instance', 'WebAssembly.Memory', 'WebAssembly.Table',
18
17
  'WebAssembly.CompileError', 'WebAssembly.LinkError', 'WebAssembly.RuntimeError'
19
18
  ];
20
- exports.SysClassItems = literals;
21
- //# sourceMappingURL=sys-class.js.map
19
+ export const SysClassItems = literals;
20
+ literalPool.define(FQN, 'SysClass', SysClassItems, { i18n: true, aliases: ['SystemClass'] });
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SysFunctionItems = void 0;
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
4
3
  const literals = ['constructor', '__defineGetter__', '__defineSetter__', 'hasOwnProperty',
5
4
  '__lookupGetter__', '__lookupSetter__', 'isPrototypeOf', 'propertyIsEnumerable',
6
5
  'toString', 'valueOf', '__proto__', 'toLocaleString', 'toJSON', '__esModule'];
7
- exports.SysFunctionItems = literals;
8
- //# sourceMappingURL=sys-function.js.map
6
+ export const SysFunctionItems = literals;
7
+ literalPool.define(FQN, 'SysFunction', SysFunctionItems, { i18n: true, aliases: ['SystemFunction', 'SystemFn', 'SysFn'] });
@@ -1,9 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TrueWeakItems = void 0;
1
+ import { literalPool } from "@leyyo/common";
2
+ import { FQN } from "../internal.js";
4
3
  /**
5
4
  * Weak True
6
5
  * */
7
6
  const literals = ['1', 'true', 't', 'yes', 'y', 'on'];
8
- exports.TrueWeakItems = literals;
9
- //# sourceMappingURL=true-weak.js.map
7
+ export const TrueWeakItems = literals;
8
+ literalPool.define(FQN, 'TrueWeak', TrueWeakItems, { i18n: true, aliases: ['TrueLike'] });
@@ -1,16 +1,15 @@
1
- export * from './index.types';
2
- export * from './to-array-value';
3
- export * from './to-boolean-value';
4
- export * from './to-date-value';
5
- export * from './to-delimited-value';
6
- export * from './to-bare-object';
7
- export * from './to-enum-value';
8
- export * from './to-integer-value';
9
- export * from './to-list-value';
10
- export * from './to-literal-value';
11
- export * from './to-map-value';
12
- export * from './to-number-value';
13
- export * from './to-object-value';
14
- export * from './to-set-value';
15
- export * from './to-string-value';
16
- export * from './to-text-value';
1
+ export * from './index.types.js';
2
+ export * from './to-array-value.js';
3
+ export * from './to-boolean-value.js';
4
+ export * from './to-date-value.js';
5
+ export * from './to-delimited-value.js';
6
+ export * from './to-enum-value.js';
7
+ export * from './to-integer-value.js';
8
+ export * from './to-list-value.js';
9
+ export * from './to-literal-value.js';
10
+ export * from './to-map-value.js';
11
+ export * from './to-number-value.js';
12
+ export * from './to-object-value.js';
13
+ export * from './to-set-value.js';
14
+ export * from './to-string-value.js';
15
+ export * from './to-text-value.js';
package/dist/to/index.js CHANGED
@@ -1,33 +1,15 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./index.types"), exports);
18
- __exportStar(require("./to-array-value"), exports);
19
- __exportStar(require("./to-boolean-value"), exports);
20
- __exportStar(require("./to-date-value"), exports);
21
- __exportStar(require("./to-delimited-value"), exports);
22
- __exportStar(require("./to-bare-object"), exports);
23
- __exportStar(require("./to-enum-value"), exports);
24
- __exportStar(require("./to-integer-value"), exports);
25
- __exportStar(require("./to-list-value"), exports);
26
- __exportStar(require("./to-literal-value"), exports);
27
- __exportStar(require("./to-map-value"), exports);
28
- __exportStar(require("./to-number-value"), exports);
29
- __exportStar(require("./to-object-value"), exports);
30
- __exportStar(require("./to-set-value"), exports);
31
- __exportStar(require("./to-string-value"), exports);
32
- __exportStar(require("./to-text-value"), exports);
33
- //# sourceMappingURL=index.js.map
1
+ export * from './index.types.js';
2
+ export * from './to-array-value.js';
3
+ export * from './to-boolean-value.js';
4
+ export * from './to-date-value.js';
5
+ export * from './to-delimited-value.js';
6
+ export * from './to-enum-value.js';
7
+ export * from './to-integer-value.js';
8
+ export * from './to-list-value.js';
9
+ export * from './to-literal-value.js';
10
+ export * from './to-map-value.js';
11
+ export * from './to-number-value.js';
12
+ export * from './to-object-value.js';
13
+ export * from './to-set-value.js';
14
+ export * from './to-string-value.js';
15
+ export * from './to-text-value.js';
@@ -1,4 +1,4 @@
1
- import { EnumAlt, EnumLiteral, EnumMap, ExtendedType, KeyValue, Opt } from "@leyyo/common";
1
+ import { Enum, EnumAlt, ExtendedType, KeyValue, Literal, Opt } from "@leyyo/common";
2
2
  /**
3
3
  * Convert base options
4
4
  * */
@@ -77,11 +77,11 @@ export interface ToOptEnum<E extends KeyValue = string, R extends string = strin
77
77
  /**
78
78
  * Enum object
79
79
  * */
80
- enumMap: EnumMap<E>;
80
+ enum: Enum<E>;
81
81
  /**
82
82
  * Alternative map for an enum
83
83
  * */
84
- enumAlt?: EnumAlt<E>;
84
+ alt?: EnumAlt<E>;
85
85
  }
86
86
  /**
87
87
  * Literal convert options
@@ -90,9 +90,9 @@ export interface ToOptLiteral<E extends KeyValue = string, R extends string = st
90
90
  /**
91
91
  * Literal items as an array
92
92
  * */
93
- enumItems: EnumLiteral<E>;
93
+ literal: Literal<E>;
94
94
  /**
95
95
  * Alternative map for an enum
96
96
  * */
97
- enumAlt?: EnumAlt<E>;
97
+ alt?: EnumAlt<E>;
98
98
  }
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.types.js.map
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { ToOptArray, ToOptFn } from "./index.types";
1
+ import { ToOptArray, ToOptFn } from "./index.types.js";
2
2
  /**
3
3
  * Convert any value to `array`
4
4
  *
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toArrayValue = toArrayValue;
4
- const common_1 = require("@leyyo/common");
5
- const util_1 = require("./util");
6
- const error_1 = require("../error");
1
+ import { isEmpty, List, optCheck, optField } from "@leyyo/common";
2
+ import { _toElse, _toEmpty, _toRun } from "./util.js";
3
+ import { InvalidArrayError } from "../error/index.js";
7
4
  /**
8
5
  * Convert any value to `array`
9
6
  *
@@ -11,17 +8,17 @@ const error_1 = require("../error");
11
8
  * @param {ToOpt} opt
12
9
  * @return {Array}
13
10
  * */
14
- function toArrayValue(value, opt) {
15
- let o = (0, common_1.optCheck)(opt);
16
- if ((0, common_1.isEmpty)(value)) {
17
- return (0, util_1._toEmpty)(value, o, error_1.InvalidArrayError, 'array');
11
+ export function toArrayValue(value, opt) {
12
+ let o = optCheck(opt);
13
+ if (isEmpty(value)) {
14
+ return _toEmpty(value, o, InvalidArrayError, 'array');
18
15
  }
19
16
  switch (typeof value) {
20
17
  case "string":
21
18
  case "boolean":
22
19
  case "number":
23
20
  case "bigint":
24
- const o2 = Object.assign({}, o);
21
+ const o2 = { ...o };
25
22
  delete o2.nullable;
26
23
  o2.nullable = o2.itemNullable;
27
24
  return toArrayValue([value], o2);
@@ -29,7 +26,7 @@ function toArrayValue(value, opt) {
29
26
  if (value instanceof Set) {
30
27
  return toArrayValue(Array.from(value.values()), o);
31
28
  }
32
- else if (value instanceof common_1.List) {
29
+ else if (value instanceof List) {
33
30
  return toArrayValue([...value], o);
34
31
  }
35
32
  else if (Array.isArray(value)) {
@@ -37,12 +34,12 @@ function toArrayValue(value, opt) {
37
34
  if (o.zeroLength) {
38
35
  return [];
39
36
  }
40
- return (0, util_1._toEmpty)(value, o, error_1.InvalidArrayError, 'array');
37
+ return _toEmpty(value, o, InvalidArrayError, 'array');
41
38
  }
42
39
  if (typeof o.itemFn !== "function" || value.length < 1) {
43
40
  return value;
44
41
  }
45
- const o2 = Object.assign({}, o);
42
+ const o2 = { ...o };
46
43
  delete o2.nullable;
47
44
  o2.nullable = o2.itemNullable;
48
45
  const oldField = o2.field;
@@ -51,9 +48,9 @@ function toArrayValue(value, opt) {
51
48
  value.splice(0, value.length);
52
49
  clonedArr.forEach((v, index) => {
53
50
  o2.field = oldField;
54
- (0, common_1.optField)(o2, index);
55
- const itemValue = (0, util_1._toRun)(() => o2.itemFn(v, o2), o2, 'item');
56
- if (!o.ignoreEmptyItems || !(0, common_1.isEmpty)(itemValue)) {
51
+ optField(o2, index);
52
+ const itemValue = _toRun(() => o2.itemFn(v, o2), o2, 'item');
53
+ if (!o.ignoreEmptyItems || !isEmpty(itemValue)) {
57
54
  value.push(value);
58
55
  }
59
56
  });
@@ -61,8 +58,7 @@ function toArrayValue(value, opt) {
61
58
  }
62
59
  return toArrayValue([value], o);
63
60
  case 'function':
64
- return toArrayValue((0, util_1._toRun)(value, o, 'function'), o);
61
+ return toArrayValue(_toRun(value, o, 'function'), o);
65
62
  }
66
- return (0, util_1._toElse)(value, o, error_1.InvalidArrayError, 'array');
63
+ return _toElse(value, o, InvalidArrayError, 'array');
67
64
  }
68
- //# sourceMappingURL=to-array-value.js.map
@@ -1,4 +1,4 @@
1
- import { ToOpt, ToOptFn } from "./index.types";
1
+ import { ToOpt, ToOptFn } from "./index.types.js";
2
2
  /**
3
3
  * Convert any value to `boolean`
4
4
  *
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBooleanValue = toBooleanValue;
4
- const common_1 = require("@leyyo/common");
5
- const util_1 = require("./util");
6
- const is_1 = require("../is");
7
- const error_1 = require("../error");
1
+ import { InvalidValueError, isEmpty, optAppend, optCheck } from "@leyyo/common";
2
+ import { _toElse, _toEmpty, _toRun } from "./util.js";
3
+ import { isFalseLike, isTrueLike } from "../is/index.js";
4
+ import { InvalidBooleanError } from "../error/index.js";
8
5
  // noinspection JSUnusedGlobalSymbols
9
6
  /**
10
7
  * Convert any value to `boolean`
@@ -13,10 +10,10 @@ const error_1 = require("../error");
13
10
  * @param {ToOpt} opt
14
11
  * @return {boolean}
15
12
  * */
16
- function toBooleanValue(value, opt) {
17
- let o = (0, common_1.optCheck)(opt);
18
- if ((0, common_1.isEmpty)(value)) {
19
- return (0, util_1._toEmpty)(value, o, error_1.InvalidBooleanError, 'boolean');
13
+ export function toBooleanValue(value, opt) {
14
+ let o = optCheck(opt);
15
+ if (isEmpty(value)) {
16
+ return _toEmpty(value, o, InvalidBooleanError, 'boolean');
20
17
  }
21
18
  let err;
22
19
  switch (typeof value) {
@@ -24,19 +21,19 @@ function toBooleanValue(value, opt) {
24
21
  return value;
25
22
  case 'string':
26
23
  case 'number':
27
- if ((0, is_1.isTrueLike)(value)) {
24
+ if (isTrueLike(value)) {
28
25
  return true;
29
26
  }
30
- if ((0, is_1.isFalseLike)(value)) {
27
+ if (isFalseLike(value)) {
31
28
  return false;
32
29
  }
33
- o = (0, common_1.optAppend)(o, {
30
+ o = optAppend(o, {
34
31
  issue: 'invalid',
35
32
  expected: 'boolean',
36
33
  type: 'string',
37
34
  value,
38
35
  });
39
- err = new common_1.InvalidValueError('Invalid boolean like for text', o);
36
+ err = new InvalidValueError('Invalid boolean like for text', o);
40
37
  if (!o.silent) {
41
38
  throw err;
42
39
  }
@@ -51,8 +48,7 @@ function toBooleanValue(value, opt) {
51
48
  }
52
49
  break;
53
50
  case 'function':
54
- return toBooleanValue((0, util_1._toRun)(value, o, 'function'), o);
51
+ return toBooleanValue(_toRun(value, o, 'function'), o);
55
52
  }
56
- return (0, util_1._toElse)(value, o, error_1.InvalidBooleanError, 'boolean');
53
+ return _toElse(value, o, InvalidBooleanError, 'boolean');
57
54
  }
58
- //# sourceMappingURL=to-boolean-value.js.map
@@ -1,4 +1,4 @@
1
- import { ToOpt, ToOptFn } from "./index.types";
1
+ import { ToOpt, ToOptFn } from "./index.types.js";
2
2
  /**
3
3
  * Convert any value to `date`
4
4
  *
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDateValue = toDateValue;
4
- const common_1 = require("@leyyo/common");
5
- const util_1 = require("./util");
6
- const error_1 = require("../error");
1
+ import { isEmpty, optCheck } from "@leyyo/common";
2
+ import { _toElse, _toEmpty, _toRun } from "./util.js";
3
+ import { InvalidDateError } from "../error/index.js";
7
4
  // noinspection JSUnusedGlobalSymbols
8
5
  /**
9
6
  * Convert any value to `date`
@@ -12,10 +9,10 @@ const error_1 = require("../error");
12
9
  * @param {ToOpt} opt
13
10
  * @return {Date}
14
11
  * */
15
- function toDateValue(value, opt) {
16
- let o = (0, common_1.optCheck)(opt);
17
- if ((0, common_1.isEmpty)(value)) {
18
- return (0, util_1._toEmpty)(value, o, error_1.InvalidDateError, 'date');
12
+ export function toDateValue(value, opt) {
13
+ let o = optCheck(opt);
14
+ if (isEmpty(value)) {
15
+ return _toEmpty(value, o, InvalidDateError, 'date');
19
16
  }
20
17
  switch (typeof value) {
21
18
  case 'object':
@@ -23,7 +20,7 @@ function toDateValue(value, opt) {
23
20
  return value;
24
21
  }
25
22
  else if (typeof value['toDateValue'] === 'function') {
26
- return toDateValue((0, util_1._toRun)(value['toDateValue'], o, 'moment'), o);
23
+ return toDateValue(_toRun(value['toDateValue'], o, 'moment'), o);
27
24
  }
28
25
  if (Array.isArray(value)) {
29
26
  const arr = value;
@@ -33,23 +30,22 @@ function toDateValue(value, opt) {
33
30
  }
34
31
  if (arr.length > 1 && arr.length < 8) {
35
32
  const [year, monthIndex, date, hours, minutes, seconds, ms] = arr;
36
- return (0, util_1._toRun)(() => new Date(year, monthIndex, date, hours, minutes, seconds, ms), o, 'array');
33
+ return _toRun(() => new Date(year, monthIndex, date, hours, minutes, seconds, ms), o, 'array');
37
34
  }
38
35
  }
39
36
  break;
40
37
  case 'string':
41
38
  const str = value.trim();
42
39
  if (str === '') {
43
- return (0, util_1._toEmpty)(value, o, error_1.InvalidDateError, 'date');
40
+ return _toEmpty(value, o, InvalidDateError, 'date');
44
41
  }
45
- return toDateValue((0, util_1._toRun)(() => new Date(str), o, 'string'), o);
42
+ return toDateValue(_toRun(() => new Date(str), o, 'string'), o);
46
43
  case 'bigint':
47
- return toDateValue((0, util_1._toRun)(() => new Date(value.toString(10)), o, 'bigint'), o);
44
+ return toDateValue(_toRun(() => new Date(value.toString(10)), o, 'bigint'), o);
48
45
  case 'number':
49
- return toDateValue((0, util_1._toRun)(() => new Date(value), o, 'number'), o);
46
+ return toDateValue(_toRun(() => new Date(value), o, 'number'), o);
50
47
  case 'function':
51
- return toDateValue((0, util_1._toRun)(value, o, 'function'), o);
48
+ return toDateValue(_toRun(value, o, 'function'), o);
52
49
  }
53
- return (0, util_1._toElse)(value, o, error_1.InvalidDateError, 'date', 'string', 'integer');
50
+ return _toElse(value, o, InvalidDateError, 'date', 'string', 'integer');
54
51
  }
55
- //# sourceMappingURL=to-date-value.js.map
@@ -1,4 +1,4 @@
1
- import { ToOptArray, ToOptFn } from "./index.types";
1
+ import { ToOptArray, ToOptFn } from "./index.types.js";
2
2
  /**
3
3
  * Convert any value to `array` from text
4
4
  *
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDelimitedValue = toDelimitedValue;
4
- const common_1 = require("@leyyo/common");
5
- const util_1 = require("./util");
6
- const to_array_value_1 = require("./to-array-value");
7
- const error_1 = require("../error");
1
+ import { isEmpty, optCheck } from "@leyyo/common";
2
+ import { _toElse, _toEmpty, _toRun } from "./util.js";
3
+ import { toArrayValue } from "./to-array-value.js";
4
+ import { InvalidDelimitedError } from "../error/index.js";
8
5
  // noinspection JSUnusedGlobalSymbols
9
6
  /**
10
7
  * Convert any value to `array` from text
@@ -13,31 +10,30 @@ const error_1 = require("../error");
13
10
  * @param {ToOpt} opt
14
11
  * @return {Array}
15
12
  * */
16
- function toDelimitedValue(value, opt) {
17
- let o = (0, common_1.optCheck)(opt);
18
- if ((0, common_1.isEmpty)(value)) {
19
- return (0, util_1._toEmpty)(value, o, error_1.InvalidDelimitedError, 'string');
13
+ export function toDelimitedValue(value, opt) {
14
+ let o = optCheck(opt);
15
+ if (isEmpty(value)) {
16
+ return _toEmpty(value, o, InvalidDelimitedError, 'string');
20
17
  }
21
18
  switch (typeof value) {
22
19
  case "string":
23
20
  const str = value.trim();
24
21
  if (str === '') {
25
- return (0, util_1._toEmpty)(value, o, error_1.InvalidDelimitedError, 'string');
22
+ return _toEmpty(value, o, InvalidDelimitedError, 'string');
26
23
  }
27
24
  const arr = str
28
25
  .split(',')
29
26
  .map(v => v.trim())
30
27
  .filter(v => v !== '');
31
- return (0, to_array_value_1.toArrayValue)(arr, o);
28
+ return toArrayValue(arr, o);
32
29
  case "boolean":
33
30
  case "number":
34
31
  case "bigint":
35
- return (0, to_array_value_1.toArrayValue)([value], o);
32
+ return toArrayValue([value], o);
36
33
  case 'object':
37
- return (0, to_array_value_1.toArrayValue)(value, o);
34
+ return toArrayValue(value, o);
38
35
  case 'function':
39
- return toDelimitedValue((0, util_1._toRun)(value, o, 'function'), o);
36
+ return toDelimitedValue(_toRun(value, o, 'function'), o);
40
37
  }
41
- return (0, util_1._toElse)(value, o, error_1.InvalidDelimitedError, 'string');
38
+ return _toElse(value, o, InvalidDelimitedError, 'string');
42
39
  }
43
- //# sourceMappingURL=to-delimited-value.js.map
@@ -1,4 +1,4 @@
1
- import { ToOptEnum, ToOptFn } from "./index.types";
1
+ import { ToOptEnum, ToOptFn } from "./index.types.js";
2
2
  import { KeyValue } from "@leyyo/common";
3
3
  /**
4
4
  * Convert any value to `enum` (string or integer)