Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

utils-shin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utils-shin

简单通用工具方法

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Utils-Shin

该项目是一个 JavaScript 工具库,提供了一些常用的格式化和校验功能,包括金额格式化、手机号、身份证号和邮箱的校验等功能。

安装

npm install utils-shin

使用方法

导入模块

import { Format, Validate } from 'utils-shin';

格式化功能(Format)

格式化金额展示

Format.formatMoney(money, symbol, decimals);

参数:

  • money (number): 要格式化的金额
  • symbol (string): 货币符号,默认为空字符串
  • decimals (number): 保留的小数位数,默认为 2

返回格式化后的金额字符串。

校验功能(Validate)

手机号校验

Validate.mobileCheck(value);

身份证校验

Validate.IDCardCheck(value);

邮箱校验

Validate.emailCheck(value);

许可证

MIT

FAQs

Package last updated on 18 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts