@duplojs/utils 1.1.7 → 1.1.9

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 (313) hide show
  1. package/dist/array/reduce.cjs +1 -0
  2. package/dist/array/reduce.mjs +1 -0
  3. package/dist/array/reduceRight.cjs +1 -0
  4. package/dist/array/reduceRight.mjs +1 -0
  5. package/dist/common/globalStore.cjs +21 -0
  6. package/dist/common/globalStore.d.ts +7 -0
  7. package/dist/common/globalStore.mjs +19 -0
  8. package/dist/common/index.d.ts +1 -0
  9. package/dist/common/instanceOf.cjs +1 -0
  10. package/dist/common/instanceOf.mjs +1 -0
  11. package/dist/common/kind.cjs +12 -3
  12. package/dist/common/kind.d.ts +12 -3
  13. package/dist/common/kind.mjs +11 -4
  14. package/dist/common/wrapValue.cjs +4 -0
  15. package/dist/common/wrapValue.d.ts +1 -0
  16. package/dist/common/wrapValue.mjs +4 -1
  17. package/dist/dataParser/base.cjs +4 -3
  18. package/dist/dataParser/base.d.ts +2 -2
  19. package/dist/dataParser/base.mjs +4 -3
  20. package/dist/dataParser/baseExtended.cjs +3 -2
  21. package/dist/dataParser/baseExtended.d.ts +1 -1
  22. package/dist/dataParser/baseExtended.mjs +3 -2
  23. package/dist/dataParser/error.cjs +4 -4
  24. package/dist/dataParser/error.d.ts +3 -3
  25. package/dist/dataParser/error.mjs +4 -4
  26. package/dist/dataParser/extended/array.cjs +1 -0
  27. package/dist/dataParser/extended/array.mjs +1 -0
  28. package/dist/dataParser/extended/bigint.cjs +1 -0
  29. package/dist/dataParser/extended/bigint.mjs +1 -0
  30. package/dist/dataParser/extended/boolean.cjs +1 -0
  31. package/dist/dataParser/extended/boolean.mjs +1 -0
  32. package/dist/dataParser/extended/coerce/bigint.cjs +1 -0
  33. package/dist/dataParser/extended/coerce/bigint.mjs +1 -0
  34. package/dist/dataParser/extended/coerce/boolean.cjs +1 -0
  35. package/dist/dataParser/extended/coerce/boolean.mjs +1 -0
  36. package/dist/dataParser/extended/coerce/empty.cjs +1 -0
  37. package/dist/dataParser/extended/coerce/empty.mjs +1 -0
  38. package/dist/dataParser/extended/coerce/nil.cjs +1 -0
  39. package/dist/dataParser/extended/coerce/nil.mjs +1 -0
  40. package/dist/dataParser/extended/coerce/number.cjs +1 -0
  41. package/dist/dataParser/extended/coerce/number.mjs +1 -0
  42. package/dist/dataParser/extended/coerce/string.cjs +1 -0
  43. package/dist/dataParser/extended/coerce/string.mjs +1 -0
  44. package/dist/dataParser/extended/empty.cjs +1 -0
  45. package/dist/dataParser/extended/empty.mjs +1 -0
  46. package/dist/dataParser/extended/lazy.cjs +1 -0
  47. package/dist/dataParser/extended/lazy.mjs +1 -0
  48. package/dist/dataParser/extended/literal.cjs +1 -0
  49. package/dist/dataParser/extended/literal.mjs +1 -0
  50. package/dist/dataParser/extended/nil.cjs +1 -0
  51. package/dist/dataParser/extended/nil.mjs +1 -0
  52. package/dist/dataParser/extended/nullable.cjs +1 -0
  53. package/dist/dataParser/extended/nullable.mjs +1 -0
  54. package/dist/dataParser/extended/number.cjs +1 -0
  55. package/dist/dataParser/extended/number.mjs +1 -0
  56. package/dist/dataParser/extended/object.cjs +1 -0
  57. package/dist/dataParser/extended/object.mjs +1 -0
  58. package/dist/dataParser/extended/optional.cjs +1 -0
  59. package/dist/dataParser/extended/optional.mjs +1 -0
  60. package/dist/dataParser/extended/pipe.cjs +1 -0
  61. package/dist/dataParser/extended/pipe.mjs +1 -0
  62. package/dist/dataParser/extended/record.cjs +1 -0
  63. package/dist/dataParser/extended/record.mjs +1 -0
  64. package/dist/dataParser/extended/string.cjs +1 -0
  65. package/dist/dataParser/extended/string.mjs +1 -0
  66. package/dist/dataParser/extended/templateLiteral.cjs +1 -0
  67. package/dist/dataParser/extended/templateLiteral.mjs +1 -0
  68. package/dist/dataParser/extended/transform.cjs +1 -0
  69. package/dist/dataParser/extended/transform.mjs +1 -0
  70. package/dist/dataParser/extended/tuple.cjs +1 -0
  71. package/dist/dataParser/extended/tuple.mjs +1 -0
  72. package/dist/dataParser/extended/union.cjs +1 -0
  73. package/dist/dataParser/extended/union.mjs +1 -0
  74. package/dist/dataParser/extended/unknown.cjs +1 -0
  75. package/dist/dataParser/extended/unknown.mjs +1 -0
  76. package/dist/dataParser/kind.cjs +10 -0
  77. package/dist/dataParser/kind.d.ts +1 -0
  78. package/dist/dataParser/kind.mjs +8 -0
  79. package/dist/dataParser/parsers/array/checkers/max.cjs +2 -2
  80. package/dist/dataParser/parsers/array/checkers/max.d.ts +1 -1
  81. package/dist/dataParser/parsers/array/checkers/max.mjs +2 -2
  82. package/dist/dataParser/parsers/array/checkers/min.cjs +2 -2
  83. package/dist/dataParser/parsers/array/checkers/min.d.ts +1 -1
  84. package/dist/dataParser/parsers/array/checkers/min.mjs +2 -2
  85. package/dist/dataParser/parsers/array/index.cjs +2 -2
  86. package/dist/dataParser/parsers/array/index.d.ts +1 -1
  87. package/dist/dataParser/parsers/array/index.mjs +2 -2
  88. package/dist/dataParser/parsers/bigint/checkers/max.cjs +2 -2
  89. package/dist/dataParser/parsers/bigint/checkers/max.d.ts +1 -1
  90. package/dist/dataParser/parsers/bigint/checkers/max.mjs +2 -2
  91. package/dist/dataParser/parsers/bigint/checkers/min.cjs +2 -2
  92. package/dist/dataParser/parsers/bigint/checkers/min.d.ts +1 -1
  93. package/dist/dataParser/parsers/bigint/checkers/min.mjs +2 -2
  94. package/dist/dataParser/parsers/bigint/index.cjs +2 -2
  95. package/dist/dataParser/parsers/bigint/index.d.ts +1 -1
  96. package/dist/dataParser/parsers/bigint/index.mjs +2 -2
  97. package/dist/dataParser/parsers/boolean.cjs +2 -2
  98. package/dist/dataParser/parsers/boolean.d.ts +1 -1
  99. package/dist/dataParser/parsers/boolean.mjs +2 -2
  100. package/dist/dataParser/parsers/coerce/bigint.cjs +1 -0
  101. package/dist/dataParser/parsers/coerce/bigint.mjs +1 -0
  102. package/dist/dataParser/parsers/coerce/boolean.cjs +1 -0
  103. package/dist/dataParser/parsers/coerce/boolean.mjs +1 -0
  104. package/dist/dataParser/parsers/coerce/empty.cjs +1 -0
  105. package/dist/dataParser/parsers/coerce/empty.mjs +1 -0
  106. package/dist/dataParser/parsers/coerce/nil.cjs +1 -0
  107. package/dist/dataParser/parsers/coerce/nil.mjs +1 -0
  108. package/dist/dataParser/parsers/coerce/number.cjs +1 -0
  109. package/dist/dataParser/parsers/coerce/number.mjs +1 -0
  110. package/dist/dataParser/parsers/coerce/string.cjs +1 -0
  111. package/dist/dataParser/parsers/coerce/string.mjs +1 -0
  112. package/dist/dataParser/parsers/empty.cjs +2 -2
  113. package/dist/dataParser/parsers/empty.d.ts +1 -1
  114. package/dist/dataParser/parsers/empty.mjs +2 -2
  115. package/dist/dataParser/parsers/lazy.cjs +2 -2
  116. package/dist/dataParser/parsers/lazy.d.ts +1 -1
  117. package/dist/dataParser/parsers/lazy.mjs +2 -2
  118. package/dist/dataParser/parsers/literal.cjs +4 -3
  119. package/dist/dataParser/parsers/literal.d.ts +1 -1
  120. package/dist/dataParser/parsers/literal.mjs +4 -3
  121. package/dist/dataParser/parsers/nil.cjs +2 -2
  122. package/dist/dataParser/parsers/nil.d.ts +1 -1
  123. package/dist/dataParser/parsers/nil.mjs +2 -2
  124. package/dist/dataParser/parsers/nullable.cjs +2 -2
  125. package/dist/dataParser/parsers/nullable.d.ts +1 -1
  126. package/dist/dataParser/parsers/nullable.mjs +2 -2
  127. package/dist/dataParser/parsers/number/checkers/int.cjs +2 -2
  128. package/dist/dataParser/parsers/number/checkers/int.d.ts +1 -1
  129. package/dist/dataParser/parsers/number/checkers/int.mjs +2 -2
  130. package/dist/dataParser/parsers/number/checkers/max.cjs +2 -2
  131. package/dist/dataParser/parsers/number/checkers/max.d.ts +1 -1
  132. package/dist/dataParser/parsers/number/checkers/max.mjs +2 -2
  133. package/dist/dataParser/parsers/number/checkers/min.cjs +2 -2
  134. package/dist/dataParser/parsers/number/checkers/min.d.ts +1 -1
  135. package/dist/dataParser/parsers/number/checkers/min.mjs +2 -2
  136. package/dist/dataParser/parsers/number/index.cjs +2 -2
  137. package/dist/dataParser/parsers/number/index.d.ts +1 -1
  138. package/dist/dataParser/parsers/number/index.mjs +2 -2
  139. package/dist/dataParser/parsers/object.cjs +3 -2
  140. package/dist/dataParser/parsers/object.d.ts +1 -1
  141. package/dist/dataParser/parsers/object.mjs +3 -2
  142. package/dist/dataParser/parsers/optional.cjs +2 -2
  143. package/dist/dataParser/parsers/optional.d.ts +1 -1
  144. package/dist/dataParser/parsers/optional.mjs +2 -2
  145. package/dist/dataParser/parsers/pipe.cjs +2 -2
  146. package/dist/dataParser/parsers/pipe.d.ts +1 -1
  147. package/dist/dataParser/parsers/pipe.mjs +2 -2
  148. package/dist/dataParser/parsers/record.cjs +2 -2
  149. package/dist/dataParser/parsers/record.d.ts +1 -1
  150. package/dist/dataParser/parsers/record.mjs +2 -2
  151. package/dist/dataParser/parsers/string/checkers/email.cjs +2 -2
  152. package/dist/dataParser/parsers/string/checkers/email.d.ts +1 -1
  153. package/dist/dataParser/parsers/string/checkers/email.mjs +2 -2
  154. package/dist/dataParser/parsers/string/checkers/max.cjs +2 -2
  155. package/dist/dataParser/parsers/string/checkers/max.d.ts +1 -1
  156. package/dist/dataParser/parsers/string/checkers/max.mjs +2 -2
  157. package/dist/dataParser/parsers/string/checkers/min.cjs +2 -2
  158. package/dist/dataParser/parsers/string/checkers/min.d.ts +1 -1
  159. package/dist/dataParser/parsers/string/checkers/min.mjs +2 -2
  160. package/dist/dataParser/parsers/string/checkers/regex.cjs +2 -2
  161. package/dist/dataParser/parsers/string/checkers/regex.d.ts +1 -1
  162. package/dist/dataParser/parsers/string/checkers/regex.mjs +2 -2
  163. package/dist/dataParser/parsers/string/checkers/url.cjs +2 -2
  164. package/dist/dataParser/parsers/string/checkers/url.d.ts +1 -1
  165. package/dist/dataParser/parsers/string/checkers/url.mjs +2 -2
  166. package/dist/dataParser/parsers/string/index.cjs +2 -2
  167. package/dist/dataParser/parsers/string/index.d.ts +1 -1
  168. package/dist/dataParser/parsers/string/index.mjs +2 -2
  169. package/dist/dataParser/parsers/templateLiteral.cjs +3 -2
  170. package/dist/dataParser/parsers/templateLiteral.d.ts +1 -1
  171. package/dist/dataParser/parsers/templateLiteral.mjs +3 -2
  172. package/dist/dataParser/parsers/transform.cjs +2 -2
  173. package/dist/dataParser/parsers/transform.d.ts +1 -1
  174. package/dist/dataParser/parsers/transform.mjs +2 -2
  175. package/dist/dataParser/parsers/tuple.cjs +2 -2
  176. package/dist/dataParser/parsers/tuple.d.ts +1 -1
  177. package/dist/dataParser/parsers/tuple.mjs +2 -2
  178. package/dist/dataParser/parsers/union.cjs +2 -2
  179. package/dist/dataParser/parsers/union.d.ts +1 -1
  180. package/dist/dataParser/parsers/union.mjs +2 -2
  181. package/dist/dataParser/parsers/unknown.cjs +2 -2
  182. package/dist/dataParser/parsers/unknown.d.ts +1 -1
  183. package/dist/dataParser/parsers/unknown.mjs +2 -2
  184. package/dist/either/bool/base.cjs +2 -2
  185. package/dist/either/bool/base.d.ts +1 -1
  186. package/dist/either/bool/base.mjs +2 -2
  187. package/dist/either/bool/falsy.cjs +5 -4
  188. package/dist/either/bool/falsy.d.ts +4 -4
  189. package/dist/either/bool/falsy.mjs +5 -4
  190. package/dist/either/bool/truthy.cjs +4 -3
  191. package/dist/either/bool/truthy.d.ts +5 -5
  192. package/dist/either/bool/truthy.mjs +4 -3
  193. package/dist/either/future/base.cjs +2 -2
  194. package/dist/either/future/base.d.ts +1 -1
  195. package/dist/either/future/base.mjs +2 -2
  196. package/dist/either/future/create.cjs +1 -0
  197. package/dist/either/future/create.mjs +1 -0
  198. package/dist/either/future/error.cjs +3 -2
  199. package/dist/either/future/error.d.ts +1 -1
  200. package/dist/either/future/error.mjs +3 -2
  201. package/dist/either/future/success.cjs +3 -2
  202. package/dist/either/future/success.d.ts +2 -2
  203. package/dist/either/future/success.mjs +3 -2
  204. package/dist/either/hasInformation.cjs +3 -3
  205. package/dist/either/hasInformation.d.ts +1 -1
  206. package/dist/either/hasInformation.mjs +1 -1
  207. package/dist/either/index.cjs +3 -2
  208. package/dist/either/index.d.ts +1 -1
  209. package/dist/either/index.mjs +1 -1
  210. package/dist/either/kind.cjs +12 -0
  211. package/dist/either/kind.d.ts +2 -0
  212. package/dist/either/kind.mjs +9 -0
  213. package/dist/either/left/create.cjs +3 -4
  214. package/dist/either/left/create.d.ts +2 -2
  215. package/dist/either/left/create.mjs +2 -3
  216. package/dist/either/left/error.cjs +2 -2
  217. package/dist/either/left/error.d.ts +1 -1
  218. package/dist/either/left/error.mjs +2 -2
  219. package/dist/either/left/fail.cjs +2 -2
  220. package/dist/either/left/fail.d.ts +1 -1
  221. package/dist/either/left/fail.mjs +2 -2
  222. package/dist/either/left/is.cjs +2 -2
  223. package/dist/either/left/is.mjs +1 -1
  224. package/dist/either/left/when.cjs +1 -0
  225. package/dist/either/left/when.mjs +1 -0
  226. package/dist/either/nullable/base.cjs +2 -2
  227. package/dist/either/nullable/base.d.ts +1 -1
  228. package/dist/either/nullable/base.mjs +2 -2
  229. package/dist/either/nullable/empty.cjs +3 -2
  230. package/dist/either/nullable/empty.d.ts +1 -1
  231. package/dist/either/nullable/empty.mjs +3 -2
  232. package/dist/either/nullable/filled.cjs +3 -2
  233. package/dist/either/nullable/filled.d.ts +1 -1
  234. package/dist/either/nullable/filled.mjs +3 -2
  235. package/dist/either/nullish/base.cjs +2 -2
  236. package/dist/either/nullish/base.d.ts +1 -1
  237. package/dist/either/nullish/base.mjs +2 -2
  238. package/dist/either/nullish/empty.cjs +3 -2
  239. package/dist/either/nullish/empty.d.ts +2 -2
  240. package/dist/either/nullish/empty.mjs +3 -2
  241. package/dist/either/nullish/filled.cjs +4 -3
  242. package/dist/either/nullish/filled.d.ts +1 -1
  243. package/dist/either/nullish/filled.mjs +4 -3
  244. package/dist/either/optional/base.cjs +2 -2
  245. package/dist/either/optional/base.d.ts +1 -1
  246. package/dist/either/optional/base.mjs +2 -2
  247. package/dist/either/optional/empty.cjs +5 -4
  248. package/dist/either/optional/empty.d.ts +3 -3
  249. package/dist/either/optional/empty.mjs +5 -4
  250. package/dist/either/optional/filled.cjs +5 -4
  251. package/dist/either/optional/filled.d.ts +3 -3
  252. package/dist/either/optional/filled.mjs +5 -4
  253. package/dist/either/right/asyncPipe.cjs +1 -0
  254. package/dist/either/right/asyncPipe.mjs +1 -0
  255. package/dist/either/right/create.cjs +3 -4
  256. package/dist/either/right/create.d.ts +2 -2
  257. package/dist/either/right/create.mjs +2 -3
  258. package/dist/either/right/is.cjs +2 -2
  259. package/dist/either/right/is.mjs +1 -1
  260. package/dist/either/right/ok.cjs +2 -2
  261. package/dist/either/right/ok.d.ts +1 -1
  262. package/dist/either/right/ok.mjs +2 -2
  263. package/dist/either/right/pipe.cjs +1 -0
  264. package/dist/either/right/pipe.mjs +1 -0
  265. package/dist/either/right/success.cjs +2 -2
  266. package/dist/either/right/success.d.ts +2 -2
  267. package/dist/either/right/success.mjs +2 -2
  268. package/dist/either/right/when.cjs +1 -0
  269. package/dist/either/right/when.mjs +1 -0
  270. package/dist/either/whenHasInformation.cjs +3 -2
  271. package/dist/either/whenHasInformation.d.ts +1 -1
  272. package/dist/either/whenHasInformation.mjs +2 -1
  273. package/dist/generator/asyncReduce.cjs +1 -0
  274. package/dist/generator/asyncReduce.mjs +1 -0
  275. package/dist/generator/reduce.cjs +1 -0
  276. package/dist/generator/reduce.mjs +1 -0
  277. package/dist/index.cjs +5 -0
  278. package/dist/index.mjs +3 -2
  279. package/dist/number/greater.cjs +12 -0
  280. package/dist/number/greater.d.ts +2 -0
  281. package/dist/number/greater.mjs +10 -0
  282. package/dist/number/greaterThan.cjs +12 -0
  283. package/dist/number/greaterThan.d.ts +2 -0
  284. package/dist/number/greaterThan.mjs +10 -0
  285. package/dist/number/index.cjs +8 -0
  286. package/dist/number/index.d.ts +4 -0
  287. package/dist/number/index.mjs +4 -0
  288. package/dist/number/less.cjs +12 -0
  289. package/dist/number/less.d.ts +2 -0
  290. package/dist/number/less.mjs +10 -0
  291. package/dist/number/lessThan.cjs +12 -0
  292. package/dist/number/lessThan.d.ts +2 -0
  293. package/dist/number/lessThan.mjs +10 -0
  294. package/dist/object/deepDiscriminate.cjs +1 -0
  295. package/dist/object/deepDiscriminate.mjs +1 -0
  296. package/dist/object/discriminate.cjs +1 -0
  297. package/dist/object/discriminate.mjs +1 -0
  298. package/dist/object/entries.cjs +3 -1
  299. package/dist/object/entries.mjs +4 -2
  300. package/dist/object/keys.cjs +3 -1
  301. package/dist/object/keys.mjs +4 -2
  302. package/dist/pattern/exhaustive.cjs +1 -0
  303. package/dist/pattern/exhaustive.mjs +1 -0
  304. package/dist/pattern/otherwise.cjs +1 -0
  305. package/dist/pattern/otherwise.mjs +1 -0
  306. package/dist/pattern/result.cjs +1 -0
  307. package/dist/pattern/result.mjs +1 -0
  308. package/dist/string/types/forbiddenString.d.ts +8 -0
  309. package/dist/string/types/index.d.ts +1 -0
  310. package/package.json +1 -1
  311. package/dist/either/base.cjs +0 -7
  312. package/dist/either/base.d.ts +0 -1
  313. package/dist/either/base.mjs +0 -5
@@ -1,7 +1,7 @@
1
1
  import { type Kind } from "../../common/kind";
2
2
  import { type WrappedValue } from "../../common/wrapValue";
3
- import { eitherInformationKind } from "../base";
4
- export declare const eitherRightKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"either-right", unknown>>;
3
+ import { eitherInformationKind } from "../kind";
4
+ export declare const eitherRightKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/right", unknown>>;
5
5
  type _EitherRight<GenericInformation extends string = string, GenericValue extends unknown = unknown> = (Kind<typeof eitherRightKind.definition> & Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue<GenericValue>);
6
6
  export interface EitherRight<GenericInformation extends string = string, GenericValue extends unknown = unknown> extends _EitherRight<GenericInformation, GenericValue> {
7
7
  }
@@ -1,8 +1,7 @@
1
- import { createKind } from '../../common/kind.mjs';
2
1
  import { wrapValue } from '../../common/wrapValue.mjs';
3
- import { eitherInformationKind } from '../base.mjs';
2
+ import { createEitherKind, eitherInformationKind } from '../kind.mjs';
4
3
 
5
- const eitherRightKind = createKind("either-right");
4
+ const eitherRightKind = createEitherKind("right");
6
5
  function right(information, value = undefined) {
7
6
  return eitherRightKind.setTo(eitherInformationKind.setTo(wrapValue(value), information));
8
7
  }
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var base = require('../base.cjs');
3
+ var kind = require('../kind.cjs');
4
4
  var create = require('./create.cjs');
5
5
  var wrapValue = require('../../common/wrapValue.cjs');
6
6
 
7
7
  function isRight(input) {
8
8
  return create.eitherRightKind.has(input)
9
- && base.eitherInformationKind.has(input)
9
+ && kind.eitherInformationKind.has(input)
10
10
  && wrapValue.isWrappedValue(input);
11
11
  }
12
12
 
@@ -1,4 +1,4 @@
1
- import { eitherInformationKind } from '../base.mjs';
1
+ import { eitherInformationKind } from '../kind.mjs';
2
2
  import { eitherRightKind } from './create.mjs';
3
3
  import { isWrappedValue } from '../../common/wrapValue.mjs';
4
4
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var kind = require('../../common/kind.cjs');
3
+ var kind = require('../kind.cjs');
4
4
  var create = require('./create.cjs');
5
5
 
6
- const eitherOkKind = kind.createKind("either-ok");
6
+ const eitherOkKind = kind.createEitherKind("ok");
7
7
  function ok() {
8
8
  return eitherOkKind.setTo(create.right("ok", undefined));
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { type Kind } from "../../common/kind";
2
2
  import { type EitherRight } from "./create";
3
- export declare const eitherOkKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"either-ok", unknown>>;
3
+ export declare const eitherOkKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/ok", unknown>>;
4
4
  type _EitherOk = (EitherRight<"ok", never> & Kind<typeof eitherOkKind.definition>);
5
5
  export interface EitherOk extends _EitherOk {
6
6
  }
@@ -1,7 +1,7 @@
1
- import { createKind } from '../../common/kind.mjs';
1
+ import { createEitherKind } from '../kind.mjs';
2
2
  import { right } from './create.mjs';
3
3
 
4
- const eitherOkKind = createKind("either-ok");
4
+ const eitherOkKind = createEitherKind("ok");
5
5
  function ok() {
6
6
  return eitherOkKind.setTo(right("ok", undefined));
7
7
  }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../../common/unwrap.cjs');
4
+ require('../../common/globalStore.cjs');
4
5
  var is = require('../left/is.cjs');
5
6
  var success = require('./success.cjs');
6
7
  var is$1 = require('./is.cjs');
@@ -1,4 +1,5 @@
1
1
  import { unwrap } from '../../common/unwrap.mjs';
2
+ import '../../common/globalStore.mjs';
2
3
  import { isLeft } from '../left/is.mjs';
3
4
  import { success } from './success.mjs';
4
5
  import { isRight } from './is.mjs';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var kind = require('../kind.cjs');
3
4
  var create = require('./create.cjs');
4
- var kind = require('../../common/kind.cjs');
5
5
 
6
- const eitherSuccessKind = kind.createKind("either-success");
6
+ const eitherSuccessKind = kind.createEitherKind("success");
7
7
  function success(value) {
8
8
  return eitherSuccessKind.setTo(create.right("success", value));
9
9
  }
@@ -1,6 +1,6 @@
1
- import { type EitherRight } from "./create";
2
1
  import { type Kind } from "../../common/kind";
3
- export declare const eitherSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"either-success", unknown>>;
2
+ import { type EitherRight } from "./create";
3
+ export declare const eitherSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/success", unknown>>;
4
4
  type _EitherSuccess<GenericValue extends unknown = unknown> = (EitherRight<"success", GenericValue> & Kind<typeof eitherSuccessKind.definition>);
5
5
  export interface EitherSuccess<GenericValue extends unknown = unknown> extends _EitherSuccess<GenericValue> {
6
6
  }
@@ -1,7 +1,7 @@
1
+ import { createEitherKind } from '../kind.mjs';
1
2
  import { right } from './create.mjs';
2
- import { createKind } from '../../common/kind.mjs';
3
3
 
4
- const eitherSuccessKind = createKind("either-success");
4
+ const eitherSuccessKind = createEitherKind("success");
5
5
  function success(value) {
6
6
  return eitherSuccessKind.setTo(right("success", value));
7
7
  }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../../common/unwrap.cjs');
4
+ require('../../common/globalStore.cjs');
4
5
  var is = require('./is.cjs');
5
6
 
6
7
  function whenIsRight(...args) {
@@ -1,4 +1,5 @@
1
1
  import { unwrap } from '../../common/unwrap.mjs';
2
+ import '../../common/globalStore.mjs';
2
3
  import { isRight } from './is.mjs';
3
4
 
4
5
  function whenIsRight(...args) {
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../common/unwrap.cjs');
4
- var base = require('./base.cjs');
4
+ require('../common/globalStore.cjs');
5
+ var kind = require('./kind.cjs');
5
6
  var is = require('./left/is.cjs');
6
7
  var is$1 = require('./right/is.cjs');
7
8
 
@@ -15,7 +16,7 @@ function whenHasInformation(...args) {
15
16
  ? information
16
17
  : [information];
17
18
  if ((is.isLeft(input)
18
- || is$1.isRight(input)) && formattedInformation.includes(base.eitherInformationKind.getValue(input))) {
19
+ || is$1.isRight(input)) && formattedInformation.includes(kind.eitherInformationKind.getValue(input))) {
19
20
  return theFunction(unwrap.unwrap(input));
20
21
  }
21
22
  return input;
@@ -1,7 +1,7 @@
1
1
  import { type Kind, type WrappedValue, type AnyValue, type Unwrap, type BreakGenericLink } from "../common";
2
2
  import { type EitherRight } from "./right";
3
3
  import { type EitherLeft } from "./left";
4
- import { eitherInformationKind } from "./base";
4
+ import { eitherInformationKind } from "./kind";
5
5
  type Either = EitherRight | EitherLeft;
6
6
  export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<BreakGenericLink<GenericInput>, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
7
7
  export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(input: GenericInput, information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): GenericOutput | Exclude<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
@@ -1,5 +1,6 @@
1
1
  import { unwrap } from '../common/unwrap.mjs';
2
- import { eitherInformationKind } from './base.mjs';
2
+ import '../common/globalStore.mjs';
3
+ import { eitherInformationKind } from './kind.mjs';
3
4
  import { isLeft } from './left/is.mjs';
4
5
  import { isRight } from './right/is.mjs';
5
6
 
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../common/unwrap.cjs');
4
+ require('../common/globalStore.cjs');
4
5
  var override = require('../object/override.cjs');
5
6
 
6
7
  function asyncReduce(...args) {
@@ -1,4 +1,5 @@
1
1
  import { unwrap } from '../common/unwrap.mjs';
2
+ import '../common/globalStore.mjs';
2
3
  import { override } from '../object/override.mjs';
3
4
 
4
5
  function asyncReduce(...args) {
@@ -3,6 +3,7 @@
3
3
  var kind = require('../common/kind.cjs');
4
4
  var wrapValue = require('../common/wrapValue.cjs');
5
5
  var unwrap = require('../common/unwrap.cjs');
6
+ require('../common/globalStore.cjs');
6
7
  var override = require('../object/override.cjs');
7
8
 
8
9
  const generatorReduceFromKind = kind.createKind("generator-reduce-from");
@@ -1,6 +1,7 @@
1
1
  import { createKind } from '../common/kind.mjs';
2
2
  import { wrapValue } from '../common/wrapValue.mjs';
3
3
  import { unwrap } from '../common/unwrap.mjs';
4
+ import '../common/globalStore.mjs';
4
5
  import { override } from '../object/override.mjs';
5
6
 
6
7
  const generatorReduceFromKind = createKind("generator-reduce-from");
package/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ var whenElse = require('./common/whenElse.cjs');
37
37
  var justReturn = require('./common/justReturn.cjs');
38
38
  var memo = require('./common/memo.cjs');
39
39
  var instanceOf = require('./common/instanceOf.cjs');
40
+ var globalStore = require('./common/globalStore.cjs');
40
41
  var index = require('./array/index.cjs');
41
42
  var index$1 = require('./number/index.cjs');
42
43
  var index$2 = require('./either/index.cjs');
@@ -58,6 +59,8 @@ exports.escapeRegExp = escapeRegExp.escapeRegExp;
58
59
  exports.createExternalPromise = externalPromise.createExternalPromise;
59
60
  exports.createInterpolation = interpolation.createInterpolation;
60
61
  exports.createKind = kind.createKind;
62
+ exports.createKindNamespace = kind.createKindNamespace;
63
+ exports.isRuntimeKind = kind.isRuntimeKind;
61
64
  exports.keyKindPrefix = kind.keyKindPrefix;
62
65
  exports.kindHeritage = kind.kindHeritage;
63
66
  exports.pipe = pipe.pipe;
@@ -75,6 +78,7 @@ exports.unwrap = unwrap.unwrap;
75
78
  exports.asyncLoop = asyncLoop.asyncLoop;
76
79
  exports.createAsyncRetry = asyncRetry.createAsyncRetry;
77
80
  exports.useAsyncRetry = asyncRetry.useAsyncRetry;
81
+ exports.isRuntimeWrappedValueKey = wrapValue.isRuntimeWrappedValueKey;
78
82
  exports.isWrappedValue = wrapValue.isWrappedValue;
79
83
  exports.keyWrappedValue = wrapValue.keyWrappedValue;
80
84
  exports.wrapValue = wrapValue.wrapValue;
@@ -94,6 +98,7 @@ exports.whenElse = whenElse.whenElse;
94
98
  exports.justReturn = justReturn.justReturn;
95
99
  exports.memo = memo.memo;
96
100
  exports.instanceOf = instanceOf.instanceOf;
101
+ exports.createGlobalStore = globalStore.createGlobalStore;
97
102
  exports.A = index;
98
103
  exports.DArray = index;
99
104
  exports.DNumber = index$1;
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ export { createEnum } from './common/enum.mjs';
5
5
  export { escapeRegExp } from './common/escapeRegExp.mjs';
6
6
  export { createExternalPromise } from './common/externalPromise.mjs';
7
7
  export { createInterpolation } from './common/interpolation.mjs';
8
- export { createKind, keyKindPrefix, kindHeritage } from './common/kind.mjs';
8
+ export { createKind, createKindNamespace, isRuntimeKind, keyKindPrefix, kindHeritage } from './common/kind.mjs';
9
9
  export { pipe } from './common/pipe.mjs';
10
10
  export { promiseObject } from './common/promiseObject.mjs';
11
11
  export { simpleClone } from './common/simpleClone.mjs';
@@ -18,7 +18,7 @@ export { toWrappedValue } from './common/toWrappedValue.mjs';
18
18
  export { unwrap } from './common/unwrap.mjs';
19
19
  export { asyncLoop } from './common/asyncLoop.mjs';
20
20
  export { createAsyncRetry, useAsyncRetry } from './common/asyncRetry.mjs';
21
- export { isWrappedValue, keyWrappedValue, wrapValue } from './common/wrapValue.mjs';
21
+ export { isRuntimeWrappedValueKey, isWrappedValue, keyWrappedValue, wrapValue } from './common/wrapValue.mjs';
22
22
  export { toString } from './common/toString.mjs';
23
23
  export { innerPipe } from './common/innerPipe.mjs';
24
24
  export { asyncInnerPipe } from './common/asyncInnerPipe.mjs';
@@ -35,6 +35,7 @@ export { whenElse } from './common/whenElse.mjs';
35
35
  export { justReturn } from './common/justReturn.mjs';
36
36
  export { memo } from './common/memo.mjs';
37
37
  export { instanceOf } from './common/instanceOf.mjs';
38
+ export { createGlobalStore } from './common/globalStore.mjs';
38
39
  import * as index from './array/index.mjs';
39
40
  export { index as A };
40
41
  export { index as DArray };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function greater(...args) {
4
+ if (args.length === 1) {
5
+ const [threshold] = args;
6
+ return (value) => greater(value, threshold);
7
+ }
8
+ const [value, threshold] = args;
9
+ return value >= threshold;
10
+ }
11
+
12
+ exports.greater = greater;
@@ -0,0 +1,2 @@
1
+ export declare function greater<GenericValue extends number>(threshold: number): (value: GenericValue) => boolean;
2
+ export declare function greater<GenericValue extends number>(value: GenericValue, threshold: number): boolean;
@@ -0,0 +1,10 @@
1
+ function greater(...args) {
2
+ if (args.length === 1) {
3
+ const [threshold] = args;
4
+ return (value) => greater(value, threshold);
5
+ }
6
+ const [value, threshold] = args;
7
+ return value >= threshold;
8
+ }
9
+
10
+ export { greater };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function greaterThan(...args) {
4
+ if (args.length === 1) {
5
+ const [threshold] = args;
6
+ return (value) => greaterThan(value, threshold);
7
+ }
8
+ const [value, threshold] = args;
9
+ return value > threshold;
10
+ }
11
+
12
+ exports.greaterThan = greaterThan;
@@ -0,0 +1,2 @@
1
+ export declare function greaterThan<GenericValue extends number>(threshold: number): (value: GenericValue) => boolean;
2
+ export declare function greaterThan<GenericValue extends number>(value: GenericValue, threshold: number): boolean;
@@ -0,0 +1,10 @@
1
+ function greaterThan(...args) {
2
+ if (args.length === 1) {
3
+ const [threshold] = args;
4
+ return (value) => greaterThan(value, threshold);
5
+ }
6
+ const [value, threshold] = args;
7
+ return value > threshold;
8
+ }
9
+
10
+ export { greaterThan };
@@ -22,6 +22,10 @@ var sin = require('./sin.cjs');
22
22
  var subtract = require('./subtract.cjs');
23
23
  var tan = require('./tan.cjs');
24
24
  var trunc = require('./trunc.cjs');
25
+ var greater = require('./greater.cjs');
26
+ var less = require('./less.cjs');
27
+ var greaterThan = require('./greaterThan.cjs');
28
+ var lessThan = require('./lessThan.cjs');
25
29
 
26
30
 
27
31
 
@@ -47,3 +51,7 @@ exports.sin = sin.sin;
47
51
  exports.subtract = subtract.subtract;
48
52
  exports.tan = tan.tan;
49
53
  exports.trunc = trunc.trunc;
54
+ exports.greater = greater.greater;
55
+ exports.less = less.less;
56
+ exports.greaterThan = greaterThan.greaterThan;
57
+ exports.lessThan = lessThan.lessThan;
@@ -20,3 +20,7 @@ export * from "./sin";
20
20
  export * from "./subtract";
21
21
  export * from "./tan";
22
22
  export * from "./trunc";
23
+ export * from "./greater";
24
+ export * from "./less";
25
+ export * from "./greaterThan";
26
+ export * from "./lessThan";
@@ -20,3 +20,7 @@ export { sin } from './sin.mjs';
20
20
  export { subtract } from './subtract.mjs';
21
21
  export { tan } from './tan.mjs';
22
22
  export { trunc } from './trunc.mjs';
23
+ export { greater } from './greater.mjs';
24
+ export { less } from './less.mjs';
25
+ export { greaterThan } from './greaterThan.mjs';
26
+ export { lessThan } from './lessThan.mjs';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function less(...args) {
4
+ if (args.length === 1) {
5
+ const [threshold] = args;
6
+ return (value) => less(value, threshold);
7
+ }
8
+ const [value, threshold] = args;
9
+ return value <= threshold;
10
+ }
11
+
12
+ exports.less = less;
@@ -0,0 +1,2 @@
1
+ export declare function less<GenericValue extends number>(threshold: number): (value: GenericValue) => boolean;
2
+ export declare function less<GenericValue extends number>(value: GenericValue, threshold: number): boolean;
@@ -0,0 +1,10 @@
1
+ function less(...args) {
2
+ if (args.length === 1) {
3
+ const [threshold] = args;
4
+ return (value) => less(value, threshold);
5
+ }
6
+ const [value, threshold] = args;
7
+ return value <= threshold;
8
+ }
9
+
10
+ export { less };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function lessThan(...args) {
4
+ if (args.length === 1) {
5
+ const [threshold] = args;
6
+ return (value) => lessThan(value, threshold);
7
+ }
8
+ const [value, threshold] = args;
9
+ return value < threshold;
10
+ }
11
+
12
+ exports.lessThan = lessThan;
@@ -0,0 +1,2 @@
1
+ export declare function lessThan<GenericValue extends number>(threshold: number): (value: GenericValue) => boolean;
2
+ export declare function lessThan<GenericValue extends number>(value: GenericValue, threshold: number): boolean;
@@ -0,0 +1,10 @@
1
+ function lessThan(...args) {
2
+ if (args.length === 1) {
3
+ const [threshold] = args;
4
+ return (value) => lessThan(value, threshold);
5
+ }
6
+ const [value, threshold] = args;
7
+ return value < threshold;
8
+ }
9
+
10
+ export { lessThan };
@@ -2,6 +2,7 @@
2
2
 
3
3
  var equal = require('../common/equal.cjs');
4
4
  var getDeepProperty = require('./getDeepProperty.cjs');
5
+ require('../common/globalStore.cjs');
5
6
 
6
7
  function deepDiscriminate(...args) {
7
8
  if (args.length === 2) {
@@ -1,5 +1,6 @@
1
1
  import { equal } from '../common/equal.mjs';
2
2
  import { getDeepProperty } from './getDeepProperty.mjs';
3
+ import '../common/globalStore.mjs';
3
4
 
4
5
  function deepDiscriminate(...args) {
5
6
  if (args.length === 2) {
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var equal = require('../common/equal.cjs');
4
+ require('../common/globalStore.cjs');
4
5
 
5
6
  function discriminate(...args) {
6
7
  if (args.length === 2) {
@@ -1,4 +1,5 @@
1
1
  import { equal } from '../common/equal.mjs';
2
+ import '../common/globalStore.mjs';
2
3
 
3
4
  function discriminate(...args) {
4
5
  if (args.length === 2) {
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ var kind = require('../common/kind.cjs');
3
4
  var wrapValue = require('../common/wrapValue.cjs');
5
+ require('../common/globalStore.cjs');
4
6
 
5
7
  function entries(object) {
6
8
  return Object.entries(object)
7
- .filter(([key]) => !key.startsWith(wrapValue.keyWrappedValue));
9
+ .filter(([key]) => !wrapValue.isRuntimeWrappedValueKey(key) && !kind.isRuntimeKind(key));
8
10
  }
9
11
 
10
12
  exports.entries = entries;
@@ -1,8 +1,10 @@
1
- import { keyWrappedValue } from '../common/wrapValue.mjs';
1
+ import { isRuntimeKind } from '../common/kind.mjs';
2
+ import { isRuntimeWrappedValueKey } from '../common/wrapValue.mjs';
3
+ import '../common/globalStore.mjs';
2
4
 
3
5
  function entries(object) {
4
6
  return Object.entries(object)
5
- .filter(([key]) => !key.startsWith(keyWrappedValue));
7
+ .filter(([key]) => !isRuntimeWrappedValueKey(key) && !isRuntimeKind(key));
6
8
  }
7
9
 
8
10
  export { entries };
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ var kind = require('../common/kind.cjs');
3
4
  var wrapValue = require('../common/wrapValue.cjs');
5
+ require('../common/globalStore.cjs');
4
6
 
5
7
  function keys(object) {
6
8
  return Object.keys(object)
7
- .filter((key) => !key.startsWith(wrapValue.keyWrappedValue));
9
+ .filter((key) => !wrapValue.isRuntimeWrappedValueKey(key) && !kind.isRuntimeKind(key));
8
10
  }
9
11
 
10
12
  exports.keys = keys;
@@ -1,8 +1,10 @@
1
- import { keyWrappedValue } from '../common/wrapValue.mjs';
1
+ import { isRuntimeKind } from '../common/kind.mjs';
2
+ import { isRuntimeWrappedValueKey } from '../common/wrapValue.mjs';
3
+ import '../common/globalStore.mjs';
2
4
 
3
5
  function keys(object) {
4
6
  return Object.keys(object)
5
- .filter((key) => !key.startsWith(keyWrappedValue));
7
+ .filter((key) => !isRuntimeWrappedValueKey(key) && !isRuntimeKind(key));
6
8
  }
7
9
 
8
10
  export { keys };
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../common/unwrap.cjs');
4
+ require('../common/globalStore.cjs');
4
5
 
5
6
  function exhaustive(result) {
6
7
  return unwrap.unwrap(result);
@@ -1,4 +1,5 @@
1
1
  import { unwrap } from '../common/unwrap.mjs';
2
+ import '../common/globalStore.mjs';
2
3
 
3
4
  function exhaustive(result) {
4
5
  return unwrap(result);
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var unwrap = require('../common/unwrap.cjs');
4
+ require('../common/globalStore.cjs');
4
5
  var result = require('./result.cjs');
5
6
 
6
7
  function otherwise(...args) {
@@ -1,4 +1,5 @@
1
1
  import { unwrap } from '../common/unwrap.mjs';
2
+ import '../common/globalStore.mjs';
2
3
  import { isResult } from './result.mjs';
3
4
 
4
5
  function otherwise(...args) {
@@ -2,6 +2,7 @@
2
2
 
3
3
  var kind = require('../common/kind.cjs');
4
4
  var wrapValue = require('../common/wrapValue.cjs');
5
+ require('../common/globalStore.cjs');
5
6
 
6
7
  const patternResultKind = kind.createKind("pattern-result");
7
8
  function result(value) {
@@ -1,5 +1,6 @@
1
1
  import { createKind } from '../common/kind.mjs';
2
2
  import { wrapValue } from '../common/wrapValue.mjs';
3
+ import '../common/globalStore.mjs';
3
4
 
4
5
  const patternResultKind = createKind("pattern-result");
5
6
  function result(value) {
@@ -0,0 +1,8 @@
1
+ import { type IsEqual } from "../../common";
2
+ import { type Includes } from "../../string";
3
+ declare const SymbolErrorForbiddenString: unique symbol;
4
+ type SymbolErrorForbiddenString = typeof SymbolErrorForbiddenString;
5
+ export type ForbiddenString<GenericValue extends string, GenericCharacters extends string> = IsEqual<(GenericCharacters extends string ? Includes<GenericValue, GenericCharacters> : never) | false, boolean> extends true ? {
6
+ [SymbolErrorForbiddenString]: `String "${GenericCharacters}" is forbidden in value.`;
7
+ } : GenericValue;
8
+ export {};
@@ -6,3 +6,4 @@ export * from "./startsWith";
6
6
  export * from "./normalizeForm";
7
7
  export * from "./split";
8
8
  export * from "./stringLength";
9
+ export * from "./forbiddenString";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/utils",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "author": "mathcovax",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- var kind = require('../common/kind.cjs');
4
-
5
- const eitherInformationKind = kind.createKind("either-information");
6
-
7
- exports.eitherInformationKind = eitherInformationKind;
@@ -1 +0,0 @@
1
- export declare const eitherInformationKind: import("../common").KindHandler<import("../common").KindDefinition<"either-information", string>>;
@@ -1,5 +0,0 @@
1
- import { createKind } from '../common/kind.mjs';
2
-
3
- const eitherInformationKind = createKind("either-information");
4
-
5
- export { eitherInformationKind };