ivl 0.1.4 → 0.1.6
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 +77 -67
- package/lib/helpers/index.d.ts +11 -5
- package/lib/helpers/index.js +1 -1
- package/lib/index.d.ts +16 -11
- package/lib/index.js +1 -1
- package/lib/patterns/index.d.ts +5 -1
- package/lib/patterns/index.js +1 -1
- package/package.json +55 -50
package/README.md
CHANGED
|
@@ -4,49 +4,51 @@ Main focus is on speed and flexibility of the validation rules
|
|
|
4
4
|
|
|
5
5
|
Supports asynchronous rule validation by default. Use `getInputErrorsSync` and `getSchemaErrorsSync` for better performance if you don't need to support asynchronous checks on your inputs.
|
|
6
6
|
# Main functionality
|
|
7
|
-
Write your own custom validators to exactly match your
|
|
7
|
+
Write your own custom validators to exactly match your use case using a simple object:
|
|
8
8
|
```javascript
|
|
9
9
|
const my_rules = {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
"Input must be more than 40": (i) => i > 40,
|
|
11
|
+
"Input must be divisible by 10": (i) => !(i % 10)
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
console.log(getInputErrors(50, my_rules)); // []
|
|
14
|
+
console.log(getInputErrors(11, my_rules)); // ["Input must be more than 40", "Input must be divisible by 10"]
|
|
15
|
+
console.log(getInputErrors(30, my_rules)) // ["Input must be more than 40"]
|
|
15
16
|
|
|
17
|
+
```
|
|
16
18
|
|
|
17
19
|
## Frontend example
|
|
18
20
|
```javascript
|
|
19
21
|
// src/index.ts
|
|
20
22
|
import { getInputErrorsSync, getInputErrors } from 'ivl';
|
|
21
23
|
import type { RULES } from 'ivl';
|
|
22
|
-
import { matchesRegex,
|
|
24
|
+
import { matchesRegex, minLength, maxLength, isType } from 'ivl/helpers';
|
|
23
25
|
|
|
24
|
-
// This is also exportable from 'ivl/patterns'
|
|
26
|
+
// This pattern is also exportable from 'ivl/patterns'
|
|
25
27
|
const EMAIL_PATTERN = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{1,}$/;
|
|
26
28
|
|
|
27
29
|
const EMAIL_REQUIREMENTS: RULES = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
"Must be string": isType('string'),
|
|
31
|
+
"Must be less then 100 characters": maxLength(100),
|
|
32
|
+
"Not a valid email address": matchesRegex(EMAIL_PATTERN),
|
|
33
|
+
"That email is already in use": async (i) => {
|
|
34
|
+
// Fetch info from whatever backend and make a decision based on that asynchronously
|
|
35
|
+
const email_in_use = await fetch(`https://mybackend/email-exists/${i}`)
|
|
36
|
+
return !email_in_use // We will return true if the email is not already taken
|
|
37
|
+
}
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
const PASSWORD_REQUIREMENTS: RULES = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
"Must be string": isType('string'),
|
|
42
|
+
"Must be at least 8 characters": minLength(Infinity, 8),
|
|
43
|
+
"Must contain at least one upper case character": matchesRegex(/(?=.*[A-Z])/),
|
|
44
|
+
"Must contain at least one lower case character": matchesRegex(/(?=.*[a-z])/),
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
// You can of course expand on your existing rules:
|
|
46
48
|
const STRONG_PASSWORD_REQUIREMENTS: RULES = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
...PASSWORD_REQUIREMENTS,
|
|
50
|
+
"Must contain at least one digit": matchesRegex(/(?=.*\d)/),
|
|
51
|
+
"Must contain at least one symbol": matchesRegex(/[^\w]/),
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
const email_value = "some-value";
|
|
@@ -64,39 +66,47 @@ console.log({email_errors, pw_errors, strong_pw_errors});
|
|
|
64
66
|
|
|
65
67
|
```typescript
|
|
66
68
|
// rules.ts
|
|
69
|
+
|
|
70
|
+
import { isType, minLength, maxLength, matchesRegex } from 'ivl/helpers';
|
|
71
|
+
import { checkValueInDatabase } from 'my-database-controller';
|
|
72
|
+
|
|
73
|
+
const existsInDatabase = (key: string, table: string, exists: boolean = true): RULE =>
|
|
74
|
+
async (value) =>
|
|
75
|
+
exists != !(await checkValueInDatabase(value as string, key, table)).length
|
|
76
|
+
|
|
67
77
|
const EMAIL_REQUIREMENTS = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
"Must be string": isType('string'),
|
|
79
|
+
"Must be less then 100 characters": maxLength(100),
|
|
80
|
+
"Not a valid email address": matchesRegex(EMAIL_PATTERN),
|
|
71
81
|
};
|
|
72
82
|
|
|
73
83
|
const PASSWORD_REQUIREMENTS = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
"Must be string": isType('string'),
|
|
85
|
+
"Must be at least 8 characters": minLength(8),
|
|
86
|
+
"Must contain at least one upper case character": matchesRegex(/(?=.*[A-Z])/),
|
|
87
|
+
"Must contain at least one lower case character": matchesRegex(/(?=.*[a-z])/),
|
|
88
|
+
"Must contain at least one digit": matchesRegex(/(?=.*\d)/),
|
|
89
|
+
"Must contain at least one symbol": matchesRegex(/[^\w]/),
|
|
80
90
|
};
|
|
81
91
|
|
|
82
|
-
export const LOGIN_SCHEMA = {
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
export const LOGIN_SCHEMA: SCHEMA = {
|
|
93
|
+
email: EMAIL_REQUIREMENTS,
|
|
94
|
+
password: PASSWORD_REQUIREMENTS
|
|
85
95
|
}
|
|
86
96
|
|
|
87
|
-
export const REGISTER_SCHEMA = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
export const REGISTER_SCHEMA: SCHEMA = {
|
|
98
|
+
organization_name: {} // Pass in an empty rule set, so the value can be whatever
|
|
99
|
+
email: {
|
|
100
|
+
...EMAIL_REQUIREMENTS,
|
|
101
|
+
"Email already registered": existsInDatabase('email','users', false)
|
|
102
|
+
},
|
|
103
|
+
password: PASSWORD_REQUIREMENTS
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
export const INVITATION_PARAM: SCHEMA = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
code: {
|
|
108
|
+
"Not a valid invitation": existsInDatabase('code', 'invitation')
|
|
109
|
+
}
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
```
|
|
@@ -112,43 +122,43 @@ import { LOGIN_SCHEMA, REGISTER_SCHEMA, INVITATION_PARAM } from './rules.ts'
|
|
|
112
122
|
|
|
113
123
|
// Wrapper for hono validator middleware
|
|
114
124
|
const validateWrapper = (schema: SCHEMA, error: ClientErrorStatusCode | RedirectStatusCode = 400, strict = true) =>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
async (value: any, c: Context) => {
|
|
126
|
+
const jwt = c.get('jwtPayload'); // Pass jwt to the validator so we could use its value when checking input validation rules
|
|
127
|
+
const errors = await getSchemaErrors(value, schema, {strict:true}, jwt);
|
|
128
|
+
if (Object.values(errors).filter((e) => e.length).length) {
|
|
129
|
+
throw new HTTPException(error, {
|
|
130
|
+
message: JSON.stringify(errors),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
125
135
|
|
|
126
136
|
const app = new Hono();
|
|
127
137
|
|
|
128
138
|
app.use(jwt({
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}))
|
|
139
|
+
secret: "some-secret-value",
|
|
140
|
+
cookie: 'token'
|
|
141
|
+
}));
|
|
132
142
|
|
|
133
143
|
app.post('/login',
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
validator('json', validateWrapper(LOGIN_SCHEMA)),
|
|
145
|
+
(c) => c.text("Success"));
|
|
136
146
|
|
|
137
147
|
app.all('/logout', (c) => c.text("Success"));
|
|
138
148
|
|
|
139
149
|
app.put('/register',
|
|
140
|
-
|
|
141
|
-
|
|
150
|
+
validator('json', validateWrapper(REGISTER_SCHEMA)),
|
|
151
|
+
(c) => c.text("Success"));
|
|
142
152
|
|
|
143
153
|
// This first validates the invitation parameter against our database
|
|
144
154
|
// And then validates the body of the request
|
|
145
155
|
app.put('/register/:invitation_code',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)),
|
|
151
|
-
|
|
156
|
+
validator('param', validateWrapper(INVITATION_PARAM)),
|
|
157
|
+
validator('json', validateWrapper(
|
|
158
|
+
// Registering via invitation needs all the same values except organization name - inherit parts of rule sets, as opposed to extending the rule set as shown above
|
|
159
|
+
(({ organization_name, ...invite_schema }) => invite_schema)(REGISTRATION_SCHEMA)
|
|
160
|
+
)),
|
|
161
|
+
(c)=> c.text("Success"));
|
|
152
162
|
|
|
153
163
|
export default app;
|
|
154
164
|
```
|
package/lib/helpers/index.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v8.1.1
|
|
2
2
|
|
|
3
|
+
export type RULE_SYNC = (value: unknown, ...overload: unknown[]) => boolean;
|
|
3
4
|
export type RULE = (value: unknown, ...overload: unknown[]) => boolean | Promise<boolean>;
|
|
4
5
|
export type RULES = {
|
|
5
6
|
[index: string]: RULE;
|
|
6
7
|
};
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const matchesRegex: (regex: RegExp) =>
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
8
|
+
export declare const isType: (type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function") => RULE_SYNC;
|
|
9
|
+
export declare const matchesRegex: (regex: RegExp) => RULE_SYNC;
|
|
10
|
+
export declare const max: (max_value?: number) => RULE_SYNC;
|
|
11
|
+
export declare const min: (min_value?: number) => RULE_SYNC;
|
|
12
|
+
export declare const maxLength: (max_length?: number) => RULE_SYNC;
|
|
13
|
+
export declare const minLength: (min_length?: number) => RULE_SYNC;
|
|
14
|
+
export declare const stringBetween: (max?: number, min?: number) => RULE_SYNC;
|
|
15
|
+
export declare const numberBetween: (max?: number, min?: number) => RULE_SYNC;
|
|
16
|
+
export declare const acceptAny: (rules?: RULE[]) => RULE;
|
|
17
|
+
export declare const acceptAnySync: (rules?: RULE_SYNC[]) => RULE_SYNC;
|
|
12
18
|
export declare const allowUndefined: (rules: RULES) => {};
|
|
13
19
|
export declare const preprocess: (fn: Function, rules: RULES) => {};
|
|
14
20
|
|
package/lib/helpers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=(n)=>n!==null&&typeof n==="object"&&("length"in n)&&typeof n.length==="number",p=(n)=>(e)=>typeof e===n,i=(n)=>(e)=>typeof e==="string"&&n.test(e),m=(n=1/0)=>(e)=>typeof e==="number"&&e<=n,f=(n=-1/0)=>(e)=>typeof e==="number"&&e>=n,w=(n=1/0)=>(e)=>s(e)&&e.length<=n,y=(n=1/0)=>(e)=>s(e)&&e.length>=n,a=(n=100,e=0)=>(t)=>typeof t==="string"&&t.length>=e&&t.length<n,L=(n=100,e=1)=>(t)=>typeof t==="number"&&t>=e&&t<n,h=(n=[])=>async(e,...t)=>(await Promise.all(n.map((o)=>o(void 0,e,...t)))).some((o)=>o),R=(n=[])=>(e,...t)=>n.map((o)=>o(void 0,e,...t)).some((o)=>o);var g=(n)=>Object.entries(n).reduce((e,[t,o])=>({...e,[t]:(r,...u)=>typeof r==="undefined"?!0:o(r,...u)}),{}),l=(n,e)=>Object.entries(e).reduce((t,[o,r])=>({...t,[o]:(u,...c)=>r(n(u),...c)}),{});export{a as stringBetween,l as preprocess,L as numberBetween,y as minLength,f as min,w as maxLength,m as max,i as matchesRegex,p as isType,g as allowUndefined,R as acceptAnySync,h as acceptAny};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v8.1.1
|
|
2
2
|
|
|
3
|
-
export type RULE = (value: unknown, ...overload: unknown[]) => boolean | Promise<boolean>;
|
|
4
3
|
export type RULE_SYNC = (value: unknown, ...overload: unknown[]) => boolean;
|
|
5
|
-
export type
|
|
6
|
-
[index: string]: RULE;
|
|
7
|
-
};
|
|
4
|
+
export type RULE = (value: unknown, ...overload: unknown[]) => boolean | Promise<boolean>;
|
|
8
5
|
export type RULES_SYNC = {
|
|
9
6
|
[index: string]: RULE_SYNC;
|
|
10
7
|
};
|
|
11
|
-
export type
|
|
12
|
-
[index: string]:
|
|
8
|
+
export type RULES = {
|
|
9
|
+
[index: string]: RULE;
|
|
13
10
|
};
|
|
14
11
|
export type SCHEMA_SYNC = {
|
|
15
12
|
[index: string]: RULES_SYNC;
|
|
16
13
|
};
|
|
14
|
+
export type SCHEMA = {
|
|
15
|
+
[index: string]: RULES;
|
|
16
|
+
};
|
|
17
17
|
export type CHECKABLE_OBJECT = {
|
|
18
18
|
[index: string]: unknown;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* @arg {boolean} strict --- Don't allow object to have keys not included in the schema
|
|
22
|
+
* @arg {boolean} break_early --- Return the first error found
|
|
23
|
+
*/
|
|
24
|
+
export type SCHEMA_OPTIONS = {
|
|
25
|
+
strict?: boolean;
|
|
26
|
+
};
|
|
23
27
|
export type CHECKED_SCHEMA_SYNC = {
|
|
24
28
|
[index: string]: string[];
|
|
25
29
|
};
|
|
30
|
+
export type CHECKED_SCHEMA = Promise<CHECKED_SCHEMA_SYNC>;
|
|
26
31
|
export declare const getValueErrors: (value: unknown, rules: RULES, ...overload: unknown[]) => Promise<string[]>;
|
|
27
|
-
export declare const getSchemaErrors: (object: CHECKABLE_OBJECT, schema: SCHEMA,
|
|
32
|
+
export declare const getSchemaErrors: (object: CHECKABLE_OBJECT, schema: SCHEMA, options?: SCHEMA_OPTIONS, ...overload: unknown[]) => CHECKED_SCHEMA;
|
|
28
33
|
export declare const getValueErrorsSync: (value: unknown, rules: RULES_SYNC, ...overload: unknown[]) => string[];
|
|
29
|
-
export declare const getSchemaErrorsSync: (object: CHECKABLE_OBJECT, schema: SCHEMA_SYNC,
|
|
34
|
+
export declare const getSchemaErrorsSync: (object: CHECKABLE_OBJECT, schema: SCHEMA_SYNC, options?: SCHEMA_OPTIONS, ...overload: unknown[]) => CHECKED_SCHEMA_SYNC;
|
|
30
35
|
|
|
31
36
|
export {};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var W={strict:!1},X=async(B,G,...J)=>{const q={};return Object.entries(G).forEach(([x,f])=>{q[x]=Promise.resolve(!1).then(()=>f(B,...J)).then((z)=>q[x]=z).catch(()=>q[x]=!1)}),await Promise.allSettled(Object.values(q)),Object.entries(q).reduce((x,[f,z])=>z?x:[...x,f],[])},Z=async(B,G,J=W,...q)=>{const x={};if(Object.entries(G).forEach(([f,z])=>{x[f]=X(B[f],z,...q).then((K)=>{x[f]=K}).catch((K)=>{x[f]=K})}),J.strict){const f=Object.keys(B),z=new Set(Object.keys(G));f.filter((Q)=>!z.has(Q)).forEach((Q)=>{x[Q]=["Key not allowed"]})}return await Promise.allSettled(Object.values(x)),x},Y=(B,G,...J)=>Object.entries(G).reduce((q,[x,f])=>{try{return f(B,...J)?q:[...q,x]}catch(z){return[...q,x]}},[]),$=(B,G,J=W,...q)=>{const x=Object.entries(G).reduce((f,[z,K])=>({...f,[z]:Y(B[z],K,...q)}),{});if(J.strict){const f=Object.keys(B),z=new Set(Object.keys(G));f.filter((Q)=>!z.has(Q)).forEach((Q)=>{x[Q]=["Key not allowed"]})}return x};export{Y as getValueErrorsSync,X as getValueErrors,$ as getSchemaErrorsSync,Z as getSchemaErrors};
|
package/lib/patterns/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v8.1.1
|
|
2
2
|
|
|
3
3
|
export declare const EMAIL_PATTERN: RegExp;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const MYSQL_TIMESTAMP_PATTERN: RegExp;
|
|
5
5
|
export declare const URL_PATTERN: RegExp;
|
|
6
|
+
export declare const ISO_8601_DATETIME_PATTERN_STRICT: RegExp;
|
|
7
|
+
export declare const ISO_8601_DATETIME_PATTERN: RegExp;
|
|
8
|
+
export declare const ISO_8601_TIME_PATTERN: RegExp;
|
|
9
|
+
export declare const RFC_2822_TIMESTAMP_PATTERN: RegExp;
|
|
6
10
|
|
|
7
11
|
export {};
|
package/lib/patterns/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=/^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{1,}$/,c=/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,d=/^(https?:\/\/)?([^\s$.?#].[^\s]*)\.[a-z]{2,}(\/[^\s]*)?$/i,f=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,j=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)$/,k=/^(2[0-3]|[01][0-9]):?([0-5][0-9]):?([0-5][0-9])(Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?)$/,l=/^(?:(Sun|Mon|Tue|Wed|Thu|Fri|Sat),\s+)?(0[1-9]|[1-2]?[0-9]|3[01])\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(19[0-9]{2}|[2-9][0-9]{3})\s+(2[0-3]|[0-1][0-9]):([0-5][0-9])(?::(60|[0-5][0-9]))?\s+([-\+][0-9]{2}[0-5][0-9]|(?:UT|GMT|(?:E|C|M|P)(?:ST|DT)|[A-IK-Z]))(\s+|\(([^\(\)]+|\\\(|\\\))*\))*$/;export{d as URL_PATTERN,l as RFC_2822_TIMESTAMP_PATTERN,c as MYSQL_TIMESTAMP_PATTERN,k as ISO_8601_TIME_PATTERN,f as ISO_8601_DATETIME_PATTERN_STRICT,j as ISO_8601_DATETIME_PATTERN,x as EMAIL_PATTERN};
|
package/package.json
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
"name": "ivl",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Oskar Voorel",
|
|
6
|
+
"email": "oskar@voorel.com"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Oskar-V/validator.git"
|
|
11
|
+
},
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/bun": "^1.0.0",
|
|
15
|
+
"bun-plugin-dts": "^0.2.1",
|
|
16
|
+
"mitata": "^0.1.11",
|
|
17
|
+
"typescript": "^5.2.2",
|
|
18
|
+
"yup": "^1.4.0",
|
|
19
|
+
"zod": "^3.23.8"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./lib/index.d.ts",
|
|
24
|
+
"default": "./lib/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./patterns": {
|
|
27
|
+
"types": "./lib/patterns/index.d.ts",
|
|
28
|
+
"default": "./lib/patterns/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./helpers": {
|
|
31
|
+
"types": "./lib/helpers/index.d.ts",
|
|
32
|
+
"default": "./lib/helpers/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/Oskar-V/validator/issues/new"
|
|
37
|
+
},
|
|
38
|
+
"description": "Lightweight input validation",
|
|
39
|
+
"files": [
|
|
40
|
+
"lib"
|
|
41
|
+
],
|
|
42
|
+
"homepage": "https://github.com/Oskar-V/validator",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"validation",
|
|
45
|
+
"typescript",
|
|
46
|
+
"schema",
|
|
47
|
+
"input"
|
|
48
|
+
],
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "rm -rf ./lib && bun run build.mjs",
|
|
52
|
+
"prepublishOnly": "bun run build",
|
|
53
|
+
"benchmark": "bun run ./benchmark/index.ts"
|
|
54
|
+
},
|
|
55
|
+
"sideEffects": "false",
|
|
56
|
+
"types": "lib/index.d.ts"
|
|
52
57
|
}
|