@jager-ai/holy-bible-api
Version:
성경 구절 검색 및 슬래시 명령어 지원 API 모듈
113 lines (112 loc) • 7.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BIBLE_ABBREVIATIONS = exports.BIBLE_BOOKS = void 0;
exports.getBibleBook = getBibleBook;
exports.normalizeBibleReference = normalizeBibleReference;
exports.BIBLE_BOOKS = [
{ name: '창세기', abbr: '창', chapters: 50, testament: 'old' },
{ name: '출애굽기', abbr: '출', chapters: 40, testament: 'old' },
{ name: '레위기', abbr: '레', chapters: 27, testament: 'old' },
{ name: '민수기', abbr: '민', chapters: 36, testament: 'old' },
{ name: '신명기', abbr: '신', chapters: 34, testament: 'old' },
{ name: '여호수아', abbr: '수', chapters: 24, testament: 'old' },
{ name: '사사기', abbr: '삿', chapters: 21, testament: 'old' },
{ name: '룻기', abbr: '룻', chapters: 4, testament: 'old' },
{ name: '사무엘상', abbr: '삼상', chapters: 31, testament: 'old' },
{ name: '사무엘하', abbr: '삼하', chapters: 24, testament: 'old' },
{ name: '열왕기상', abbr: '왕상', chapters: 22, testament: 'old' },
{ name: '열왕기하', abbr: '왕하', chapters: 25, testament: 'old' },
{ name: '역대상', abbr: '대상', chapters: 29, testament: 'old' },
{ name: '역대하', abbr: '대하', chapters: 36, testament: 'old' },
{ name: '에스라', abbr: '스', chapters: 10, testament: 'old' },
{ name: '느헤미야', abbr: '느', chapters: 13, testament: 'old' },
{ name: '에스더', abbr: '에', chapters: 10, testament: 'old' },
{ name: '욥기', abbr: '욥', chapters: 42, testament: 'old' },
{ name: '시편', abbr: '시', chapters: 150, testament: 'old' },
{ name: '잠언', abbr: '잠', chapters: 31, testament: 'old' },
{ name: '전도서', abbr: '전', chapters: 12, testament: 'old' },
{ name: '아가', abbr: '아', chapters: 8, testament: 'old' },
{ name: '이사야', abbr: '사', chapters: 66, testament: 'old' },
{ name: '예레미야', abbr: '렘', chapters: 52, testament: 'old' },
{ name: '예레미야 애가', abbr: '애', chapters: 5, testament: 'old' },
{ name: '에스겔', abbr: '겔', chapters: 48, testament: 'old' },
{ name: '다니엘', abbr: '단', chapters: 12, testament: 'old' },
{ name: '호세아', abbr: '호', chapters: 14, testament: 'old' },
{ name: '요엘', abbr: '욜', chapters: 3, testament: 'old' },
{ name: '아모스', abbr: '암', chapters: 9, testament: 'old' },
{ name: '오바댜', abbr: '옵', chapters: 1, testament: 'old' },
{ name: '요나', abbr: '욘', chapters: 4, testament: 'old' },
{ name: '미가', abbr: '미', chapters: 7, testament: 'old' },
{ name: '나훔', abbr: '나', chapters: 3, testament: 'old' },
{ name: '하박국', abbr: '합', chapters: 3, testament: 'old' },
{ name: '스바냐', abbr: '습', chapters: 3, testament: 'old' },
{ name: '학개', abbr: '학', chapters: 2, testament: 'old' },
{ name: '스가랴', abbr: '슥', chapters: 14, testament: 'old' },
{ name: '말라기', abbr: '말', chapters: 4, testament: 'old' },
{ name: '마태복음', abbr: '마', chapters: 28, testament: 'new' },
{ name: '마가복음', abbr: '막', chapters: 16, testament: 'new' },
{ name: '누가복음', abbr: '눅', chapters: 24, testament: 'new' },
{ name: '요한복음', abbr: '요', chapters: 21, testament: 'new' },
{ name: '사도행전', abbr: '행', chapters: 28, testament: 'new' },
{ name: '로마서', abbr: '롬', chapters: 16, testament: 'new' },
{ name: '고린도전서', abbr: '고전', chapters: 16, testament: 'new' },
{ name: '고린도후서', abbr: '고후', chapters: 13, testament: 'new' },
{ name: '갈라디아서', abbr: '갈', chapters: 6, testament: 'new' },
{ name: '에베소서', abbr: '엡', chapters: 6, testament: 'new' },
{ name: '빌립보서', abbr: '빌', chapters: 4, testament: 'new' },
{ name: '골로새서', abbr: '골', chapters: 4, testament: 'new' },
{ name: '데살로니가전서', abbr: '살전', chapters: 5, testament: 'new' },
{ name: '데살로니가후서', abbr: '살후', chapters: 3, testament: 'new' },
{ name: '디모데전서', abbr: '딤전', chapters: 6, testament: 'new' },
{ name: '디모데후서', abbr: '딤후', chapters: 4, testament: 'new' },
{ name: '디도서', abbr: '딛', chapters: 3, testament: 'new' },
{ name: '빌레몬서', abbr: '몬', chapters: 1, testament: 'new' },
{ name: '히브리서', abbr: '히', chapters: 13, testament: 'new' },
{ name: '야고보서', abbr: '약', chapters: 5, testament: 'new' },
{ name: '베드로전서', abbr: '벧전', chapters: 5, testament: 'new' },
{ name: '베드로후서', abbr: '벧후', chapters: 3, testament: 'new' },
{ name: '요한일서', abbr: '요일', chapters: 5, testament: 'new' },
{ name: '요한이서', abbr: '요이', chapters: 1, testament: 'new' },
{ name: '요한삼서', abbr: '요삼', chapters: 1, testament: 'new' },
{ name: '유다서', abbr: '유', chapters: 1, testament: 'new' },
{ name: '요한계시록', abbr: '계', chapters: 22, testament: 'new' }
];
exports.BIBLE_ABBREVIATIONS = {
'창': '창세기', '출': '출애굽기', '레': '레위기', '민': '민수기', '신': '신명기',
'수': '여호수아', '삿': '사사기', '룻': '룻기', '삼상': '사무엘상', '삼하': '사무엘하',
'왕상': '열왕기상', '왕하': '열왕기하', '대상': '역대상', '대하': '역대하',
'스': '에스라', '느': '느헤미야', '에': '에스더', '욥': '욥기', '시': '시편',
'잠': '잠언', '전': '전도서', '아': '아가', '사': '이사야', '렘': '예레미야',
'애': '예레미야 애가', '겔': '에스겔', '단': '다니엘', '호': '호세아',
'욜': '요엘', '암': '아모스', '옵': '오바댜', '욘': '요나', '미': '미가',
'나': '나훔', '합': '하박국', '습': '스바냐', '학': '학개', '슥': '스가랴', '말': '말라기',
'마': '마태복음', '막': '마가복음', '눅': '누가복음', '요': '요한복음',
'행': '사도행전', '롬': '로마서', '고전': '고린도전서', '고후': '고린도후서',
'갈': '갈라디아서', '엡': '에베소서', '빌': '빌립보서', '골': '골로새서',
'살전': '데살로니가전서', '살후': '데살로니가후서', '딤전': '디모데전서',
'딤후': '디모데후서', '딛': '디도서', '몬': '빌레몬서', '히': '히브리서',
'약': '야고보서', '벧전': '베드로전서', '벧후': '베드로후서',
'요일': '요한일서', '요이': '요한이서', '요삼': '요한삼서', '유': '유다서', '계': '요한계시록'
};
function getBibleBook(nameOrAbbr) {
const exactMatch = exports.BIBLE_BOOKS.find(book => book.name === nameOrAbbr || book.abbr === nameOrAbbr);
if (exactMatch)
return exactMatch;
const fullName = exports.BIBLE_ABBREVIATIONS[nameOrAbbr];
if (fullName) {
return exports.BIBLE_BOOKS.find(book => book.name === fullName);
}
return undefined;
}
function normalizeBibleReference(reference) {
const normalized = reference.replace(/^([가-힣]+)(\d+):(\d+)/, '$1 $2:$3');
const match = normalized.match(/^([가-힣]+)\s+(.+)$/);
if (!match)
return reference;
const [, bookAbbr, rest] = match;
const fullName = exports.BIBLE_ABBREVIATIONS[bookAbbr];
if (fullName) {
return `${fullName} ${rest}`;
}
return normalized;
}