@adia-technology/international-ssn-validator 中文文档教程

发布于 4年前 浏览 1 项目主页 更新于 3年前

International SSN Validator

该实用程序检查社会安全号码的有效性。 目前支持的国家是美国和瑞士。

Getting started

Installation

npm install @adia-technology/international-ssn-validator --save

Usage

import { validateSsn, ValidationResult } from '@adia-technology/international-ssn-validator';

let validationResult = validateSsn('756.1111.2222.00', 'ch');
let isValid = validationResult === ValidationResult.Valid;

API

这个库公开了一个函数,validateSsn,它接受两个参数:

  • ssn : string - SSN to validate.
  • countryCode : string - country for which to check the SSN against. Currently supported are us and ch.

它返回一个 ValidationResult,它本质上是一个字符串枚举,被设置为以下值之一:“有效”“INVALID_FORMAT”“INVALID_CHECKSUM”

Dependencies

该库使用以下其他库:

International SSN Validator

This utility checks validity of Social Security Numbers. Currently supported countries are USA and Switzerland.

Getting started

Installation

npm install @adia-technology/international-ssn-validator --save

Usage

import { validateSsn, ValidationResult } from '@adia-technology/international-ssn-validator';

let validationResult = validateSsn('756.1111.2222.00', 'ch');
let isValid = validationResult === ValidationResult.Valid;

API

This library exposes a single function, validateSsn, that accepts two parameters:

  • ssn : string - SSN to validate.
  • countryCode : string - country for which to check the SSN against. Currently supported are us and ch.

It returns a ValidationResult, which essentially is a string enum being set to one of the values: 'VALID', 'INVALID_FORMAT' or 'INVALID_CHECKSUM'.

Dependencies

This library uses the following other libraries:

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文