Comparing version 7.1.1 to 8.0.1
@@ -14,2 +14,6 @@ declare const GUBU: { | ||
}; | ||
keyspec?: { | ||
active?: boolean; | ||
keymark?: string; | ||
}; | ||
prefix?: string; | ||
@@ -20,2 +24,6 @@ }; | ||
log?: (point: string, state: State) => void; | ||
skip?: { | ||
depth?: number | number[]; | ||
keys?: string[]; | ||
}; | ||
}; | ||
@@ -37,6 +45,6 @@ type ValType = 'any' | // Any type. | ||
'regexp' | // A regular expression. | ||
'check' | // A check function. | ||
'undefined'; | ||
type Node<V> = { | ||
$: typeof GUBU; | ||
o: any; | ||
t: ValType; | ||
@@ -56,3 +64,2 @@ d: number; | ||
m: NodeMeta; | ||
s?: string; | ||
z?: string; | ||
@@ -65,3 +72,6 @@ } & { | ||
...vals: any[]) => Node<S>; | ||
type Validate = (val: any, update: Update, state: State) => boolean; | ||
type Validate = ((val: any, update: Update, state: State) => boolean) & { | ||
s?: (n: Node<any>) => string; | ||
a?: any[]; | ||
}; | ||
declare class State { | ||
@@ -86,2 +96,3 @@ match: boolean; | ||
keys: string[]; | ||
ancestors: Node<any>[]; | ||
path: string[]; | ||
@@ -152,3 +163,3 @@ node: Node<any>; | ||
<V>(root?: V, ctx?: Context): V & S; | ||
valid: <V_1>(root?: V_1 | undefined, ctx?: Context) => root is V_1 & S; | ||
valid: <V>(root?: V, ctx?: Context) => root is (V & S); | ||
match(root?: any, ctx?: Context): boolean; | ||
@@ -158,3 +169,4 @@ error(root?: any, ctx?: Context): GubuError[]; | ||
node(): Node<S>; | ||
stringify(shape?: any): string; | ||
stringify(...rest: any[]): string; | ||
jsonify(): any; | ||
toString(): string; | ||
@@ -169,5 +181,11 @@ gubu: { | ||
val?: any; | ||
d?: number; | ||
meta?: NodeMeta; | ||
ancestors?: Node<any>[]; | ||
node?: Node<any>; | ||
tokens?: string[]; | ||
i?: number; | ||
}): any; | ||
refs?: any; | ||
} | string, current?: any): any; | ||
declare function build(v: any, top?: boolean): any; | ||
declare function truncate(str?: string, len?: number): string; | ||
@@ -197,2 +215,5 @@ declare const Required: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
declare const Rename: <V>(this: any, inopts: any, shape?: Node<V> | V) => Node<V>; | ||
declare const Child: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
declare const Rest: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
declare const Type: <V>(this: any, tname: string, shape?: Node<V> | V) => Node<V>; | ||
declare const Min: <V>(this: any, min: number | string, shape?: Node<V> | V) => Node<V>; | ||
@@ -203,39 +224,38 @@ declare const Max: <V>(this: any, max: number | string, shape?: Node<V> | V) => Node<V>; | ||
declare const Len: <V>(this: any, len: number, shape?: Node<V> | V) => Node<V>; | ||
declare const Child: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
declare const Rest: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
declare function buildize<V>(node0?: any, node1?: any): Node<V>; | ||
declare function buildize<V>(self?: any, shape?: any): Node<V>; | ||
declare function makeErr(state: State, text?: string, why?: string, user?: any): ErrDesc; | ||
declare function stringify(src: any, replacer?: any, dequote?: boolean, expand?: boolean): string; | ||
declare function stringify(src: any, replacer?: any, dequote?: boolean, expand?: boolean): any; | ||
declare const G$: (node: any) => Node<any>; | ||
declare const BuilderMap: { | ||
Above: <V>(this: any, above: number | string, shape?: Node<V> | V) => Node<V>; | ||
After: <V_1>(this: any, validate: Validate, shape?: V_1 | Node<V_1> | undefined) => Node<V_1>; | ||
After: <V>(this: any, validate: Validate, shape?: Node<V> | V) => Node<V>; | ||
All: (this: any, ...inshapes: any[]) => Node<unknown>; | ||
Any: <V_2>(this: any, shape?: V_2 | Node<V_2> | undefined) => Node<V_2>; | ||
Before: <V_3>(this: any, validate: Validate, shape?: V_3 | Node<V_3> | undefined) => Node<V_3>; | ||
Below: <V_4>(this: any, below: number | string, shape?: V_4 | Node<V_4> | undefined) => Node<V_4>; | ||
Check: <V_5>(this: any, check: Validate | RegExp | string, shape?: V_5 | Node<V_5> | undefined) => Node<V_5>; | ||
Child: <V_6>(this: any, child?: any, shape?: V_6 | Node<V_6> | undefined) => Node<V_6>; | ||
Closed: <V_7>(this: any, shape?: V_7 | Node<V_7> | undefined) => Node<V_7>; | ||
Default: <V_8>(this: any, dval?: any, shape?: V_8 | Node<V_8> | undefined) => Node<V_8>; | ||
Define: <V_9>(this: any, inopts: any, shape?: V_9 | Node<V_9> | undefined) => Node<V_9>; | ||
Empty: <V_10>(this: any, shape?: V_10 | Node<V_10> | undefined) => Node<V_10>; | ||
Any: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Before: <V>(this: any, validate: Validate, shape?: Node<V> | V) => Node<V>; | ||
Below: <V>(this: any, below: number | string, shape?: Node<V> | V) => Node<V>; | ||
Check: <V>(this: any, check: Validate | RegExp | string, shape?: Node<V> | V) => Node<V>; | ||
Child: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
Closed: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Default: <V>(this: any, dval?: any, shape?: Node<V> | V) => Node<V>; | ||
Define: <V>(this: any, inopts: any, shape?: Node<V> | V) => Node<V>; | ||
Empty: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Exact: (this: any, ...vals: any[]) => Node<unknown>; | ||
Fault: <V_11>(this: any, msg: string, shape?: V_11 | Node<V_11> | undefined) => Node<V_11>; | ||
Func: <V_12>(this: any, shape?: V_12 | Node<V_12> | undefined) => Node<V_12>; | ||
Ignore: <V_13>(this: any, shape?: V_13 | Node<V_13> | undefined) => Node<V_13>; | ||
Fault: <V>(this: any, msg: string, shape?: Node<V> | V) => Node<V>; | ||
Func: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Ignore: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Key: (this: any, depth?: number | Function, join?: string) => Node<unknown>; | ||
Len: <V_14>(this: any, len: number, shape?: V_14 | Node<V_14> | undefined) => Node<V_14>; | ||
Max: <V_15>(this: any, max: number | string, shape?: V_15 | Node<V_15> | undefined) => Node<V_15>; | ||
Min: <V_16>(this: any, min: number | string, shape?: V_16 | Node<V_16> | undefined) => Node<V_16>; | ||
Never: <V_17>(this: any, shape?: V_17 | Node<V_17> | undefined) => Node<V_17>; | ||
Len: <V>(this: any, len: number, shape?: Node<V> | V) => Node<V>; | ||
Max: <V>(this: any, max: number | string, shape?: Node<V> | V) => Node<V>; | ||
Min: <V>(this: any, min: number | string, shape?: Node<V> | V) => Node<V>; | ||
Never: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
One: (this: any, ...inshapes: any[]) => Node<unknown>; | ||
Open: <V_18>(this: any, shape?: V_18 | Node<V_18> | undefined) => Node<V_18>; | ||
Optional: <V_19>(this: any, shape?: V_19 | Node<V_19> | undefined) => Node<V_19>; | ||
Refer: <V_20>(this: any, inopts: any, shape?: V_20 | Node<V_20> | undefined) => Node<V_20>; | ||
Rename: <V_21>(this: any, inopts: any, shape?: V_21 | Node<V_21> | undefined) => Node<V_21>; | ||
Required: <V_22>(this: any, shape?: V_22 | Node<V_22> | undefined) => Node<V_22>; | ||
Skip: <V_23>(this: any, shape?: V_23 | Node<V_23> | undefined) => Node<V_23>; | ||
Open: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Optional: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Refer: <V>(this: any, inopts: any, shape?: Node<V> | V) => Node<V>; | ||
Rename: <V>(this: any, inopts: any, shape?: Node<V> | V) => Node<V>; | ||
Required: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Skip: <V>(this: any, shape?: Node<V> | V) => Node<V>; | ||
Some: (this: any, ...inshapes: any[]) => Node<unknown>; | ||
Rest: <V_24>(this: any, child?: any, shape?: V_24 | Node<V_24> | undefined) => Node<V_24>; | ||
Rest: <V>(this: any, child?: any, shape?: Node<V> | V) => Node<V>; | ||
Type: <V>(this: any, tname: string, shape?: Node<V> | V) => Node<V>; | ||
}; | ||
@@ -259,2 +279,3 @@ type GubuShape = ReturnType<typeof make> & { | ||
expr: typeof expr; | ||
build: typeof build; | ||
MakeArgu: typeof MakeArgu; | ||
@@ -293,2 +314,3 @@ }; | ||
declare const GSome: (this: any, ...inshapes: any[]) => Node<unknown>; | ||
declare const GType: <V>(this: any, tname: string, shape?: Node<V> | V) => Node<V>; | ||
type args = any[] | IArguments; | ||
@@ -298,2 +320,2 @@ type Argu = (args: args | string, whence: string | Record<string, any>, spec?: Record<string, any>) => (typeof args extends string ? ((args: args) => Record<string, any>) : Record<string, any>); | ||
export type { Validate, Update, Context, Builder, Node, State, GubuShape, }; | ||
export { Gubu, G$, nodize, buildize, makeErr, stringify, truncate, expr, MakeArgu, Above, After, All, Any, Before, Below, Check, Child, Closed, Default, Define, Empty, Exact, Fault, Func, Ignore, Key, Len, Max, Min, Never, One, Open, Optional, Refer, Rename, Required, Skip, Some, Rest, GAbove, GAfter, GAll, GAny, GBefore, GBelow, GCheck, GChild, GClosed, GDefault, GDefine, GEmpty, GExact, GFault, GFunc, GIgnore, GKey, GLen, GMax, GMin, GNever, GOne, GOpen, GOptional, GRefer, GRename, GRequired, GSkip, GSome, GRest, }; | ||
export { Gubu, G$, nodize, buildize, makeErr, stringify, truncate, expr, MakeArgu, build, Above, After, All, Any, Before, Below, Check, Child, Closed, Default, Define, Empty, Exact, Fault, Func, Ignore, Key, Len, Max, Min, Never, One, Open, Optional, Refer, Rename, Required, Skip, Some, Type, Rest, GAbove, GAfter, GAll, GAny, GBefore, GBelow, GCheck, GChild, GClosed, GDefault, GDefine, GEmpty, GExact, GFault, GFunc, GIgnore, GKey, GLen, GMax, GMin, GNever, GOne, GOpen, GOptional, GRefer, GRename, GRequired, GSkip, GSome, GType, GRest, }; |
{ | ||
"name": "gubu", | ||
"version": "7.1.1", | ||
"version": "8.0.1", | ||
"description": "An object shape validation utility.", | ||
@@ -26,6 +26,6 @@ "main": "gubu.js", | ||
"test-watch": "npm run version && jest --coverage --watchAll", | ||
"test-web": "npm run build && npm run build-web && browserify -i util -o test/web.js -e test/entry.js -im && open test/web.html", | ||
"test-web": "npm run build && npm run build-web && browserify -i util -o test/web.js -e test/entry.js -im && open test/web.test.html", | ||
"watch": "npm run version && tsc -w -d", | ||
"build": "npm run version && tsc -d", | ||
"build-web": "cp gubu.js gubu.min.js && browserify -i util -o gubu.min.js -e gubu.web.js -s Gubu -im -p tinyify", | ||
"build-web": "cp gubu.js gubu.min.js && browserify -i util -o gubu.min.js -e gubu.web.js -s Gubu -im", | ||
"version": "node -r fs -e \"v=require('./package.json').version;s=fs.readFileSync('./gubu.ts').toString();if(!s.includes('VERSION = \\''+v+'\\'')){s=s.replace(/VERSION = '.*?'/,'VERSION = \\''+v+'\\'');fs.writeFileSync('./gubu.ts',s)}\"", | ||
@@ -50,12 +50,18 @@ "clean": "rm -rf node_modules yarn.lock package-lock.json", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^26.0.1", | ||
"@types/jest": "^29.5.12", | ||
"browserify": "^17.0.0", | ||
"es-jest": "^2.1.0", | ||
"esbuild": "^0.21.5", | ||
"esbuild": "^0.23.0", | ||
"esbuild-jest": "^0.5.0", | ||
"jest": "^29.7.0", | ||
"tinyify": "^4.0.0", | ||
"ts-jest": "^29.1.4", | ||
"typescript": "^5.4.5" | ||
"ts-jest": "^29.1.5", | ||
"typescript": "^5.5.3", | ||
"vite": "^5.2.8", | ||
"vite-plugin-commonjs": "^0.10.1" | ||
}, | ||
"overrides": { | ||
"acorn": "8.12.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
447883
7757
12
2