0.0.1 • Published 12 months ago

@miop/utils v0.0.1

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
12 months ago

@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';
0.0.1

12 months ago