sehoo 1.0.3 → 1.0.5

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.
package/index.ts CHANGED
@@ -36,7 +36,7 @@ const validateParams = (option: Option) => {
36
36
  }
37
37
  };
38
38
 
39
- const sehoo = async (option: Option) => {
39
+ const sehoo = (option: Option) => {
40
40
  validateParams(option);
41
41
  const 세전_월급여 = option.monthlyPaycheck;
42
42
  const 비과세액 = option.taxFreeAmount || 1;
@@ -54,7 +54,7 @@ const sehoo = async (option: Option) => {
54
54
  const 건강보험 = 절사(과세대상 * 건강보험_공제율);
55
55
  const 고용보험 = 절사(과세대상 * 고용보험_공제율);
56
56
  const taxFilePath = path.join(__dirname, "tax.csv");
57
- const 간이세액_기준 = fs.readFileSync(taxFilePath, "utf-8").split("\n").map((line) => line.split("\t");
57
+ const 간이세액_기준 = fs.readFileSync(taxFilePath, "utf-8").split("\n").map((line) => line.split("\t"));
58
58
  let 소득세 = 절사(Number(간이세액_기준.find(line => Number(line[0]) > 과세대상 / 1000)?.[공제대상가족_수]));
59
59
  if (!소득세) {
60
60
  const 기본_세액 = 1_507_400;
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@ type Option = {
5
5
  smallBusinessTaxReduction?: boolean;
6
6
  returnInKorean?: boolean;
7
7
  };
8
- declare const sehoo: (option: Option) => Promise<{
8
+ declare const sehoo: (option: Option) => {
9
9
  국민연금: number;
10
10
  건강보험: number;
11
11
  장기요양보험: number;
@@ -39,5 +39,5 @@ declare const sehoo: (option: Option) => Promise<{
39
39
  주민세?: undefined;
40
40
  공제액_합계?: undefined;
41
41
  실수령액?: undefined;
42
- }>;
42
+ };
43
43
  export default sehoo;
package/lib/index.js CHANGED
@@ -1,15 +1,7 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const fs = require("fs/promises");
3
+ const fs = require("fs");
4
+ const path = require("path");
13
5
  const 절사 = (num) => {
14
6
  return Math.floor(num / 10) * 10;
15
7
  };
@@ -33,7 +25,7 @@ const validateParams = (option) => {
33
25
  throw new Error("공제대상 가족 수는 1 이상 11 이하이어야 합니다.");
34
26
  }
35
27
  };
36
- const sehoo = (option) => __awaiter(void 0, void 0, void 0, function* () {
28
+ const sehoo = (option) => {
37
29
  var _a;
38
30
  validateParams(option);
39
31
  const 세전_월급여 = option.monthlyPaycheck;
@@ -49,8 +41,8 @@ const sehoo = (option) => __awaiter(void 0, void 0, void 0, function* () {
49
41
  const 장기요양보험 = 절사(과세대상 * 장기요양보험_공제율);
50
42
  const 건강보험 = 절사(과세대상 * 건강보험_공제율);
51
43
  const 고용보험 = 절사(과세대상 * 고용보험_공제율);
52
- const 간이세액_기준 = yield fs.readFile("./tax.csv", "utf-8")
53
- .then((data) => data.split("\n").map((line) => line.split("\t")));
44
+ const taxFilePath = path.join(__dirname, "tax.csv");
45
+ const 간이세액_기준 = fs.readFileSync(taxFilePath, "utf-8").split("\n").map((line) => line.split("\t"));
54
46
  let 소득세 = 절사(Number((_a = 간이세액_기준.find(line => Number(line[0]) > 과세대상 / 1000)) === null || _a === void 0 ? void 0 : _a[공제대상가족_수]));
55
47
  if (!소득세) {
56
48
  const 기본_세액 = 1507400;
@@ -101,7 +93,7 @@ const sehoo = (option) => __awaiter(void 0, void 0, void 0, function* () {
101
93
  total: 공제액_합계,
102
94
  actualSalary: 세전_월급여 - 공제액_합계,
103
95
  };
104
- });
96
+ };
105
97
  // main({
106
98
  // monthlyPaycheck: 6_290_000,
107
99
  // taxFreeAmount: 100_000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sehoo",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {