ivl 0.1.2 → 0.1.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.
@@ -0,0 +1,15 @@
1
+ // Generated by dts-bundle-generator v8.1.1
2
+
3
+ export type RULE = (value: unknown, ...overload: unknown[]) => boolean | Promise<boolean>;
4
+ export type RULES = {
5
+ [index: string]: RULE;
6
+ };
7
+ export declare const type: (type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function") => RULE;
8
+ export declare const matchesRegex: (regex: RegExp) => (value: unknown) => boolean;
9
+ export declare const stringBetween: (max?: number, min?: number) => (s: unknown) => boolean;
10
+ export declare const numberBetween: (max?: number, min?: number) => (i: unknown) => boolean;
11
+ export declare const acceptAny: (rules?: RULE[]) => (i: unknown, ...extra: unknown[]) => Promise<boolean>;
12
+ export declare const allowUndefined: (rules: RULES) => {};
13
+ export declare const preprocess: (fn: Function, rules: RULES) => {};
14
+
15
+ export {};
@@ -1 +1 @@
1
- var p=(e)=>(n)=>typeof n===e,s=(e)=>(n)=>typeof n==="string"&&e.test(n),i=(e=100,n=0)=>(t)=>typeof t==="string"&&t.length>=n&&t.length<e,w=(e=100,n=1)=>(t)=>typeof t==="number"&&t>=n&&t<e,f=(e=[])=>async(n,...t)=>(await Promise.all(e.map((o)=>o.call(void 0,n,...t)))).some((o)=>o),d=(e)=>Object.entries(e).reduce((n,[t,o])=>({...n,[t]:(r,...c)=>typeof r==="undefined"?!0:o(r,...c)}),{}),k=(e,n)=>Object.entries(n).reduce((t,[o,r])=>({...t,[o]:(c,...u)=>r(e(c),...u)}),{});export{p as type,i as stringBetween,k as preprocess,w as numberBetween,s as matchesRegex,d as allowUndefined,f as acceptAny};
1
+ var u=(e)=>(n)=>typeof n===e,i=(e)=>(n)=>typeof n==="string"&&e.test(n),p=(e=100,n=0)=>(t)=>typeof t==="string"&&t.length>=n&&t.length<e,f=(e=100,n=1)=>(t)=>typeof t==="number"&&t>=n&&t<e,w=(e=[])=>async(n,...t)=>(await Promise.all(e.map((o)=>o.call(void 0,n,...t)))).some((o)=>o);var a=(e)=>Object.entries(e).reduce((n,[t,o])=>({...n,[t]:(r,...c)=>typeof r==="undefined"?!0:o(r,...c)}),{}),l=(e,n)=>Object.entries(n).reduce((t,[o,r])=>({...t,[o]:(c,...s)=>r(e(c),...s)}),{});export{u as type,p as stringBetween,l as preprocess,f as numberBetween,i as matchesRegex,a as allowUndefined,w as acceptAny};
package/lib/index.d.ts CHANGED
@@ -1,7 +1,31 @@
1
1
  // Generated by dts-bundle-generator v8.1.1
2
2
 
3
- export declare const EMAIL_PATTERN: RegExp;
4
- export declare const TIMESTAMP_PATTERN: RegExp;
5
- export declare const URL_PATTERN: RegExp;
3
+ export type RULE = (value: unknown, ...overload: unknown[]) => boolean | Promise<boolean>;
4
+ export type RULE_SYNC = (value: unknown, ...overload: unknown[]) => boolean;
5
+ export type RULES = {
6
+ [index: string]: RULE;
7
+ };
8
+ export type RULES_SYNC = {
9
+ [index: string]: RULE_SYNC;
10
+ };
11
+ export type SCHEMA = {
12
+ [index: string]: RULES;
13
+ };
14
+ export type SCHEMA_SYNC = {
15
+ [index: string]: RULES_SYNC;
16
+ };
17
+ export type CHECKABLE_OBJECT = {
18
+ [index: string]: unknown;
19
+ };
20
+ export type CHECKED_SCHEMA = Promise<{
21
+ [index: string]: string[];
22
+ }>;
23
+ export type CHECKED_SCHEMA_SYNC = {
24
+ [index: string]: string[];
25
+ };
26
+ export declare const getValueErrors: (value: unknown, rules: RULES, ...overload: unknown[]) => Promise<string[]>;
27
+ export declare const getSchemaErrors: (object: CHECKABLE_OBJECT, schema: SCHEMA, strict?: Boolean, ...overload: unknown[]) => CHECKED_SCHEMA;
28
+ export declare const getValueErrorsSync: (value: unknown, rules: RULES_SYNC, ...overload: unknown[]) => string[];
29
+ export declare const getSchemaErrorsSync: (object: CHECKABLE_OBJECT, schema: SCHEMA_SYNC, strict?: Boolean, ...overload: unknown[]) => CHECKED_SCHEMA_SYNC;
6
30
 
7
31
  export {};
@@ -0,0 +1,7 @@
1
+ // Generated by dts-bundle-generator v8.1.1
2
+
3
+ export declare const EMAIL_PATTERN: RegExp;
4
+ export declare const TIMESTAMP_PATTERN: RegExp;
5
+ export declare const URL_PATTERN: RegExp;
6
+
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ivl",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "description": "Lightweight input validation",