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

wj-password-validator

v1.0.4

Published

A library to generate and validate password validation regex based on user inputs

Readme

Password Validator Library

다양한 유효성 검사를 위한 정규식(RegExp)을 생성하는 JavaScript 라이브러리입니다.

NPM

설치

npm install wj-password-validator

사용법

비밀번호 유효성 검사 예시

import { createPasswordRegex } from "password-validator-library";

const options = {
  minLength: 8, // 최소 길이
  uppercase: true, // 대문자 포함
  lowercase: true, // 소문자 포함
  digits: true, // 숫자 포함
  specialChar: true, // 특수문자 포함
};

const passwordRegex = createPasswordRegex(options);
const isValid = new RegExp(passwordRegex).test("YourPassword123!");

이메일 유효성 검사 예시

import { createEmailRegex } from "password-validator-library";

const emailRegex = createEmailRegex();
const isValid = emailRegex.test("[email protected]");

전화번호 유효성 검사

import { createPhoneNumberRegex } from "password-validator-library";

const phoneRegex = createPhoneNumberRegex();
const isValid = phoneRegex.test("+821012345678");

날짜 유효성 검사 (YYYY-MM-DD)

import { createDateRegex } from "password-validator-library";

const dateRegex = createDateRegex();
const isValid = dateRegex.test("2024-03-20");

지원하는 기능

비밀번호 검증

  • 최소 길이 설정
  • 대문자 포함 여부
  • 소문자 포함 여부
  • 숫자 포함 여부
  • 특수문자 포함 여부 (!@#$%^&*(),.?":{}|<>)

기타 유효성 검사

  • 이메일 주소 형식 검증
  • 국제 전화번호 형식 검증 (E.164 형식)
  • 날짜 형식 검증 (YYYY-MM-DD)

사용예시

// 예시: React 컴포넌트에서 라이브러리 사용하기

import React, { useState } from 'react';
import { createPasswordRegex, createEmailRegex, createPhoneNumberRegex, createDateRegex } from 'your-library-name';

const App = () => {
  const [password, setPassword] = useState('');
  const [email, setEmail] = useState('');
  const [phoneNumber, setPhoneNumber] = useState('');
  const [date, setDate] = useState('');

  // 정규 표현식 생성
  const passwordRegex = createPasswordRegex({ minLength: 8, uppercase: true, lowercase: true, digits: true, specialChar: true });
  const emailRegex = createEmailRegex();
  const phoneNumberRegex = createPhoneNumberRegex();
  const dateRegex = createDateRegex();

  // 유효성 검사 함수
  const validatePassword = (password) => {
    return new RegExp(passwordRegex).test(password);
  };

  const validateEmail = (email) => {
    return new RegExp(emailRegex).test(email);
  };

  const validatePhoneNumber = (phone) => {
    return new RegExp(phoneNumberRegex).test(phone);
  };

  const validateDate = (date) => {
    return new RegExp(dateRegex).test(date);
  };

  return (
    <div>
      <h1>Form Validation Example</h1>
      
      {/* Password */}
      <input 
        type="password" 
        placeholder="Enter password" 
        value={password} 
        onChange={(e) => setPassword(e.target.value)} 
      />
      <p>Password valid: {validatePassword(password) ? 'Yes' : 'No'}</p>

      {/* Email */}
      <input 
        type="email" 
        placeholder="Enter email" 
        value={email} 
        onChange={(e) => setEmail(e.target.value)} 
      />
      <p>Email valid: {validateEmail(email) ? 'Yes' : 'No'}</p>

      {/* Phone Number */}
      <input 
        type="tel" 
        placeholder="Enter phone number" 
        value={phoneNumber} 
        onChange={(e) => setPhoneNumber(e.target.value)} 
      />
      <p>Phone Number valid: {validatePhoneNumber(phoneNumber) ? 'Yes' : 'No'}</p>

      {/* Date */}
      <input 
        type="date" 
        placeholder="Enter date" 
        value={date} 
        onChange={(e) => setDate(e.target.value)} 
      />
      <p>Date valid: {validateDate(date) ? 'Yes' : 'No'}</p>
    </div>
  );
};

export default App;


라이선스

MIT License