@blastlabs/utils 1.11.0

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.
Files changed (137) hide show
  1. package/README.md +267 -0
  2. package/dist/components/dev/ApiLogger.d.ts +136 -0
  3. package/dist/components/dev/ApiLogger.d.ts.map +1 -0
  4. package/dist/components/dev/ApiLogger.js +408 -0
  5. package/dist/components/dev/DevPanel.d.ts +32 -0
  6. package/dist/components/dev/DevPanel.d.ts.map +1 -0
  7. package/dist/components/dev/DevPanel.js +196 -0
  8. package/dist/components/dev/FormDevTools/FormDevTools.d.ts +136 -0
  9. package/dist/components/dev/FormDevTools/FormDevTools.d.ts.map +1 -0
  10. package/dist/components/dev/FormDevTools/FormDevTools.js +442 -0
  11. package/dist/components/dev/FormDevTools/index.d.ts +3 -0
  12. package/dist/components/dev/FormDevTools/index.d.ts.map +1 -0
  13. package/dist/components/dev/FormDevTools/index.js +1 -0
  14. package/dist/components/dev/FormDevTools/styles.d.ts +45 -0
  15. package/dist/components/dev/FormDevTools/styles.d.ts.map +1 -0
  16. package/dist/components/dev/FormDevTools/styles.js +197 -0
  17. package/dist/components/dev/IdSelector.d.ts +50 -0
  18. package/dist/components/dev/IdSelector.d.ts.map +1 -0
  19. package/dist/components/dev/IdSelector.js +129 -0
  20. package/dist/components/dev/WindowSizeDisplay.d.ts +44 -0
  21. package/dist/components/dev/WindowSizeDisplay.d.ts.map +1 -0
  22. package/dist/components/dev/WindowSizeDisplay.js +74 -0
  23. package/dist/components/dev/ZIndexDebugger.d.ts +32 -0
  24. package/dist/components/dev/ZIndexDebugger.d.ts.map +1 -0
  25. package/dist/components/dev/ZIndexDebugger.js +184 -0
  26. package/dist/components/dev/index.d.ts +15 -0
  27. package/dist/components/dev/index.d.ts.map +1 -0
  28. package/dist/components/dev/index.js +12 -0
  29. package/dist/components/index.d.ts +8 -0
  30. package/dist/components/index.d.ts.map +1 -0
  31. package/dist/components/index.js +7 -0
  32. package/dist/date/index.d.ts +64 -0
  33. package/dist/date/index.d.ts.map +1 -0
  34. package/dist/date/index.js +92 -0
  35. package/dist/date/index.test.d.ts +2 -0
  36. package/dist/date/index.test.d.ts.map +1 -0
  37. package/dist/date/index.test.js +166 -0
  38. package/dist/form/__tests__/formatter.test.d.ts +2 -0
  39. package/dist/form/__tests__/formatter.test.d.ts.map +1 -0
  40. package/dist/form/__tests__/formatter.test.js +74 -0
  41. package/dist/form/__tests__/helpers.test.d.ts +2 -0
  42. package/dist/form/__tests__/helpers.test.d.ts.map +1 -0
  43. package/dist/form/__tests__/helpers.test.js +42 -0
  44. package/dist/form/__tests__/validation.test.d.ts +2 -0
  45. package/dist/form/__tests__/validation.test.d.ts.map +1 -0
  46. package/dist/form/__tests__/validation.test.js +67 -0
  47. package/dist/form/formatter.d.ts +34 -0
  48. package/dist/form/formatter.d.ts.map +1 -0
  49. package/dist/form/formatter.js +76 -0
  50. package/dist/form/helpers.d.ts +16 -0
  51. package/dist/form/helpers.d.ts.map +1 -0
  52. package/dist/form/helpers.js +34 -0
  53. package/dist/form/index.d.ts +9 -0
  54. package/dist/form/index.d.ts.map +1 -0
  55. package/dist/form/index.js +11 -0
  56. package/dist/form/validation.d.ts +33 -0
  57. package/dist/form/validation.d.ts.map +1 -0
  58. package/dist/form/validation.js +56 -0
  59. package/dist/hooks/index.d.ts +19 -0
  60. package/dist/hooks/index.d.ts.map +1 -0
  61. package/dist/hooks/index.js +23 -0
  62. package/dist/hooks/useClickOutside.d.ts +49 -0
  63. package/dist/hooks/useClickOutside.d.ts.map +1 -0
  64. package/dist/hooks/useClickOutside.js +94 -0
  65. package/dist/hooks/useCopyToClipboard.d.ts +67 -0
  66. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
  67. package/dist/hooks/useCopyToClipboard.js +79 -0
  68. package/dist/hooks/useDebounce.d.ts +47 -0
  69. package/dist/hooks/useDebounce.d.ts.map +1 -0
  70. package/dist/hooks/useDebounce.js +60 -0
  71. package/dist/hooks/useEventListener.d.ts +79 -0
  72. package/dist/hooks/useEventListener.d.ts.map +1 -0
  73. package/dist/hooks/useEventListener.js +33 -0
  74. package/dist/hooks/useIntersectionObserver.d.ts +109 -0
  75. package/dist/hooks/useIntersectionObserver.d.ts.map +1 -0
  76. package/dist/hooks/useIntersectionObserver.js +128 -0
  77. package/dist/hooks/useLocalStorage.d.ts +19 -0
  78. package/dist/hooks/useLocalStorage.d.ts.map +1 -0
  79. package/dist/hooks/useLocalStorage.js +91 -0
  80. package/dist/hooks/useMediaQuery.d.ts +56 -0
  81. package/dist/hooks/useMediaQuery.d.ts.map +1 -0
  82. package/dist/hooks/useMediaQuery.js +104 -0
  83. package/dist/hooks/usePrevious.d.ts +58 -0
  84. package/dist/hooks/usePrevious.d.ts.map +1 -0
  85. package/dist/hooks/usePrevious.js +67 -0
  86. package/dist/hooks/useSessionStorage.d.ts +19 -0
  87. package/dist/hooks/useSessionStorage.d.ts.map +1 -0
  88. package/dist/hooks/useSessionStorage.js +85 -0
  89. package/dist/hooks/useThrottle.d.ts +57 -0
  90. package/dist/hooks/useThrottle.d.ts.map +1 -0
  91. package/dist/hooks/useThrottle.js +80 -0
  92. package/dist/hooks/useToggle.d.ts +49 -0
  93. package/dist/hooks/useToggle.d.ts.map +1 -0
  94. package/dist/hooks/useToggle.js +56 -0
  95. package/dist/hooks/useWindowSize.d.ts +58 -0
  96. package/dist/hooks/useWindowSize.d.ts.map +1 -0
  97. package/dist/hooks/useWindowSize.js +79 -0
  98. package/dist/index.d.ts +6 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +17 -0
  101. package/dist/mock/form.d.ts +41 -0
  102. package/dist/mock/form.d.ts.map +1 -0
  103. package/dist/mock/form.js +195 -0
  104. package/dist/mock/generators.d.ts +112 -0
  105. package/dist/mock/generators.d.ts.map +1 -0
  106. package/dist/mock/generators.js +195 -0
  107. package/dist/mock/index.d.ts +8 -0
  108. package/dist/mock/index.d.ts.map +1 -0
  109. package/dist/mock/index.js +9 -0
  110. package/dist/number/format.d.ts +116 -0
  111. package/dist/number/format.d.ts.map +1 -0
  112. package/dist/number/format.js +165 -0
  113. package/dist/number/index.d.ts +7 -0
  114. package/dist/number/index.d.ts.map +1 -0
  115. package/dist/number/index.js +7 -0
  116. package/dist/string/__tests__/case.test.d.ts +2 -0
  117. package/dist/string/__tests__/case.test.d.ts.map +1 -0
  118. package/dist/string/__tests__/case.test.js +61 -0
  119. package/dist/string/__tests__/manipulation.test.d.ts +2 -0
  120. package/dist/string/__tests__/manipulation.test.d.ts.map +1 -0
  121. package/dist/string/__tests__/manipulation.test.js +109 -0
  122. package/dist/string/__tests__/validation.test.d.ts +2 -0
  123. package/dist/string/__tests__/validation.test.d.ts.map +1 -0
  124. package/dist/string/__tests__/validation.test.js +101 -0
  125. package/dist/string/case.d.ts +42 -0
  126. package/dist/string/case.d.ts.map +1 -0
  127. package/dist/string/case.js +71 -0
  128. package/dist/string/index.d.ts +9 -0
  129. package/dist/string/index.d.ts.map +1 -0
  130. package/dist/string/index.js +11 -0
  131. package/dist/string/manipulation.d.ts +61 -0
  132. package/dist/string/manipulation.d.ts.map +1 -0
  133. package/dist/string/manipulation.js +106 -0
  134. package/dist/string/validation.d.ts +79 -0
  135. package/dist/string/validation.d.ts.map +1 -0
  136. package/dist/string/validation.js +115 -0
  137. package/package.json +86 -0
@@ -0,0 +1,115 @@
1
+ /**
2
+ * String Validation Utilities
3
+ */
4
+ /**
5
+ * 빈 문자열 또는 공백만 있는지 확인
6
+ * @example isEmpty('') // true
7
+ * @example isEmpty(' ') // true
8
+ * @example isEmpty('hello') // false
9
+ */
10
+ export function isEmpty(str) {
11
+ return !str || str.trim().length === 0;
12
+ }
13
+ /**
14
+ * 문자열이 특정 문자로 시작하는지 확인
15
+ * @example startsWith('hello', 'he') // true
16
+ */
17
+ export function startsWith(str, searchString) {
18
+ return str.startsWith(searchString);
19
+ }
20
+ /**
21
+ * 문자열이 특정 문자로 끝나는지 확인
22
+ * @example endsWith('hello', 'lo') // true
23
+ */
24
+ export function endsWith(str, searchString) {
25
+ return str.endsWith(searchString);
26
+ }
27
+ /**
28
+ * 문자열에 특정 문자열이 포함되어 있는지 확인
29
+ * @example contains('hello world', 'world') // true
30
+ */
31
+ export function contains(str, searchString) {
32
+ return str.includes(searchString);
33
+ }
34
+ /**
35
+ * 알파벳만 포함하는지 확인
36
+ * @example isAlpha('hello') // true
37
+ * @example isAlpha('hello123') // false
38
+ */
39
+ export function isAlpha(str) {
40
+ return /^[a-zA-Z]+$/.test(str);
41
+ }
42
+ /**
43
+ * 숫자만 포함하는지 확인
44
+ * @example isNumeric('123') // true
45
+ * @example isNumeric('123.45') // false
46
+ */
47
+ export function isNumeric(str) {
48
+ return /^[0-9]+$/.test(str);
49
+ }
50
+ /**
51
+ * 알파벳과 숫자만 포함하는지 확인
52
+ * @example isAlphanumeric('hello123') // true
53
+ * @example isAlphanumeric('hello_123') // false
54
+ */
55
+ export function isAlphanumeric(str) {
56
+ return /^[a-zA-Z0-9]+$/.test(str);
57
+ }
58
+ /**
59
+ * 소문자만 포함하는지 확인
60
+ * @example isLowerCase('hello') // true
61
+ * @example isLowerCase('Hello') // false
62
+ */
63
+ export function isLowerCase(str) {
64
+ return str === str.toLowerCase() && str !== str.toUpperCase();
65
+ }
66
+ /**
67
+ * 대문자만 포함하는지 확인
68
+ * @example isUpperCase('HELLO') // true
69
+ * @example isUpperCase('Hello') // false
70
+ */
71
+ export function isUpperCase(str) {
72
+ return str === str.toUpperCase() && str !== str.toLowerCase();
73
+ }
74
+ /**
75
+ * JSON 형식인지 확인
76
+ * @example isJSON('{"name":"John"}') // true
77
+ * @example isJSON('not json') // false
78
+ */
79
+ export function isJSON(str) {
80
+ try {
81
+ JSON.parse(str);
82
+ return true;
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * 16진수 색상 코드인지 확인
90
+ * @example isHexColor('#fff') // true
91
+ * @example isHexColor('#ffffff') // true
92
+ * @example isHexColor('fff') // false
93
+ */
94
+ export function isHexColor(str) {
95
+ return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(str);
96
+ }
97
+ /**
98
+ * UUID 형식인지 확인
99
+ * @example isUUID('123e4567-e89b-12d3-a456-426614174000') // true
100
+ */
101
+ export function isUUID(str) {
102
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(str);
103
+ }
104
+ /**
105
+ * Base64 인코딩된 문자열인지 확인
106
+ * @example isBase64('SGVsbG8gV29ybGQ=') // true
107
+ */
108
+ export function isBase64(str) {
109
+ try {
110
+ return btoa(atob(str)) === str;
111
+ }
112
+ catch {
113
+ return false;
114
+ }
115
+ }
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@blastlabs/utils",
3
+ "version": "1.11.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "prepare": "npm run build:tsc",
12
+ "prepublishOnly": "npm run test:run && npm run clean && npm run build:tsc",
13
+ "build": "npm run build",
14
+ "build:tsc": "tsc",
15
+ "clean": "rm -rf dist",
16
+ "dev": "tsc --watch",
17
+ "test": "vitest",
18
+ "test:ui": "vitest --ui",
19
+ "test:run": "vitest run",
20
+ "test:coverage": "vitest run --coverage"
21
+ },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "./hooks": {
29
+ "types": "./dist/hooks/index.d.ts",
30
+ "import": "./dist/hooks/index.js",
31
+ "default": "./dist/hooks/index.js"
32
+ },
33
+ "./components": {
34
+ "types": "./dist/components/index.d.ts",
35
+ "import": "./dist/components/index.js",
36
+ "default": "./dist/components/index.js"
37
+ },
38
+ "./components/dev": {
39
+ "types": "./dist/components/dev/index.d.ts",
40
+ "import": "./dist/components/dev/index.js",
41
+ "default": "./dist/components/dev/index.js"
42
+ }
43
+ },
44
+ "typesVersions": {
45
+ "*": {
46
+ "hooks": [
47
+ "./dist/hooks/index.d.ts"
48
+ ],
49
+ "components": [
50
+ "./dist/components/index.d.ts"
51
+ ],
52
+ "components/dev": [
53
+ "./dist/components/dev/index.d.ts"
54
+ ]
55
+ }
56
+ },
57
+ "keywords": [],
58
+ "author": "",
59
+ "license": "ISC",
60
+ "description": "",
61
+ "dependencies": {
62
+ "dayjs": "^1.11.19"
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^25.0.6",
66
+ "typescript": "^5.9.3",
67
+ "@types/react": "^19.2.8",
68
+ "@vitest/ui": "^4.0.16",
69
+ "vitest": "^4.0.16"
70
+ },
71
+ "peerDependencies": {
72
+ "react": ">=16.8.0",
73
+ "react-dom": ">=16.8.0"
74
+ },
75
+ "peerDependenciesMeta": {
76
+ "react": {
77
+ "optional": true
78
+ },
79
+ "react-dom": {
80
+ "optional": true
81
+ }
82
+ },
83
+ "publishConfig": {
84
+ "access": "public"
85
+ }
86
+ }