@duplojs/lang 0.0.0 → 0.0.1-beta.10

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 (567) hide show
  1. package/dist/array/at/default.d.ts +1 -1
  2. package/dist/array/chunk.d.ts +3 -2
  3. package/dist/array/concat.d.ts +1 -1
  4. package/dist/array/copyWithin.d.ts +1 -1
  5. package/dist/array/fill/all.d.ts +1 -1
  6. package/dist/array/fill/default.d.ts +3 -3
  7. package/dist/array/filter.d.ts +1 -1
  8. package/dist/array/findAndReplace.d.ts +1 -1
  9. package/dist/array/findAndSplice/delete.d.ts +1 -1
  10. package/dist/array/findAndSplice/insert.d.ts +1 -1
  11. package/dist/array/index.cjs +0 -3
  12. package/dist/array/index.d.ts +0 -1
  13. package/dist/array/index.mjs +1 -3
  14. package/dist/array/insert.d.ts +3 -3
  15. package/dist/array/length.d.ts +1 -1
  16. package/dist/array/lengthEqual.d.ts +1 -1
  17. package/dist/array/map.d.ts +1 -1
  18. package/dist/array/maxElements.d.ts +1 -1
  19. package/dist/array/minElements.d.ts +1 -1
  20. package/dist/array/pop.d.ts +1 -1
  21. package/dist/array/prepend.d.ts +1 -1
  22. package/dist/array/push.d.ts +3 -3
  23. package/dist/array/reverse.d.ts +1 -1
  24. package/dist/array/shift.d.ts +1 -1
  25. package/dist/array/sort.d.ts +1 -1
  26. package/dist/array/splice/delete.d.ts +1 -1
  27. package/dist/array/splice/insert.d.ts +1 -1
  28. package/dist/array/unshift.d.ts +3 -3
  29. package/dist/chrono/createDate.cjs +9 -9
  30. package/dist/chrono/createDate.d.ts +3 -3
  31. package/dist/chrono/createDate.mjs +9 -9
  32. package/dist/chrono/createTime.cjs +24 -13
  33. package/dist/chrono/createTime.mjs +24 -13
  34. package/dist/chrono/theDate.cjs +15 -16
  35. package/dist/chrono/theDate.d.ts +15 -15
  36. package/dist/chrono/theDate.mjs +15 -16
  37. package/dist/chrono/theTime.cjs +0 -1
  38. package/dist/chrono/theTime.mjs +0 -1
  39. package/dist/chrono/types/spoolingTime.d.ts +2 -1
  40. package/dist/common/constraint/cast/index.d.ts +3 -3
  41. package/dist/common/constraint/cast/number.d.ts +15 -0
  42. package/dist/common/constraint/cast/string.d.ts +21 -0
  43. package/dist/common/constraint/index.d.ts +2 -0
  44. package/dist/common/constraint/infer/array.d.ts +7 -0
  45. package/dist/{array/infer.cjs → common/constraint/infer/index.cjs} +1 -1
  46. package/dist/common/constraint/infer/index.d.ts +26 -0
  47. package/dist/{string/infer.mjs → common/constraint/infer/index.mjs} +1 -1
  48. package/dist/common/constraint/infer/number.d.ts +11 -0
  49. package/dist/common/constraint/infer/string.d.ts +13 -0
  50. package/dist/common/constraint/remove.cjs +6 -0
  51. package/dist/common/constraint/remove.d.ts +2 -0
  52. package/dist/common/constraint/remove.mjs +6 -0
  53. package/dist/common/formData.cjs +4 -2
  54. package/dist/common/formData.mjs +4 -2
  55. package/dist/common/index.cjs +6 -0
  56. package/dist/common/index.mjs +5 -1
  57. package/dist/common/isType.d.ts +3 -2
  58. package/dist/common/queue.cjs +9 -7
  59. package/dist/common/queue.mjs +9 -7
  60. package/dist/common/types/forward.d.ts +1 -0
  61. package/dist/common/types/index.d.ts +3 -0
  62. package/dist/common/types/isObject.d.ts +8 -0
  63. package/dist/common/types/json.d.ts +1 -1
  64. package/dist/common/types/splitPromise.d.ts +1 -0
  65. package/dist/dataStructure/common/codec/base.cjs +29 -0
  66. package/dist/dataStructure/common/{codec.d.ts → codec/base.d.ts} +8 -8
  67. package/dist/dataStructure/common/codec/base.mjs +26 -0
  68. package/dist/dataStructure/common/codec/defaults/index.d.ts +2 -0
  69. package/dist/dataStructure/common/codec/defaults/json.cjs +26 -0
  70. package/dist/dataStructure/common/codec/defaults/json.d.ts +6 -0
  71. package/dist/dataStructure/common/codec/defaults/json.mjs +26 -0
  72. package/dist/dataStructure/common/codec/defaults/string.cjs +44 -0
  73. package/dist/dataStructure/common/codec/defaults/string.d.ts +11 -0
  74. package/dist/dataStructure/common/codec/defaults/string.mjs +44 -0
  75. package/dist/dataStructure/common/codec/index.d.ts +2 -0
  76. package/dist/dataStructure/common/error/base.cjs +73 -0
  77. package/dist/dataStructure/common/error/base.d.ts +50 -0
  78. package/dist/dataStructure/common/error/base.mjs +69 -0
  79. package/dist/dataStructure/common/error/defaultInterpreter.cjs +84 -0
  80. package/dist/dataStructure/common/error/defaultInterpreter.d.ts +57 -0
  81. package/dist/dataStructure/common/error/defaultInterpreter.mjs +83 -0
  82. package/dist/dataStructure/common/error/index.d.ts +3 -0
  83. package/dist/dataStructure/common/error/interpreter.cjs +45 -0
  84. package/dist/dataStructure/common/error/interpreter.d.ts +36 -0
  85. package/dist/dataStructure/common/error/interpreter.mjs +45 -0
  86. package/dist/dataStructure/constraint/base.cjs +34 -5
  87. package/dist/dataStructure/constraint/base.d.ts +13 -4
  88. package/dist/dataStructure/constraint/base.mjs +34 -6
  89. package/dist/dataStructure/constraint/defaults/absolutePath.cjs +13 -0
  90. package/dist/dataStructure/constraint/defaults/absolutePath.d.ts +10 -0
  91. package/dist/dataStructure/constraint/defaults/absolutePath.mjs +12 -0
  92. package/dist/dataStructure/constraint/defaults/allowedCharacters.cjs +1 -1
  93. package/dist/dataStructure/constraint/defaults/allowedCharacters.d.ts +1 -3
  94. package/dist/dataStructure/constraint/defaults/allowedCharacters.mjs +1 -1
  95. package/dist/dataStructure/constraint/defaults/arrayLengthEqual.cjs +1 -1
  96. package/dist/dataStructure/constraint/defaults/arrayLengthEqual.d.ts +1 -1
  97. package/dist/dataStructure/constraint/defaults/arrayLengthEqual.mjs +1 -1
  98. package/dist/dataStructure/constraint/defaults/betweenThan.cjs +1 -1
  99. package/dist/dataStructure/constraint/defaults/betweenThan.d.ts +1 -1
  100. package/dist/dataStructure/constraint/defaults/betweenThan.mjs +1 -1
  101. package/dist/dataStructure/constraint/defaults/betweenThanOrEqual.cjs +1 -1
  102. package/dist/dataStructure/constraint/defaults/betweenThanOrEqual.d.ts +1 -1
  103. package/dist/dataStructure/constraint/defaults/betweenThanOrEqual.mjs +1 -1
  104. package/dist/dataStructure/constraint/defaults/email.cjs +1 -1
  105. package/dist/dataStructure/constraint/defaults/email.d.ts +1 -1
  106. package/dist/dataStructure/constraint/defaults/email.mjs +1 -1
  107. package/dist/dataStructure/constraint/defaults/even.cjs +1 -1
  108. package/dist/dataStructure/constraint/defaults/even.d.ts +1 -1
  109. package/dist/dataStructure/constraint/defaults/even.mjs +1 -1
  110. package/dist/dataStructure/constraint/defaults/greaterThan.cjs +1 -1
  111. package/dist/dataStructure/constraint/defaults/greaterThan.d.ts +1 -1
  112. package/dist/dataStructure/constraint/defaults/greaterThan.mjs +1 -1
  113. package/dist/dataStructure/constraint/defaults/greaterThanOrEqual.cjs +1 -1
  114. package/dist/dataStructure/constraint/defaults/greaterThanOrEqual.d.ts +1 -1
  115. package/dist/dataStructure/constraint/defaults/greaterThanOrEqual.mjs +1 -1
  116. package/dist/dataStructure/constraint/defaults/index.d.ts +6 -0
  117. package/dist/dataStructure/constraint/defaults/integer.cjs +1 -1
  118. package/dist/dataStructure/constraint/defaults/integer.d.ts +1 -1
  119. package/dist/dataStructure/constraint/defaults/integer.mjs +1 -1
  120. package/dist/dataStructure/constraint/defaults/lessThan.cjs +1 -1
  121. package/dist/dataStructure/constraint/defaults/lessThan.d.ts +1 -1
  122. package/dist/dataStructure/constraint/defaults/lessThan.mjs +1 -1
  123. package/dist/dataStructure/constraint/defaults/lessThanOrEqual.cjs +1 -1
  124. package/dist/dataStructure/constraint/defaults/lessThanOrEqual.d.ts +1 -1
  125. package/dist/dataStructure/constraint/defaults/lessThanOrEqual.mjs +1 -1
  126. package/dist/dataStructure/constraint/defaults/maxCharacters.cjs +1 -1
  127. package/dist/dataStructure/constraint/defaults/maxCharacters.d.ts +1 -1
  128. package/dist/dataStructure/constraint/defaults/maxCharacters.mjs +1 -1
  129. package/dist/dataStructure/constraint/defaults/maxElements.cjs +1 -1
  130. package/dist/dataStructure/constraint/defaults/maxElements.d.ts +1 -1
  131. package/dist/dataStructure/constraint/defaults/maxElements.mjs +1 -1
  132. package/dist/dataStructure/constraint/defaults/minCharacters.cjs +4 -4
  133. package/dist/dataStructure/constraint/defaults/minCharacters.d.ts +2 -2
  134. package/dist/dataStructure/constraint/defaults/minCharacters.mjs +4 -4
  135. package/dist/dataStructure/constraint/defaults/minElements.cjs +1 -1
  136. package/dist/dataStructure/constraint/defaults/minElements.d.ts +1 -1
  137. package/dist/dataStructure/constraint/defaults/minElements.mjs +1 -1
  138. package/dist/dataStructure/constraint/defaults/multipleOf.cjs +1 -1
  139. package/dist/dataStructure/constraint/defaults/multipleOf.d.ts +1 -1
  140. package/dist/dataStructure/constraint/defaults/multipleOf.mjs +1 -1
  141. package/dist/dataStructure/constraint/defaults/negative.cjs +1 -1
  142. package/dist/dataStructure/constraint/defaults/negative.d.ts +1 -1
  143. package/dist/dataStructure/constraint/defaults/negative.mjs +1 -1
  144. package/dist/dataStructure/constraint/defaults/notEmpty.cjs +1 -1
  145. package/dist/dataStructure/constraint/defaults/notEmpty.d.ts +1 -1
  146. package/dist/dataStructure/constraint/defaults/notEmpty.mjs +1 -1
  147. package/dist/dataStructure/constraint/defaults/notZero.cjs +1 -1
  148. package/dist/dataStructure/constraint/defaults/notZero.d.ts +1 -1
  149. package/dist/dataStructure/constraint/defaults/notZero.mjs +1 -1
  150. package/dist/dataStructure/constraint/defaults/numberInString.cjs +13 -0
  151. package/dist/dataStructure/constraint/defaults/numberInString.d.ts +10 -0
  152. package/dist/dataStructure/constraint/defaults/numberInString.mjs +12 -0
  153. package/dist/dataStructure/constraint/defaults/odd.cjs +1 -1
  154. package/dist/dataStructure/constraint/defaults/odd.d.ts +1 -1
  155. package/dist/dataStructure/constraint/defaults/odd.mjs +1 -1
  156. package/dist/dataStructure/constraint/defaults/path.cjs +13 -0
  157. package/dist/dataStructure/constraint/defaults/path.d.ts +10 -0
  158. package/dist/dataStructure/constraint/defaults/path.mjs +12 -0
  159. package/dist/dataStructure/constraint/defaults/positive.cjs +1 -1
  160. package/dist/dataStructure/constraint/defaults/positive.d.ts +1 -1
  161. package/dist/dataStructure/constraint/defaults/positive.mjs +1 -1
  162. package/dist/dataStructure/constraint/defaults/refine.cjs +1 -1
  163. package/dist/dataStructure/constraint/defaults/refine.d.ts +1 -1
  164. package/dist/dataStructure/constraint/defaults/refine.mjs +1 -1
  165. package/dist/dataStructure/constraint/defaults/regex.cjs +13 -0
  166. package/dist/dataStructure/constraint/defaults/regex.d.ts +10 -0
  167. package/dist/dataStructure/constraint/defaults/regex.mjs +12 -0
  168. package/dist/dataStructure/constraint/defaults/safe.cjs +1 -1
  169. package/dist/dataStructure/constraint/defaults/safe.d.ts +1 -1
  170. package/dist/dataStructure/constraint/defaults/safe.mjs +1 -1
  171. package/dist/dataStructure/constraint/defaults/segmentPath.cjs +13 -0
  172. package/dist/dataStructure/constraint/defaults/segmentPath.d.ts +10 -0
  173. package/dist/dataStructure/constraint/defaults/segmentPath.mjs +12 -0
  174. package/dist/dataStructure/constraint/defaults/strictNegative.cjs +1 -1
  175. package/dist/dataStructure/constraint/defaults/strictNegative.d.ts +1 -1
  176. package/dist/dataStructure/constraint/defaults/strictNegative.mjs +1 -1
  177. package/dist/dataStructure/constraint/defaults/strictPositive.cjs +1 -1
  178. package/dist/dataStructure/constraint/defaults/strictPositive.d.ts +1 -1
  179. package/dist/dataStructure/constraint/defaults/strictPositive.mjs +1 -1
  180. package/dist/dataStructure/constraint/defaults/stringLengthEqual.cjs +1 -1
  181. package/dist/dataStructure/constraint/defaults/stringLengthEqual.d.ts +1 -1
  182. package/dist/dataStructure/constraint/defaults/stringLengthEqual.mjs +1 -1
  183. package/dist/dataStructure/constraint/defaults/trimmed.cjs +13 -0
  184. package/dist/dataStructure/constraint/defaults/trimmed.d.ts +10 -0
  185. package/dist/dataStructure/constraint/defaults/trimmed.mjs +12 -0
  186. package/dist/dataStructure/constraint/defaults/url.cjs +2 -2
  187. package/dist/dataStructure/constraint/defaults/url.d.ts +2 -3
  188. package/dist/dataStructure/constraint/defaults/url.mjs +2 -2
  189. package/dist/dataStructure/constraint/defaults/uuid.cjs +2 -4
  190. package/dist/dataStructure/constraint/defaults/uuid.d.ts +1 -3
  191. package/dist/dataStructure/constraint/defaults/uuid.mjs +4 -5
  192. package/dist/dataStructure/constraint/identifier.d.ts +3 -4
  193. package/dist/dataStructure/constraint/types/constraints.d.ts +22 -15
  194. package/dist/dataStructure/fundamentalType/base.cjs +3 -3
  195. package/dist/dataStructure/fundamentalType/base.d.ts +4 -5
  196. package/dist/dataStructure/fundamentalType/base.mjs +3 -3
  197. package/dist/dataStructure/fundamentalType/defaults/bigint.cjs +4 -2
  198. package/dist/dataStructure/fundamentalType/defaults/bigint.d.ts +4 -4
  199. package/dist/dataStructure/fundamentalType/defaults/bigint.mjs +5 -2
  200. package/dist/dataStructure/fundamentalType/defaults/boolean.cjs +4 -2
  201. package/dist/dataStructure/fundamentalType/defaults/boolean.d.ts +4 -4
  202. package/dist/dataStructure/fundamentalType/defaults/boolean.mjs +5 -2
  203. package/dist/dataStructure/fundamentalType/defaults/date.cjs +4 -2
  204. package/dist/dataStructure/fundamentalType/defaults/date.d.ts +4 -4
  205. package/dist/dataStructure/fundamentalType/defaults/date.mjs +5 -2
  206. package/dist/dataStructure/fundamentalType/defaults/null.cjs +4 -2
  207. package/dist/dataStructure/fundamentalType/defaults/null.d.ts +4 -4
  208. package/dist/dataStructure/fundamentalType/defaults/null.mjs +5 -2
  209. package/dist/dataStructure/fundamentalType/defaults/number.cjs +4 -2
  210. package/dist/dataStructure/fundamentalType/defaults/number.d.ts +4 -4
  211. package/dist/dataStructure/fundamentalType/defaults/number.mjs +5 -2
  212. package/dist/dataStructure/fundamentalType/defaults/string.cjs +4 -2
  213. package/dist/dataStructure/fundamentalType/defaults/string.d.ts +4 -4
  214. package/dist/dataStructure/fundamentalType/defaults/string.mjs +5 -2
  215. package/dist/dataStructure/fundamentalType/defaults/time.cjs +4 -2
  216. package/dist/dataStructure/fundamentalType/defaults/time.d.ts +4 -4
  217. package/dist/dataStructure/fundamentalType/defaults/time.mjs +5 -2
  218. package/dist/dataStructure/fundamentalType/defaults/undefined.cjs +4 -2
  219. package/dist/dataStructure/fundamentalType/defaults/undefined.d.ts +4 -4
  220. package/dist/dataStructure/fundamentalType/defaults/undefined.mjs +5 -2
  221. package/dist/dataStructure/fundamentalType/identifier.d.ts +3 -4
  222. package/dist/dataStructure/helpers/absolutePath.cjs +7 -0
  223. package/dist/dataStructure/helpers/absolutePath.d.ts +2 -0
  224. package/dist/dataStructure/helpers/absolutePath.mjs +7 -0
  225. package/dist/dataStructure/helpers/array.d.ts +1 -1
  226. package/dist/dataStructure/helpers/bigint.d.ts +1 -1
  227. package/dist/dataStructure/helpers/boolean.d.ts +1 -1
  228. package/dist/dataStructure/helpers/date.d.ts +1 -1
  229. package/dist/dataStructure/helpers/extend.d.ts +1 -1
  230. package/dist/dataStructure/helpers/index.d.ts +10 -1
  231. package/dist/dataStructure/helpers/isNullable.cjs +12 -0
  232. package/dist/dataStructure/helpers/isNullable.d.ts +2 -0
  233. package/dist/dataStructure/helpers/isNullable.mjs +12 -0
  234. package/dist/dataStructure/helpers/isOptional.cjs +12 -0
  235. package/dist/dataStructure/helpers/isOptional.d.ts +2 -0
  236. package/dist/dataStructure/helpers/isOptional.mjs +12 -0
  237. package/dist/dataStructure/helpers/lazy.d.ts +1 -1
  238. package/dist/dataStructure/helpers/null.d.ts +1 -1
  239. package/dist/dataStructure/helpers/nullable.cjs +5 -2
  240. package/dist/dataStructure/helpers/nullable.mjs +5 -2
  241. package/dist/dataStructure/helpers/number.d.ts +1 -1
  242. package/dist/dataStructure/helpers/numberInString.cjs +7 -0
  243. package/dist/dataStructure/helpers/numberInString.d.ts +2 -0
  244. package/dist/dataStructure/helpers/numberInString.mjs +7 -0
  245. package/dist/dataStructure/helpers/object.d.ts +1 -1
  246. package/dist/dataStructure/helpers/optional.cjs +5 -2
  247. package/dist/dataStructure/helpers/optional.mjs +5 -2
  248. package/dist/dataStructure/helpers/partial.cjs +5 -2
  249. package/dist/dataStructure/helpers/partial.mjs +5 -2
  250. package/dist/dataStructure/helpers/path.cjs +7 -0
  251. package/dist/dataStructure/helpers/path.d.ts +2 -0
  252. package/dist/dataStructure/helpers/path.mjs +7 -0
  253. package/dist/dataStructure/helpers/record.d.ts +1 -1
  254. package/dist/dataStructure/helpers/regex.cjs +7 -0
  255. package/dist/dataStructure/helpers/regex.d.ts +2 -0
  256. package/dist/dataStructure/helpers/regex.mjs +7 -0
  257. package/dist/dataStructure/helpers/required.cjs +6 -3
  258. package/dist/dataStructure/helpers/required.d.ts +2 -1
  259. package/dist/dataStructure/helpers/required.mjs +6 -3
  260. package/dist/dataStructure/helpers/segmentPath.cjs +7 -0
  261. package/dist/dataStructure/helpers/segmentPath.d.ts +2 -0
  262. package/dist/dataStructure/helpers/segmentPath.mjs +7 -0
  263. package/dist/dataStructure/helpers/string.d.ts +1 -1
  264. package/dist/dataStructure/helpers/time.d.ts +1 -1
  265. package/dist/dataStructure/helpers/trimmed.cjs +7 -0
  266. package/dist/dataStructure/helpers/trimmed.d.ts +2 -0
  267. package/dist/dataStructure/helpers/trimmed.mjs +7 -0
  268. package/dist/dataStructure/helpers/undefined.d.ts +1 -1
  269. package/dist/dataStructure/helpers/union.d.ts +1 -1
  270. package/dist/dataStructure/helpers/unwrapLazy.cjs +9 -0
  271. package/dist/dataStructure/helpers/unwrapLazy.d.ts +2 -0
  272. package/dist/dataStructure/helpers/unwrapLazy.mjs +9 -0
  273. package/dist/dataStructure/helpers/url.cjs +2 -2
  274. package/dist/dataStructure/helpers/url.d.ts +1 -2
  275. package/dist/dataStructure/helpers/url.mjs +2 -2
  276. package/dist/dataStructure/index.cjs +158 -60
  277. package/dist/dataStructure/index.mjs +80 -21
  278. package/dist/dataStructure/structure/base.cjs +22 -12
  279. package/dist/dataStructure/structure/base.d.ts +8 -5
  280. package/dist/dataStructure/structure/base.mjs +16 -6
  281. package/dist/dataStructure/structure/defaults/array.d.ts +2 -2
  282. package/dist/dataStructure/structure/defaults/array.mjs +8 -5
  283. package/dist/dataStructure/structure/defaults/index.d.ts +1 -0
  284. package/dist/dataStructure/structure/defaults/lazy.cjs +10 -3
  285. package/dist/dataStructure/structure/defaults/lazy.d.ts +2 -2
  286. package/dist/dataStructure/structure/defaults/lazy.mjs +10 -3
  287. package/dist/dataStructure/structure/defaults/nonEncodableString.cjs +17 -0
  288. package/dist/dataStructure/structure/defaults/nonEncodableString.d.ts +10 -0
  289. package/dist/dataStructure/structure/defaults/nonEncodableString.mjs +16 -0
  290. package/dist/dataStructure/structure/defaults/object.d.ts +2 -2
  291. package/dist/dataStructure/structure/defaults/object.mjs +8 -5
  292. package/dist/dataStructure/structure/defaults/record.cjs +7 -7
  293. package/dist/dataStructure/structure/defaults/record.d.ts +3 -3
  294. package/dist/dataStructure/structure/defaults/record.mjs +15 -12
  295. package/dist/dataStructure/structure/defaults/type.cjs +1 -1
  296. package/dist/dataStructure/structure/defaults/type.d.ts +2 -2
  297. package/dist/dataStructure/structure/defaults/type.mjs +2 -2
  298. package/dist/dataStructure/structure/defaults/union.cjs +23 -17
  299. package/dist/dataStructure/structure/defaults/union.d.ts +3 -3
  300. package/dist/dataStructure/structure/defaults/union.mjs +27 -18
  301. package/dist/dataStructure/structure/identifier.d.ts +3 -4
  302. package/dist/dataStructure/structure/types/constraintsValue.d.ts +1 -1
  303. package/dist/dataStructure/structure/types/structures.d.ts +2 -1
  304. package/dist/dataStructure/structure/types/value.d.ts +1 -1
  305. package/dist/dataStructure/type/base.cjs +17 -4
  306. package/dist/dataStructure/type/base.d.ts +7 -3
  307. package/dist/dataStructure/type/base.mjs +17 -4
  308. package/dist/dataStructure/type/defaults/bigint.d.ts +1 -1
  309. package/dist/dataStructure/type/defaults/bigintLiteral.cjs +1 -1
  310. package/dist/dataStructure/type/defaults/bigintLiteral.d.ts +1 -1
  311. package/dist/dataStructure/type/defaults/bigintLiteral.mjs +1 -1
  312. package/dist/dataStructure/type/defaults/boolean.d.ts +1 -1
  313. package/dist/dataStructure/type/defaults/booleanLiteral.cjs +1 -1
  314. package/dist/dataStructure/type/defaults/booleanLiteral.d.ts +1 -1
  315. package/dist/dataStructure/type/defaults/booleanLiteral.mjs +1 -1
  316. package/dist/dataStructure/type/defaults/date.d.ts +1 -1
  317. package/dist/dataStructure/type/defaults/null.d.ts +1 -1
  318. package/dist/dataStructure/type/defaults/number.d.ts +1 -1
  319. package/dist/dataStructure/type/defaults/numberLiteral.cjs +1 -1
  320. package/dist/dataStructure/type/defaults/numberLiteral.d.ts +1 -1
  321. package/dist/dataStructure/type/defaults/numberLiteral.mjs +1 -1
  322. package/dist/dataStructure/type/defaults/string.d.ts +1 -1
  323. package/dist/dataStructure/type/defaults/stringLiteral.cjs +1 -1
  324. package/dist/dataStructure/type/defaults/stringLiteral.d.ts +1 -1
  325. package/dist/dataStructure/type/defaults/stringLiteral.mjs +1 -1
  326. package/dist/dataStructure/type/defaults/time.d.ts +1 -1
  327. package/dist/dataStructure/type/defaults/undefined.d.ts +1 -1
  328. package/dist/dataStructure/type/identifier.d.ts +3 -4
  329. package/dist/either/index.cjs +30 -8
  330. package/dist/either/index.d.ts +4 -0
  331. package/dist/either/index.mjs +23 -9
  332. package/dist/either/left/index.d.ts +3 -2
  333. package/dist/either/left/none.cjs +15 -0
  334. package/dist/either/left/none.d.ts +7 -0
  335. package/dist/either/left/none.mjs +14 -0
  336. package/dist/either/matchInformationOtherwise.d.ts +1 -1
  337. package/dist/either/rewriteInformation.cjs +22 -0
  338. package/dist/either/rewriteInformation.d.ts +14 -0
  339. package/dist/either/rewriteInformation.mjs +22 -0
  340. package/dist/either/right/asyncGroup.cjs +2 -2
  341. package/dist/either/right/asyncGroup.mjs +2 -2
  342. package/dist/either/right/group.cjs +1 -1
  343. package/dist/either/right/group.mjs +1 -1
  344. package/dist/either/right/index.d.ts +6 -5
  345. package/dist/either/right/some.cjs +15 -0
  346. package/dist/either/right/some.d.ts +7 -0
  347. package/dist/either/right/some.mjs +14 -0
  348. package/dist/either/toMaybe.cjs +12 -0
  349. package/dist/either/toMaybe.d.ts +5 -0
  350. package/dist/either/toMaybe.mjs +12 -0
  351. package/dist/either/types/mayBe.d.ts +3 -0
  352. package/dist/either/unwrapOr.cjs +14 -0
  353. package/dist/either/unwrapOr.d.ts +8 -0
  354. package/dist/either/unwrapOr.mjs +14 -0
  355. package/dist/either/unwrapOtherwise.cjs +14 -0
  356. package/dist/either/unwrapOtherwise.d.ts +8 -0
  357. package/dist/either/unwrapOtherwise.mjs +14 -0
  358. package/dist/generator/asyncChunk.d.ts +3 -2
  359. package/dist/generator/chunk.d.ts +3 -2
  360. package/dist/generator/reduce.cjs +2 -1
  361. package/dist/generator/reduce.mjs +1 -1
  362. package/dist/generator/types/flat.d.ts +2 -2
  363. package/dist/index.cjs +43 -39
  364. package/dist/index.mjs +4 -2
  365. package/dist/invocation/flow/base.d.ts +8 -3
  366. package/dist/invocation/flow/controller/base.d.ts +1 -0
  367. package/dist/invocation/flow/controller/defaults/aborter.cjs +38 -0
  368. package/dist/invocation/flow/controller/defaults/aborter.d.ts +17 -0
  369. package/dist/invocation/flow/controller/defaults/aborter.mjs +36 -0
  370. package/dist/invocation/flow/controller/defaults/debounce.d.ts +1 -1
  371. package/dist/invocation/flow/controller/defaults/filter.cjs +5 -3
  372. package/dist/invocation/flow/controller/defaults/filter.d.ts +1 -1
  373. package/dist/invocation/flow/controller/defaults/filter.mjs +5 -3
  374. package/dist/invocation/flow/controller/defaults/index.d.ts +1 -0
  375. package/dist/invocation/flow/controller/defaults/retry.d.ts +1 -1
  376. package/dist/invocation/flow/controller/defaults/throttling.d.ts +1 -1
  377. package/dist/invocation/flow/controller/defaults/timeout.d.ts +1 -1
  378. package/dist/invocation/index.cjs +15 -8
  379. package/dist/invocation/index.d.ts +1 -1
  380. package/dist/invocation/index.mjs +10 -6
  381. package/dist/invocation/reader.cjs +26 -0
  382. package/dist/invocation/reader.d.ts +28 -0
  383. package/dist/invocation/reader.mjs +25 -0
  384. package/dist/kind/createIdentifier.d.ts +8 -4
  385. package/dist/kind/types/getName.d.ts +2 -0
  386. package/dist/kind/types/getNamespaceName.d.ts +3 -0
  387. package/dist/kind/types/index.d.ts +2 -0
  388. package/dist/kind/types/remove.d.ts +2 -2
  389. package/dist/modeling/entity/base.cjs +38 -11
  390. package/dist/modeling/entity/base.d.ts +25 -10
  391. package/dist/modeling/entity/base.mjs +32 -6
  392. package/dist/modeling/entity/helper.d.ts +1 -1
  393. package/dist/modeling/entity/index.d.ts +0 -1
  394. package/dist/modeling/entity/namespace.cjs +2 -2
  395. package/dist/modeling/entity/namespace.d.ts +1 -1
  396. package/dist/modeling/entity/namespace.mjs +3 -3
  397. package/dist/modeling/flag/base.cjs +1 -5
  398. package/dist/modeling/flag/base.d.ts +6 -7
  399. package/dist/modeling/flag/base.mjs +1 -5
  400. package/dist/modeling/index.cjs +45 -28
  401. package/dist/modeling/index.d.ts +1 -0
  402. package/dist/modeling/index.mjs +18 -9
  403. package/dist/modeling/newType/base.cjs +34 -13
  404. package/dist/modeling/newType/base.d.ts +9 -2
  405. package/dist/modeling/newType/base.mjs +26 -7
  406. package/dist/modeling/newType/helper.cjs +2 -2
  407. package/dist/modeling/newType/helper.d.ts +1 -1
  408. package/dist/modeling/newType/helper.mjs +2 -2
  409. package/dist/modeling/taggedObject/base.cjs +113 -0
  410. package/dist/modeling/taggedObject/base.d.ts +61 -0
  411. package/dist/modeling/taggedObject/base.mjs +110 -0
  412. package/dist/modeling/taggedObject/helper.cjs +34 -0
  413. package/dist/modeling/taggedObject/helper.d.ts +15 -0
  414. package/dist/modeling/taggedObject/helper.mjs +31 -0
  415. package/dist/modeling/taggedObject/index.d.ts +2 -0
  416. package/dist/number/betweenThan.d.ts +2 -2
  417. package/dist/number/betweenThanOrEqual.d.ts +2 -2
  418. package/dist/number/greaterThan.d.ts +1 -1
  419. package/dist/number/greaterThanOrEqual.d.ts +1 -1
  420. package/dist/number/index.cjs +0 -3
  421. package/dist/number/index.d.ts +0 -1
  422. package/dist/number/index.mjs +1 -3
  423. package/dist/number/lessThan.d.ts +1 -1
  424. package/dist/number/lessThanOrEqual.d.ts +1 -1
  425. package/dist/number/sort.d.ts +1 -1
  426. package/dist/number/types/isGreater.d.ts +5 -5
  427. package/dist/object/assign.d.ts +3 -3
  428. package/dist/object/types/assign.d.ts +2 -0
  429. package/dist/object/types/forbiddenUndefinedProps.d.ts +3 -0
  430. package/dist/object/types/index.d.ts +4 -2
  431. package/dist/object/types/override.d.ts +4 -0
  432. package/dist/object/types/split.d.ts +2 -2
  433. package/dist/path/computeRelative.cjs +5 -6
  434. package/dist/path/computeRelative.d.ts +1 -1
  435. package/dist/path/computeRelative.mjs +5 -6
  436. package/dist/path/constraints/absolute.d.ts +1 -1
  437. package/dist/path/constraints/index.d.ts +2 -1
  438. package/dist/path/constraints/segment.d.ts +3 -0
  439. package/dist/path/getBaseName.cjs +7 -7
  440. package/dist/path/getBaseName.d.ts +2 -2
  441. package/dist/path/getBaseName.mjs +7 -7
  442. package/dist/path/getExtensionName.cjs +9 -4
  443. package/dist/path/getExtensionName.d.ts +2 -2
  444. package/dist/path/getExtensionName.mjs +9 -4
  445. package/dist/path/getParentFolderPath.cjs +9 -4
  446. package/dist/path/getParentFolderPath.d.ts +1 -2
  447. package/dist/path/getParentFolderPath.mjs +9 -4
  448. package/dist/path/index.cjs +6 -3
  449. package/dist/path/index.d.ts +3 -2
  450. package/dist/path/index.mjs +5 -3
  451. package/dist/path/is.cjs +9 -4
  452. package/dist/path/is.d.ts +4 -2
  453. package/dist/path/is.mjs +9 -4
  454. package/dist/path/isAbsolute.cjs +3 -5
  455. package/dist/path/isAbsolute.d.ts +4 -2
  456. package/dist/path/isAbsolute.mjs +3 -5
  457. package/dist/path/isSegment.cjs +6 -0
  458. package/dist/path/isSegment.d.ts +4 -0
  459. package/dist/path/isSegment.mjs +6 -0
  460. package/dist/path/normalize.cjs +18 -0
  461. package/dist/path/normalize.d.ts +2 -0
  462. package/dist/path/normalize.mjs +18 -0
  463. package/dist/path/resolveFrom.cjs +4 -5
  464. package/dist/path/resolveFrom.d.ts +10 -2
  465. package/dist/path/resolveFrom.mjs +4 -5
  466. package/dist/path/resolveRelative.cjs +17 -20
  467. package/dist/path/resolveRelative.d.ts +9 -2
  468. package/dist/path/resolveRelative.mjs +17 -20
  469. package/dist/path/types/index.d.ts +6 -0
  470. package/dist/path/types/isLiteralAbsolutePath.d.ts +2 -0
  471. package/dist/path/types/isLiteralPath.d.ts +20 -0
  472. package/dist/path/types/isLiteralSegmentPath.d.ts +9 -0
  473. package/dist/path/types/requireLiteralAbsolutePath.d.ts +3 -0
  474. package/dist/path/types/requireLiteralPath.d.ts +3 -0
  475. package/dist/path/types/requireLiteralSegmentPath.d.ts +3 -0
  476. package/dist/pattern/index.cjs +12 -0
  477. package/dist/pattern/index.d.ts +4 -0
  478. package/dist/pattern/index.mjs +9 -1
  479. package/dist/pattern/matchWithEntity.cjs +12 -0
  480. package/dist/pattern/matchWithEntity.d.ts +12 -0
  481. package/dist/pattern/matchWithEntity.mjs +12 -0
  482. package/dist/pattern/matchWithEntityOtherwise.cjs +13 -0
  483. package/dist/pattern/matchWithEntityOtherwise.d.ts +14 -0
  484. package/dist/pattern/matchWithEntityOtherwise.mjs +13 -0
  485. package/dist/pattern/matchWithNumber.d.ts +4 -4
  486. package/dist/pattern/matchWithNumberOtherwise.cjs +2 -6
  487. package/dist/pattern/matchWithNumberOtherwise.d.ts +4 -4
  488. package/dist/pattern/matchWithNumberOtherwise.mjs +2 -6
  489. package/dist/pattern/matchWithString.d.ts +4 -4
  490. package/dist/pattern/matchWithStringOtherwise.cjs +2 -6
  491. package/dist/pattern/matchWithStringOtherwise.d.ts +5 -5
  492. package/dist/pattern/matchWithStringOtherwise.mjs +2 -6
  493. package/dist/pattern/matchWithTaggedObject.cjs +12 -0
  494. package/dist/pattern/matchWithTaggedObject.d.ts +12 -0
  495. package/dist/pattern/matchWithTaggedObject.mjs +12 -0
  496. package/dist/pattern/matchWithTaggedObjectOtherwise.cjs +13 -0
  497. package/dist/pattern/matchWithTaggedObjectOtherwise.d.ts +14 -0
  498. package/dist/pattern/matchWithTaggedObjectOtherwise.mjs +13 -0
  499. package/dist/string/at.d.ts +2 -2
  500. package/dist/string/constraints/allowedCharacters.d.ts +3 -3
  501. package/dist/string/constraints/index.d.ts +2 -1
  502. package/dist/string/constraints/number.d.ts +4 -0
  503. package/dist/string/first.d.ts +1 -1
  504. package/dist/string/index.cjs +6 -3
  505. package/dist/string/index.d.ts +1 -1
  506. package/dist/string/index.mjs +5 -3
  507. package/dist/string/isComposedOf.cjs +0 -1
  508. package/dist/string/isComposedOf.d.ts +5 -8
  509. package/dist/string/isComposedOf.mjs +0 -1
  510. package/dist/string/isNumber.cjs +7 -0
  511. package/dist/string/isNumber.d.ts +5 -0
  512. package/dist/string/isNumber.mjs +7 -0
  513. package/dist/string/isUrl.cjs +2 -11
  514. package/dist/string/isUrl.d.ts +1 -5
  515. package/dist/string/isUrl.mjs +2 -11
  516. package/dist/string/last.d.ts +1 -1
  517. package/dist/string/lengthEqual.d.ts +1 -1
  518. package/dist/string/maxCharacters.d.ts +1 -1
  519. package/dist/string/minCharacters.d.ts +1 -1
  520. package/dist/string/padEnd.d.ts +1 -1
  521. package/dist/string/padStart.d.ts +1 -1
  522. package/dist/string/pop.d.ts +1 -1
  523. package/dist/string/shift.d.ts +1 -1
  524. package/dist/string/slice.d.ts +1 -1
  525. package/dist/string/substring.d.ts +1 -1
  526. package/dist/string/to.d.ts +9 -2
  527. package/dist/string/trim/default.d.ts +1 -1
  528. package/dist/string/trim/end.d.ts +1 -1
  529. package/dist/string/trim/index.d.ts +1 -0
  530. package/dist/string/trim/is.cjs +6 -0
  531. package/dist/string/trim/is.d.ts +2 -0
  532. package/dist/string/trim/is.mjs +6 -0
  533. package/dist/string/trim/start.d.ts +1 -1
  534. package/dist/string/types/IsAllowedString.d.ts +5 -0
  535. package/dist/string/types/index.d.ts +5 -5
  536. package/dist/string/types/numberInString.d.ts +1 -0
  537. package/dist/string/types/split.d.ts +1 -1
  538. package/dist/tuple/from.cjs +6 -0
  539. package/dist/tuple/from.d.ts +8 -0
  540. package/dist/tuple/from.mjs +6 -0
  541. package/dist/tuple/index.cjs +6 -1
  542. package/dist/tuple/index.d.ts +1 -0
  543. package/dist/tuple/index.mjs +6 -2
  544. package/package.json +2 -2
  545. package/dist/array/infer.d.ts +0 -14
  546. package/dist/array/infer.mjs +0 -6
  547. package/dist/dataStructure/common/codec.cjs +0 -28
  548. package/dist/dataStructure/common/codec.mjs +0 -25
  549. package/dist/dataStructure/common/error.cjs +0 -53
  550. package/dist/dataStructure/common/error.d.ts +0 -30
  551. package/dist/dataStructure/common/error.mjs +0 -52
  552. package/dist/invocation/useCase.cjs +0 -26
  553. package/dist/invocation/useCase.d.ts +0 -28
  554. package/dist/invocation/useCase.mjs +0 -25
  555. package/dist/modeling/entity/entityName.cjs +0 -13
  556. package/dist/modeling/entity/entityName.d.ts +0 -13
  557. package/dist/modeling/entity/entityName.mjs +0 -13
  558. package/dist/number/infer.cjs +0 -6
  559. package/dist/number/infer.d.ts +0 -12
  560. package/dist/number/infer.mjs +0 -6
  561. package/dist/object/types/assignObjects.d.ts +0 -2
  562. package/dist/path/fix.cjs +0 -8
  563. package/dist/path/fix.d.ts +0 -1
  564. package/dist/path/fix.mjs +0 -8
  565. package/dist/string/infer.cjs +0 -6
  566. package/dist/string/infer.d.ts +0 -12
  567. package/dist/string/types/number.d.ts +0 -1
@@ -25,13 +25,13 @@ type CheckIsGreater<GreaterSplitValue extends DCommon.AnyTuple<DString.Digit>, G
25
25
  infer InferredRestSplitValue extends DCommon.AnyTuple<DString.Digit>,
26
26
  infer InferredRestSplitReference extends DCommon.AnyTuple<FigureGreaterThanTableValue>
27
27
  ] ? CheckIsGreater<InferredRestSplitValue, InferredRestSplitReference> : never : false;
28
- type toStringDecimal<GenericValue extends number> = `${GenericValue}` extends `${DString.Number}.${DString.Number}` ? `${GenericValue}` : `${GenericValue}.0`;
28
+ type toStringDecimal<GenericValue extends number> = `${GenericValue}` extends `${DString.NumberInString}.${DString.NumberInString}` ? `${GenericValue}` : `${GenericValue}.0`;
29
29
  type PrepareValues<GenericValue extends number, GenericReference extends number> = readonly [
30
30
  toStringDecimal<GenericValue>,
31
31
  toStringDecimal<GenericReference>
32
32
  ] extends readonly [
33
- `${infer InferredValueInteger extends DString.Number}.${infer InferredValueDecimals extends DString.Number}`,
34
- `${infer InferredReferenceInteger extends DString.Number}.${infer InferredReferenceDecimals extends DString.Number}`
33
+ `${infer InferredValueInteger extends DString.NumberInString}.${infer InferredValueDecimals extends DString.NumberInString}`,
34
+ `${infer InferredReferenceInteger extends DString.NumberInString}.${infer InferredReferenceDecimals extends DString.NumberInString}`
35
35
  ] ? DCommon.And<[
36
36
  DCommon.IsEqual<InferredValueDecimals, "0">,
37
37
  DCommon.IsEqual<InferredReferenceDecimals, "0">
@@ -52,8 +52,8 @@ type PrepareValues<GenericValue extends number, GenericReference extends number>
52
52
  `${infer InferredResultReference}`
53
53
  ] ? readonly [`${InferredResultValue}`, `${InferredResultReference}`] : never : never : readonly [InferredValueInteger, InferredReferenceInteger] : never;
54
54
  type ComputeIsGreater<GenericValue extends number, GenericReference extends number> = PrepareValues<GenericValue, GenericReference> extends readonly [
55
- infer InferredValue extends DString.Number,
56
- infer InferredReference extends DString.Number
55
+ infer InferredValue extends DString.NumberInString,
56
+ infer InferredReference extends DString.NumberInString
57
57
  ] ? DCommon.And<[
58
58
  DString.Includes<InferredValue, "-">,
59
59
  DCommon.Not<DString.Includes<InferredReference, "-">>
@@ -1,4 +1,4 @@
1
- import { AssignObjects } from './types';
1
+ import { Assign } from './types';
2
2
  import type * as DCommon from '../common';
3
- export declare function assign<GenericObject extends object, GenericValue extends Partial<Record<keyof GenericObject, unknown>> & DCommon.AnyObject>(value: GenericValue): (object: GenericObject) => AssignObjects<GenericObject, GenericValue>;
4
- export declare function assign<GenericObject extends object, GenericValue extends Partial<Record<keyof GenericObject, unknown>> & DCommon.AnyObject>(object: GenericObject, value: GenericValue): AssignObjects<GenericObject, GenericValue>;
3
+ export declare function assign<GenericObject extends object, GenericValue extends Partial<Record<keyof GenericObject, unknown>> & DCommon.AnyObject>(value: GenericValue): (object: GenericObject) => Assign<GenericObject, GenericValue>;
4
+ export declare function assign<GenericObject extends object, GenericValue extends Partial<Record<keyof GenericObject, unknown>> & DCommon.AnyObject>(object: GenericObject, value: GenericValue): Assign<GenericObject, GenericValue>;
@@ -0,0 +1,2 @@
1
+ import type * as DCommon from '../../common';
2
+ export type Assign<GenericFirstObject extends object, GenericSecondObject extends object> = DCommon.SimplifyTopLevel<Omit<GenericFirstObject, keyof GenericSecondObject> & GenericSecondObject>;
@@ -0,0 +1,3 @@
1
+ import { GetPropsWithValueExtends } from './getPropsWithValueExtends';
2
+ import type * as DCommon from '../../common';
3
+ export type ForbiddenUndefinedProps<GenericObject extends object> = DCommon.IsNever<GetPropsWithValueExtends<GenericObject, undefined>> extends true ? unknown : DCommon.ComputedTypeError<"Having \"undefined\" values for properties is not allowed.">;
@@ -1,13 +1,15 @@
1
- export type * from './assignObjects';
2
- export type * from './everyCombination';
1
+ export type * from './assign';
3
2
  export type * from './deepPartial';
4
3
  export type * from './deepReadonly';
5
4
  export type * from './deepRemoveReadonly';
6
5
  export type * from './deepRequired';
6
+ export type * from './everyCombination';
7
7
  export type * from './flatObject';
8
8
  export type * from './forbiddenKey';
9
+ export type * from './forbiddenUndefinedProps';
9
10
  export type * from './getPropsWithValue';
10
11
  export type * from './getPropsWithValueExtends';
12
+ export type * from './override';
11
13
  export type * from './partialKeys';
12
14
  export type * from './requireAtLeastOne';
13
15
  export type * from './requiredKeys';
@@ -0,0 +1,4 @@
1
+ import type * as DCommon from '../../common';
2
+ export type Override<GenericInput extends object, GenericNewValue extends Partial<GenericInput>> = DCommon.SimplifyTopLevel<{
3
+ [Prop in keyof GenericInput]: Prop extends keyof GenericNewValue ? GenericNewValue[Prop] extends infer InferredNewValue ? InferredNewValue extends undefined ? GenericInput[Prop] : InferredNewValue : never : GenericInput[Prop];
4
+ }>;
@@ -2,12 +2,12 @@ import type * as DCommon from '../../common';
2
2
  type CreateShape<GenericResult extends unknown, GenericProp extends keyof any> = GenericResult extends any ? {
3
3
  [RemapProp in GenericProp]: GenericResult;
4
4
  } : never;
5
- export type Split<GenericValue extends unknown, GenericMax extends number = 10, GenericAccumulator extends readonly never[] = readonly []> = GenericValue extends object ? GenericAccumulator["length"] extends GenericMax ? GenericValue : {
5
+ export type Split<GenericValue extends unknown, GenericMax extends number = 10, GenericAccumulator extends readonly never[] = readonly []> = GenericValue extends unknown ? DCommon.IsObject<GenericValue> extends true ? GenericAccumulator["length"] extends GenericMax ? GenericValue : {
6
6
  [Prop in keyof GenericValue]: DCommon.NeverCoalescing<CreateShape<Split<GenericValue[Prop], GenericMax, [
7
7
  ...GenericAccumulator,
8
8
  never
9
9
  ]>, Prop>, {
10
10
  [RemapProp in Prop]: never;
11
11
  }>;
12
- }[keyof GenericValue] : GenericValue;
12
+ }[keyof GenericValue] : GenericValue : never;
13
13
  export {};
@@ -1,13 +1,12 @@
1
- const require_fix = require("./fix.cjs");
2
1
  //#region scripts/path/computeRelative.ts
3
2
  function computeRelative(source, destination) {
4
- const sourceSegments = require_fix.fix(source).split("/");
5
- const destinationSegments = require_fix.fix(destination).split("/");
6
- let commonIndex = 1;
3
+ const sourceSegments = source === "/" ? [] : source.slice(1).split("/");
4
+ const destinationSegments = destination === "/" ? [] : destination.slice(1).split("/");
5
+ let commonIndex = 0;
7
6
  while (commonIndex < sourceSegments.length && commonIndex < destinationSegments.length && sourceSegments[commonIndex] === destinationSegments[commonIndex]) commonIndex++;
8
7
  let result = "";
9
- for (let index = commonIndex; index < sourceSegments.length; index++) result += result === "" ? ".." : "/..";
10
- for (let index = commonIndex; index < destinationSegments.length; index++) result += result === "" ? destinationSegments[index] : `/${destinationSegments[index]}`;
8
+ for (let index = commonIndex; index < sourceSegments.length; index++) result += result ? "/.." : "..";
9
+ for (let index = commonIndex; index < destinationSegments.length; index++) result += result ? `/${destinationSegments[index]}` : destinationSegments[index];
11
10
  return result || ".";
12
11
  }
13
12
  //#endregion
@@ -1,2 +1,2 @@
1
1
  import { Absolute, Path } from './constraints';
2
- export declare function computeRelative<GenericSourcePath extends string & Path & Absolute, GenericDestinationPath extends string & Path & Absolute>(source: GenericSourcePath, destination: GenericDestinationPath): string & Path;
2
+ export declare function computeRelative<GenericSourcePath extends string & Absolute, GenericDestinationPath extends string & Absolute>(source: GenericSourcePath, destination: GenericDestinationPath): string & Path;
@@ -1,13 +1,12 @@
1
- import { fix } from "./fix.mjs";
2
1
  //#region scripts/path/computeRelative.ts
3
2
  function computeRelative(source, destination) {
4
- const sourceSegments = fix(source).split("/");
5
- const destinationSegments = fix(destination).split("/");
6
- let commonIndex = 1;
3
+ const sourceSegments = source === "/" ? [] : source.slice(1).split("/");
4
+ const destinationSegments = destination === "/" ? [] : destination.slice(1).split("/");
5
+ let commonIndex = 0;
7
6
  while (commonIndex < sourceSegments.length && commonIndex < destinationSegments.length && sourceSegments[commonIndex] === destinationSegments[commonIndex]) commonIndex++;
8
7
  let result = "";
9
- for (let index = commonIndex; index < sourceSegments.length; index++) result += result === "" ? ".." : "/..";
10
- for (let index = commonIndex; index < destinationSegments.length; index++) result += result === "" ? destinationSegments[index] : `/${destinationSegments[index]}`;
8
+ for (let index = commonIndex; index < sourceSegments.length; index++) result += result ? "/.." : "..";
9
+ for (let index = commonIndex; index < destinationSegments.length; index++) result += result ? `/${destinationSegments[index]}` : destinationSegments[index];
11
10
  return result || ".";
12
11
  }
13
12
  //#endregion
@@ -1,3 +1,3 @@
1
1
  import type * as DCommon from '../../common';
2
- export interface Absolute extends DCommon.Constraint<"path" | "path-absolute"> {
2
+ export interface Absolute extends DCommon.Constraint<"path-absolute"> {
3
3
  }
@@ -1,2 +1,3 @@
1
- export type * from './path';
2
1
  export type * from './absolute';
2
+ export type * from './path';
3
+ export type * from './segment';
@@ -0,0 +1,3 @@
1
+ import type * as DCommon from '../../common';
2
+ export interface Segment extends DCommon.Constraint<"path-segment"> {
3
+ }
@@ -1,12 +1,12 @@
1
+ const require_isSegment = require("./isSegment.cjs");
1
2
  //#region scripts/path/getBaseName.ts
2
- const baseNameRegex = /\/?([^/]+)$/;
3
- const extensionNameRegex = /\.([^./]+)$/;
4
- const segmentTrailingRegex = /\/+$/;
3
+ const baseNameRegex = /([^/]+)$/;
4
+ const extensionNameRegex = /(?<!^)\.[^./]+$/;
5
5
  function getBaseName(path, params) {
6
- const fixedPath = path.replace(segmentTrailingRegex, "");
7
- const baseName = baseNameRegex.exec(fixedPath)?.[1] ?? "";
8
- if (params?.removeExtension) return baseName.replace(extensionNameRegex, "");
9
- return baseName;
6
+ const baseName = baseNameRegex.exec(path)?.[1];
7
+ if (baseName === void 0) return null;
8
+ const result = params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
9
+ return require_isSegment.isSegment(result) ? result : null;
10
10
  }
11
11
  //#endregion
12
12
  exports.getBaseName = getBaseName;
@@ -1,5 +1,5 @@
1
- import { Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  export interface GetBaseNameParams {
3
3
  removeExtension?: boolean;
4
4
  }
5
- export declare function getBaseName<GenericPath extends string & Path>(path: GenericPath, params?: GetBaseNameParams): string;
5
+ export declare function getBaseName<GenericPath extends string & (Path | Absolute | Segment)>(path: GenericPath, params?: GetBaseNameParams): (string & Segment) | null;
@@ -1,12 +1,12 @@
1
+ import { isSegment } from "./isSegment.mjs";
1
2
  //#region scripts/path/getBaseName.ts
2
- const baseNameRegex = /\/?([^/]+)$/;
3
- const extensionNameRegex = /\.([^./]+)$/;
4
- const segmentTrailingRegex = /\/+$/;
3
+ const baseNameRegex = /([^/]+)$/;
4
+ const extensionNameRegex = /(?<!^)\.[^./]+$/;
5
5
  function getBaseName(path, params) {
6
- const fixedPath = path.replace(segmentTrailingRegex, "");
7
- const baseName = baseNameRegex.exec(fixedPath)?.[1] ?? "";
8
- if (params?.removeExtension) return baseName.replace(extensionNameRegex, "");
9
- return baseName;
6
+ const baseName = baseNameRegex.exec(path)?.[1];
7
+ if (baseName === void 0) return null;
8
+ const result = params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
9
+ return isSegment(result) ? result : null;
10
10
  }
11
11
  //#endregion
12
12
  export { getBaseName };
@@ -1,9 +1,14 @@
1
+ const require_isSegment = require("./isSegment.cjs");
1
2
  //#region scripts/path/getExtensionName.ts
2
- const extensionNameRegex = /\.([^./]+)$/;
3
+ const basenameRegex = /([^/]+)$/;
3
4
  function getExtensionName(path, params) {
4
- const match = extensionNameRegex.exec(path);
5
- if (match) return params?.withDot ? `.${match[1]}` : match[1];
6
- return "";
5
+ const baseName = basenameRegex.exec(path)?.[1];
6
+ if (!baseName || baseName === "." || baseName === "..") return null;
7
+ const dotIndex = baseName.lastIndexOf(".");
8
+ if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
9
+ const extension = baseName.slice(dotIndex + 1);
10
+ const result = params?.withDot ? `.${extension}` : extension;
11
+ return require_isSegment.isSegment(result) ? result : null;
7
12
  }
8
13
  //#endregion
9
14
  exports.getExtensionName = getExtensionName;
@@ -1,5 +1,5 @@
1
- import { Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  export interface GetExtensionNameParams {
3
3
  withDot?: boolean;
4
4
  }
5
- export declare function getExtensionName<GenericPath extends string & Path>(path: GenericPath, params?: GetExtensionNameParams): string;
5
+ export declare function getExtensionName<GenericPath extends string & (Path | Absolute | Segment)>(path: GenericPath, params?: GetExtensionNameParams): (string & Segment) | null;
@@ -1,9 +1,14 @@
1
+ import { isSegment } from "./isSegment.mjs";
1
2
  //#region scripts/path/getExtensionName.ts
2
- const extensionNameRegex = /\.([^./]+)$/;
3
+ const basenameRegex = /([^/]+)$/;
3
4
  function getExtensionName(path, params) {
4
- const match = extensionNameRegex.exec(path);
5
- if (match) return params?.withDot ? `.${match[1]}` : match[1];
6
- return "";
5
+ const baseName = basenameRegex.exec(path)?.[1];
6
+ if (!baseName || baseName === "." || baseName === "..") return null;
7
+ const dotIndex = baseName.lastIndexOf(".");
8
+ if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
9
+ const extension = baseName.slice(dotIndex + 1);
10
+ const result = params?.withDot ? `.${extension}` : extension;
11
+ return isSegment(result) ? result : null;
7
12
  }
8
13
  //#endregion
9
14
  export { getExtensionName };
@@ -1,9 +1,14 @@
1
1
  //#region scripts/path/getParentFolderPath.ts
2
- const folderNameRegex = /([^]+)\/[^/]+\/?$/;
2
+ const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
3
+ const onlyParentSegmentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
3
4
  function getParentFolderPath(path) {
4
- const match = path.match(folderNameRegex);
5
- if (!match) return "";
6
- return match[1];
5
+ if (path === "/") return null;
6
+ if (path === ".") return "..";
7
+ if (onlyParentSegmentsRegex.test(path)) return `${path}/..`;
8
+ const parent = parentFolderPathRegex.exec(path)?.[1];
9
+ if (parent === void 0) return ".";
10
+ if (parent === "") return "/";
11
+ return parent;
7
12
  }
8
13
  //#endregion
9
14
  exports.getParentFolderPath = getParentFolderPath;
@@ -1,3 +1,2 @@
1
1
  import { Absolute, Path } from './constraints';
2
- export declare function getParentFolderPath<GenericPath extends string & Path & Absolute>(path: GenericPath): string;
3
- export declare function getParentFolderPath<GenericPath extends string & Path>(path: GenericPath): string;
2
+ export declare function getParentFolderPath<GenericPath extends string & (Path | Absolute)>(path: GenericPath): (string & Path) | null;
@@ -1,9 +1,14 @@
1
1
  //#region scripts/path/getParentFolderPath.ts
2
- const folderNameRegex = /([^]+)\/[^/]+\/?$/;
2
+ const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
3
+ const onlyParentSegmentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
3
4
  function getParentFolderPath(path) {
4
- const match = path.match(folderNameRegex);
5
- if (!match) return "";
6
- return match[1];
5
+ if (path === "/") return null;
6
+ if (path === ".") return "..";
7
+ if (onlyParentSegmentsRegex.test(path)) return `${path}/..`;
8
+ const parent = parentFolderPathRegex.exec(path)?.[1];
9
+ if (parent === void 0) return ".";
10
+ if (parent === "") return "/";
11
+ return parent;
7
12
  }
8
13
  //#endregion
9
14
  export { getParentFolderPath };
@@ -1,33 +1,36 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
- const require_fix = require("./fix.cjs");
3
2
  const require_computeRelative = require("./computeRelative.cjs");
3
+ const require_isSegment = require("./isSegment.cjs");
4
4
  const require_getBaseName = require("./getBaseName.cjs");
5
5
  const require_getExtensionName = require("./getExtensionName.cjs");
6
6
  const require_getParentFolderPath = require("./getParentFolderPath.cjs");
7
7
  const require_is = require("./is.cjs");
8
8
  const require_isAbsolute = require("./isAbsolute.cjs");
9
+ const require_normalize = require("./normalize.cjs");
9
10
  const require_resolveRelative = require("./resolveRelative.cjs");
10
11
  const require_resolveFrom = require("./resolveFrom.cjs");
11
12
  //#region scripts/path/index.ts
12
13
  var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
13
14
  computeRelative: () => require_computeRelative.computeRelative,
14
- fix: () => require_fix.fix,
15
15
  getBaseName: () => require_getBaseName.getBaseName,
16
16
  getExtensionName: () => require_getExtensionName.getExtensionName,
17
17
  getParentFolderPath: () => require_getParentFolderPath.getParentFolderPath,
18
18
  is: () => require_is.is,
19
19
  isAbsolute: () => require_isAbsolute.isAbsolute,
20
+ isSegment: () => require_isSegment.isSegment,
21
+ normalize: () => require_normalize.normalize,
20
22
  resolveFrom: () => require_resolveFrom.resolveFrom,
21
23
  resolveRelative: () => require_resolveRelative.resolveRelative
22
24
  });
23
25
  //#endregion
24
26
  exports.computeRelative = require_computeRelative.computeRelative;
25
- exports.fix = require_fix.fix;
26
27
  exports.getBaseName = require_getBaseName.getBaseName;
27
28
  exports.getExtensionName = require_getExtensionName.getExtensionName;
28
29
  exports.getParentFolderPath = require_getParentFolderPath.getParentFolderPath;
29
30
  exports.is = require_is.is;
30
31
  exports.isAbsolute = require_isAbsolute.isAbsolute;
32
+ exports.isSegment = require_isSegment.isSegment;
33
+ exports.normalize = require_normalize.normalize;
31
34
  Object.defineProperty(exports, "path_exports", {
32
35
  enumerable: true,
33
36
  get: function() {
@@ -1,11 +1,12 @@
1
- export type * from './constraints';
2
1
  export * from './computeRelative';
3
- export * from './fix';
2
+ export type * from './constraints';
4
3
  export * from './getBaseName';
5
4
  export * from './getExtensionName';
6
5
  export * from './getParentFolderPath';
7
6
  export * from './is';
8
7
  export * from './isAbsolute';
8
+ export * from './isSegment';
9
+ export * from './normalize';
9
10
  export * from './resolveFrom';
10
11
  export * from './resolveRelative';
11
12
  export type * from './types';
@@ -1,24 +1,26 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
- import { fix } from "./fix.mjs";
3
2
  import { computeRelative } from "./computeRelative.mjs";
3
+ import { isSegment } from "./isSegment.mjs";
4
4
  import { getBaseName } from "./getBaseName.mjs";
5
5
  import { getExtensionName } from "./getExtensionName.mjs";
6
6
  import { getParentFolderPath } from "./getParentFolderPath.mjs";
7
7
  import { is } from "./is.mjs";
8
8
  import { isAbsolute } from "./isAbsolute.mjs";
9
+ import { normalize } from "./normalize.mjs";
9
10
  import { resolveRelative } from "./resolveRelative.mjs";
10
11
  import { resolveFrom } from "./resolveFrom.mjs";
11
12
  //#region scripts/path/index.ts
12
13
  var path_exports = /* @__PURE__ */ __exportAll({
13
14
  computeRelative: () => computeRelative,
14
- fix: () => fix,
15
15
  getBaseName: () => getBaseName,
16
16
  getExtensionName: () => getExtensionName,
17
17
  getParentFolderPath: () => getParentFolderPath,
18
18
  is: () => is,
19
19
  isAbsolute: () => isAbsolute,
20
+ isSegment: () => isSegment,
21
+ normalize: () => normalize,
20
22
  resolveFrom: () => resolveFrom,
21
23
  resolveRelative: () => resolveRelative
22
24
  });
23
25
  //#endregion
24
- export { computeRelative, fix, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, path_exports, resolveFrom, resolveRelative };
26
+ export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
package/dist/path/is.cjs CHANGED
@@ -1,8 +1,13 @@
1
1
  //#region scripts/path/is.ts
2
- const nullCharacter = String.fromCharCode(0);
3
- const posixPathRegex = /^(?:\/|\/?[^/]+(?:\/[^/]+)*(?:\/+)?)$/;
4
- function is(path) {
5
- return !path.includes(nullCharacter) && posixPathRegex.test(path);
2
+ const dotSegmentRegExp = /(^|\/)\.(\/|$)/;
3
+ const endsWithSlash = /[^]+\/$/;
4
+ const dotDotRegExp = /(^|\/)\.\.(\/|$)/;
5
+ const invalidDotDotRegExp = /(^|\/)(?!\.\.(?:\/|$))[^/]+\/\.\.(?:\/|$)/;
6
+ function is(value) {
7
+ if (value === ".") return true;
8
+ if (value === "" || value.includes("\0") || value.includes("//") || endsWithSlash.test(value) || dotSegmentRegExp.test(value)) return false;
9
+ if (value.startsWith("/")) return !dotDotRegExp.test(value);
10
+ return !invalidDotDotRegExp.test(value);
6
11
  }
7
12
  //#endregion
8
13
  exports.is = is;
package/dist/path/is.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- import { Path } from './constraints';
2
- export declare function is<GenericPath extends string>(path: GenericPath): path is GenericPath & Path;
1
+ import { Absolute, Path } from './constraints';
2
+ import { IsLiteralPath } from './types';
3
+ import type * as DString from '../string';
4
+ export declare function is<GenericPath extends string>(value: GenericPath): value is (GenericPath extends (Path | Absolute) ? GenericPath : IsLiteralPath<GenericPath> extends true ? GenericPath : DString.IsLiteral<GenericPath> extends true ? never : GenericPath & Path);
package/dist/path/is.mjs CHANGED
@@ -1,8 +1,13 @@
1
1
  //#region scripts/path/is.ts
2
- const nullCharacter = String.fromCharCode(0);
3
- const posixPathRegex = /^(?:\/|\/?[^/]+(?:\/[^/]+)*(?:\/+)?)$/;
4
- function is(path) {
5
- return !path.includes(nullCharacter) && posixPathRegex.test(path);
2
+ const dotSegmentRegExp = /(^|\/)\.(\/|$)/;
3
+ const endsWithSlash = /[^]+\/$/;
4
+ const dotDotRegExp = /(^|\/)\.\.(\/|$)/;
5
+ const invalidDotDotRegExp = /(^|\/)(?!\.\.(?:\/|$))[^/]+\/\.\.(?:\/|$)/;
6
+ function is(value) {
7
+ if (value === ".") return true;
8
+ if (value === "" || value.includes("\0") || value.includes("//") || endsWithSlash.test(value) || dotSegmentRegExp.test(value)) return false;
9
+ if (value.startsWith("/")) return !dotDotRegExp.test(value);
10
+ return !invalidDotDotRegExp.test(value);
6
11
  }
7
12
  //#endregion
8
13
  export { is };
@@ -1,9 +1,7 @@
1
+ const require_is = require("./is.cjs");
1
2
  //#region scripts/path/isAbsolute.ts
2
- const containBackPathRegex = /(^|\/)\.\.(?=\/|$)/;
3
- const nullCharacter = String.fromCharCode(0);
4
- const posixAbsolutePathRegex = /^\/(?:$|[^/]+(?:\/[^/]+)*(?:\/+)?$)/;
5
- function isAbsolute(path) {
6
- return !path.includes(nullCharacter) && posixAbsolutePathRegex.test(path) && !containBackPathRegex.test(path);
3
+ function isAbsolute(value) {
4
+ return value.startsWith("/") && require_is.is(value);
7
5
  }
8
6
  //#endregion
9
7
  exports.isAbsolute = isAbsolute;
@@ -1,2 +1,4 @@
1
- import { Absolute, Path } from './constraints';
2
- export declare function isAbsolute<GenericPath extends string>(path: GenericPath): path is GenericPath & Path & Absolute;
1
+ import { Absolute } from './constraints';
2
+ import { IsLiteralAbsolutePath } from './types';
3
+ import type * as DString from '../string';
4
+ export declare function isAbsolute<GenericPath extends string>(value: GenericPath): value is (GenericPath extends Absolute ? GenericPath : IsLiteralAbsolutePath<GenericPath> extends true ? GenericPath : DString.IsLiteral<GenericPath> extends true ? never : GenericPath & Absolute);
@@ -1,9 +1,7 @@
1
+ import { is } from "./is.mjs";
1
2
  //#region scripts/path/isAbsolute.ts
2
- const containBackPathRegex = /(^|\/)\.\.(?=\/|$)/;
3
- const nullCharacter = String.fromCharCode(0);
4
- const posixAbsolutePathRegex = /^\/(?:$|[^/]+(?:\/[^/]+)*(?:\/+)?$)/;
5
- function isAbsolute(path) {
6
- return !path.includes(nullCharacter) && posixAbsolutePathRegex.test(path) && !containBackPathRegex.test(path);
3
+ function isAbsolute(value) {
4
+ return value.startsWith("/") && is(value);
7
5
  }
8
6
  //#endregion
9
7
  export { isAbsolute };
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/isSegment.ts
2
+ function isSegment(value) {
3
+ return value !== "" && value !== "." && value !== ".." && !value.includes("/") && !value.includes("\0");
4
+ }
5
+ //#endregion
6
+ exports.isSegment = isSegment;
@@ -0,0 +1,4 @@
1
+ import { Segment } from './constraints';
2
+ import { IsLiteralSegmentPath } from './types';
3
+ import type * as DString from '../string';
4
+ export declare function isSegment<GenericValue extends string>(value: GenericValue): value is (GenericValue extends Segment ? GenericValue : IsLiteralSegmentPath<GenericValue> extends true ? GenericValue : DString.IsLiteral<GenericValue> extends true ? never : GenericValue & Segment);
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/isSegment.ts
2
+ function isSegment(value) {
3
+ return value !== "" && value !== "." && value !== ".." && !value.includes("/") && !value.includes("\0");
4
+ }
5
+ //#endregion
6
+ export { isSegment };
@@ -0,0 +1,18 @@
1
+ //#region scripts/path/normalize.ts
2
+ function normalize(path) {
3
+ if (path.includes("\0")) return null;
4
+ const absolute = path.startsWith("/");
5
+ const result = [];
6
+ for (const segment of path.split("/")) {
7
+ if (segment === "" || segment === ".") continue;
8
+ if (segment === "..") {
9
+ if (result.length !== 0 && result.at(-1) !== "..") result.pop();
10
+ else if (!absolute) result.push("..");
11
+ continue;
12
+ }
13
+ result.push(segment);
14
+ }
15
+ return absolute ? `/${result.join("/")}` : result.join("/") || ".";
16
+ }
17
+ //#endregion
18
+ exports.normalize = normalize;
@@ -0,0 +1,2 @@
1
+ import { Path } from './constraints';
2
+ export declare function normalize(path: string): (string & Path) | null;
@@ -0,0 +1,18 @@
1
+ //#region scripts/path/normalize.ts
2
+ function normalize(path) {
3
+ if (path.includes("\0")) return null;
4
+ const absolute = path.startsWith("/");
5
+ const result = [];
6
+ for (const segment of path.split("/")) {
7
+ if (segment === "" || segment === ".") continue;
8
+ if (segment === "..") {
9
+ if (result.length !== 0 && result.at(-1) !== "..") result.pop();
10
+ else if (!absolute) result.push("..");
11
+ continue;
12
+ }
13
+ result.push(segment);
14
+ }
15
+ return absolute ? `/${result.join("/")}` : result.join("/") || ".";
16
+ }
17
+ //#endregion
18
+ export { normalize };
@@ -1,10 +1,9 @@
1
1
  const require_resolveRelative = require("./resolveRelative.cjs");
2
2
  //#region scripts/path/resolveFrom.ts
3
- const aboveRootRegex = /^(?:\.\.\/)+/;
4
- function resolveFrom(origin, segments) {
5
- const result = require_resolveRelative.resolveRelative([origin, ...segments]);
6
- if (!result.startsWith("../")) return result;
7
- return `/${result.replace(aboveRootRegex, "")}`;
3
+ function resolveFrom(origin, segments, params) {
4
+ const resultRelative = require_resolveRelative.resolveRelative(segments);
5
+ if (params?.stayInOrigin && (resultRelative === ".." || resultRelative.startsWith("../") || resultRelative.startsWith("/"))) return null;
6
+ return require_resolveRelative.resolveRelative([origin, resultRelative]);
8
7
  }
9
8
  //#endregion
10
9
  exports.resolveFrom = resolveFrom;
@@ -1,3 +1,11 @@
1
- import { Absolute, Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  import { RequireSegments } from './types';
3
- export declare function resolveFrom<const GenericSegments extends readonly (string & Path)[]>(origin: string & Path & Absolute, segments: GenericSegments & RequireSegments<GenericSegments>): string & Path & Absolute;
3
+ import type * as DCommon from '../common';
4
+ export interface ResolveFromParams {
5
+ stayInOrigin?: boolean;
6
+ }
7
+ export declare function resolveFrom<const GenericSegments extends readonly (string & (Path | Absolute | Segment))[], const GenericParams extends ResolveFromParams>(origin: string & Absolute, segments: GenericSegments & RequireSegments<GenericSegments>, params?: GenericParams): (string & Absolute) | (DCommon.BreakGenericLink<DCommon.Or<[
8
+ DCommon.IsEqual<GenericParams["stayInOrigin"], ResolveFromParams["stayInOrigin"]>,
9
+ DCommon.IsEqual<GenericParams["stayInOrigin"], false>,
10
+ DCommon.IsEqual<GenericParams["stayInOrigin"], unknown>
11
+ ]> extends true ? never : null>);
@@ -1,10 +1,9 @@
1
1
  import { resolveRelative } from "./resolveRelative.mjs";
2
2
  //#region scripts/path/resolveFrom.ts
3
- const aboveRootRegex = /^(?:\.\.\/)+/;
4
- function resolveFrom(origin, segments) {
5
- const result = resolveRelative([origin, ...segments]);
6
- if (!result.startsWith("../")) return result;
7
- return `/${result.replace(aboveRootRegex, "")}`;
3
+ function resolveFrom(origin, segments, params) {
4
+ const resultRelative = resolveRelative(segments);
5
+ if (params?.stayInOrigin && (resultRelative === ".." || resultRelative.startsWith("../") || resultRelative.startsWith("/"))) return null;
6
+ return resolveRelative([origin, resultRelative]);
8
7
  }
9
8
  //#endregion
10
9
  export { resolveFrom };