EzPasswordCheckerBuilder

EzPasswordCheckerBuilder

new EzPasswordCheckerBuilder()

Author:
  • 이승갑 (dltmdrkq2@gmail.com)
  • 정민석 (whitn86@gmail.com)

Methods

addRule(rule, …args) → {nexacro.EzPasswordCheckerBuilder}

Description:
  • 룰 추가

Example
const EzPasswordChecker = (new nexacro.EzPasswordCheckerBuilder())
.addRule(nexacro.EzPasswordRule.RULES) //사전 정의된 룰 사용시
.addRule(nexacro.EzPasswordRule.RULES.SIZE, 8, 20) // 옵션이 필요한 사전 정의된 룰 사용
.addRule(new nexacro.EzPasswordRule(              // 커스텀 룰 사용
  'ENG_END', 						//name
  (pw) => /.*[a-zA-Z]$/.test(pw), 	//rule
  { 									//message
    ko: '비밀번호는 영문으로 끝나야 합니다.', 
    en: '..',
    zh: '..'
  }
))
.build();
Parameters:
Name Type Attributes Description
rule function | nexacro.EzPasswordRule

룰 또는 룰 생성 함수

args any <repeatable>

룰 생성함수 사용시 전달될 파라미터

Returns:

builder

Type
nexacro.EzPasswordCheckerBuilder

build() → {class}

Description:
  • 룰 정보를 이용해 EzPasswordChecker 클래스 생성

Example
const EzPasswordChecker = (new nexacro.EzPasswordCheckerBuilder())
.addRule(...nexacro.EzPasswordRule.RULES) 
.addRule(nexacro.EzPasswordRule.RULES.SIZE, 8, 20)
.build();
const checker = new EzPasswordChecker();
Returns:

EzPasswordChecker

Type
class