npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mnemonic-number-kr

v1.0.2

Published

숫자를 외우기 쉬운 한국어 단어로 변환, Converts numbers to predefined list of Korean words

Downloads

3

Readme

mnemonic-number-kr

숫자를 외우기 쉬운 한국어 단어로 변환, Converts numbers to predefined list of Korean words

설치 (Installation)

npm install mnemonic-number-kr

사용법 (Usage)

기본 사용법 (Default usage)

let mnum_basic = new MnemonicNumberKr();

mnum_basic.on('load', () => {
  console.log(mnum_basic.fromInteger(0)); // [ '하나', '하나' ]
  console.log(mnum_basic.fromInteger(1)); // [ '둘', '하나' ]
});

배열 순서 섞기 (Shuffle array)

배열은 기본적으로 가나다순으로 정렬이 되있기에, 이를 무시하기 위해 배열을 섞는 방법 seed에 관한 자세한 내용은 https://github.com/webcaetano/shuffle-seed 참고

let mnum_shuffled = new MnemonicNumberKr({
  shuffle: 'Any shuffle seed' // 아무 문자열이나 가능
});

mnum_shuffled.on('load', () => {
  console.log(mnum_shuffled.fromInteger(0)); // [ '둘', '둘' ]
  console.log(mnum_shuffled.fromInteger(1)); // [ '하나', '둘' ]
});

출력 포멧 (Output format)

출력 포멧에 따라서 단어를 어떤식으로 사용할지 결정합니다. 예를 들면 [word] 일 경우 한 단어만을 사용하게되어 35,304개의 경우의 수 밖에 없지만, [word]-[word]와 같이 두 개의 단어를 사용하게되면 총 1,246,372,416개의 표현이 가능해집니다.

let mnum_single_word = new MnemonicNumberKr({
  dictionaries: [ 'test.txt' ]
});

mnum_single_word.on('load', () => {
  console.log(mnum_single_word.combinations); // 3
  console.log(mnum_single_word.fromInteger(0)); // [ '하나' ]
});

let mnum_double_word = new MnemonicNumberKr({
  dictionaries: [ 'test.txt', 'test.txt' ]
});

mnum_double_word.on('load', () => {
  console.log(mnum_double_word.combinations) // 9 = 3*3
  console.log(mnum_double_word.fromInteger(0)); // [ '하나', '하나' ]
});

경우의 수 주의 (Caution)

예상된 경우의 수보다 더 큰 숫자를 변환할 경우, 다시 복구할때 데이터 손실이 일어날 수 있습니다. If you use larger number than the available combinations, you will lose the actual number data.

let mnum = new MnemonicNumberKr({
  dictionaries: [ 'test.txt' ]
});

mnum.on('load', () => {
  console.log(mnum.combinations); // 3 (test.txt)

  for(let i=0; i<6; i++) {
    let words = mnum.fromInteger(i);
    console.log(i, words, mnum.toInteger(words))
  }

  // result:
  // 0 [ '둘', '둘' ] 0
  // 1 [ '하나', '둘' ] 1
  // 2 [ '둘', '하나' ] 2
  // 3 [ '하나', '하나' ] 3
  // 4 [ '둘', '둘' ] 0
  // 5 [ '하나', '둘' ] 1
});