🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More β†’
Socket
Book a DemoSign in
Socket

manseryeok

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

manseryeok

Korean Saju (Four Pillars) and Manseryeok calculation library

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2.5K
-24.6%
Maintainers
1
Weekly downloads
Β 
Created
Source

Manseryeok (λ§Œμ„Έλ ₯)

Korean Saju (Four Pillars) and Manseryeok calculation library

ν•œκ΅­ 사주λͺ…λ¦¬ν•™μ˜ λ§Œμ„Έλ ₯을 κ³„μ‚°ν•˜λŠ” TypeScript λΌμ΄λΈŒλŸ¬λ¦¬μž…λ‹ˆλ‹€.

μ–‘λ ₯/음λ ₯ λ‚ μ§œλ₯Ό μž…λ ₯ν•˜λ©΄ μ •ν™•ν•œ μ‚¬μ£ΌνŒ”μž(λ…„μ£Ό, μ›”μ£Ό, 일주, μ‹œμ£Ό)λ₯Ό κ³„μ‚°ν•΄μ€λ‹ˆλ‹€.

Features

  • 🎯 μ •ν™•ν•œ μ‚¬μ£ΌνŒ”μž 계산 (λ…„μ£Ό, μ›”μ£Ό, 일주, μ‹œμ£Ό)
  • πŸŒ™ 음λ ₯/μ–‘λ ₯ μžλ™ λ³€ν™˜
  • πŸ“… 절기 기반 μ›”μ£Ό 계산
  • πŸ”„ 60κ°‘μž μˆœν™˜ 계산
  • ⏰ λΆ„(minute) λ‹¨μœ„κΉŒμ§€ κ³ λ €ν•œ μ •λ°€ν•œ μ‹œμ£Ό 계산
  • ⚑ TypeScript μ™„λ²½ 지원
  • πŸ§ͺ μ² μ €ν•œ ν…ŒμŠ€νŠΈ 컀버리지

Installation

npm install manseryeok
# or
yarn add manseryeok
# or
pnpm add manseryeok

Usage

Basic Usage (μ–‘λ ₯ μ‚¬μš©)

import { calculateFourPillars, fourPillarsToString } from 'manseryeok';

// μ–‘λ ₯ λ‚ μ§œλ‘œ 사주 계산
const result = calculateFourPillars({
  year: 1992,      // 연도 (μ–‘λ ₯)
  month: 10,       // μ›” (μ–‘λ ₯, 1-12)
  day: 24,         // 일 (μ–‘λ ₯, 1-31)
  hour: 5,         // μ‹œ (24μ‹œκ°„μ œ, 0-23)
  minute: 30       // λΆ„ (0-59)
});

console.log(fourPillarsToString(result));
// 좜λ ₯: μž„μ‹ μ—°μ£Ό, κ²½μˆ μ›”μ£Ό, κ³„μœ μΌμ£Ό, μ„λ¬˜μ‹œμ£Ό

// λ‹€μ–‘ν•œ 좜λ ₯ ν˜•μ‹
console.log(result.toString());
// 좜λ ₯: μž„μ‹ λ…„μ£Ό, κ²½μˆ μ›”μ£Ό, κ³„μœ μΌμ£Ό, μ„λ¬˜μ‹œμ£Ό

console.log(result.toObject());
// 좜λ ₯: { year: 'μž„μ‹ ', month: '경술', day: 'κ³„μœ ', hour: 'μ„λ¬˜' }

console.log(result.toHanjaString());
// 좜λ ₯: ε£¬η”³εΉ΄ζŸ±, 庚戌月柱, η™Έι…‰ζ—₯柱, δΉ™ε―ζ™‚ζŸ±

console.log(result.toHanjaObject());
// 좜λ ₯: {
//   year: { korean: 'μž„μ‹ ', hanja: '壬申' },
//   month: { korean: '경술', hanja: '庚戌' },
//   day: { korean: 'κ³„μœ ', hanja: 'η™Έι…‰' },
//   hour: { korean: 'μ„λ¬˜', hanja: '乙卯' }
// }

// μŒμ–‘μ˜€ν–‰ 정보
console.log(result.dayElement);
// 좜λ ₯: { stem: '수', branch: '금' }
// stem은 μ²œκ°„(계)의 μ˜€ν–‰, branchλŠ” μ§€μ§€(유)의 μ˜€ν–‰

console.log(result.dayYinYang);
// 좜λ ₯: { stem: '음', branch: '음' }
// stem은 μ²œκ°„(계)의 μŒμ–‘, branchλŠ” μ§€μ§€(유)의 μŒμ–‘

Using Lunar Calendar (음λ ₯ μ‚¬μš©)

// 음λ ₯ λ‚ μ§œλ‘œ 사주 계산
const result = calculateFourPillars({
  year: 1992,              // 연도 (음λ ₯)
  month: 9,                // μ›” (음λ ₯, 1-12)
  day: 29,                 // 일 (음λ ₯, 1-30)
  hour: 5,                 // μ‹œ (24μ‹œκ°„μ œ, 0-23)
  minute: 30,              // λΆ„ (0-59)
  isLunar: true,           // 음λ ₯ μ‚¬μš© μ—¬λΆ€ (ν•„μˆ˜)
  isLeapMonth: false       // μœ€λ‹¬ μ—¬λΆ€ (음λ ₯ μ‚¬μš©μ‹œμ—λ§Œ ν•„μš”)
});

// μœ„ 음λ ₯ 1992λ…„ 9μ›” 29일은 μ–‘λ ₯ 1992λ…„ 10μ›” 24일과 동일

Parameter Details

νŒŒλΌλ―Έν„°νƒ€μž…μ„€λͺ…λ²”μœ„/μ˜ˆμ‹œ
yearnumber연도1900-2100
monthnumberμ›”1-12
daynumber일1-31 (μ–‘λ ₯), 1-30 (음λ ₯)
hournumberμ‹œ (24μ‹œκ°„μ œ)0-23 (0μ‹œ = μžμ •, 13μ‹œ = μ˜€ν›„ 1μ‹œ)
minutenumberλΆ„0-59
isLunarboolean?음λ ₯ μ‚¬μš© μ—¬λΆ€true/false (κΈ°λ³Έκ°’: false)
isLeapMonthboolean?μœ€λ‹¬ μ—¬λΆ€true/false (음λ ₯일 λ•Œλ§Œ μ‚¬μš©)

μ‹œκ°„ μž…λ ₯ μ˜ˆμ‹œ

// μƒˆλ²½ 3μ‹œ 15λΆ„
const time1 = { hour: 3, minute: 15 };

// μ˜€μ „ 9μ‹œ 정각
const time2 = { hour: 9, minute: 0 };

// μ˜€ν›„ 2μ‹œ 30λΆ„
const time3 = { hour: 14, minute: 30 };

// λ°€ 11μ‹œ 45λΆ„
const time4 = { hour: 23, minute: 45 };

Calendar Conversion (음λ ₯/μ–‘λ ₯ λ³€ν™˜)

음λ ₯κ³Ό μ–‘λ ₯을 μ„œλ‘œ λ³€ν™˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

import { solarToLunar, lunarToSolar } from 'manseryeok';

// μ–‘λ ₯ β†’ 음λ ₯ λ³€ν™˜
const lunar = solarToLunar(2024, 1, 1);
console.log(lunar); 
// { year: 2023, month: 11, day: 20, isLeapMonth: false }
// 2024λ…„ 1μ›” 1일은 음λ ₯으둜 2023λ…„ 11μ›” 20일

// 음λ ₯ β†’ μ–‘λ ₯ λ³€ν™˜
const solar = lunarToSolar(2023, 11, 20, false);
console.log(solar); 
// { year: 2024, month: 1, day: 1 }
// 음λ ₯ 2023λ…„ 11μ›” 20일은 μ–‘λ ₯으둜 2024λ…„ 1μ›” 1일

// μœ€λ‹¬ 처리 μ˜ˆμ‹œ
const leapMonthSolar = lunarToSolar(2020, 4, 1, true); // 2020λ…„ 윀4μ›” 1일
console.log(leapMonthSolar);
// { year: 2020, month: 5, day: 23 }

Additional Features

import { 
  getHeavenlyStemYinYang,
  getHeavenlyStemElement,
  getEarthlyBranchElement 
} from 'manseryeok';

// μ²œκ°„μ˜ μŒμ–‘ 확인
console.log(getHeavenlyStemYinYang('κ°‘')); // 'μ–‘'

// μ²œκ°„μ˜ μ˜€ν–‰ 확인
console.log(getHeavenlyStemElement('κ°‘')); // 'λͺ©'

// μ§€μ§€μ˜ μ˜€ν–‰ 확인
console.log(getEarthlyBranchElement('자')); // '수'

API Reference

Types

interface BirthInfo {
  year: number;
  month: number;
  day: number;
  hour: number;
  minute: number;
  isLunar?: boolean;      // trueλ©΄ 음λ ₯, false/undefinedλ©΄ μ–‘λ ₯
  isLeapMonth?: boolean;  // 음λ ₯ μœ€λ‹¬ μ—¬λΆ€
}

interface Pillar {
  heavenlyStem: HeavenlyStem;   // μ²œκ°„
  earthlyBranch: EarthlyBranch; // μ§€μ§€
}

interface FourPillars {
  year: Pillar;   // μ—°μ£Ό
  month: Pillar;  // μ›”μ£Ό
  day: Pillar;    // 일주
  hour: Pillar;   // μ‹œμ£Ό
}

Functions

  • calculateFourPillars(birthInfo: BirthInfo): FourPillars - 사주 계산
  • fourPillarsToString(fourPillars: FourPillars): string - 사주λ₯Ό ν•œκ΅­μ–΄ λ¬Έμžμ—΄λ‘œ λ³€ν™˜
  • solarToLunar(year, month, day): LunarDate - μ–‘λ ₯을 음λ ₯으둜 λ³€ν™˜
  • lunarToSolar(year, month, day, isLeapMonth): SolarDate - 음λ ₯을 μ–‘λ ₯으둜 λ³€ν™˜
  • getHeavenlyStemYinYang(stem: HeavenlyStem): YinYang - μ²œκ°„μ˜ μŒμ–‘
  • getHeavenlyStemElement(stem: HeavenlyStem): FiveElement - μ²œκ°„μ˜ μ˜€ν–‰
  • getEarthlyBranchElement(branch: EarthlyBranch): FiveElement - μ§€μ§€μ˜ μ˜€ν–‰

Time System (μ‹œκ°„ 체계)

12μ‹œμ§„ 체계

μ‹œμ£Ό 계산은 λ‹€μŒμ˜ 12μ‹œμ§„ 체계λ₯Ό λ”°λ¦…λ‹ˆλ‹€:

μ‹œμ§„μ‹œκ°„λŒ€24μ‹œκ°„μ œ μž…λ ₯ μ˜ˆμ‹œ
μžμ‹œ(子時)23:00-01:00hour: 23 λ˜λŠ” hour: 0
μΆ•μ‹œ(δΈ‘ζ™‚)01:00-03:00hour: 1 λ˜λŠ” hour: 2
μΈμ‹œ(ε―…ζ™‚)03:00-05:00hour: 3 λ˜λŠ” hour: 4
λ¬˜μ‹œ(卯時)05:00-07:00hour: 5 λ˜λŠ” hour: 6
μ§„μ‹œ(θΎ°ζ™‚)07:00-09:00hour: 7 λ˜λŠ” hour: 8
μ‚¬μ‹œ(ε·³ζ™‚)09:00-11:00hour: 9 λ˜λŠ” hour: 10
μ˜€μ‹œ(εˆζ™‚)11:00-13:00hour: 11 λ˜λŠ” hour: 12
λ―Έμ‹œ(ζœͺζ™‚)13:00-15:00hour: 13 λ˜λŠ” hour: 14
μ‹ μ‹œ(η”³ζ™‚)15:00-17:00hour: 15 λ˜λŠ” hour: 16
μœ μ‹œ(ι…‰ζ™‚)17:00-19:00hour: 17 λ˜λŠ” hour: 18
μˆ μ‹œ(ζˆŒζ™‚)19:00-21:00hour: 19 λ˜λŠ” hour: 20
ν•΄μ‹œ(δΊ₯ζ™‚)21:00-23:00hour: 21 λ˜λŠ” hour: 22

μ •ν™•ν•œ μ‹œμ£Ό 계산

λΆ„(minute) λ‹¨μœ„κΉŒμ§€ κ³ λ €ν•˜μ—¬ 더 μ •ν™•ν•œ μ‹œμ£Όλ₯Ό κ³„μ‚°ν•©λ‹ˆλ‹€:

  • 각 μ‹œμ§„μ˜ κ²½κ³„μ—μ„œ 뢄을 κ³ λ €ν•˜μ—¬ μ •ν™•ν•œ μ‹œμ§„μ„ κ²°μ •
  • 예: 5μ‹œ 30뢄은 λ¬˜μ‹œμ˜ μ€‘λ°˜μœΌλ‘œ μ •ν™•ν•˜κ²Œ 계산

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build
pnpm build

# Lint
pnpm lint

# Format
pnpm format

License

MIT Β© Yoohyojun

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

References

  • 음λ ₯ 데이터: ν•œκ΅­μ²œλ¬Έμ—°κ΅¬μ›
  • 절기 계산: μ²œλ¬Έν•™μ  계산에 κΈ°λ°˜ν•œ 근사 곡식
  • 사주 계산: 전톡 λ§Œμ„Έλ ₯ 계산법

Examples

μ‹€μ œ μ‚¬μš© μ˜ˆμ‹œ

// 1. μ–‘λ ₯으둜 μž…λ ₯
const saju1 = calculateFourPillars({
  year: 1990,
  month: 5,
  day: 15,
  hour: 14,    // μ˜€ν›„ 2μ‹œ
  minute: 30
});

// 2. 음λ ₯으둜 μž…λ ₯ (음λ ₯ 1990λ…„ 4μ›” 21일)
const saju2 = calculateFourPillars({
  year: 1990,
  month: 4,
  day: 21,
  hour: 14,
  minute: 30,
  isLunar: true,
  isLeapMonth: false
});

// 3. μžμ • μΆœμƒ
const saju3 = calculateFourPillars({
  year: 2000,
  month: 1,
  day: 1,
  hour: 0,     // μžμ • (0μ‹œ)
  minute: 0
});

// 4. λ°€ 11μ‹œ μΆœμƒ (μžμ‹œ)
const saju4 = calculateFourPillars({
  year: 2000,
  month: 1,
  day: 1,
  hour: 23,    // λ°€ 11μ‹œ (μžμ‹œ)
  minute: 30
});

Keywords

saju

FAQs

Package last updated on 14 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts