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

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,201 @@
1
+ function $(n) {
2
+ return n ? JSON.parse(JSON.stringify(n)) : null;
3
+ }
4
+ function f(n, t = 2) {
5
+ return String(n).padStart(t, "0");
6
+ }
7
+ function h(n = !1, t = "-") {
8
+ const e = /* @__PURE__ */ new Date(), c = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0"), i = String(e.getMinutes()).padStart(2, "0"), s = String(e.getSeconds()).padStart(2, "0");
9
+ let a = e.getHours();
10
+ a = a % 12, a === 0 && (a = 12);
11
+ const l = String(a).padStart(2, "0");
12
+ return n ? `${c}${t}${r}${t}${o} ${l}:${i}:${s}` : `${c}${t}${r}${t}${o}`;
13
+ }
14
+ function m(n, t = "full") {
15
+ if (!n) return "";
16
+ const e = new Date(n), c = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
17
+ let i = e.getHours();
18
+ const s = String(e.getMinutes()).padStart(2, "0"), a = String(e.getSeconds()).padStart(2, "0"), l = i >= 12 ? "오후" : "오전";
19
+ i = i % 12, i === 0 && (i = 12);
20
+ const p = String(i).padStart(2, "0");
21
+ switch (t) {
22
+ case "date":
23
+ return `${c}-${r}-${o}`;
24
+ case "full":
25
+ return `${c}-${r}-${o} ${l} ${p}:${s}`;
26
+ case "shot":
27
+ return `${r}-${o} ${p}:${s}`;
28
+ case "fullEn":
29
+ return `${c}-${r}-${o} ${p}:${s}:${a}`;
30
+ case "list":
31
+ return [c, r, o, p, s, a];
32
+ }
33
+ }
34
+ function S(n) {
35
+ if (n == null) return "";
36
+ const t = typeof n == "number" ? n : Number(n);
37
+ if (isNaN(t)) return "";
38
+ const e = t.toString().split("."), c = e[0] ?? "0", r = e[1], o = c.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
39
+ return r ? `${o}.${r}` : o;
40
+ }
41
+ function y(n, t = "-") {
42
+ if (!n) return "";
43
+ const e = n.replace(/\D/g, "");
44
+ return e.startsWith("02") ? e.replace(
45
+ /^(02)(\d{3,4})(\d{4})$/,
46
+ `$1${t}$2${t}$3`
47
+ ) : /^(01[016789]|070)/.test(e) ? e.replace(
48
+ /^(01[016789]|070)(\d{3,4})(\d{4})$/,
49
+ `$1${t}$2${t}$3`
50
+ ) : e.replace(
51
+ /^(\d{3})(\d{3,4})(\d{4})$/,
52
+ `$1${t}$2${t}$3`
53
+ );
54
+ }
55
+ function w(n = !1) {
56
+ const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), c = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0"), s = String(t.getSeconds()).padStart(2, "0"), a = String(Math.floor(Math.random() * 1e5)).padStart(
57
+ 3,
58
+ "0"
59
+ );
60
+ if (n)
61
+ return `${o}${i}${s}-${a}`;
62
+ const l = `${e}${c}${r}${o}${i}${s}${a}`;
63
+ return String(l);
64
+ }
65
+ function b(n, t = "KO", e = "TEXT") {
66
+ const c = {
67
+ KO: ["", "십", "백", "천"],
68
+ CN: ["", "拾", "佰", "仟"],
69
+ CNF: ["", "拾", "佰", "仟"]
70
+ }, r = {
71
+ KO: ["", "만", "억", "조", "경"],
72
+ CN: ["", "万", "亿", "兆", "京"],
73
+ CNF: ["", "萬", "億", "兆", "京"]
74
+ }, o = {
75
+ KO: ["영", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구"],
76
+ CN: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
77
+ CNF: ["零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖"]
78
+ }, i = {
79
+ KO: { zero: "영", wonJeong: "원정", unit: "₩" },
80
+ CN: { zero: "零", wonJeong: "元整", unit: "¥" },
81
+ CNF: { zero: "零", wonJeong: "圓整", unit: "¥" }
82
+ };
83
+ if (n === 0)
84
+ return `<span style="font-weight:bold;">${i[t].zero}</span>${i[t].wonJeong}
85
+ <span style="display:inline-block; width:30px;"></span>
86
+ (<span style="display:inline-block; width:10px;"></span>₩
87
+ <span style="display:inline-block; width:20px;"></span>
88
+ <span style="font-weight:bold;">0</span>
89
+ <span style="display:inline-block; width:10px;"></span>)`;
90
+ let s = "";
91
+ const a = String(n).split("").reverse().join("");
92
+ for (let l = 0; l < a.length; l += 4) {
93
+ const p = a.slice(l, l + 4).split("").reverse().join("");
94
+ let d = "";
95
+ for (let u = 0; u < p.length; u++) {
96
+ const g = parseInt(p[p.length - 1 - u]);
97
+ g !== 0 && (d = o[t][g] + c[t][u] + d);
98
+ }
99
+ d && (s = d + r[t][l / 4] + s);
100
+ }
101
+ return e == "HTML" ? `
102
+ <span style="font-weight:bold;">${s}</span>
103
+ <span style="display:inline-block; width:20px;"></span>
104
+ ${i[t].wonJeong}
105
+ <span style="display:inline-block; width:20px;"></span>
106
+ (<span style="display:inline-block; width:20px;"></span>${i[t].unit}
107
+ <span style="display:inline-block; width:50px;"></span>
108
+ <span style="font-weight:bold;">${n.toLocaleString()}</span>
109
+ <span style="display:inline-block; width:20px;"></span>)
110
+ ` : `${s}`;
111
+ }
112
+ function N(n, t = 0) {
113
+ if (n == null || n === "") return 0;
114
+ try {
115
+ if (typeof n == "number") {
116
+ const a = Math.pow(10, t);
117
+ return t <= 0 ? Math.trunc(n) : Math.trunc(n * a) / a;
118
+ }
119
+ let e = n.toString();
120
+ const c = e.includes("-"), o = e.replace(/[^0-9.]/g, "").split("."), i = o[0] + (o.length > 1 ? "." + o[1] : "");
121
+ if (!i) return 0;
122
+ let s = parseFloat(i);
123
+ if (c && (s = -s), t <= 0)
124
+ return Math.trunc(s);
125
+ {
126
+ const a = Math.pow(10, t);
127
+ return Math.trunc(s * a) / a;
128
+ }
129
+ } catch (e) {
130
+ return console.error(e), 0;
131
+ }
132
+ }
133
+ function C(n) {
134
+ return n.replace(/\n/g, "<br>");
135
+ }
136
+ function M(n) {
137
+ if (!n)
138
+ return 0;
139
+ const t = new Date(n), e = /* @__PURE__ */ new Date();
140
+ t.setHours(0, 0, 0, 0), e.setHours(0, 0, 0, 0);
141
+ const c = t.getTime() - e.getTime(), r = Math.ceil(c / (1e3 * 60 * 60 * 24));
142
+ return r > 0 ? r : 0;
143
+ }
144
+ function x() {
145
+ if (typeof window > "u" || window.daum) return;
146
+ const n = document.createElement("script");
147
+ n.src = "//t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js", document.head.appendChild(n);
148
+ }
149
+ function D() {
150
+ return new Promise((n) => {
151
+ new window.daum.Postcode({
152
+ oncomplete: (t) => {
153
+ n({
154
+ postalCode: t.zonecode,
155
+ address: t.userSelectedType === "R" ? t.address : t.jibunAddress
156
+ });
157
+ }
158
+ }).open();
159
+ });
160
+ }
161
+ function F({
162
+ input: n,
163
+ useParagraphs: t = !1,
164
+ tabSize: e = 4,
165
+ title: c = ""
166
+ }) {
167
+ if (!n) return "";
168
+ let r = n;
169
+ const o = " ".repeat(e);
170
+ r = r.replace(/\t/g, o), r = r.replace(/ {2,}/g, (s) => "&nbsp;".repeat(s.length - 1) + " "), r = r.replace(/\r\n/g, `
171
+ `).replace(/\r/g, `
172
+ `);
173
+ const i = r.split(`
174
+ `).map((s) => c && s.startsWith(c) ? `<div style="font-size:1.2em;font-weight:bold;margin:20px 0px 0px;">${s.slice(c.length)}</div>` : s);
175
+ return t ? i.join(`
176
+ `).split(/\n{2,}/).map((a) => `<p>${a.replace(/\n/g, "<br>")}</p>`).join(`
177
+ `) : i.join("<br>");
178
+ }
179
+ function k(n, t = []) {
180
+ return t.filter((e) => n.includes(e)).join(",");
181
+ }
182
+ const T = {
183
+ CopyJson: $,
184
+ FillToZero: f,
185
+ FormatCurrentDate: h,
186
+ FormatDateString: m,
187
+ Comma: S,
188
+ FormatPhoneKr: y,
189
+ CreateSerialNumber: w,
190
+ CurrencyConvert: b,
191
+ ToNumber: N,
192
+ ToBr: C,
193
+ GetRemainingDays: M,
194
+ LoadDaumPostcode: x,
195
+ SearchAddress: D,
196
+ toHtml: F,
197
+ ExtractMatchedKeywords: k
198
+ };
199
+ export {
200
+ T as halox
201
+ };
@@ -0,0 +1,20 @@
1
+ (function(d,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(d=typeof globalThis<"u"?globalThis:d||self,u(d.HaloxUtilsKit={}))})(this,(function(d){"use strict";function u(n){return n?JSON.parse(JSON.stringify(n)):null}function h(n,t=2){return String(n).padStart(t,"0")}function m(n=!1,t="-"){const e=new Date,c=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");let a=e.getHours();a=a%12,a===0&&(a=12);const l=String(a).padStart(2,"0");return n?`${c}${t}${r}${t}${s} ${l}:${i}:${o}`:`${c}${t}${r}${t}${s}`}function S(n,t="full"){if(!n)return"";const e=new Date(n),c=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");let i=e.getHours();const o=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0"),l=i>=12?"오후":"오전";i=i%12,i===0&&(i=12);const p=String(i).padStart(2,"0");switch(t){case"date":return`${c}-${r}-${s}`;case"full":return`${c}-${r}-${s} ${l} ${p}:${o}`;case"shot":return`${r}-${s} ${p}:${o}`;case"fullEn":return`${c}-${r}-${s} ${p}:${o}:${a}`;case"list":return[c,r,s,p,o,a]}}function y(n){if(n==null)return"";const t=typeof n=="number"?n:Number(n);if(isNaN(t))return"";const e=t.toString().split("."),c=e[0]??"0",r=e[1],s=c.replace(/\B(?=(\d{3})+(?!\d))/g,",");return r?`${s}.${r}`:s}function w(n,t="-"){if(!n)return"";const e=n.replace(/\D/g,"");return e.startsWith("02")?e.replace(/^(02)(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`):/^(01[016789]|070)/.test(e)?e.replace(/^(01[016789]|070)(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`):e.replace(/^(\d{3})(\d{3,4})(\d{4})$/,`$1${t}$2${t}$3`)}function b(n=!1){const t=new Date,e=t.getFullYear(),c=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),a=String(Math.floor(Math.random()*1e5)).padStart(3,"0");if(n)return`${s}${i}${o}-${a}`;const l=`${e}${c}${r}${s}${i}${o}${a}`;return String(l)}function N(n,t="KO",e="TEXT"){const c={KO:["","십","백","천"],CN:["","拾","佰","仟"],CNF:["","拾","佰","仟"]},r={KO:["","만","억","조","경"],CN:["","万","亿","兆","京"],CNF:["","萬","億","兆","京"]},s={KO:["영","일","이","삼","사","오","육","칠","팔","구"],CN:["零","一","二","三","四","五","六","七","八","九"],CNF:["零","壹","貳","叁","肆","伍","陸","柒","捌","玖"]},i={KO:{zero:"영",wonJeong:"원정",unit:"₩"},CN:{zero:"零",wonJeong:"元整",unit:"¥"},CNF:{zero:"零",wonJeong:"圓整",unit:"¥"}};if(n===0)return`<span style="font-weight:bold;">${i[t].zero}</span>${i[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 o="";const a=String(n).split("").reverse().join("");for(let l=0;l<a.length;l+=4){const p=a.slice(l,l+4).split("").reverse().join("");let f="";for(let g=0;g<p.length;g++){const $=parseInt(p[p.length-1-g]);$!==0&&(f=s[t][$]+c[t][g]+f)}f&&(o=f+r[t][l/4]+o)}return e=="HTML"?`
7
+ <span style="font-weight:bold;">${o}</span>
8
+ <span style="display:inline-block; width:20px;"></span>
9
+ ${i[t].wonJeong}
10
+ <span style="display:inline-block; width:20px;"></span>
11
+ (<span style="display:inline-block; width:20px;"></span>${i[t].unit}
12
+ <span style="display:inline-block; width:50px;"></span>
13
+ <span style="font-weight:bold;">${n.toLocaleString()}</span>
14
+ <span style="display:inline-block; width:20px;"></span>)
15
+ `:`${o}`}function M(n,t=0){if(n==null||n==="")return 0;try{if(typeof n=="number"){const a=Math.pow(10,t);return t<=0?Math.trunc(n):Math.trunc(n*a)/a}let e=n.toString();const c=e.includes("-"),s=e.replace(/[^0-9.]/g,"").split("."),i=s[0]+(s.length>1?"."+s[1]:"");if(!i)return 0;let o=parseFloat(i);if(c&&(o=-o),t<=0)return Math.trunc(o);{const a=Math.pow(10,t);return Math.trunc(o*a)/a}}catch(e){return console.error(e),0}}function x(n){return n.replace(/\n/g,"<br>")}function C(n){if(!n)return 0;const t=new Date(n),e=new Date;t.setHours(0,0,0,0),e.setHours(0,0,0,0);const c=t.getTime()-e.getTime(),r=Math.ceil(c/(1e3*60*60*24));return r>0?r:0}function D(){if(typeof window>"u"||window.daum)return;const n=document.createElement("script");n.src="//t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",document.head.appendChild(n)}function T(){return new Promise(n=>{new window.daum.Postcode({oncomplete:t=>{n({postalCode:t.zonecode,address:t.userSelectedType==="R"?t.address:t.jibunAddress})}}).open()})}function j({input:n,useParagraphs:t=!1,tabSize:e=4,title:c=""}){if(!n)return"";let r=n;const s=" ".repeat(e);r=r.replace(/\t/g,s),r=r.replace(/ {2,}/g,o=>"&nbsp;".repeat(o.length-1)+" "),r=r.replace(/\r\n/g,`
16
+ `).replace(/\r/g,`
17
+ `);const i=r.split(`
18
+ `).map(o=>c&&o.startsWith(c)?`<div style="font-size:1.2em;font-weight:bold;margin:20px 0px 0px;">${o.slice(c.length)}</div>`:o);return t?i.join(`
19
+ `).split(/\n{2,}/).map(a=>`<p>${a.replace(/\n/g,"<br>")}</p>`).join(`
20
+ `):i.join("<br>")}function F(n,t=[]){return t.filter(e=>n.includes(e)).join(",")}const k={CopyJson:u,FillToZero:h,FormatCurrentDate:m,FormatDateString:S,Comma:y,FormatPhoneKr:w,CreateSerialNumber:b,CurrencyConvert:N,ToNumber:M,ToBr:x,GetRemainingDays:C,LoadDaumPostcode:D,SearchAddress:T,toHtml:j,ExtractMatchedKeywords:F};d.halox=k,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,115 @@
1
+ export {};
2
+ declare global {
3
+ interface Window {
4
+ daum: any;
5
+ }
6
+ }
7
+ /**
8
+ * 객체를 복사하여 반환
9
+ * @param data
10
+ * @returns
11
+ */
12
+ export declare function CopyJson(data: any): any;
13
+ /**
14
+ * 문자에 0을 채워서 원하는 길이만큼 반환
15
+ * @param str
16
+ * @param len
17
+ * @returns
18
+ */
19
+ export declare function FillToZero(str: string | number, len?: number): string;
20
+ /**
21
+ * 현재 날짜 반환
22
+ * @param time
23
+ * @param split 날짜 구분 기호 - 또는 .
24
+ * @returns
25
+ */
26
+ export declare function FormatCurrentDate(time?: boolean, split?: "-" | "."): string;
27
+ /**
28
+ * 날짜 문자열 형식 변환
29
+ * @param dateStr 날짜 문자열
30
+ * @param type 날짜 형식
31
+ * @param type "date" | "full" | "shot" | "fullEn" = "full"
32
+ * @returns
33
+ */
34
+ export declare function FormatDateString(dateStr: string | Date, type?: "date" | "full" | "shot" | 'list' | "fullEn"): string | (string | number)[];
35
+ /**
36
+ * 숫자에 콤마를 찍어줌
37
+ * @param value 숫자
38
+ * @returns
39
+ */
40
+ export declare function Comma(value: number | string): string;
41
+ /**
42
+ * 전화번호 분리
43
+ * @param number 전화번호
44
+ * @param separator 분리기호
45
+ * @returns
46
+ */
47
+ export declare function FormatPhoneKr(number: string, separator?: "ㆍ" | "." | "-"): string;
48
+ /**
49
+ * 랜덤문자열 생성
50
+ * @param split 랜덤문자열앞에 분리선
51
+ * @returns
52
+ */
53
+ export declare function CreateSerialNumber(split?: boolean): string;
54
+ /**
55
+ * 숫자를 언어에 맞는 문자열로 변환
56
+ * @param number 숫자
57
+ * @param lang 언어 KO , CN
58
+ * @returns
59
+ */
60
+ export declare function CurrencyConvert(number: number, lang?: "KO" | "CN" | "CNF", type?: "HTML" | "TEXT"): string;
61
+ /**
62
+ * 숫자만 허용 및 반환
63
+ * @param value
64
+ * @returns
65
+ */
66
+ export declare function ToNumber(value: string | number | null | undefined, precision?: number): number;
67
+ /**
68
+ * 줄바꿈을 <br>로 변경
69
+ * @param str
70
+ * @returns
71
+ */
72
+ export declare function ToBr(str: string): string;
73
+ /**
74
+ * 현재날짜와의 날짜 차이를 구함
75
+ * @param dateString 'yyyy-mm-dd'
76
+ * @returns
77
+ */
78
+ export declare function GetRemainingDays(dateString: string | Date): number;
79
+ /**
80
+ * 주소찾기
81
+ * @returns
82
+ */
83
+ export declare function LoadDaumPostcode(): void;
84
+ export declare function SearchAddress(): Promise<{
85
+ postalCode: string;
86
+ address: string;
87
+ }>;
88
+ /**
89
+ * 일반 문장을 HTML로 변환
90
+ * @param params
91
+ * @returns
92
+ */
93
+ export declare function toHtml({ input, useParagraphs, tabSize, title }: {
94
+ input?: string;
95
+ useParagraphs?: boolean;
96
+ tabSize?: number;
97
+ title?: string;
98
+ }): string;
99
+ /**
100
+ * 지정한 키워드가 존재하면 문자열 반환
101
+ * @param str
102
+ * @param keywordList
103
+ * @returns
104
+ */
105
+ export declare function ExtractMatchedKeywords(str: string, keywordList?: string[]): string;
106
+ /**
107
+ * 나이계산
108
+ * official: 만나이 => 행정, 민사, 일상 모든 기준
109
+ * common: 세는나이 => 예전 한국식 (식당, 일상 대화)
110
+ * military => 병역법, 청소년보호법 (술·담배 구매)
111
+ * @param birthDate
112
+ * @param old
113
+ * @returns
114
+ */
115
+ export declare function GetAge(birthDate: string | Date, type?: 'official' | 'common' | 'military'): number;
@@ -0,0 +1,19 @@
1
+ import { CopyJson, FillToZero, FormatCurrentDate, FormatDateString, Comma, FormatPhoneKr, CreateSerialNumber, CurrencyConvert, ToNumber, ToBr, GetRemainingDays, LoadDaumPostcode, SearchAddress, toHtml, ExtractMatchedKeywords } 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
+ ToNumber: typeof ToNumber;
12
+ ToBr: typeof ToBr;
13
+ GetRemainingDays: typeof GetRemainingDays;
14
+ LoadDaumPostcode: typeof LoadDaumPostcode;
15
+ SearchAddress: typeof SearchAddress;
16
+ toHtml: typeof toHtml;
17
+ ExtractMatchedKeywords: typeof ExtractMatchedKeywords;
18
+ };
19
+ export default functions;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "halox-utils-kit-ts",
3
+ "version": "0.0.1-beta.10",
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,139 @@
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
+ - 2026-02-18
25
+ - 우편번호서비스 daum > kakaocdn으로 변경
26
+ - ToNumber 음수 및 소수점처리파라미터 추가
27
+ - FormatDateString함수 list 옵션추가 반환 > [year,month,day,hh,minutes,seconds]
28
+ - 나이계산 함수 추가 getAge
29
+
30
+
31
+ ## Usage Example
32
+
33
+ ```js
34
+ import { halox } from 'halox-utils-kit-ts'
35
+
36
+ // 문자 , 배열 , 객체 깊은 복사
37
+ CopyJson(data: any) as Any
38
+ ---
39
+ // 문자열에 0을 채워주는 함수 leng > str.length
40
+ FillToZero(str: string | number, len: number = 2) as String
41
+ ---
42
+ // 현재 날짜를 정한 문자열형식으로 반환
43
+ FormatCurrentDate(
44
+ time: boolean = false,
45
+ split: "-" | "." = "-"
46
+ ) as String
47
+ ---
48
+ // 날짜를 정한 문자열형식으로 반환
49
+ FormatDateString(
50
+ dateStr: string | Date,
51
+ type: "date" | "full" | "shot" | "fullEn" = "full" | "list"
52
+ ) as String
53
+
54
+ // 숫자를 콤마를 찍어서 문자열로 반환
55
+ Comma(value: number | string): string
56
+ ---
57
+ // 한국 전화번호 형식으로 변환
58
+ FormatPhoneKr(
59
+ number: string,
60
+ separator: "ㆍ" | "." | "-" = "-"
61
+ ) as String
62
+ ---
63
+ /**
64
+ * 랜덤숫자 생성
65
+ */
66
+ CreateSerialNumber(split: boolean = false) as String
67
+ ---
68
+ /**
69
+ * 통화단위 변환 lang 한국어 한자간체 한자정자
70
+ */
71
+ CurrencyConvert(
72
+ number: number,
73
+ lang: "KO" | "CN" | "CNF" = "KO",
74
+ type: "HTML" | "TEXT" = "TEXT"
75
+ ) as String | html
76
+ // example
77
+ <div v-html="CurrencyConvert(123456789, 'KO', 'HTML')"></div>
78
+ <div>{{CurrencyConvert(123456789, 'KO', 'TEXT')}}</div>
79
+ ---
80
+ /**
81
+ * 숫자만 반환 소수점옵션 및 음수 자동반영
82
+ */
83
+ ToNumber(value: string | number,precision:number=0) as Number
84
+ ---
85
+ /**
86
+ * \n을 <br>로 변환
87
+ */
88
+ ToBr(str: string)
89
+ ---
90
+ /**
91
+ * 현재날짜와의 날짜 차이를 구함
92
+ */
93
+ GetRemainingDays(dateString: string) as Number
94
+ ---
95
+ /**
96
+ * 우편번호 및 주소검색
97
+ */
98
+ SearchAddress() as {postalCode: string, address: string}
99
+ // example
100
+ halox.SearchAddress().then((res: any) => {
101
+ console.log(res)
102
+ })
103
+
104
+ onMounted(() => {
105
+ halox.LoadDaumPostcode()
106
+ })
107
+ ---
108
+ /**
109
+ * 문장을 HTML로 변환
110
+ */
111
+ toHtml({
112
+ input, // 문장
113
+ useParagraphs=false, // TRUE일경우 문장을 <p>태그로 감싸서 반환,아니면 <BR>로 반환
114
+ tabSize=4, // 탭(\t) 하나 공백길이
115
+ title='' //지정된 문자가 줄 첫글자이면 타이틀적용
116
+ }) as String
117
+ // example
118
+ <div v-html="toHtml({input: `문장을 입력하세요`, useParagraphs: true})"></div>
119
+ ---
120
+ /**
121
+ * 지정한 키워드가 존재하면 문자열 반환
122
+ * 활용 > 태그 자동 생성 ,검색 필터링 ,알림/조건 트리거
123
+ */
124
+ ExtractMatchedKeywords(str: string, keywordList: string[]=[]) as String
125
+ // example
126
+ {{ExtractMatchedKeywords('오늘은 토끼가 오신 날 입니다.', ['토끼', '날날'])}}
127
+ '토끼,날' 반환
128
+
129
+ /**
130
+ * 나이계산
131
+ * official: 만나이 => 행정, 민사, 일상 모든 기준
132
+ * common: 세는나이 => 예전 한국식 (식당, 일상 대화)
133
+ * military => 병역법, 청소년보호법 (술·담배 구매)
134
+ * @param birthDate '1990-01-01'
135
+ * @param type 'official' | 'common' | 'military
136
+ * @returns
137
+ */
138
+ GetAge('1990-01-01', 'official') as Number
139
+ ```
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
+ });