New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@aolie/common

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aolie/common

基于 TypeScript 的工具函数库

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

前端工具库

@aolie/common

安装

pnpm install @aolie/common --save-dev

提供方法

  • isDeepEqual:深度比较对象是否相等;
  • isNil:是否为 null 或 undefined
  • numberFormat:千分位格式化的数字
  • uuidFast:生成 uuid
  • trim:去除字符串头尾空格或指定字符
  • trimStart:去除字符串头部空格或指定字符
  • trimEnd:去除字符串尾部空格或指定字符
  • phoneEncrypt:手机号码脱敏
  • isEmptyObject:判断obj是否为空
  • randomNum:生成指定范围[min, max]的随机数
  • isEmail:判断是否为邮箱地址
  • isIdCard:判断是否为身份证号
  • isPhoneNum:判断是否为手机号
  • isUrl:判断是否为 URL 地址
  • getUrlParam:获取 url 参数
  • treeToArray:平铺树形结构
  • theme:默认主题色 less 变量
  • downloadFile:文件下载方法
  • request:接口请求方法

request、downloadFile 方法使用(services 文件)

import { downloadFile } from "@aolie/common";
import request from "@aolie/common/lib/request";
import { prefix, appPlatform } from "@/utils/config";
// 修改默认配置
request.extendOptions({
  headers: {
    "Content-Type": "application/json; charset=utf-8",
  },
  prefix,
});

// 平台接口配置prefix
export function getUserInfo() {
  return request("user/toUserInfo", {
    prefix: appPlatform,
    method: "POST",
  });
}

// post请求
export function postRuleTypeDict(params) {
  return request.post(`audit/exec/postRuleTypeDict`, {
    data: params,
  });
}

// get请求
export function getRuleTypeDict(params) {
  return request(`audit/exec/getRuleTypeDict`, {
    params,
  });
}

/**
 * 文件下载
 * @param param
 * @returns
 */
export function exportRuleExecDetail(params) {
  return downloadFile("audit/exec/exportRuleExecDetail", prefix, params);
}

theme 方法使用(.umirc.ts 文件)

import theme from '@aolie/common/lib/theme';

export default defineConfig({
  ...,
  theme
})

Keywords

typescript

FAQs

Package last updated on 26 Sep 2025

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