@guillaume-docquier/tools-ts 10.0.0 → 10.1.1

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.
package/README.md CHANGED
@@ -39,12 +39,15 @@ external APIs, CLI input, local storage, or other unknown data.
39
39
 
40
40
  Import these tools from `@guillaume-docquier/tools-ts/schemas`. Install Zod in the consuming project to use this optional subpath; the root entry point does not load Zod.
41
41
 
42
- | Export | What it is | Use it when |
43
- | ----------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
44
- | typedParse | Parses a typed, deeply unbranded value with a Zod schema and returns its output. | Invalid data is an internal invariant violation that should throw. |
45
- | safeTypedParse | The non-throwing counterpart, returning a Zod safe parse result. | Validation may fail and the caller will handle the result. |
46
- | IntegerSchema and `Integer` | Parses and brands whole numbers. | A value must be an integer, including zero or a negative integer. |
47
- | PositiveNumberSchema and `PositiveNumber` | Parses and brands numbers greater than zero. | A value must be positive but may be fractional. |
42
+ | Export | What it is | Use it when |
43
+ | ----------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
44
+ | typedParse | Parses a typed, deeply unbranded value with a Zod schema and returns its output. | Invalid data is an internal invariant violation that should throw. |
45
+ | safeTypedParse | The non-throwing counterpart, returning a Zod safe parse result. | Validation may fail and the caller will handle the result. |
46
+ | IntegerSchema and `Integer` | Parses and brands whole numbers. | A value must be an integer, including zero or a negative integer. |
47
+ | PositiveNumberSchema and `PositiveNumber` | Parses and brands numbers greater than zero. | A value must be positive but may be fractional. |
48
+ | NonNegativeNumberSchema and `NonNegativeNumber` | Parses and brands numbers greater than or equal to zero. | A value may be zero or positive, including fractions. |
49
+ | NegativeNumberSchema and `NegativeNumber` | Parses and brands numbers less than zero. | A value must be negative but may be fractional. |
50
+ | NonPositiveNumberSchema and `NonPositiveNumber` | Parses and brands numbers less than or equal to zero. | A value may be zero or negative, including fractions. |
48
51
 
49
52
  ### Numeric Utilities
50
53
 
@@ -1,3 +1,6 @@
1
1
  export { IntegerSchema, type Integer } from "./schemas/Integer.js";
2
+ export { NegativeNumberSchema, type NegativeNumber } from "./schemas/NegativeNumber.js";
3
+ export { NonNegativeNumberSchema, type NonNegativeNumber } from "./schemas/NonNegativeNumber.js";
4
+ export { NonPositiveNumberSchema, type NonPositiveNumber } from "./schemas/NonPositiveNumber.js";
2
5
  export { PositiveNumberSchema, type PositiveNumber } from "./schemas/PositiveNumber.js";
3
6
  export { typedParse, safeTypedParse } from "./schemas/typedParse.js";
@@ -1,4 +1,7 @@
1
1
  export { IntegerSchema } from "./schemas/Integer.js";
2
+ export { NegativeNumberSchema } from "./schemas/NegativeNumber.js";
3
+ export { NonNegativeNumberSchema } from "./schemas/NonNegativeNumber.js";
4
+ export { NonPositiveNumberSchema } from "./schemas/NonPositiveNumber.js";
2
5
  export { PositiveNumberSchema } from "./schemas/PositiveNumber.js";
3
6
  export { typedParse, safeTypedParse } from "./schemas/typedParse.js";
4
7
  //# sourceMappingURL=entry.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry.schemas.js","sourceRoot":"","sources":["../src/entry.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAuB,MAAM,6BAA6B,CAAA;AACvF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"entry.schemas.js","sourceRoot":"","sources":["../src/entry.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAuB,MAAM,6BAA6B,CAAA;AACvF,OAAO,EAAE,uBAAuB,EAA0B,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAE,uBAAuB,EAA0B,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAE,oBAAoB,EAAuB,MAAM,6BAA6B,CAAA;AACvF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { type Branded } from "../Brand.js";
3
+ /**
4
+ * A number less than zero.
5
+ */
6
+ export type NegativeNumber = Branded<"NegativeNumber", number>;
7
+ /**
8
+ * Parses a number less than zero, including negative fractions.
9
+ */
10
+ export declare const NegativeNumberSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<NegativeNumber, number>>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { branded } from "../Brand.js";
3
+ /**
4
+ * Parses a number less than zero, including negative fractions.
5
+ */
6
+ export const NegativeNumberSchema = z
7
+ .number()
8
+ .negative()
9
+ .transform(branded);
10
+ //# sourceMappingURL=NegativeNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NegativeNumber.js","sourceRoot":"","sources":["../../src/schemas/NegativeNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAOnD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,SAAS,CAAC,OAAuB,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { type Branded } from "../Brand.js";
3
+ /**
4
+ * A number greater than or equal to zero.
5
+ */
6
+ export type NonNegativeNumber = Branded<"NonNegativeNumber", number>;
7
+ /**
8
+ * Parses a number greater than or equal to zero, including zero and positive fractions.
9
+ */
10
+ export declare const NonNegativeNumberSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<NonNegativeNumber, number>>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { branded } from "../Brand.js";
3
+ /**
4
+ * Parses a number greater than or equal to zero, including zero and positive fractions.
5
+ */
6
+ export const NonNegativeNumberSchema = z
7
+ .number()
8
+ .nonnegative()
9
+ .transform(branded);
10
+ //# sourceMappingURL=NonNegativeNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NonNegativeNumber.js","sourceRoot":"","sources":["../../src/schemas/NonNegativeNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAOnD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,EAAE;KACR,WAAW,EAAE;KACb,SAAS,CAAC,OAA0B,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { type Branded } from "../Brand.js";
3
+ /**
4
+ * A number less than or equal to zero.
5
+ */
6
+ export type NonPositiveNumber = Branded<"NonPositiveNumber", number>;
7
+ /**
8
+ * Parses a number less than or equal to zero, including zero and negative fractions.
9
+ */
10
+ export declare const NonPositiveNumberSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<NonPositiveNumber, number>>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { branded } from "../Brand.js";
3
+ /**
4
+ * Parses a number less than or equal to zero, including zero and negative fractions.
5
+ */
6
+ export const NonPositiveNumberSchema = z
7
+ .number()
8
+ .nonpositive()
9
+ .transform(branded);
10
+ //# sourceMappingURL=NonPositiveNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NonPositiveNumber.js","sourceRoot":"","sources":["../../src/schemas/NonPositiveNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAOnD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,EAAE;KACR,WAAW,EAAE;KACb,SAAS,CAAC,OAA0B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guillaume-docquier/tools-ts",
3
- "version": "10.0.0",
3
+ "version": "10.1.1",
4
4
  "description": "My personal collection of typescript tools",
5
5
  "homepage": "https://github.com/Guillaume-Docquier/tools-ts",
6
6
  "license": "MIT",
@@ -34,24 +34,24 @@
34
34
  "@logtape/redaction": "^2.3.6"
35
35
  },
36
36
  "devDependencies": {
37
- "@guillaume-docquier/oxfmt": "^1.0.10",
38
- "@guillaume-docquier/oxlint": "^1.8.3",
37
+ "@guillaume-docquier/oxfmt": "^1.0.14",
38
+ "@guillaume-docquier/oxlint": "^1.8.7",
39
39
  "@semantic-release/commit-analyzer": "^13.0.1",
40
40
  "@semantic-release/exec": "^7.1.0",
41
- "@semantic-release/github": "^12.0.9",
41
+ "@semantic-release/github": "^12.0.10",
42
42
  "@semantic-release/release-notes-generator": "^14.1.1",
43
- "@types/node": "^26.6.2",
43
+ "@types/node": "^26.6.3",
44
44
  "@vitest/coverage-v8": "^5.0.0",
45
45
  "conventional-changelog-conventionalcommits": "^9.3.1",
46
46
  "husky": "^9.1.7",
47
47
  "jiti": "^2.7.0",
48
- "lint-staged": "^17.5.1",
49
- "oxfmt": ">=0.68.0",
50
- "oxlint": "^1.83.0",
51
- "oxlint-tsgolint": "^7.0.2002",
48
+ "lint-staged": "^17.6.0",
49
+ "oxfmt": ">=0.70.0",
50
+ "oxlint": "^1.85.0",
51
+ "oxlint-tsgolint": "^7.0.2003",
52
52
  "semantic-release": "^25.0.9",
53
53
  "typescript": "~7.0.2",
54
- "vite": "^8.3.0",
54
+ "vite": "^8.3.1",
55
55
  "vitest": "^5.0.0",
56
56
  "zod": "^4.6.5"
57
57
  },