typanic 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,8 +42,12 @@ Every helper takes the value and an optional `label` used in the error message
42
42
  | `forcedString(value, label?)` | `string` | throws unless `typeof value === "string"` |
43
43
  | `forcedInteger(value, label?)` | `number` | accepts integers and integer-looking strings (`"42"`) |
44
44
  | `forcedIntegerFromString(value, label?)` | `number` | accepts safe decimal integer strings only; useful for form/query values |
45
+ | `forcedPositiveInteger(value, label?)` | `number` | accepts safe integers greater than zero and integer-looking strings (`"42"`) |
46
+ | `forcedPositiveIntegerFromString(value, label?)` | `number` | accepts safe positive decimal integer strings only |
47
+ | `forcedNonBlankString(value, label?)` | `string` | trims and rejects blank strings |
45
48
  | `forcedFloat(value, label?)` | `number` | accepts finite numbers and numeric strings; rejects `NaN`/`Infinity` |
46
49
  | `forcedBoolean(value, label?)` | `boolean` | does **not** coerce `"true"`/`1` — pass a real boolean |
50
+ | `forcedFunction(value, label?)` | `Function` | throws unless `typeof value === "function"` |
47
51
 
48
52
  ### Optional — `null` when absent, throw when present-but-wrong-typed
49
53
 
@@ -52,19 +56,23 @@ Every helper takes the value and an optional `label` used in the error message
52
56
  | `optionalString(value, label?)` | `string \| null` |
53
57
  | `optionalInteger(value, label?)` | `number \| null` |
54
58
  | `optionalIntegerFromString(value, label?)` | `number \| null` |
59
+ | `optionalPositiveInteger(value, label?)` | `number \| null` |
60
+ | `optionalPositiveIntegerFromString(value, label?)` | `number \| null` |
61
+ | `optionalNonBlankString(value, label?)` | `string \| null` |
55
62
  | `optionalFloat(value, label?)` | `number \| null` |
56
63
  | `optionalBoolean(value, label?)` | `boolean \| null` |
64
+ | `optionalFunction(value, label?)` | `Function \| null` |
57
65
 
58
66
  `null` and `undefined` both count as "absent" and return `null`. A value that is
59
67
  *present* but of the wrong type still throws — absence and corruption are
60
68
  different things.
61
69
 
62
70
  ```js
63
- import {forcedIntegerFromString, optionalString} from "typanic"
71
+ import {forcedPositiveIntegerFromString, optionalString} from "typanic"
64
72
 
65
- const cols = forcedIntegerFromString(payload.cols, "cols") // decimal string -> number, or throws
66
- const cursor = optionalString(payload.cursor, "cursor") // string | null
67
- const status = optionalString(payload.status, "status") ?? "ok" // default only when you truly need one
73
+ const cols = forcedPositiveIntegerFromString(payload.cols, "cols") // positive decimal string -> number, or throws
74
+ const cursor = optionalString(payload.cursor, "cursor") // string | null
75
+ const status = optionalString(payload.status, "status") ?? "ok" // default only when you truly need one
68
76
  ```
69
77
 
70
78
  ## Why "forced"?
package/build/index.d.ts CHANGED
@@ -53,6 +53,59 @@ export function forcedIntegerFromString(value: unknown, label?: string): number;
53
53
  * @returns {number | null} the parsed integer value, or null when absent
54
54
  */
55
55
  export function optionalIntegerFromString(value: unknown, label?: string): number | null;
56
+ /**
57
+ * Returns the value as a safe positive integer, otherwise throws. Numeric
58
+ * strings are parsed; zero, negatives, decimals, and unsafe integers throw.
59
+ *
60
+ * @param {unknown} value the value to assert
61
+ * @param {string} [label] name used in the thrown error message
62
+ * @returns {number} the value, typed as a safe positive integer
63
+ */
64
+ export function forcedPositiveInteger(value: unknown, label?: string): number;
65
+ /**
66
+ * Like {@link forcedPositiveInteger}, but allows the value to be absent
67
+ * (null/undefined become null). A present invalid value still throws.
68
+ *
69
+ * @param {unknown} value the value to assert
70
+ * @param {string} [label] name used in the thrown error message
71
+ * @returns {number | null} the positive integer value, or null when absent
72
+ */
73
+ export function optionalPositiveInteger(value: unknown, label?: string): number | null;
74
+ /**
75
+ * Returns a safe positive decimal integer parsed from a string, otherwise throws.
76
+ * Use this for form, route, or query values that must be strings before parsing.
77
+ *
78
+ * @param {unknown} value the value to assert
79
+ * @param {string} [label] name used in the thrown error message
80
+ * @returns {number} the value, parsed as a safe positive decimal integer
81
+ */
82
+ export function forcedPositiveIntegerFromString(value: unknown, label?: string): number;
83
+ /**
84
+ * Like {@link forcedPositiveIntegerFromString}, but allows the value to be absent
85
+ * (null/undefined become null). A present invalid value still throws.
86
+ *
87
+ * @param {unknown} value the value to assert
88
+ * @param {string} [label] name used in the thrown error message
89
+ * @returns {number | null} the parsed positive integer value, or null when absent
90
+ */
91
+ export function optionalPositiveIntegerFromString(value: unknown, label?: string): number | null;
92
+ /**
93
+ * Returns a trimmed string when it has non-whitespace content, otherwise throws.
94
+ *
95
+ * @param {unknown} value the value to assert
96
+ * @param {string} [label] name used in the thrown error message
97
+ * @returns {string} the trimmed non-blank string
98
+ */
99
+ export function forcedNonBlankString(value: unknown, label?: string): string;
100
+ /**
101
+ * Like {@link forcedNonBlankString}, but allows the value to be absent
102
+ * (null/undefined become null). Blank strings still throw when present.
103
+ *
104
+ * @param {unknown} value the value to assert
105
+ * @param {string} [label] name used in the thrown error message
106
+ * @returns {string | null} the trimmed non-blank string, or null when absent
107
+ */
108
+ export function optionalNonBlankString(value: unknown, label?: string): string | null;
56
109
  /**
57
110
  * Returns the value as a finite number, otherwise throws. Numeric strings are
58
111
  * parsed; everything else (including NaN and Infinity) throws.
@@ -89,4 +142,22 @@ export function forcedBoolean(value: unknown, label?: string): boolean;
89
142
  * @returns {boolean | null} the boolean value, or null when absent
90
143
  */
91
144
  export function optionalBoolean(value: unknown, label?: string): boolean | null;
145
+ /**
146
+ * Returns the value when it is a function, otherwise throws.
147
+ *
148
+ * @param {unknown} value the value to assert
149
+ * @param {string} [label] name used in the thrown error message
150
+ * @returns {Function} the value, typed as a function
151
+ */
152
+ export function forcedFunction(value: unknown, label?: string): Function;
153
+ /**
154
+ * Like {@link forcedFunction}, but allows the value to be absent
155
+ * (null/undefined become null). A value that is present but not a function
156
+ * still throws.
157
+ *
158
+ * @param {unknown} value the value to assert
159
+ * @param {string} [label] name used in the thrown error message
160
+ * @returns {Function | null} the function value, or null when absent
161
+ */
162
+ export function optionalFunction(value: unknown, label?: string): Function | null;
92
163
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,oCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,sCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;GAOG;AACH,uCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,+CAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAclB;AAED;;;;;;;GAOG;AACH,iDAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,mCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,OAAO,CAQnB;AAED;;;;;;;GAOG;AACH,uCAJW,OAAO,UACP,MAAM,GACJ,OAAO,GAAG,IAAI,CAM1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,oCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,sCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;GAOG;AACH,uCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,+CAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAclB;AAED;;;;;;;GAOG;AACH,iDAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,6CAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;GAOG;AACH,+CAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,uDAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAclB;AAED;;;;;;;GAOG;AACH,yDAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;GAMG;AACH,4CAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;GAOG;AACH,8CAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,mCAJW,OAAO,UACP,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,MAAM,GAAG,IAAI,CAMzB;AAED;;;;;;;GAOG;AACH,qCAJW,OAAO,UACP,MAAM,GACJ,OAAO,CAQnB;AAED;;;;;;;GAOG;AACH,uCAJW,OAAO,UACP,MAAM,GACJ,OAAO,GAAG,IAAI,CAM1B;AAED;;;;;;GAMG;AACH,sCAJW,OAAO,UACP,MAAM,YAShB;AAED;;;;;;;;GAQG;AACH,wCAJW,OAAO,UACP,MAAM,GACJ,WAAW,IAAI,CAM3B"}
package/build/index.js CHANGED
@@ -104,6 +104,95 @@ export function optionalIntegerFromString(value, label = "value") {
104
104
  return null;
105
105
  return forcedIntegerFromString(value, label);
106
106
  }
107
+ /**
108
+ * Returns the value as a safe positive integer, otherwise throws. Numeric
109
+ * strings are parsed; zero, negatives, decimals, and unsafe integers throw.
110
+ *
111
+ * @param {unknown} value the value to assert
112
+ * @param {string} [label] name used in the thrown error message
113
+ * @returns {number} the value, typed as a safe positive integer
114
+ */
115
+ export function forcedPositiveInteger(value, label = "value") {
116
+ const parsedValue = typeof value === "number" || (typeof value === "string" && value.trim() !== "")
117
+ ? Number(value)
118
+ : Number.NaN;
119
+ if (!Number.isSafeInteger(parsedValue) || parsedValue < 1) {
120
+ throw new TypeError(`Expected ${label} to be a positive integer but got ${describeType(value)}`);
121
+ }
122
+ return parsedValue;
123
+ }
124
+ /**
125
+ * Like {@link forcedPositiveInteger}, but allows the value to be absent
126
+ * (null/undefined become null). A present invalid value still throws.
127
+ *
128
+ * @param {unknown} value the value to assert
129
+ * @param {string} [label] name used in the thrown error message
130
+ * @returns {number | null} the positive integer value, or null when absent
131
+ */
132
+ export function optionalPositiveInteger(value, label = "value") {
133
+ if (value === null || value === undefined)
134
+ return null;
135
+ return forcedPositiveInteger(value, label);
136
+ }
137
+ /**
138
+ * Returns a safe positive decimal integer parsed from a string, otherwise throws.
139
+ * Use this for form, route, or query values that must be strings before parsing.
140
+ *
141
+ * @param {unknown} value the value to assert
142
+ * @param {string} [label] name used in the thrown error message
143
+ * @returns {number} the value, parsed as a safe positive decimal integer
144
+ */
145
+ export function forcedPositiveIntegerFromString(value, label = "value") {
146
+ if (typeof value === "string") {
147
+ const trimmedValue = value.trim();
148
+ if (/^\d+$/.test(trimmedValue)) {
149
+ const parsedValue = Number.parseInt(trimmedValue, 10);
150
+ if (Number.isSafeInteger(parsedValue) && parsedValue > 0)
151
+ return parsedValue;
152
+ }
153
+ }
154
+ throw new TypeError(`Expected ${label} to be a positive integer string but got ${describeType(value)}`);
155
+ }
156
+ /**
157
+ * Like {@link forcedPositiveIntegerFromString}, but allows the value to be absent
158
+ * (null/undefined become null). A present invalid value still throws.
159
+ *
160
+ * @param {unknown} value the value to assert
161
+ * @param {string} [label] name used in the thrown error message
162
+ * @returns {number | null} the parsed positive integer value, or null when absent
163
+ */
164
+ export function optionalPositiveIntegerFromString(value, label = "value") {
165
+ if (value === null || value === undefined)
166
+ return null;
167
+ return forcedPositiveIntegerFromString(value, label);
168
+ }
169
+ /**
170
+ * Returns a trimmed string when it has non-whitespace content, otherwise throws.
171
+ *
172
+ * @param {unknown} value the value to assert
173
+ * @param {string} [label] name used in the thrown error message
174
+ * @returns {string} the trimmed non-blank string
175
+ */
176
+ export function forcedNonBlankString(value, label = "value") {
177
+ const stringValue = forcedString(value, label).trim();
178
+ if (!stringValue) {
179
+ throw new TypeError(`Expected ${label} to be a non-blank string but got ${describeType(value)}`);
180
+ }
181
+ return stringValue;
182
+ }
183
+ /**
184
+ * Like {@link forcedNonBlankString}, but allows the value to be absent
185
+ * (null/undefined become null). Blank strings still throw when present.
186
+ *
187
+ * @param {unknown} value the value to assert
188
+ * @param {string} [label] name used in the thrown error message
189
+ * @returns {string | null} the trimmed non-blank string, or null when absent
190
+ */
191
+ export function optionalNonBlankString(value, label = "value") {
192
+ if (value === null || value === undefined)
193
+ return null;
194
+ return forcedNonBlankString(value, label);
195
+ }
107
196
  /**
108
197
  * Returns the value as a finite number, otherwise throws. Numeric strings are
109
198
  * parsed; everything else (including NaN and Infinity) throws.
@@ -162,4 +251,31 @@ export function optionalBoolean(value, label = "value") {
162
251
  return null;
163
252
  return forcedBoolean(value, label);
164
253
  }
254
+ /**
255
+ * Returns the value when it is a function, otherwise throws.
256
+ *
257
+ * @param {unknown} value the value to assert
258
+ * @param {string} [label] name used in the thrown error message
259
+ * @returns {Function} the value, typed as a function
260
+ */
261
+ export function forcedFunction(value, label = "value") {
262
+ if (typeof value !== "function") {
263
+ throw new TypeError(`Expected ${label} to be a function but got ${describeType(value)}`);
264
+ }
265
+ return value;
266
+ }
267
+ /**
268
+ * Like {@link forcedFunction}, but allows the value to be absent
269
+ * (null/undefined become null). A value that is present but not a function
270
+ * still throws.
271
+ *
272
+ * @param {unknown} value the value to assert
273
+ * @param {string} [label] name used in the thrown error message
274
+ * @returns {Function | null} the function value, or null when absent
275
+ */
276
+ export function optionalFunction(value, label = "value") {
277
+ if (value === null || value === undefined)
278
+ return null;
279
+ return forcedFunction(value, label);
280
+ }
165
281
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","s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AE,KAAK,GAAG,OAAO;IAClD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,YAAY,KAAK,4BAA4B,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACzF,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACpD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IAEtD,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACnD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,YAAY,KAAK,6BAA6B,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACrD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IAEtD,OAAO,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typanic",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Forced runtime type assertions for untrusted input — get the type you expect or throw, instead of silently coercing a wrong value to \"\" / 0 / false.",
5
5
  "keywords": [
6
6
  "type",