1.1.1 • Published 3 years ago

orcrist-utils v1.1.1

Weekly downloads
12
License
ISC
Repository
-
Last release
3 years ago

orcrist-utils

traceLog api

1、import { traceLog } from 'orcrist-utils';

2、traceLog({ log: encodeURIComponent(errorLog), scene: 'xxxx', });

身份证姓名校验 checkCNName 校验规则:仅只是中文和 中文·

  1. import {checkCNName} from 'orcrist-utils';
  2. checkCNName(value) 返回值类型 boolean true -- 格式正确 false -- 格式错误

非身份证姓名校验 checkName 校验规则: 支持中文和英文以及数字 特殊字符除外

  1. import {checkName} from 'orcrist-utils';
  2. checkName(value) 返回值类型 boolean true -- 格式正确 false -- 格式错误

身份证证件号校验 18 位 || 15 位

  1. import {checkIdNo} from 'orcrist-utils';
  2. checkIdNo(value)返回值类型 boolean true -- 格式正确 false -- 格式错误

证件号-护照校验

  • 1、总长度:9 位;
  • 2、第 1-2 位:字母或阿拉伯数字;
  • 3、第 3-9 位:阿拉伯数字
  1. import {checkPassNo} from 'orcrist-utils';
  2. checkPassNo(value) 返回值类型 boolean true -- 格式正确 false -- 格式错误

证件号-港澳居民来往内地通行证校验

  • 1、9 位或者 11 位;
  • 2、第 1 位为字母,“H”或“M”;
  • 3、第 2 位-11 位或者第 2 位-8 位为阿拉伯数字
  1. import {checkHMNo} from 'orcrist-utils';
  2. checkHMNo(value) 返回值类型 boolean true -- 格式正确 false -- 格式错误

证件号-台湾居民来往大陆通行证校验

  • 总长度:8 位,均为阿拉伯数字
  1. import {checkTWNo} from 'orcrist-utils';
  2. checkTWNo(value) 返回值类型 boolean true -- 格式正确 false -- 格式错误

手机号校验

  1. import {checkPhoneNo} from 'orcrist-utils';
  2. checkPhoneNo(value)返回值类型 boolean true -- 格式正确 false -- 格式错误

根据身份证号获取出生年月日

  1. import {getBirth} from 'orcrist-utils';
  2. getBirth(id) 返回值类型 string '1990/01/03'

年龄校验-身份证号

  • output : true 未成年人 false 成年人
  1. import {isChildById} from 'orcrist-utils';
  2. isChildById(value) 返回值类型 boolean true -- 未成年人 false -- 成年人

年龄校验-非身份证号 (出生年月选择器 格式 '1994-11-26')

  • input value 格式 string '1994-11-26'
  • output : true 未成年人 false 成年人
  1. import {isChildByDate} from 'orcrist-utils';
  2. isChildByDate(value) 返回值类型 boolean true -- 未成年人 false -- 成年人

邮箱校验

  1. import {checkEmail} from 'orcrist-utils';
  2. checkEmail(value) boolean true -- 格式正确 false -- 格式错误