Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@toss/hangul

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toss/hangul - npm Package Compare versions

Comparing version 1.5.0 to 1.6.1

dist/disassemble.d.ts

71

CHANGELOG.md

@@ -6,5 +6,14 @@ # Change Log

# [1.6.0](https://github.com/toss/slash/compare/@toss/hangul@1.5.0...@toss/hangul@1.6.0) (2023-10-04)
### Bug Fixes
* delete duplicated pages ([#327](https://github.com/toss/slash/issues/327)) ([b3d9221](https://github.com/toss/slash/commit/b3d92212792cb712f8e2a798abb93e9e37e22749))
### Features
* **hangul:** Merge internal changes ([#310](https://github.com/toss/slash/issues/310)) ([9f7cfdf](https://github.com/toss/slash/commit/9f7cfdf7eea2e84d996317dca1c8c4d8c7f2fece))
# [1.5.0](https://github.com/toss/slash/compare/@toss/hangul@1.4.0...@toss/hangul@1.5.0) (2023-07-03)
### Bug Fixes

@@ -14,3 +23,2 @@

### Features

@@ -21,9 +29,4 @@

# [1.4.0](https://github.com/toss/slash/compare/@toss/hangul@1.3.0...@toss/hangul@1.4.0) (2023-06-13)
### Features

@@ -33,9 +36,4 @@

# [1.3.0](https://github.com/toss/slash/compare/@toss/hangul@1.2.0...@toss/hangul@1.3.0) (2023-04-12)
### Features

@@ -46,9 +44,4 @@

# [1.2.0](https://github.com/toss/slash/compare/@toss/hangul@1.1.5...@toss/hangul@1.2.0) (2023-02-27)
### Features

@@ -58,9 +51,4 @@

## [1.1.5](https://github.com/toss/slash/compare/@toss/hangul@1.1.4...@toss/hangul@1.1.5) (2023-01-09)
### Bug Fixes

@@ -70,6 +58,2 @@

## [1.1.4](https://github.com/toss/slash/compare/@toss/hangul@1.1.3...@toss/hangul@1.1.4) (2022-12-06)

@@ -79,6 +63,2 @@

## [1.1.3](https://github.com/toss/slash/compare/@toss/hangul@1.1.2...@toss/hangul@1.1.3) (2022-11-16)

@@ -88,6 +68,2 @@

## [1.1.2](https://github.com/toss/slash/compare/@toss/hangul@1.1.1...@toss/hangul@1.1.2) (2022-11-15)

@@ -97,6 +73,2 @@

## [1.1.1](https://github.com/toss/slash/compare/@toss/hangul@1.1.0...@toss/hangul@1.1.1) (2022-11-14)

@@ -106,9 +78,4 @@

# [1.1.0](https://github.com/toss/slash/compare/@toss/hangul@1.0.4...@toss/hangul@1.1.0) (2022-11-10)
### Features

@@ -118,6 +85,2 @@

## [1.0.4](https://github.com/toss/slash/compare/@toss/hangul@1.0.3...@toss/hangul@1.0.4) (2022-11-01)

@@ -127,9 +90,4 @@

## [1.0.3](https://github.com/toss/slash/compare/@toss/hangul@1.0.1...@toss/hangul@1.0.3) (2022-10-18)
### Bug Fixes

@@ -139,9 +97,4 @@

## [1.0.2](https://github.com/toss/slash/compare/@toss/hangul@1.0.1...@toss/hangul@1.0.2) (2022-10-12)
### Bug Fixes

@@ -151,8 +104,4 @@

## [1.0.1](https://github.com/toss/slash/compare/@toss/hangul@1.0.0...@toss/hangul@1.0.1) (2022-10-11)
**Note:** Version bump only for package @toss/hangul
/** @tossdocs-ignore */
export * from './disassemble';
export * from './hangulIncludes';
export * from './chosungIncludes';
export * from './disassembleHangul';
export * from './disassembleHangulToGroups';
export * from './hangulIncludes';
export * from './josa';
export * from './utils';

@@ -5,77 +5,2 @@ 'use strict';

/** @tossdocs-ignore */
var COMPLETE_HANGUL_START_CHARCODE = '가'.charCodeAt(0);
var COMPLETE_HANGUL_END_CHARCODE = '힣'.charCodeAt(0);
/**
* ㄱ -> 'ㄱ'
* ㄳ -> 'ㄱㅅ' 으로 나눈다.
*/
var DISASSEMBLED_CONSONANTS_BY_CONSONANT = {
// 종성이 없는 경우 '빈' 초성으로 관리하는 것이 편리하여, 빈 문자열도 포함한다.
'': '',
ㄱ: 'ㄱ',
ㄲ: 'ㄲ',
ㄳ: 'ㄱㅅ',
ㄴ: 'ㄴ',
ㄵ: 'ㄴㅈ',
ㄶ: 'ㄴㅎ',
ㄷ: 'ㄷ',
ㄸ: 'ㄸ',
ㄹ: 'ㄹ',
ㄺ: 'ㄹㄱ',
ㄻ: 'ㄹㅁ',
ㄼ: 'ㄹㅂ',
ㄽ: 'ㄹㅅ',
ㄾ: 'ㄹㅌ',
ㄿ: 'ㄹㅍ',
ㅀ: 'ㄹㅎ',
ㅁ: 'ㅁ',
ㅂ: 'ㅂ',
ㅃ: 'ㅃ',
ㅄ: 'ㅂㅅ',
ㅅ: 'ㅅ',
ㅆ: 'ㅆ',
ㅇ: 'ㅇ',
ㅈ: 'ㅈ',
ㅉ: 'ㅉ',
ㅊ: 'ㅊ',
ㅋ: 'ㅋ',
ㅌ: 'ㅌ',
ㅍ: 'ㅍ',
ㅎ: 'ㅎ'
};
var DISASSEMBLED_VOWELS_BY_VOWEL = {
ㅏ: 'ㅏ',
ㅐ: 'ㅐ',
ㅑ: 'ㅑ',
ㅒ: 'ㅒ',
ㅓ: 'ㅓ',
ㅔ: 'ㅔ',
ㅕ: 'ㅕ',
ㅖ: 'ㅖ',
ㅗ: 'ㅗ',
ㅘ: 'ㅗㅏ',
ㅙ: 'ㅗㅐ',
ㅚ: 'ㅗㅣ',
ㅛ: 'ㅛ',
ㅜ: 'ㅜ',
ㅝ: 'ㅜㅓ',
ㅞ: 'ㅜㅔ',
ㅟ: 'ㅜㅣ',
ㅠ: 'ㅠ',
ㅡ: 'ㅡ',
ㅢ: 'ㅡㅣ',
ㅣ: 'ㅣ'
};
/**
* 초성으로 올 수 있는 한글 글자
*/
var HANGUL_CHARACTERS_BY_FIRST_INDEX = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'];
var HANGUL_CHARACTERS_BY_MIDDLE_INDEX = Object.values(DISASSEMBLED_VOWELS_BY_VOWEL);
var HANGUL_CHARACTERS_BY_LAST_INDEX = ['', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'].map(function (consonant) {
return DISASSEMBLED_CONSONANTS_BY_CONSONANT[consonant];
});
function _slicedToArray(arr, i) {

@@ -214,2 +139,77 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();

/** @tossdocs-ignore */
var COMPLETE_HANGUL_START_CHARCODE = '가'.charCodeAt(0);
var COMPLETE_HANGUL_END_CHARCODE = '힣'.charCodeAt(0);
/**
* ㄱ -> 'ㄱ'
* ㄳ -> 'ㄱㅅ' 으로 나눈다.
*/
var DISASSEMBLED_CONSONANTS_BY_CONSONANT = {
// 종성이 없는 경우 '빈' 초성으로 관리하는 것이 편리하여, 빈 문자열도 포함한다.
'': '',
ㄱ: 'ㄱ',
ㄲ: 'ㄲ',
ㄳ: 'ㄱㅅ',
ㄴ: 'ㄴ',
ㄵ: 'ㄴㅈ',
ㄶ: 'ㄴㅎ',
ㄷ: 'ㄷ',
ㄸ: 'ㄸ',
ㄹ: 'ㄹ',
ㄺ: 'ㄹㄱ',
ㄻ: 'ㄹㅁ',
ㄼ: 'ㄹㅂ',
ㄽ: 'ㄹㅅ',
ㄾ: 'ㄹㅌ',
ㄿ: 'ㄹㅍ',
ㅀ: 'ㄹㅎ',
ㅁ: 'ㅁ',
ㅂ: 'ㅂ',
ㅃ: 'ㅃ',
ㅄ: 'ㅂㅅ',
ㅅ: 'ㅅ',
ㅆ: 'ㅆ',
ㅇ: 'ㅇ',
ㅈ: 'ㅈ',
ㅉ: 'ㅉ',
ㅊ: 'ㅊ',
ㅋ: 'ㅋ',
ㅌ: 'ㅌ',
ㅍ: 'ㅍ',
ㅎ: 'ㅎ'
};
var DISASSEMBLED_VOWELS_BY_VOWEL = {
ㅏ: 'ㅏ',
ㅐ: 'ㅐ',
ㅑ: 'ㅑ',
ㅒ: 'ㅒ',
ㅓ: 'ㅓ',
ㅔ: 'ㅔ',
ㅕ: 'ㅕ',
ㅖ: 'ㅖ',
ㅗ: 'ㅗ',
ㅘ: 'ㅗㅏ',
ㅙ: 'ㅗㅐ',
ㅚ: 'ㅗㅣ',
ㅛ: 'ㅛ',
ㅜ: 'ㅜ',
ㅝ: 'ㅜㅓ',
ㅞ: 'ㅜㅔ',
ㅟ: 'ㅜㅣ',
ㅠ: 'ㅠ',
ㅡ: 'ㅡ',
ㅢ: 'ㅡㅣ',
ㅣ: 'ㅣ'
};
/**
* 초성으로 올 수 있는 한글 글자
*/
var HANGUL_CHARACTERS_BY_FIRST_INDEX = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'];
var HANGUL_CHARACTERS_BY_MIDDLE_INDEX = Object.values(DISASSEMBLED_VOWELS_BY_VOWEL);
var HANGUL_CHARACTERS_BY_LAST_INDEX = ['', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'].map(function (consonant) {
return DISASSEMBLED_CONSONANTS_BY_CONSONANT[consonant];
});
/** @tossdocs-ignore */
function disassembleCompleteHangulCharacter(letter) {

@@ -281,3 +281,15 @@ var charCode = letter.charCodeAt(0);

}
function disassembleHangul(str) {
return disassembleHangulToGroups(str).reduce(function (hanguls, disassembleds) {
return "".concat(hanguls).concat(disassembleds.join(''));
}, '');
}
/** @tossdocs-ignore */
function hangulIncludes(x, y) {
var disassembledX = disassembleHangul(x);
var disassembledY = disassembleHangul(y);
return disassembledX.includes(disassembledY);
}
/**

@@ -351,16 +363,2 @@ * @name hasBatchim

/** @tossdocs-ignore */
function disassembleHangul(str) {
return disassembleHangulToGroups(str).reduce(function (hanguls, disassembleds) {
return "".concat(hanguls).concat(disassembleds.join(''));
}, '');
}
/** @tossdocs-ignore */
function hangulIncludes(x, y) {
var disassembledX = disassembleHangul(x);
var disassembledY = disassembleHangul(y);
return disassembledX.includes(disassembledY);
}
/** @tossdocs-ignore */
var 로_조사 = ['으로/로', '으로서/로서', '으로써/로써', '으로부터/로부터'];

@@ -400,3 +398,5 @@ function josa(word, josa) {

exports.disassembleHangulToGroups = disassembleHangulToGroups;
exports.getFirstConsonants = getFirstConsonants;
exports.hangulIncludes = hangulIncludes;
exports.hasBatchim = hasBatchim;
exports.josa = josa;
{
"name": "@toss/hangul",
"version": "1.5.0",
"version": "1.6.1",
"sideEffects": false,

@@ -28,3 +28,3 @@ "exports": {

"@testing-library/jest-dom": "^5.16.4",
"@toss/rollup-config": "^0.1.4",
"@toss/rollup-config": "^0.1.5",
"@tossteam/jest": "^17",

@@ -56,4 +56,4 @@ "@types/jest": "^28.1.8",

},
"gitHead": "d0b70f1890fd3c19fb3d1266ac2cb5fa773b9782",
"gitHead": "6a4434621e29e014d537ae3dc0f026364b893a69",
"module": "./esm/index.mjs"
}

@@ -15,6 +15,6 @@ # @toss/hangul

- [chosungIncludes](https://slash.page/libraries/common/hangul/src/chosungIncludes.i18n)
- [disassembleHangul](https://slash.page/libraries/common/hangul/src/disassembleHangul.i18n)
- [disassembleHangulToGroups](https://slash.page/libraries/common/hangul/src/disassembleHangulToGroups.i18n)
- [hangulIncludes](https://slash.page/libraries/common/hangul/src/hangulIncludes.i18n)
- [josa](https://slash.page/libraries/common/hangul/src/josa.i18n)
- [chosungIncludes](https://slash.page/ko/libraries/common/hangul/src/chosungincludes.i18n)
- [disassembleHangul](https://slash.page/ko/libraries/common/hangul/src/disassemble.i18n)
- [disassembleHangulToGroups](https://slash.page/ko/libraries/common/hangul/src/disassemble.i18n)
- [hangulIncludes](https://slash.page/ko/libraries/common/hangul/src/hangulincludes.i18n)
- [josa](https://slash.page/ko/libraries/common/hangul/src/josa.i18n)

@@ -14,5 +14,5 @@ # @toss/hangul

- [chosungIncludes](https://slash.page/libraries/common/hangul/src/chosungIncludes.i18n)
- [disassembleHangul](https://slash.page/libraries/common/hangul/src/disassembleHangul.i18n)
- [disassembleHangulToGroups](https://slash.page/libraries/common/hangul/src/disassembleHangulToGroups.i18n)
- [disassembleHangul](https://slash.page/libraries/common/hangul/src/disassemble.i18n)
- [disassembleHangulToGroups](https://slash.page/libraries/common/hangul/src/disassemble.i18n)
- [hangulIncludes](https://slash.page/libraries/common/hangul/src/hangulIncludes.i18n)
- [josa](https://slash.page/libraries/common/hangul/src/josa.i18n)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc