1 | import { StringPredicate } from './predicates/string.js';
|
2 | import { NumberPredicate } from './predicates/number.js';
|
3 | import { BigIntPredicate } from './predicates/bigint.js';
|
4 | import { BooleanPredicate } from './predicates/boolean.js';
|
5 | import { Predicate } from './predicates/predicate.js';
|
6 | import { ArrayPredicate } from './predicates/array.js';
|
7 | import { ObjectPredicate } from './predicates/object.js';
|
8 | import { DatePredicate } from './predicates/date.js';
|
9 | import { ErrorPredicate } from './predicates/error.js';
|
10 | import { MapPredicate } from './predicates/map.js';
|
11 | import { WeakMapPredicate } from './predicates/weak-map.js';
|
12 | import { SetPredicate } from './predicates/set.js';
|
13 | import { WeakSetPredicate } from './predicates/weak-set.js';
|
14 | import { TypedArrayPredicate } from './predicates/typed-array.js';
|
15 | import { ArrayBufferPredicate } from './predicates/array-buffer.js';
|
16 | import { DataViewPredicate } from './predicates/data-view.js';
|
17 | import { AnyPredicate } from './predicates/any.js';
|
18 | const predicates = (object, options) => {
|
19 | Object.defineProperties(object, {
|
20 | string: {
|
21 | get: () => new StringPredicate(options),
|
22 | },
|
23 | number: {
|
24 | get: () => new NumberPredicate(options),
|
25 | },
|
26 | bigint: {
|
27 | get: () => new BigIntPredicate(options),
|
28 | },
|
29 | boolean: {
|
30 | get: () => new BooleanPredicate(options),
|
31 | },
|
32 | undefined: {
|
33 | get: () => new Predicate('undefined', options),
|
34 | },
|
35 | null: {
|
36 | get: () => new Predicate('null', options),
|
37 | },
|
38 | nullOrUndefined: {
|
39 | get: () => new Predicate('nullOrUndefined', options),
|
40 | },
|
41 | nan: {
|
42 | get: () => new Predicate('nan', options),
|
43 | },
|
44 | symbol: {
|
45 | get: () => new Predicate('symbol', options),
|
46 | },
|
47 | array: {
|
48 | get: () => new ArrayPredicate(options),
|
49 | },
|
50 | object: {
|
51 | get: () => new ObjectPredicate(options),
|
52 | },
|
53 | date: {
|
54 | get: () => new DatePredicate(options),
|
55 | },
|
56 | error: {
|
57 | get: () => new ErrorPredicate(options),
|
58 | },
|
59 | map: {
|
60 | get: () => new MapPredicate(options),
|
61 | },
|
62 | weakMap: {
|
63 | get: () => new WeakMapPredicate(options),
|
64 | },
|
65 | set: {
|
66 | get: () => new SetPredicate(options),
|
67 | },
|
68 | weakSet: {
|
69 | get: () => new WeakSetPredicate(options),
|
70 | },
|
71 | function: {
|
72 | get: () => new Predicate('Function', options),
|
73 | },
|
74 | buffer: {
|
75 | get: () => new Predicate('Buffer', options),
|
76 | },
|
77 | regExp: {
|
78 | get: () => new Predicate('RegExp', options),
|
79 | },
|
80 | promise: {
|
81 | get: () => new Predicate('Promise', options),
|
82 | },
|
83 | typedArray: {
|
84 | get: () => new TypedArrayPredicate('TypedArray', options),
|
85 | },
|
86 | int8Array: {
|
87 | get: () => new TypedArrayPredicate('Int8Array', options),
|
88 | },
|
89 | uint8Array: {
|
90 | get: () => new TypedArrayPredicate('Uint8Array', options),
|
91 | },
|
92 | uint8ClampedArray: {
|
93 | get: () => new TypedArrayPredicate('Uint8ClampedArray', options),
|
94 | },
|
95 | int16Array: {
|
96 | get: () => new TypedArrayPredicate('Int16Array', options),
|
97 | },
|
98 | uint16Array: {
|
99 | get: () => new TypedArrayPredicate('Uint16Array', options),
|
100 | },
|
101 | int32Array: {
|
102 | get: () => new TypedArrayPredicate('Int32Array', options),
|
103 | },
|
104 | uint32Array: {
|
105 | get: () => new TypedArrayPredicate('Uint32Array', options),
|
106 | },
|
107 | float32Array: {
|
108 | get: () => new TypedArrayPredicate('Float32Array', options),
|
109 | },
|
110 | float64Array: {
|
111 | get: () => new TypedArrayPredicate('Float64Array', options),
|
112 | },
|
113 | arrayBuffer: {
|
114 | get: () => new ArrayBufferPredicate('ArrayBuffer', options),
|
115 | },
|
116 | sharedArrayBuffer: {
|
117 | get: () => new ArrayBufferPredicate('SharedArrayBuffer', options),
|
118 | },
|
119 | dataView: {
|
120 | get: () => new DataViewPredicate(options),
|
121 | },
|
122 | iterable: {
|
123 | get: () => new Predicate('Iterable', options),
|
124 | },
|
125 | any: {
|
126 | value: (...predicates) => new AnyPredicate(predicates, options),
|
127 | },
|
128 | });
|
129 | return object;
|
130 | };
|
131 | export default predicates;
|
132 | export { ObjectPredicate } from './predicates/object.js';
|
133 | export { StringPredicate } from './predicates/string.js';
|
134 | export { NumberPredicate } from './predicates/number.js';
|
135 | export { BigIntPredicate } from './predicates/bigint.js';
|
136 | export { BooleanPredicate } from './predicates/boolean.js';
|
137 | export { ArrayPredicate } from './predicates/array.js';
|
138 | export { DatePredicate } from './predicates/date.js';
|
139 | export { ErrorPredicate } from './predicates/error.js';
|
140 | export { MapPredicate } from './predicates/map.js';
|
141 | export { WeakMapPredicate } from './predicates/weak-map.js';
|
142 | export { SetPredicate } from './predicates/set.js';
|
143 | export { WeakSetPredicate } from './predicates/weak-set.js';
|
144 | export { TypedArrayPredicate } from './predicates/typed-array.js';
|
145 | export { ArrayBufferPredicate } from './predicates/array-buffer.js';
|
146 | export { DataViewPredicate } from './predicates/data-view.js';
|
147 | export { AnyPredicate } from './predicates/any.js';
|