diff --git a/.changeset/README.md b/.changeset/README.md deleted file mode 100644 index e5b6d8d..0000000 --- a/.changeset/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Changesets - -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works -with multi-package repos, or single-package repos to help you version and publish your code. You can -find the full documentation for it [in our repository](https://github.com/changesets/changesets) - -We have a quick list of common questions to get you started engaging with this project in -[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json deleted file mode 100644 index a7831c0..0000000 --- a/.changeset/config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@2.1.1/schema.json", - "changelog": "@changesets/cli/changelog", - "commit": false, - "fixed": [], - "linked": [], - "access": "restricted", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [] -} \ No newline at end of file diff --git a/__tests__/KoreanNumeral_test.res b/__tests__/KoreanNumeral_test.res index 5075f72..14723cb 100644 --- a/__tests__/KoreanNumeral_test.res +++ b/__tests__/KoreanNumeral_test.res @@ -1,56 +1,55 @@ -open Jest; +open Jest describe(`1만 이하 표시`, () => { - open Expect; + open Expect test(`KoreanNumeral.fromInt`, () => { - let result = KoreanNumeral.fromInt(1234, ()); - expect(result) |> toBe(`1,234`); - }); + let result = KoreanNumeral.fromInt(1234, ()) + expect(result)->toBe(`1,234`) + }) test(`KoreanNumeral.fromFloat`, () => { - let result = KoreanNumeral.fromFloat(152212525110.0, ()); - expect(result) |> toBe(`1,522억 1,252만 5,110`); - }); + let result = KoreanNumeral.fromFloat(152212525110.0, ()) + expect(result)->toBe(`1,522억 1,252만 5,110`) + }) test(`KoreanNumeral.fromInt64`, () => { - let result = - KoreanNumeral.fromInt64(Int64.of_string("1234567890987654321"), ()); - expect(result) |> toBe(`123경 4,567조 8,909억 8,765만 4,321`); - }); -}); + let result = KoreanNumeral.fromInt64(Int64.of_string("1234567890987654321"), ()) + expect(result)->toBe(`123경 4,567조 8,909억 8,765만 4,321`) + }) +}) describe(`1만 이하는 절삭`, () => { - open Expect; + open Expect test(`1234 => ""`, () => { - let result = KoreanNumeral.fromInt(1234, ~drop=1, ()); - expect(result) |> toBe(``); - }); + let result = KoreanNumeral.fromInt(1234, ~drop=1, ()) + expect(result)->toBe(``) + }) test(`1234567 => "123만"`, () => { - let result = KoreanNumeral.fromInt(1234567, ~drop=1, ()); - expect(result) |> toBe(`123만`); - }); + let result = KoreanNumeral.fromInt(1234567, ~drop=1, ()) + expect(result)->toBe(`123만`) + }) test(`1234567890 => "12억 3,456만"`, () => { - let result = KoreanNumeral.fromInt(1234567890, ~drop=1, ()); - expect(result) |> toBe(`12억 3,456만`); - }); + let result = KoreanNumeral.fromInt(1234567890, ~drop=1, ()) + expect(result)->toBe(`12억 3,456만`) + }) test(`1234567890.1 => "12억 3,456만"`, () => { - let result = KoreanNumeral.fromFloat(1234567890.1, ~drop=1, ()); - expect(result) |> toBe(`12억 3,456만`); - }); + let result = KoreanNumeral.fromFloat(1234567890.1, ~drop=1, ()) + expect(result)->toBe(`12억 3,456만`) + }) test(`152212525110 => "1,522억 1,252만"`, () => { - let result = KoreanNumeral.fromFloat(152212525110.0, ~drop=1, ()); - expect(result) |> toBe(`1,522억 1,252만`); - }); + let result = KoreanNumeral.fromFloat(152212525110.0, ~drop=1, ()) + expect(result)->toBe(`1,522억 1,252만`) + }) test(`152212525110 => "1,522억"`, () => { - let result = KoreanNumeral.fromFloat(152200005110.0, ~drop=1, ()); - expect(result) |> toBe(`1,522억`); - }); + let result = KoreanNumeral.fromFloat(152200005110.0, ~drop=1, ()) + expect(result)->toBe(`1,522억`) + }) test(`220000152212525110.0 => "22경 1,522억 1,252만"`, () => { - let result = KoreanNumeral.fromFloat(220000152212525110.0, ~drop=1, ()); - expect(result) |> toBe(`22경 1,522억 1,252만`); - }); + let result = KoreanNumeral.fromFloat(220000152212525110.0, ~drop=1, ()) + expect(result)->toBe(`22경 1,522억 1,252만`) + }) test(`1234567890987654321 => "123경 4,567조 8,909억 8,765만"`, () => { - let result = KoreanNumeral.fromString("1234567890987654321", ~drop=1, ()); - expect(result) |> toBe(`123경 4,567조 8,909억 8,765만`); - }); -}); + let result = KoreanNumeral.fromString("1234567890987654321", ~drop=1, ()) + expect(result)->toBe(`123경 4,567조 8,909억 8,765만`) + }) +}) diff --git a/package.json b/package.json index 0f09190..921b18f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@greenlabs/rescript-korean-numeral", - "version": "0.2.0", + "version": "0.3.0", "description": "ReScript module to convert the number to Korean", "scripts": { "start": "rescript build -w", @@ -24,10 +24,7 @@ }, "homepage": "https://github.com/green-labs/rescript-korean-numeral#readme", "devDependencies": { - "@glennsl/bs-jest": "^0.6.0", - "rescript": "^10" - }, - "dependencies": { - "@changesets/cli": "^2.24.4" + "@glennsl/rescript-jest": "^0.10.0", + "rescript": "^11" } -} +} \ No newline at end of file diff --git a/bsconfig.json b/rescript.json similarity index 90% rename from bsconfig.json rename to rescript.json index 6e869e3..e60dd07 100644 --- a/bsconfig.json +++ b/rescript.json @@ -19,8 +19,7 @@ } ], "suffix": ".bs.js", - "refmt": 3, "bs-dev-dependencies": [ - "@glennsl/bs-jest" + "@glennsl/rescript-jest" ] } \ No newline at end of file diff --git a/src/KoreanNumeral.res b/src/KoreanNumeral.res index 1eb3a66..954d643 100644 --- a/src/KoreanNumeral.res +++ b/src/KoreanNumeral.res @@ -1,4 +1,4 @@ -@bs.send external toLocaleString: (int, string) => string = "toLocaleString" +@send external toLocaleString: (int, string) => string = "toLocaleString" open Belt @@ -20,7 +20,7 @@ let fromInt64 = (num, ~drop=0, ()) => { ->List.keep(i => i != "") ->List.reverse ->List.toArray - ->Js.Array.joinWith(" ", _) + ->(Js.Array.joinWith(" ", _)) } let fromInt = (num, ~drop=0, ()) => {