halox-utils-kit-ts 0.0.1-beta.6

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.
@@ -0,0 +1,122 @@
1
+ function g(e) {
2
+ return e ? JSON.parse(JSON.stringify(e)) : null;
3
+ }
4
+ function S(e, t = 2) {
5
+ return String(e).padStart(t, "0");
6
+ }
7
+ function f(e = !1, t = "-") {
8
+ const n = /* @__PURE__ */ new Date(), l = n.getFullYear(), o = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0"), r = String(n.getMinutes()).padStart(2, "0"), i = String(n.getSeconds()).padStart(2, "0");
9
+ let a = n.getHours();
10
+ a = a % 12, a === 0 && (a = 12);
11
+ const c = String(a).padStart(2, "0");
12
+ return e ? `${l}${t}${o}${t}${s} ${c}:${r}:${i}` : `${l}${t}${o}${t}${s}`;
13
+ }
14
+ function h(e, t = "full") {
15
+ if (!e) return "";
16
+ const n = new Date(e), l = n.getFullYear(), o = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0");
17
+ let r = n.getHours();
18
+ const i = String(n.getMinutes()).padStart(2, "0"), a = String(n.getSeconds()).padStart(2, "0"), c = r >= 12 ? "오후" : "오전";
19
+ r = r % 12, r === 0 && (r = 12);
20
+ const p = String(r).padStart(2, "0");
21
+ switch (t) {
22
+ case "date":
23
+ return `${l}-${o}-${s}`;
24
+ case "full":
25
+ return `${l}-${o}-${s} ${c} ${p}:${i}`;
26
+ case "shot":
27
+ return `${o}-${s} ${p}:${i}`;
28
+ case "fullEn":
29
+ return `${l}-${o}-${s} ${p}:${i}:${a}`;
30
+ }
31
+ }
32
+ function y(e) {
33
+ if (e == null) return "";
34
+ const t = typeof e == "number" ? e : Number(e);
35
+ if (isNaN(t)) return "";
36
+ const n = t.toString().split("."), l = n[0] ?? "0", o = n[1], s = l.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
37
+ return o ? `${s}.${o}` : s;
38
+ }
39
+ function w(e, t = "-") {
40
+ if (!e) return "";
41
+ const n = e.replace(/\D/g, "");
42
+ return n.startsWith("02") ? n.replace(
43
+ /^(02)(\d{3,4})(\d{4})$/,
44
+ `$1${t}$2${t}$3`
45
+ ) : /^(01[016789]|070)/.test(n) ? n.replace(
46
+ /^(01[016789]|070)(\d{3,4})(\d{4})$/,
47
+ `$1${t}$2${t}$3`
48
+ ) : n.replace(
49
+ /^(\d{3})(\d{3,4})(\d{4})$/,
50
+ `$1${t}$2${t}$3`
51
+ );
52
+ }
53
+ function m(e = !1) {
54
+ const t = /* @__PURE__ */ new Date(), n = t.getFullYear(), l = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0"), s = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(Math.floor(Math.random() * 1e5)).padStart(
55
+ 3,
56
+ "0"
57
+ );
58
+ if (e)
59
+ return `${s}${r}${i}-${a}`;
60
+ const c = `${n}${l}${o}${s}${r}${i}${a}`;
61
+ return String(c);
62
+ }
63
+ function N(e, t = "KO", n = "TEXT") {
64
+ const l = {
65
+ KO: ["", "십", "백", "천"],
66
+ CN: ["", "拾", "佰", "仟"],
67
+ CNF: ["", "拾", "佰", "仟"]
68
+ }, o = {
69
+ KO: ["", "만", "억", "조", "경"],
70
+ CN: ["", "万", "亿", "兆", "京"],
71
+ CNF: ["", "萬", "億", "兆", "京"]
72
+ }, s = {
73
+ KO: ["영", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구"],
74
+ CN: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
75
+ CNF: ["零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖"]
76
+ }, r = {
77
+ KO: { zero: "영", wonJeong: "원정", unit: "₩" },
78
+ CN: { zero: "零", wonJeong: "元整", unit: "¥" },
79
+ CNF: { zero: "零", wonJeong: "圓整", unit: "¥" }
80
+ };
81
+ if (e === 0)
82
+ return `<span style="font-weight:bold;">${r[t].zero}</span>${r[t].wonJeong}
83
+ <span style="display:inline-block; width:30px;"></span>
84
+ (<span style="display:inline-block; width:10px;"></span>₩
85
+ <span style="display:inline-block; width:20px;"></span>
86
+ <span style="font-weight:bold;">0</span>
87
+ <span style="display:inline-block; width:10px;"></span>)`;
88
+ let i = "";
89
+ const a = String(e).split("").reverse().join("");
90
+ for (let c = 0; c < a.length; c += 4) {
91
+ const p = a.slice(c, c + 4).split("").reverse().join("");
92
+ let $ = "";
93
+ for (let d = 0; d < p.length; d++) {
94
+ const u = parseInt(p[p.length - 1 - d]);
95
+ u !== 0 && ($ = s[t][u] + l[t][d] + $);
96
+ }
97
+ $ && (i = $ + o[t][c / 4] + i);
98
+ }
99
+ return n == "HTML" ? `
100
+ <span style="font-weight:bold;">${i}</span>
101
+ <span style="display:inline-block; width:20px;"></span>
102
+ ${r[t].wonJeong}
103
+ <span style="display:inline-block; width:20px;"></span>
104
+ (<span style="display:inline-block; width:20px;"></span>${r[t].unit}
105
+ <span style="display:inline-block; width:50px;"></span>
106
+ <span style="font-weight:bold;">${e.toLocaleString()}</span>
107
+ <span style="display:inline-block; width:20px;"></span>)
108
+ ` : `${i}`;
109
+ }
110
+ const b = {
111
+ CopyJson: g,
112
+ FillToZero: S,
113
+ FormatCurrentDate: f,
114
+ FormatDateString: h,
115
+ Comma: y,
116
+ FormatPhoneKr: w,
117
+ CreateSerialNumber: m,
118
+ CurrencyConvert: N
119
+ };
120
+ export {
121
+ b as halox
122
+ };
@@ -0,0 +1,15 @@
1
+ (function(d,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(d=typeof globalThis<"u"?globalThis:d||self,$(d.HaloxUtilsKit={}))})(this,(function(d){"use strict";function $(e){return e?JSON.parse(JSON.stringify(e)):null}function S(e,t=2){return String(e).padStart(t,"0")}function h(e=!1,t="-"){const n=new Date,l=n.getFullYear(),r=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),s=String(n.getMinutes()).padStart(2,"0"),i=String(n.getSeconds()).padStart(2,"0");let a=n.getHours();a=a%12,a===0&&(a=12);const c=String(a).padStart(2,"0");return e?`${l}${t}${r}${t}${o} ${c}:${s}:${i}`:`${l}${t}${r}${t}${o}`}function y(e,t="full"){if(!e)return"";const n=new Date(e),l=n.getFullYear(),r=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");let s=n.getHours();const i=String(n.getMinutes()).padStart(2,"0"),a=String(n.getSeconds()).padStart(2,"0"),c=s>=12?"오후":"오전";s=s%12,s===0&&(s=12);const p=String(s).padStart(2,"0");switch(t){case"date":return`${l}-${r}-${o}`;case"full":return`${l}-${r}-${o} ${c} ${p}:${i}`;case"shot":return`${r}-${o} ${p}:${i}`;case"fullEn":return`${l}-${r}-${o} ${p}:${i}:${a}`}}function m(e){if(e==null)return"";const t=typeof e=="number"?e:Number(e);if(isNaN(t))return"";const n=t.toString().split("."),l=n[0]??"0",r=n[1],o=l.replace(/\B(?=(\d{3})+(?!\d))/g,",");return r?`${o}.${r}`:o}function w(e,t="-"){if(!e)return"";const n=e.replace(/\D/g,"");return n.startsWith("02")?n.replace(/^(02)(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`):/^(01[016789]|070)/.test(n)?n.replace(/^(01[016789]|070)(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`):n.replace(/^(\d{3})(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`)}function b(e=!1){const t=new Date,n=t.getFullYear(),l=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0"),a=String(Math.floor(Math.random()*1e5)).padStart(3,"0");if(e)return`${o}${s}${i}-${a}`;const c=`${n}${l}${r}${o}${s}${i}${a}`;return String(c)}function N(e,t="KO",n="TEXT"){const l={KO:["","십","백","천"],CN:["","拾","佰","仟"],CNF:["","拾","佰","仟"]},r={KO:["","만","억","조","경"],CN:["","万","亿","兆","京"],CNF:["","萬","億","兆","京"]},o={KO:["영","일","이","삼","사","오","육","칠","팔","구"],CN:["零","一","二","三","四","五","六","七","八","九"],CNF:["零","壹","貳","叁","肆","伍","陸","柒","捌","玖"]},s={KO:{zero:"영",wonJeong:"원정",unit:"₩"},CN:{zero:"零",wonJeong:"元整",unit:"¥"},CNF:{zero:"零",wonJeong:"圓整",unit:"¥"}};if(e===0)return`<span style="font-weight:bold;">${s[t].zero}</span>${s[t].wonJeong}
2
+ <span style="display:inline-block; width:30px;"></span>
3
+ (<span style="display:inline-block; width:10px;"></span>₩
4
+ <span style="display:inline-block; width:20px;"></span>
5
+ <span style="font-weight:bold;">0</span>
6
+ <span style="display:inline-block; width:10px;"></span>)`;let i="";const a=String(e).split("").reverse().join("");for(let c=0;c<a.length;c+=4){const p=a.slice(c,c+4).split("").reverse().join("");let u="";for(let g=0;g<p.length;g++){const f=parseInt(p[p.length-1-g]);f!==0&&(u=o[t][f]+l[t][g]+u)}u&&(i=u+r[t][c/4]+i)}return n=="HTML"?`
7
+ <span style="font-weight:bold;">${i}</span>
8
+ <span style="display:inline-block; width:20px;"></span>
9
+ ${s[t].wonJeong}
10
+ <span style="display:inline-block; width:20px;"></span>
11
+ (<span style="display:inline-block; width:20px;"></span>${s[t].unit}
12
+ <span style="display:inline-block; width:50px;"></span>
13
+ <span style="font-weight:bold;">${e.toLocaleString()}</span>
14
+ <span style="display:inline-block; width:20px;"></span>)
15
+ `:`${i}`}const C={CopyJson:$,FillToZero:S,FormatCurrentDate:h,FormatDateString:y,Comma:m,FormatPhoneKr:w,CreateSerialNumber:b,CurrencyConvert:N};d.halox=C,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ import { default as functions } from './utils/main';
2
+ export { functions as halox };
@@ -0,0 +1,2 @@
1
+ export * from '../index'
2
+ export {}
File without changes
@@ -0,0 +1,54 @@
1
+ /**
2
+ * 객체를 복사하여 반환
3
+ * @param data
4
+ * @returns
5
+ */
6
+ export declare function CopyJson(data: any): any;
7
+ /**
8
+ * 문자에 0을 채워서 원하는 길이만큼 반환
9
+ * @param str
10
+ * @param len
11
+ * @returns
12
+ */
13
+ export declare function FillToZero(str: string | number, len?: number): string;
14
+ /**
15
+ * 현재 날짜 반환
16
+ * @param time
17
+ * @param split 날짜 구분 기호 - 또는 .
18
+ * @returns
19
+ */
20
+ export declare function FormatCurrentDate(time?: boolean, split?: "-" | "."): string;
21
+ /**
22
+ * 날짜 문자열 형식 변환
23
+ * @param dateStr 날짜 문자열
24
+ * @param type 날짜 형식
25
+ * @param type "date" | "full" | "shot" | "fullEn" = "full"
26
+ * @returns
27
+ */
28
+ export declare function FormatDateString(dateStr: string | Date, type?: "date" | "full" | "shot" | "fullEn"): string;
29
+ /**
30
+ * 숫자에 콤마를 찍어줌
31
+ * @param value 숫자
32
+ * @returns
33
+ */
34
+ export declare function Comma(value: number | string): string;
35
+ /**
36
+ * 전화번호 분리
37
+ * @param number 전화번호
38
+ * @param separator 분리기호
39
+ * @returns
40
+ */
41
+ export declare function FormatPhoneKr(number: string, separator?: "ㆍ" | "." | "-"): string;
42
+ /**
43
+ * 랜덤문자열 생성
44
+ * @param split 랜덤문자열앞에 분리선
45
+ * @returns
46
+ */
47
+ export declare function CreateSerialNumber(split?: boolean): string;
48
+ /**
49
+ * 숫자를 언어에 맞는 문자열로 변환
50
+ * @param number 숫자
51
+ * @param lang 언어 KO , CN
52
+ * @returns
53
+ */
54
+ export declare function CurrencyConvert(number: number, lang?: "KO" | "CN" | "CNF", type?: "HTML" | "TEXT"): string;
@@ -0,0 +1,12 @@
1
+ import { CopyJson, FillToZero, FormatCurrentDate, FormatDateString, Comma, FormatPhoneKr, CreateSerialNumber, CurrencyConvert } from './common';
2
+ declare const functions: {
3
+ CopyJson: typeof CopyJson;
4
+ FillToZero: typeof FillToZero;
5
+ FormatCurrentDate: typeof FormatCurrentDate;
6
+ FormatDateString: typeof FormatDateString;
7
+ Comma: typeof Comma;
8
+ FormatPhoneKr: typeof FormatPhoneKr;
9
+ CreateSerialNumber: typeof CreateSerialNumber;
10
+ CurrencyConvert: typeof CurrencyConvert;
11
+ };
12
+ export default functions;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "halox-utils-kit-ts",
3
+ "version": "0.0.1-beta.6",
4
+ "main": "dist/halox-utils-kit-ts.umd.js",
5
+ "module": "dist/halox-utils-kit-ts.es.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/shenyunv2021/halox-utils-kit-ts.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/shenyunv2021/halox-utils-kit-ts-issues/issues"
13
+ },
14
+ "homepage": "https://github.com/shenyunv2021/halox-utils-kit-ts-issues#readme",
15
+ "contributors": [
16
+ "simcheolun <shenyunv2021@gamil.com>"
17
+ ],
18
+ "license": "MIT",
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "vite build",
22
+ "build:watch": "if exist dist rd /s /q dist && vite build --watch",
23
+ "lint": "eslint . --ext .ts",
24
+ "test": "echo \"No test yet\""
25
+ },
26
+ "keywords": [
27
+ "halox-utils-kit-ts",
28
+ "typescript",
29
+ "jsavscript",
30
+ "halox",
31
+ "JAYUWARE"
32
+ ],
33
+ "author": "HaloX Dev Team",
34
+ "description": "",
35
+ "dependencies": {},
36
+ "devDependencies": {
37
+ "typescript": "^5.9.3",
38
+ "vite": "^7.2.4",
39
+ "vite-plugin-dts": "^4.5.4"
40
+ }
41
+ }
package/readme.md ADDED
@@ -0,0 +1,71 @@
1
+ # Vue3 Typescript CALENDAR UI Components Guide
2
+
3
+ ## 설치
4
+
5
+ ```sh
6
+ npm install halox-utils-kis-ts
7
+ ```
8
+ ---
9
+
10
+ ## Description
11
+
12
+ 항상 최신 버전을 유지해주세요.
13
+
14
+ 기능함수 - TYPESCRIPT
15
+ halox-utils-kis-ts
16
+
17
+ 👉 [halox-utils-kit-ts npm 페이지](https://www.npmjs.com/package/halox-utils-kit-ts)
18
+
19
+ 필요한 개선 요청은 깃헙 이슈로 남겨주세요.
20
+
21
+ ## Features
22
+
23
+ - 개발에 필요한 각종함수 제공
24
+
25
+
26
+ ## Usage Example
27
+
28
+ ```js
29
+ import { halox } from 'halox-utils-kit-ts'
30
+
31
+ // 문자 , 배열 , 객체 깊은 복사
32
+ CopyJson(data: any) as Any
33
+
34
+ // 문자열에 0을 채워주는 함수 leng > str.length
35
+ FillToZero(str: string | number, len: number = 2) as String
36
+
37
+ // 현재 날짜를 정한 문자열형식으로 반환
38
+ FormatCurrentDate(
39
+ time: boolean = false,
40
+ split: "-" | "." = "-"
41
+ ) as String
42
+
43
+ // 날짜를 정한 문자열형식으로 반환
44
+ FormatDateString(
45
+ dateStr: string | Date,
46
+ type: "date" | "full" | "shot" | "fullEn" = "full"
47
+ ) as String
48
+
49
+ // 숫자를 콤마를 찍어서 문자열로 반환
50
+ Comma(value: number | string): string
51
+
52
+ // 한국 전화번호 형식으로 변환
53
+ FormatPhoneKr(
54
+ number: string,
55
+ separator: "ㆍ" | "." | "-" = "-"
56
+ ) as String
57
+
58
+ // 랜덤숫자 생성
59
+ CreateSerialNumber(split: boolean = false) as String
60
+
61
+ // 통화단위 변환 lang 한국어 한자간체 한자정자
62
+ CurrencyConvert(
63
+ number: number,
64
+ lang: "KO" | "CN" | "CNF" = "KO",
65
+ type: "HTML" | "TEXT" = "TEXT"
66
+ ) as String | html
67
+ // example
68
+ <div v-html="CurrencyConvert(123456789, 'KO', 'HTML')"></div>
69
+ <div>{{CurrencyConvert(123456789, 'KO', 'TEXT')}}</div>
70
+
71
+ ```
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "declaration": true,
7
+ "declarationDir": "dist/types",
8
+ "emitDeclarationOnly": false,
9
+ "strict": true,
10
+ "jsx": "preserve",
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "resolveJsonModule": true,
14
+ "lib": ["ESNext", "DOM"]
15
+ },
16
+ "include": ["src"],
17
+ "exclude": ["node_modules", "dist", "example"]
18
+ }
19
+
package/vite.config.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { defineConfig } from 'vite';
2
+ import dts from 'vite-plugin-dts';
3
+ import path from 'path';
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ dts({ insertTypesEntry: true }),
8
+ ],
9
+ build: {
10
+ lib: {
11
+ entry: path.resolve(__dirname, 'src/index.ts'),
12
+ name: 'HaloxUtilsKit',
13
+ fileName: (format) => `halox-utils-kit-ts.${format}.js`,
14
+ },
15
+ },
16
+ });