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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kirin-payment-hook

v0.0.4

Published

npm modules

Downloads

7

Readme

📦 kirin-payment-hook

카드 결제 정보를 위한 입력 유효성 검증 + 상태 관리를 지원하는 커스텀 훅 모음입니다.

각 훅은 상태와 함께 포맷팅, 에러 메시지, 유효성 검사 함수 등을 제공합니다.


🛠 설치

npm install kirin-payment-hook

🚀 제공 훅 목록

import {
  useCardNumberValidation,
  useExpirationDateValidation,
  useCvcNumberValidation,
  usePasswordValidation,
} from 'kirin-payment-hook';

| Hook 이름 | 설명 | | ----------------------------- | ------------------------------------------------- | | useCardNumberValidation | 카드 번호 유효성 검사 + 브랜드 식별 + 자동 포맷팅 | | useExpirationDateValidation | 만료일 (월/년) 유효성 검사 (MM/YY) | | useCvcNumberValidation | CVC 3자리 유효성 검사 | | usePasswordValidation | 비밀번호 앞 2자리 유효성 검사 |


🧪 사용 예시

📇 카드 번호

const {
  inputStates,        // 숫자만 담긴 원본 입력값
  formattedValue,     // 포맷된 표시용 값
  onChange,           // 커링된 onChange 핸들러
  errorMessage,       // 현재 에러 메시지
  noError,            // 전체 유효성 여부
  cardBrand,          // 식별된 브랜드 (예: 'visa', 'amex')
  format              // 브랜드별 포맷 (예: [4, 4, 4, 4])
} = useCardNumberValidation();

return (
  <inputvalue={formattedValue}
    onChange={onChange()}
    placeholder="카드 번호를 입력하세요"
  />
);

🔍 리턴 타입 설명

공통 구조 (모든 훅 공통)

| 필드명 | 타입 | 설명 | | -------------- | ---------------------------------------- | -------------------------------- | | inputStates | string / { month: string, year: string } | 입력 상태값 | | onChange | 커링된 (e) => void 핸들러 | input에서 직접 연결 가능 | | errorMessage | string | 현재 상태에 해당하는 에러 메시지 | | noError | boolean | 전체 입력이 유효할 경우 true |


💳 useCardNumberValidation 전용 필드

| 필드명 | 타입 | 설명 | | ---------------- | -------- | ---------------------------------------------------------------- | | cardBrand | string | 카드 브랜드 식별 결과 ('visa', 'amex', 'unionpay', ... 등) | | formattedValue | string | 포맷팅된 카드 번호 (XXXX XXXX XXXX XXXX) | | format | number[] | 카드사별 구분 형식 ([4, 4, 4, 4] 등) |


📆 useExpirationDateValidation 전용 필드

| 필드명 | 타입 | 설명 | | ------------- | ------------------------------------ | ------------------------------------- | | inputStates | { month: string, year: string } | 월/년 각각의 입력 상태 | | onChange | (keyof inputStates) => (e) => void | month, year 키에 맞는 변경 핸들러 |


🧩 기타 특징

  • useCardNumberValidation입력값 기반 자동 카드사 식별 및 포맷 적용
  • 모든 훅은 유효성 검사와 상태 업데이트를 동시에 수행
  • 에러 메시지 자동 제공 + 유효 상태 여부 (noError) 제공