1.0.0 • Published 1 year ago
@miop/utils v1.0.0
@miop/utils
Merge functional methods in the project
Using
npm i @miop/utils加、减、乘、除法运算
import { accAdd, accSub, accMul, accDiv } from '@miop/utils';
console.log(accAdd(1, 2));
console.log(accSub(1, 2));
console.log(accMul(1, 2));
console.log(accDiv(1, 2));Calc 加、减、乘、除法运算
import { Calc } from '@miop/utils';
const calc = new Calc();
console.log(calc.add(1, 2));
console.log(calc.sub(1, 2));
console.log(calc.div(1, 2));
console.log(calc.mul(1, 2));Base64Util
import { Base64Util } from '@miop/utils';
const base64 = new Base64Util();
const eVal = Base64Util.encode('123456');
const dVal = Base64Util.decode(eVal);
console.log(eVal, dVal);Common Methods
import { getUniqueId, getRandomString, isValidUrl } from '@miop/utils';
// getUniqueId() => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
// getUniqueId(true) => xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx
// getRandomString(32) => xxxxxxxxxxxxyxxxyxxxxxxxxxxxxxxx
// isValidUrl('https://www.apiyux.com')Date Format
import { getFormatDate, getFormatDateByReg, getFormatTimestamp } from '@miop/utils';
// getFormatDate(null, 'yyyy-MM-dd hh:mm:ss');
// getFormatDateByReg('20240101') => 2024-01-01
// 两个时间戳之间的天时分秒
// getFormatTimestamp()Tags Format
import { delAllHTMLTags, delTagsAttributes, delTagsAndStyles, delAssignTagsData } from '@miop/utils';Strings Format
import { trimAll, trimLeft, trimRight, trimLR } from '@miop/utils';