@fixefy/fixefy-ui-utils 0.2.57 → 0.2.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.
@@ -1,5 +1,6 @@
1
- export declare const isArrayValid: (arr: Array<any>, minLength?: number, maxLength?: number) => boolean;
2
- export declare const isDateValid: () => boolean;
3
- export declare const isObjectValid: (obj: any, isCheckKeys?: boolean) => boolean;
4
- export declare const isStringValid: (str: string, minLength?: number | null, maxLength?: number | null, isValidateType?: boolean) => boolean;
5
- export declare const isObjectId: (value: string) => boolean;
1
+ import { MaybeN } from '@fixefy/fixefy-entities';
2
+ export declare const is_array_valid: (arr: unknown, min_length?: MaybeN<number>, max_length?: MaybeN<number>) => arr is Array<unknown>;
3
+ export declare const is_date_valid: (d: unknown) => d is Date;
4
+ export declare const is_object_valid: (obj: unknown) => obj is Record<string, unknown>;
5
+ export declare const is_string_valid: (str: unknown, minLength?: MaybeN<number>, maxLength?: MaybeN<number>) => str is string;
6
+ export declare const is_object_id: (value: unknown) => value is string;
@@ -9,60 +9,68 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- isArrayValid: function() {
13
- return isArrayValid;
12
+ is_array_valid: function() {
13
+ return is_array_valid;
14
14
  },
15
- isDateValid: function() {
16
- return isDateValid;
15
+ is_date_valid: function() {
16
+ return is_date_valid;
17
17
  },
18
- isObjectId: function() {
19
- return isObjectId;
18
+ is_object_id: function() {
19
+ return is_object_id;
20
20
  },
21
- isObjectValid: function() {
22
- return isObjectValid;
21
+ is_object_valid: function() {
22
+ return is_object_valid;
23
23
  },
24
- isStringValid: function() {
25
- return isStringValid;
24
+ is_string_valid: function() {
25
+ return is_string_valid;
26
26
  }
27
27
  });
28
- const isArrayValid = (arr, minLength = 1, maxLength = 0)=>{
29
- let rv = //arr instanceof Array
30
- Object.prototype.toString.call(arr) == '[object Array]' && isObjectValid(arr) && arr.length >= minLength;
31
- if (maxLength > 0) {
32
- rv = rv && arr.length <= maxLength;
28
+ const is_array_valid = (arr, min_length = 1, max_length = null)=>{
29
+ if (null == arr) return false;
30
+ if (false == Array.isArray(arr)) return false;
31
+ if (min_length) {
32
+ if (arr.length < min_length) return false;
33
33
  }
34
- return rv;
34
+ if (max_length) {
35
+ if (arr.length > max_length) return false;
36
+ }
37
+ return true;
35
38
  };
36
- const isDateValid = ()=>{
37
- return false;
39
+ const is_date_valid = (d)=>{
40
+ if (!d) return false;
41
+ if (Object.prototype.toString.call(d) != '[object Date]') return false;
42
+ return true;
38
43
  };
39
- const isObjectValid = (obj, isCheckKeys = false)=>{
40
- let rv = typeof obj !== 'undefined' && obj !== null;
41
- if (isCheckKeys) {
42
- rv = rv && Object.keys(obj).length > 0;
43
- }
44
+ const is_object_valid = (obj)=>{
45
+ if (null == obj) return false;
46
+ if (typeof obj != 'object') return false;
47
+ if (Object.keys(obj).length == 0) return false;
48
+ if (Object.getOwnPropertyNames(obj).length == 0) return false;
49
+ const rv = true;
44
50
  return rv;
45
51
  };
46
- const isStringValid = (str, minLength = null, maxLength = null, isValidateType = true)=>{
52
+ const is_string_valid = (str, minLength = null, maxLength = null)=>{
47
53
  if (str == null) return false;
48
- if (isValidateType && typeof str !== 'string') return false;
49
- if (str.toString().length == 0) return false;
50
- if (minLength && isNaN(minLength) === false && minLength > 0) {
51
- return str.toString().length >= minLength;
54
+ if (typeof str != 'string') return false;
55
+ if (str.length == 0) return false;
56
+ let rv = true;
57
+ if (minLength && minLength > 0 && isNaN(minLength) == false) {
58
+ rv = rv && str.length >= minLength;
52
59
  }
53
- if (maxLength && isNaN(maxLength) === false && maxLength > 0) {
54
- return str.toString().length <= maxLength;
60
+ if (rv == false) return false;
61
+ if (maxLength && maxLength > 0 && isNaN(maxLength) == false) {
62
+ rv = rv && str.length <= maxLength;
55
63
  }
56
- return true;
64
+ return rv;
57
65
  };
58
- const isObjectId = (value)=>{
66
+ const is_object_id = (value)=>{
59
67
  ///!* input check - if value is invalid - return false *!/
60
- if (isStringValid(value) === false) return false;
68
+ if (false == is_string_valid(value, 1, 24)) return false;
61
69
  ///!* set the regex *!/
62
70
  const regex = /^[0-9a-fA-F]{24}$/;
63
71
  //!* get the match *!/
64
72
  const matches = regex.exec(value);
65
73
  //!* check is null *!/
66
- const rv = matches != null && isArrayValid(matches);
74
+ const rv = matches != null && is_array_valid(matches);
67
75
  return rv;
68
76
  };
package/package.json CHANGED
@@ -3,34 +3,42 @@
3
3
  "browser": {
4
4
  "fs": false
5
5
  },
6
- "dependencies": {
7
- "@mui/material": "5.16.7",
8
- "@mui/styles": "5.16.7",
9
- "convert-excel-to-json": "1.7.0",
10
- "nookies": "2.5.2",
11
- "react": "18.3.1",
12
- "react-dom": "18.3.1"
6
+ "peerDependencies": {
7
+ "@fixefy/fixefy-entities": ">=0.1.20",
8
+ "@fixefy/fixefy-numeric": ">=0.1.3",
9
+ "@mui/material": ">=5.16.12",
10
+ "@mui/styles": ">=5.16.12",
11
+ "convert-excel-to-json": ">=1.7.0",
12
+ "csvtojson": ">=2.0.10",
13
+ "date-fns": ">=3.6.0",
14
+ "graphql-tag": ">=2.12.6",
15
+ "jss": ">=10.11.1",
16
+ "next": ">=14.2.26",
17
+ "nookies": ">=2.5.2",
18
+ "pluralize": ">=8.0.0",
19
+ "react": ">=18.3.1",
20
+ "react-dom": ">=18.3.1",
21
+ "regenerator-runtime": ">=0.13.11",
22
+ "tss-react": ">=4.8.6"
13
23
  },
24
+ "dependencies": {},
14
25
  "devDependencies": {
15
26
  "@types/convert-excel-to-json": "1.7.4",
16
27
  "@types/node": "20.14.0",
17
- "@types/nookies": "2.0.3",
18
28
  "@types/react": "18.3.3",
19
- "@typescript-eslint/eslint-plugin": "7.12.0",
20
- "@typescript-eslint/parser": "7.12.0",
21
- "eslint": "9.4.0",
22
- "eslint-config-prettier": "9.1.0",
23
- "eslint-plugin-prettier": "5.1.3",
24
- "eslint-plugin-react": "7.34.2",
25
- "eslint-plugin-react-hooks": "4.6.2",
26
- "prettier": "3.3.0",
27
- "typescript": "5.4.5"
29
+ "eslint": "9.34.0",
30
+ "eslint-config-next": "15.5.2",
31
+ "eslint-plugin-jsx-a11y": "6.10.2",
32
+ "eslint-plugin-react": "7.37.5",
33
+ "eslint-plugin-react-hooks": "5.2.0",
34
+ "prettier": "3.6.2",
35
+ "typescript": "5.9.2"
28
36
  },
29
37
  "license": "MIT",
30
38
  "name": "@fixefy/fixefy-ui-utils",
31
39
  "repository": {
32
40
  "type": "git",
33
- "url": "https://github.com/Fixefy/fixefy-commander.git"
41
+ "url": "https://github.com/Fixefy/fixefy-fixefy-ui-utils.git"
34
42
  },
35
43
  "scripts": {
36
44
  "build": "swc src -d dist --strip-leading-paths && tsc --declaration --emitDeclarationOnly --outDir dist",
@@ -38,8 +46,9 @@
38
46
  "raw_publish": "npm publish --userconfig ./.npmrc --otp 000000",
39
47
  "clean": "rm -rf build && rm -rf dist-* && yarn clean:node",
40
48
  "clean:node": "rm -rf node_modules",
41
- "lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
42
- "prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\""
49
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
50
+ "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
51
+ "prettier": "prettier --write \"src/**/*.{js,ts,jsx,tsx}\""
43
52
  },
44
53
  "engines": {
45
54
  "node": "20"
@@ -56,5 +65,5 @@
56
65
  "require": "./dist/index.js"
57
66
  }
58
67
  },
59
- "version": "0.2.57"
60
- }
68
+ "version": "0.2.59"
69
+ }