@58fe/utils
v1.0.10
Published
JS-Utils
Downloads
29
Readme
Utils
JS哆啦A梦工具包
Install
npm install @58fe/utils --save
Usage
cookie
import { cookie } from '@58fe/utils';
cookie.getCookie(name);
cookie.setCookie(name, value, outdays, path, domain);
getOS
import { getOs } from '@58fe/utils';
console.log(getOs()); // android/wp/ios
urlQuery
import { urlQuery } from '@58fe/utils';
// for example url: https://www.baidu.com/?a=1&b=2
console.log(urlQuery.query('a'));
// 1
console.log(urlQuery.queryAll());
// {a: 1, b: 2}
calcaulate
import { calcaulate } from '@58fe/utils';
calcaulate(); // must do
const num = 7;
console.log(num.add(1));
// 8
console.log(num.sub(2));
// 5
console.log(num.mul(2));
// 14
console.log(num.div(2));
// 3.5
console.log(num.toFixedNew(2));
// 7
console.log(7.3456.toFixedNew(2));
// 7.35