@hkdigital/lib-sveltekit 0.0.57 → 0.0.59

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.
@@ -35,24 +35,6 @@ export function stringArray(value: any): void;
35
35
  * @param {*} value
36
36
  */
37
37
  export function objectArray(value: any): void;
38
- /**
39
- * Throws a validation error if value is not a Promise
40
- *
41
- * @param {*} value
42
- */
43
- export function promise_(value: any): void;
44
- /**
45
- * Throws a validation error if value is not a Map
46
- *
47
- * @param {*} value
48
- */
49
- export function map_(value: any): void;
50
- /**
51
- * Throws a validation error if value is not a Set
52
- *
53
- * @param {*} value
54
- */
55
- export function set_(value: any): void;
56
38
  /**
57
39
  * Throws a validation error if value is not an Error instance
58
40
  *
@@ -146,5 +128,23 @@ declare function array_(value: any): void;
146
128
  *
147
129
  * @param {*} value
148
130
  */
149
- declare function _function(value: any): void;
150
- export { undefined_ as undefined, object_ as object, array_ as array, _function as function, _function as function, _function as class, _class as class, promise_ as promise, map_ as map, set_ as set, error_ as error, _true as true, _true as true };
131
+ declare function function_(value: any): void;
132
+ /**
133
+ * Throws a validation error if value is not a Promise
134
+ *
135
+ * @param {*} value
136
+ */
137
+ declare function promise_(value: any): void;
138
+ /**
139
+ * Throws a validation error if value is not a Map
140
+ *
141
+ * @param {*} value
142
+ */
143
+ declare function map_(value: any): void;
144
+ /**
145
+ * Throws a validation error if value is not a Set
146
+ *
147
+ * @param {*} value
148
+ */
149
+ declare function set_(value: any): void;
150
+ export { undefined_ as undefined, object_ as object, array_ as array, function_ as function, _function as function, function_ as class, _class as class, promise_ as promise, map_ as map, set_ as set, error_ as error, _true as true, _true as true };
@@ -21,6 +21,10 @@ import * as v from 'valibot';
21
21
 
22
22
  import { isObject } from '../is/index.js';
23
23
 
24
+ /** Internals */
25
+
26
+ const ObjectSchema = v.custom(isObject, `Invalid type: Expected object`);
27
+
24
28
  /** Exports */
25
29
 
26
30
  // > Primitives
@@ -80,7 +84,7 @@ export { undefined_ as undefined };
80
84
  * @param {*} value
81
85
  */
82
86
  function object_(value) {
83
- v.parse(v.custom(isObject), value);
87
+ v.parse(ObjectSchema, value);
84
88
  // v.parse(v.looseObject({}), value);
85
89
  }
86
90
 
@@ -120,20 +124,20 @@ export function objectArray(value) {
120
124
  *
121
125
  * @param {*} value
122
126
  */
123
- function _function(value) {
127
+ function function_(value) {
124
128
  v.parse(v.function(), value);
125
129
  }
126
130
 
127
- export { _function as function };
131
+ export { function_ as function };
128
132
 
129
- export { _function as class };
133
+ export { function_ as class };
130
134
 
131
135
  /**
132
136
  * Throws a validation error if value is not a Promise
133
137
  *
134
138
  * @param {*} value
135
139
  */
136
- export function promise_(value) {
140
+ function promise_(value) {
137
141
  v.parse(v.instance(Promise), value);
138
142
  }
139
143
 
@@ -144,7 +148,7 @@ export { promise_ as promise };
144
148
  *
145
149
  * @param {*} value
146
150
  */
147
- export function map_(value) {
151
+ function map_(value) {
148
152
  v.parse(v.instance(Map), value);
149
153
  }
150
154
 
@@ -155,7 +159,7 @@ export { map_ as map };
155
159
  *
156
160
  * @param {*} value
157
161
  */
158
- export function set_(value) {
162
+ function set_(value) {
159
163
  v.parse(v.instance(Set), value);
160
164
  }
161
165
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "author": "Jens Kleinhout, HKdigital (https://hkdigital.nl)",
5
5
  "license": "ISC",
6
6
  "repository": {