kanun 1.0.3 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -49,10 +49,12 @@ function getValidatorContext() {
49
49
  * @returns
50
50
  */
51
51
  function useValidatorContext(context = {}) {
52
- const nextContext = {
53
- ...getValidatorContext(),
54
- ...context
55
- };
52
+ const currentContext = validatorContextStorage.getStore();
53
+ if (currentContext) {
54
+ Object.assign(currentContext, context);
55
+ return currentContext;
56
+ }
57
+ const nextContext = { ...context };
56
58
  validatorContextStorage.enterWith(nextContext);
57
59
  return nextContext;
58
60
  }
@@ -1087,6 +1089,7 @@ var validateAttributes = class {
1087
1089
  */
1088
1090
  validateRequired(value) {
1089
1091
  if (value === null || typeof value === "undefined") return false;
1092
+ else if (typeof Blob !== "undefined" && value instanceof Blob) return true;
1090
1093
  else if (typeof value === "string" && value.trim() === "") return false;
1091
1094
  else if (Array.isArray(value) && value.length < 1) return false;
1092
1095
  else if (typeof value === "object" && Object.keys(value).length < 1) return false;
package/dist/index.js CHANGED
@@ -19,10 +19,12 @@ function getValidatorContext() {
19
19
  * @returns
20
20
  */
21
21
  function useValidatorContext(context = {}) {
22
- const nextContext = {
23
- ...getValidatorContext(),
24
- ...context
25
- };
22
+ const currentContext = validatorContextStorage.getStore();
23
+ if (currentContext) {
24
+ Object.assign(currentContext, context);
25
+ return currentContext;
26
+ }
27
+ const nextContext = { ...context };
26
28
  validatorContextStorage.enterWith(nextContext);
27
29
  return nextContext;
28
30
  }
@@ -1057,6 +1059,7 @@ var validateAttributes = class {
1057
1059
  */
1058
1060
  validateRequired(value) {
1059
1061
  if (value === null || typeof value === "undefined") return false;
1062
+ else if (typeof Blob !== "undefined" && value instanceof Blob) return true;
1060
1063
  else if (typeof value === "string" && value.trim() === "") return false;
1061
1064
  else if (Array.isArray(value) && value.length < 1) return false;
1062
1065
  else if (typeof value === "object" && Object.keys(value).length < 1) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kanun",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Framework-agnostic TypeScript-first validation library.",
5
5
  "type": "module",
6
6
  "files": [