spoclip-kit 1.0.3

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 (58) hide show
  1. package/README.md +89 -0
  2. package/dist/constants/time.d.ts +6 -0
  3. package/dist/constants/time.d.ts.map +1 -0
  4. package/dist/index.d.ts +27 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.esm.js +30 -0
  7. package/dist/index.esm.js.map +1 -0
  8. package/dist/index.js +32 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/libs/constants/time.d.ts +6 -0
  11. package/dist/libs/constants/time.d.ts.map +1 -0
  12. package/dist/libs/cost.d.ts +25 -0
  13. package/dist/libs/cost.d.ts.map +1 -0
  14. package/dist/libs/cost.test.d.ts +2 -0
  15. package/dist/libs/cost.test.d.ts.map +1 -0
  16. package/dist/libs/index.d.ts +27 -0
  17. package/dist/libs/index.d.ts.map +1 -0
  18. package/dist/libs/index.esm.js +30 -0
  19. package/dist/libs/index.esm.js.map +1 -0
  20. package/dist/libs/index.js +32 -0
  21. package/dist/libs/index.js.map +1 -0
  22. package/dist/libs/libs/cost.d.ts +25 -0
  23. package/dist/libs/libs/cost.d.ts.map +1 -0
  24. package/dist/libs/libs/cost.test.d.ts +2 -0
  25. package/dist/libs/libs/cost.test.d.ts.map +1 -0
  26. package/dist/libs/libs/index.d.ts +2 -0
  27. package/dist/libs/libs/index.d.ts.map +1 -0
  28. package/dist/libs/types/membership.d.ts +2 -0
  29. package/dist/libs/types/membership.d.ts.map +1 -0
  30. package/dist/math/index.d.ts +25 -0
  31. package/dist/math/index.d.ts.map +1 -0
  32. package/dist/math/index.esm.js +34 -0
  33. package/dist/math/index.esm.js.map +1 -0
  34. package/dist/math/index.js +41 -0
  35. package/dist/math/index.js.map +1 -0
  36. package/dist/math/math/index.d.ts +19 -0
  37. package/dist/math/math/index.d.ts.map +1 -0
  38. package/dist/math/utils/index.d.ts +2 -0
  39. package/dist/math/utils/index.d.ts.map +1 -0
  40. package/dist/math/utils/test.d.ts +5 -0
  41. package/dist/math/utils/test.d.ts.map +1 -0
  42. package/dist/types/membership.d.ts +2 -0
  43. package/dist/types/membership.d.ts.map +1 -0
  44. package/dist/utils/index.d.ts +25 -0
  45. package/dist/utils/index.d.ts.map +1 -0
  46. package/dist/utils/index.esm.js +9 -0
  47. package/dist/utils/index.esm.js.map +1 -0
  48. package/dist/utils/index.js +11 -0
  49. package/dist/utils/index.js.map +1 -0
  50. package/dist/utils/math/index.d.ts +19 -0
  51. package/dist/utils/math/index.d.ts.map +1 -0
  52. package/dist/utils/test.d.ts +5 -0
  53. package/dist/utils/test.d.ts.map +1 -0
  54. package/dist/utils/utils/index.d.ts +2 -0
  55. package/dist/utils/utils/index.d.ts.map +1 -0
  56. package/dist/utils/utils/test.d.ts +5 -0
  57. package/dist/utils/utils/test.d.ts.map +1 -0
  58. package/package.json +76 -0
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # Spoclip Kit
2
+
3
+ TypeScript utility library for internal use.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install spoclip-kit
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Import specific modules
14
+
15
+ ```typescript
16
+ import { test } from '@spoclip-kit/utils';
17
+ import { add, multiply } from '@spoclip-kit/math';
18
+
19
+ // Use the test function
20
+ test(); // logs 'test' to console
21
+
22
+ // Use math functions
23
+ const result = add(2, 3); // 5
24
+ const product = multiply(4, 5); // 20
25
+ ```
26
+
27
+ ### Import everything
28
+
29
+ ```typescript
30
+ import { test, add, multiply } from 'spoclip-kit';
31
+ ```
32
+
33
+ ## Available Modules
34
+
35
+ ### Utils (`@spoclip-kit/utils`)
36
+
37
+ - `test()` - Logs 'test' to console
38
+
39
+ ### Math (`@spoclip-kit/math`)
40
+
41
+ - `add(a, b)` - Add two numbers
42
+ - `subtract(a, b)` - Subtract two numbers
43
+ - `multiply(a, b)` - Multiply two numbers
44
+ - `divide(a, b)` - Divide two numbers
45
+ - `PI` - Math.PI constant
46
+ - `E` - Math.E constant
47
+
48
+ ## Development
49
+
50
+ ### Setup
51
+
52
+ ```bash
53
+ npm install
54
+ ```
55
+
56
+ ### Build
57
+
58
+ ```bash
59
+ npm run build
60
+ ```
61
+
62
+ ### Test
63
+
64
+ ```bash
65
+ npm run test
66
+ ```
67
+
68
+ ### Lint
69
+
70
+ ```bash
71
+ npm run lint
72
+ ```
73
+
74
+ ### Format
75
+
76
+ ```bash
77
+ npm run format
78
+ ```
79
+
80
+ ## Publishing
81
+
82
+ ```bash
83
+ npm publish
84
+ ```
85
+
86
+ ## License
87
+
88
+ MIT
89
+ # spoclip-kit
@@ -0,0 +1,6 @@
1
+ declare const SECOND = 1000;
2
+ declare const MINUTE: number;
3
+ declare const HOUR: number;
4
+ declare const DAY: number;
5
+ export { SECOND, MINUTE, HOUR, DAY };
6
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/constants/time.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,OAAO,CAAC;AACpB,QAAA,MAAM,MAAM,QAAc,CAAC;AAC3B,QAAA,MAAM,IAAI,QAAc,CAAC;AACzB,QAAA,MAAM,GAAG,QAAY,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { TicketCode } from '@/types/membership';
2
+
3
+ /**
4
+ * @description
5
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
6
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
7
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
8
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
9
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
10
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
11
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
12
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
13
+ *
14
+ * @returns - 다운로드 비용
15
+ */
16
+ declare function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }: {
17
+ duration: number;
18
+ isFullTime: boolean;
19
+ quality: '2K' | '4K';
20
+ ticketCode: TicketCode;
21
+ remainingFreeDownloads: number;
22
+ }): {
23
+ cost: number;
24
+ isPlusFree: boolean;
25
+ };
26
+
27
+ export { getDownloadCost };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @description
3
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
4
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
5
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
6
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
7
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
8
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
9
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
10
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
11
+ *
12
+ * @returns - 다운로드 비용
13
+ */
14
+ function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }) {
15
+ if (isFullTime && quality === '4K') {
16
+ return { cost: 20, isPlusFree: false };
17
+ }
18
+ const durationInSeconds = duration / 1000;
19
+ const isUnder61 = durationInSeconds < 61;
20
+ const isPlus = ticketCode === 'PLUS';
21
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
22
+ return { cost: 0, isPlusFree: true };
23
+ }
24
+ const costPerSecond = 1 / 60;
25
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10 + 1;
26
+ return { cost, isPlusFree: false };
27
+ }
28
+
29
+ export { getDownloadCost };
30
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GAOvB,EAAA;AACC,IAAA,IAAI,UAAU,IAAI,OAAO,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;AACxE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description
5
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
6
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
7
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
8
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
9
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
10
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
11
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
12
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
13
+ *
14
+ * @returns - 다운로드 비용
15
+ */
16
+ function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }) {
17
+ if (isFullTime && quality === '4K') {
18
+ return { cost: 20, isPlusFree: false };
19
+ }
20
+ const durationInSeconds = duration / 1000;
21
+ const isUnder61 = durationInSeconds < 61;
22
+ const isPlus = ticketCode === 'PLUS';
23
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
24
+ return { cost: 0, isPlusFree: true };
25
+ }
26
+ const costPerSecond = 1 / 60;
27
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10 + 1;
28
+ return { cost, isPlusFree: false };
29
+ }
30
+
31
+ exports.getDownloadCost = getDownloadCost;
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GAOvB,EAAA;AACC,IAAA,IAAI,UAAU,IAAI,OAAO,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;AACxE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -0,0 +1,6 @@
1
+ declare const SECOND = 1000;
2
+ declare const MINUTE: number;
3
+ declare const HOUR: number;
4
+ declare const DAY: number;
5
+ export { SECOND, MINUTE, HOUR, DAY };
6
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/constants/time.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,OAAO,CAAC;AACpB,QAAA,MAAM,MAAM,QAAc,CAAC;AAC3B,QAAA,MAAM,IAAI,QAAc,CAAC;AACzB,QAAA,MAAM,GAAG,QAAY,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { TicketCode } from '@/types/membership';
2
+ /**
3
+ * @description
4
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
5
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
6
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
7
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
8
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
9
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
10
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
11
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
12
+ *
13
+ * @returns - 다운로드 비용
14
+ */
15
+ export declare function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }: {
16
+ duration: number;
17
+ isFullTime: boolean;
18
+ quality: '2K' | '4K';
19
+ ticketCode: TicketCode;
20
+ remainingFreeDownloads: number;
21
+ }): {
22
+ cost: number;
23
+ isPlusFree: boolean;
24
+ };
25
+ //# sourceMappingURL=cost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/libs/cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GACvB,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;;;EAgBA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cost.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost.test.d.ts","sourceRoot":"","sources":["../../src/libs/cost.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import { TicketCode } from '@/types/membership';
2
+
3
+ /**
4
+ * @description
5
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
6
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
7
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
8
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
9
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
10
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
11
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
12
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
13
+ *
14
+ * @returns - 다운로드 비용
15
+ */
16
+ declare function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }: {
17
+ duration: number;
18
+ isFullTime: boolean;
19
+ quality: '2K' | '4K';
20
+ ticketCode: TicketCode;
21
+ remainingFreeDownloads: number;
22
+ }): {
23
+ cost: number;
24
+ isPlusFree: boolean;
25
+ };
26
+
27
+ export { getDownloadCost };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @description
3
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
4
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
5
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
6
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
7
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
8
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
9
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
10
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
11
+ *
12
+ * @returns - 다운로드 비용
13
+ */
14
+ function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }) {
15
+ if (isFullTime && quality === '4K') {
16
+ return { cost: 20, isPlusFree: false };
17
+ }
18
+ const durationInSeconds = duration / 1000;
19
+ const isUnder61 = durationInSeconds < 61;
20
+ const isPlus = ticketCode === 'PLUS';
21
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
22
+ return { cost: 0, isPlusFree: true };
23
+ }
24
+ const costPerSecond = 1 / 60;
25
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10 + 1;
26
+ return { cost, isPlusFree: false };
27
+ }
28
+
29
+ export { getDownloadCost };
30
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GAOvB,EAAA;AACC,IAAA,IAAI,UAAU,IAAI,OAAO,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;AACxE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description
5
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
6
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
7
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
8
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
9
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
10
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
11
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
12
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
13
+ *
14
+ * @returns - 다운로드 비용
15
+ */
16
+ function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }) {
17
+ if (isFullTime && quality === '4K') {
18
+ return { cost: 20, isPlusFree: false };
19
+ }
20
+ const durationInSeconds = duration / 1000;
21
+ const isUnder61 = durationInSeconds < 61;
22
+ const isPlus = ticketCode === 'PLUS';
23
+ if (isPlus && remainingFreeDownloads > 0 && isUnder61) {
24
+ return { cost: 0, isPlusFree: true };
25
+ }
26
+ const costPerSecond = 1 / 60;
27
+ const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10 + 1;
28
+ return { cost, isPlusFree: false };
29
+ }
30
+
31
+ exports.getDownloadCost = getDownloadCost;
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/libs/cost.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GAOvB,EAAA;AACC,IAAA,IAAI,UAAU,IAAI,OAAO,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;AAEA,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,IAAI;AACzC,IAAA,MAAM,SAAS,GAAG,iBAAiB,GAAG,EAAE;AACxC,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,MAAM;IAEpC,IAAI,MAAM,IAAI,sBAAsB,GAAG,CAAC,IAAI,SAAS,EAAE;QACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;IACtC;AAEA,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;AAC5B,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;AACxE,IAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC;;;;"}
@@ -0,0 +1,25 @@
1
+ import type { TicketCode } from '@/types/membership';
2
+ /**
3
+ * @description
4
+ * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨
5
+ * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료
6
+ * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작
7
+ * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨
8
+ * - 59초부터는 1.98xx 이므로 반올림 시 2톨
9
+ * - 60초부터는 2.00xx 이므로 반올림 시 2톨
10
+ * - 62초부터는 2.03xx 이므로 반올림 시 2톨
11
+ * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨
12
+ *
13
+ * @returns - 다운로드 비용
14
+ */
15
+ export declare function getDownloadCost({ duration, isFullTime, quality, ticketCode, remainingFreeDownloads, }: {
16
+ duration: number;
17
+ isFullTime: boolean;
18
+ quality: '2K' | '4K';
19
+ ticketCode: TicketCode;
20
+ remainingFreeDownloads: number;
21
+ }): {
22
+ cost: number;
23
+ isPlusFree: boolean;
24
+ };
25
+ //# sourceMappingURL=cost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/libs/cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,sBAAsB,GACvB,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;;;EAgBA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cost.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost.test.d.ts","sourceRoot":"","sources":["../../src/libs/cost.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { getDownloadCost } from './cost';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type TicketCode = 'PLUS' | 'FREE';
2
+ //# sourceMappingURL=membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/types/membership.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ declare function test(): void;
5
+
6
+ declare const PI: number;
7
+ declare const E: number;
8
+ /**
9
+ * Add two numbers
10
+ */
11
+ declare function add(a: number, b: number): number;
12
+ /**
13
+ * Subtract two numbers
14
+ */
15
+ declare function subtract(a: number, b: number): number;
16
+ /**
17
+ * Multiply two numbers
18
+ */
19
+ declare function multiply(a: number, b: number): number;
20
+ /**
21
+ * Divide two numbers
22
+ */
23
+ declare function divide(a: number, b: number): number;
24
+
25
+ export { E, PI, add, divide, multiply, subtract, test };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,34 @@
1
+ // Math utility functions module
2
+ // Add math utility functions here as needed
3
+ const PI = Math.PI;
4
+ const E = Math.E;
5
+ /**
6
+ * Add two numbers
7
+ */
8
+ function add(a, b) {
9
+ return a + b;
10
+ }
11
+ /**
12
+ * Subtract two numbers
13
+ */
14
+ function subtract(a, b) {
15
+ return a - b;
16
+ }
17
+ /**
18
+ * Multiply two numbers
19
+ */
20
+ function multiply(a, b) {
21
+ return a * b;
22
+ }
23
+ /**
24
+ * Divide two numbers
25
+ */
26
+ function divide(a, b) {
27
+ if (b === 0) {
28
+ throw new Error('Division by zero is not allowed');
29
+ }
30
+ return a / b;
31
+ }
32
+
33
+ export { E, PI, add, divide, multiply, subtract };
34
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/math/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA;AACO,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,CAAC,GAAG,IAAI,CAAC;AAEtB;;AAEG;AACG,SAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAA;IACtC,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAA;IAC3C,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAA;IAC3C,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAA;AACzC,IAAA,IAAI,CAAC,KAAK,CAAC,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IACpD;IACA,OAAO,CAAC,GAAG,CAAC;AACd;;;;"}
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ // Math utility functions module
4
+ // Add math utility functions here as needed
5
+ const PI = Math.PI;
6
+ const E = Math.E;
7
+ /**
8
+ * Add two numbers
9
+ */
10
+ function add(a, b) {
11
+ return a + b;
12
+ }
13
+ /**
14
+ * Subtract two numbers
15
+ */
16
+ function subtract(a, b) {
17
+ return a - b;
18
+ }
19
+ /**
20
+ * Multiply two numbers
21
+ */
22
+ function multiply(a, b) {
23
+ return a * b;
24
+ }
25
+ /**
26
+ * Divide two numbers
27
+ */
28
+ function divide(a, b) {
29
+ if (b === 0) {
30
+ throw new Error('Division by zero is not allowed');
31
+ }
32
+ return a / b;
33
+ }
34
+
35
+ exports.E = E;
36
+ exports.PI = PI;
37
+ exports.add = add;
38
+ exports.divide = divide;
39
+ exports.multiply = multiply;
40
+ exports.subtract = subtract;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/math/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAEA;AACO,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,CAAC,GAAG,IAAI,CAAC;AAEtB;;AAEG;AACG,SAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAA;IACtC,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAA;IAC3C,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAA;IAC3C,OAAO,CAAC,GAAG,CAAC;AACd;AAEA;;AAEG;AACG,SAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAA;AACzC,IAAA,IAAI,CAAC,KAAK,CAAC,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IACpD;IACA,OAAO,CAAC,GAAG,CAAC;AACd;;;;;;;;;"}
@@ -0,0 +1,19 @@
1
+ export declare const PI: number;
2
+ export declare const E: number;
3
+ /**
4
+ * Add two numbers
5
+ */
6
+ export declare function add(a: number, b: number): number;
7
+ /**
8
+ * Subtract two numbers
9
+ */
10
+ export declare function subtract(a: number, b: number): number;
11
+ /**
12
+ * Multiply two numbers
13
+ */
14
+ export declare function multiply(a: number, b: number): number;
15
+ /**
16
+ * Divide two numbers
17
+ */
18
+ export declare function divide(a: number, b: number): number;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,EAAE,QAAU,CAAC;AAC1B,eAAO,MAAM,CAAC,QAAS,CAAC;AAExB;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -0,0 +1,2 @@
1
+ export { test } from './test';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ export declare function test(): void;
5
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/utils/test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAE3B"}
@@ -0,0 +1,2 @@
1
+ export type TicketCode = 'PLUS' | 'FREE';
2
+ //# sourceMappingURL=membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/types/membership.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ declare function test(): void;
5
+
6
+ declare const PI: number;
7
+ declare const E: number;
8
+ /**
9
+ * Add two numbers
10
+ */
11
+ declare function add(a: number, b: number): number;
12
+ /**
13
+ * Subtract two numbers
14
+ */
15
+ declare function subtract(a: number, b: number): number;
16
+ /**
17
+ * Multiply two numbers
18
+ */
19
+ declare function multiply(a: number, b: number): number;
20
+ /**
21
+ * Divide two numbers
22
+ */
23
+ declare function divide(a: number, b: number): number;
24
+
25
+ export { E, PI, add, divide, multiply, subtract, test };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ function test() {
5
+ console.log('test');
6
+ }
7
+
8
+ export { test };
9
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/utils/test.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;SACa,IAAI,GAAA;AAClB,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACrB;;;;"}
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Test function that logs 'test' to console
5
+ */
6
+ function test() {
7
+ console.log('test');
8
+ }
9
+
10
+ exports.test = test;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/test.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;AAEG;SACa,IAAI,GAAA;AAClB,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACrB;;;;"}
@@ -0,0 +1,19 @@
1
+ export declare const PI: number;
2
+ export declare const E: number;
3
+ /**
4
+ * Add two numbers
5
+ */
6
+ export declare function add(a: number, b: number): number;
7
+ /**
8
+ * Subtract two numbers
9
+ */
10
+ export declare function subtract(a: number, b: number): number;
11
+ /**
12
+ * Multiply two numbers
13
+ */
14
+ export declare function multiply(a: number, b: number): number;
15
+ /**
16
+ * Divide two numbers
17
+ */
18
+ export declare function divide(a: number, b: number): number;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,EAAE,QAAU,CAAC;AAC1B,eAAO,MAAM,CAAC,QAAS,CAAC;AAExB;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ export declare function test(): void;
5
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/utils/test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAE3B"}
@@ -0,0 +1,2 @@
1
+ export { test } from './test';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test function that logs 'test' to console
3
+ */
4
+ export declare function test(): void;
5
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/utils/test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAE3B"}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "spoclip-kit",
3
+ "version": "1.0.3",
4
+ "type": "module",
5
+ "description": "TypeScript utility library for internal use",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "rollup -c",
14
+ "dev": "rollup -c -w",
15
+ "test": "vitest",
16
+ "test:run": "vitest run",
17
+ "lint": "eslint src --ext .ts,.tsx",
18
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
19
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
20
+ "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
21
+ "prepublishOnly": "npm run build",
22
+ "clean": "rimraf dist",
23
+ "release:patch": "npm version patch && npm publish",
24
+ "release:minor": "npm version minor && npm publish",
25
+ "release:major": "npm version major && npm publish"
26
+ },
27
+ "keywords": [
28
+ "typescript",
29
+ "utilities",
30
+ "library",
31
+ "spoclip"
32
+ ],
33
+ "author": "",
34
+ "license": "MIT",
35
+ "devDependencies": {
36
+ "@eslint/js": "^9.37.0",
37
+ "@rollup/plugin-commonjs": "^25.0.7",
38
+ "@rollup/plugin-node-resolve": "^15.2.3",
39
+ "@rollup/plugin-typescript": "^11.1.5",
40
+ "@types/node": "^20.10.5",
41
+ "@typescript-eslint/eslint-plugin": "^8.46.1",
42
+ "@typescript-eslint/parser": "^8.46.1",
43
+ "eslint": "^9.37.0",
44
+ "globals": "^16.4.0",
45
+ "prettier": "^3.1.1",
46
+ "rimraf": "^5.0.5",
47
+ "rollup": "^4.9.1",
48
+ "rollup-plugin-dts": "^6.1.0",
49
+ "tslib": "^2.6.2",
50
+ "typescript": "^5.9.3",
51
+ "vitest": "^1.1.0"
52
+ },
53
+ "peerDependencies": {
54
+ "typescript": ">=4.9.0"
55
+ },
56
+ "exports": {
57
+ ".": {
58
+ "import": "./dist/index.esm.js",
59
+ "require": "./dist/index.js",
60
+ "types": "./dist/index.d.ts"
61
+ },
62
+ "./utils": {
63
+ "import": "./dist/utils/index.esm.js",
64
+ "require": "./dist/utils/index.js",
65
+ "types": "./dist/utils/index.d.ts"
66
+ },
67
+ "./math": {
68
+ "import": "./dist/math/index.esm.js",
69
+ "require": "./dist/math/index.js",
70
+ "types": "./dist/math/index.d.ts"
71
+ }
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ }
76
+ }