sehoo 1.0.9 → 1.0.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.
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import taxBasis from "./taxBasis";
2
2
 
3
3
  const 절사 = (num: number) => {
4
- return Math.floor(num / 10) * 10;
4
+ return num - (num % 10);
5
5
  }
6
6
 
7
7
  type Option = {
@@ -14,10 +14,10 @@ type Option = {
14
14
 
15
15
  const validateParams = (option: Option) => {
16
16
  if (typeof option.monthlyPaycheck !== 'number' ) {
17
- throw new Error("월 급여는 number 타입이어야 합니다.");
17
+ throw new Error("세전 월 급여는 number 타입이어야 합니다.");
18
18
  }
19
19
  if (option.monthlyPaycheck < 0) {
20
- throw new Error("월 급여는 0 이상이어야 합니다.");
20
+ throw new Error("세전 월 급여는 0 이상이어야 합니다.");
21
21
  }
22
22
 
23
23
  if (typeof option.taxFreeAmount !== 'number' ) {
@@ -61,7 +61,7 @@ type OptionWithKorReturn = Omit<Option, 'returnInKorean'> & {
61
61
  returnInKorean: true;
62
62
  };
63
63
  type OptionWithEngReturn = Omit<Option, 'returnInKorean'> & {
64
- returnInKorean: false | undefined;
64
+ returnInKorean?: false;
65
65
  };
66
66
 
67
67
  function sehoo(option: OptionWithKorReturn): ReturnTypeKor;
@@ -70,8 +70,8 @@ function sehoo(option: OptionWithEngReturn): ReturnTypeEng;
70
70
  function sehoo(option: Option): ReturnTypeKor | ReturnTypeEng {
71
71
  validateParams(option);
72
72
  const 세전_월급여 = option.monthlyPaycheck;
73
- const 비과세액 = option.taxFreeAmount || 1;
74
- const 공제대상가족_수 = option.numberOfFamily;
73
+ const 비과세액 = option.taxFreeAmount;
74
+ const 공제대상가족_수 = option.numberOfFamily || 1;
75
75
  const 중소기업_소득세_감면 = option.smallBusinessTaxReduction;
76
76
  const 과세대상 = 세전_월급여 - 비과세액;
77
77
 
@@ -80,7 +80,8 @@ function sehoo(option: Option): ReturnTypeKor | ReturnTypeEng {
80
80
  const 장기요양보험_공제율 = 건강보험_공제율 * 0.1281;
81
81
  const 고용보험_공제율 = 0.009;
82
82
 
83
- const 국민연금 = 절사(Math.min(과세대상 * 국민연금_공제율, 5_900_000 * 국민연금_공제율));
83
+ const 국민연금_상한_월급여 = 5_900_000;
84
+ const 국민연금 = 절사(Math.min(과세대상, 국민연금_상한_월급여) * 국민연금_공제율);
84
85
  const 장기요양보험 = 절사(과세대상 * 장기요양보험_공제율);
85
86
  const 건강보험 = 절사(과세대상 * 건강보험_공제율);
86
87
  const 고용보험 = 절사(과세대상 * 고용보험_공제율);
package/lib/index.d.ts CHANGED
@@ -29,7 +29,7 @@ type OptionWithKorReturn = Omit<Option, 'returnInKorean'> & {
29
29
  returnInKorean: true;
30
30
  };
31
31
  type OptionWithEngReturn = Omit<Option, 'returnInKorean'> & {
32
- returnInKorean: false | undefined;
32
+ returnInKorean?: false;
33
33
  };
34
34
  declare function sehoo(option: OptionWithKorReturn): ReturnTypeKor;
35
35
  declare function sehoo(option: OptionWithEngReturn): ReturnTypeEng;
package/lib/index.js CHANGED
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const taxBasis_1 = require("./taxBasis");
4
4
  const 절사 = (num) => {
5
- return Math.floor(num / 10) * 10;
5
+ return num - (num % 10);
6
6
  };
7
7
  const validateParams = (option) => {
8
8
  if (typeof option.monthlyPaycheck !== 'number') {
9
- throw new Error("월 급여는 number 타입이어야 합니다.");
9
+ throw new Error("세전 월 급여는 number 타입이어야 합니다.");
10
10
  }
11
11
  if (option.monthlyPaycheck < 0) {
12
- throw new Error("월 급여는 0 이상이어야 합니다.");
12
+ throw new Error("세전 월 급여는 0 이상이어야 합니다.");
13
13
  }
14
14
  if (typeof option.taxFreeAmount !== 'number') {
15
15
  throw new Error("비과세액은 number 타입이어야 합니다.");
@@ -28,15 +28,16 @@ function sehoo(option) {
28
28
  var _a;
29
29
  validateParams(option);
30
30
  const 세전_월급여 = option.monthlyPaycheck;
31
- const 비과세액 = option.taxFreeAmount || 1;
32
- const 공제대상가족_수 = option.numberOfFamily;
31
+ const 비과세액 = option.taxFreeAmount;
32
+ const 공제대상가족_수 = option.numberOfFamily || 1;
33
33
  const 중소기업_소득세_감면 = option.smallBusinessTaxReduction;
34
34
  const 과세대상 = 세전_월급여 - 비과세액;
35
35
  const 국민연금_공제율 = 0.045;
36
36
  const 건강보험_공제율 = 0.03545;
37
37
  const 장기요양보험_공제율 = 건강보험_공제율 * 0.1281;
38
38
  const 고용보험_공제율 = 0.009;
39
- const 국민연금 = 절사(Math.min(과세대상 * 국민연금_공제율, 5900000 * 국민연금_공제율));
39
+ const 국민연금_상한_월급여 = 5900000;
40
+ const 국민연금 = 절사(Math.min(과세대상, 국민연금_상한_월급여) * 국민연금_공제율);
40
41
  const 장기요양보험 = 절사(과세대상 * 장기요양보험_공제율);
41
42
  const 건강보험 = 절사(과세대상 * 건강보험_공제율);
42
43
  const 고용보험 = 절사(과세대상 * 고용보험_공제율);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sehoo",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {