inu-light 1.0.1 → 1.0.2
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/dist/core/literal.d.ts +2 -2
- package/dist/core/literal.js +1 -1
- package/dist/core/union.d.ts +3 -5
- package/dist/core/union.js +1 -2
- package/package.json +24 -24
package/dist/core/literal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema, ParseResult } from '../types/schema.js';
|
|
2
2
|
export declare class InuLiteral<T> extends Schema<T> {
|
|
3
|
-
|
|
3
|
+
readonly expectedValue: T;
|
|
4
4
|
constructor(expectedValue: T);
|
|
5
5
|
parse(value: unknown): ParseResult<T>;
|
|
6
6
|
}
|
|
7
|
-
export declare function literal<T>(value: T): Schema<T>;
|
|
7
|
+
export declare function literal<T extends string | number | boolean>(value: T): Schema<T>;
|
package/dist/core/literal.js
CHANGED
package/dist/core/union.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Schema, ParseResult } from '../types/schema.js';
|
|
2
2
|
export declare class InuUnion<T> extends Schema<T> {
|
|
3
|
-
private schemas;
|
|
4
|
-
constructor(schemas: Schema<T
|
|
3
|
+
private readonly schemas;
|
|
4
|
+
constructor(schemas: ReadonlyArray<Schema<T>>);
|
|
5
5
|
parse(value: unknown): ParseResult<T>;
|
|
6
6
|
}
|
|
7
|
-
export declare function union<
|
|
8
|
-
[K in keyof T]: Schema<T[K]>;
|
|
9
|
-
}]): Schema<T[number]>;
|
|
7
|
+
export declare function union<U>(schemas: ReadonlyArray<Schema<U>>): Schema<U>;
|
package/dist/core/union.js
CHANGED
|
@@ -15,8 +15,7 @@ export class InuUnion extends Schema {
|
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
17
|
success: false,
|
|
18
|
-
error: `Union error: Data does not match any
|
|
19
|
-
Sub-errors: [${errors.join(' | ')}]`,
|
|
18
|
+
error: `Union error: Data does not match any allowed types.`,
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "inu-light",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A ultra-lightweight TypeScript validation library with zero dependencies.",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"validation",
|
|
17
|
-
"typescript",
|
|
18
|
-
"schema",
|
|
19
|
-
"lightweight",
|
|
20
|
-
"zod-like"
|
|
21
|
-
],
|
|
22
|
-
"author": "Seu Nome",
|
|
23
|
-
"license": "MIT"
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "inu-light",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A ultra-lightweight TypeScript validation library with zero dependencies.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"validation",
|
|
17
|
+
"typescript",
|
|
18
|
+
"schema",
|
|
19
|
+
"lightweight",
|
|
20
|
+
"zod-like"
|
|
21
|
+
],
|
|
22
|
+
"author": "Seu Nome",
|
|
23
|
+
"license": "MIT"
|
|
24
|
+
}
|