@licq/string

1.0.6 • Public • Published

@licq/string

封装一些字符串的操作方法

NPM version NPM downloads

安装

npm i --save-dev @licq/string

API

randomString

生成指定长度的随机字符串

Returns: String
Since: v1.0.0

Param Type Description
length Number 长度

Example

const str = require('@licq/string')
const res = str.randomString(10);
//==> eg: dUbkGTBgKN

uuid

生成uuid (v4)

Returns: uuid String
Since: v1.0.5
Example

const str = require('@licq/string')
const uuid = str.uuid()
// ==> 51001e12-509b-4f4a-ad73-8d7de4cef6bf

uuidValidate

校验是否是uuid

Returns: boolean
Since: v1.0.5

Param Type
uuid String

Example

const str = require('@licq/string')
const isUUID = str.uuidValidate('51001e12-509b-4f4a-ad73-8d7de4cef6bf');
// ==> true
const isUUID1 = str.uuidValidate('eH2dTHAoYOAaxegIeFq7bcGrGhPcfv83');
// ==> false

Package Sidebar

Install

npm i @licq/string

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

4.17 kB

Total Files

5

Last publish

Collaborators

  • uv-w