@jnrs/shared

v1.1.6

Published

巨能前端工程化开发,通用工具包,与框架无关的纯逻辑、类型、常量、工具函数,完全不依赖任何 UI 框架或运行时环境。

Readme

@jnrs/shared

✨ 介绍

巨能前端工程化开发,通用工具包,与框架无关的纯逻辑、类型、常量、工具函数,完全不依赖任何 UI 框架。

  • 通用类型、接口、枚举、常量
  • 纯函数工具库
  • 通用算法
  • CSS 变量
  • (已提供国际化支持)

💻 技术栈

TypeScript

🧩 安装教程

pnpm add @jnrs/shared

🔍 使用示例

import '@jnrs/shared/styles/theme.scss'
import type { User, Locale } from '@jnrs/shared'
import { Fullscreen } from '@jnrs/shared'
import { debounce } from '@jnrs/shared/lodash'
import { uuidv4 } from '@jnrs/shared/uuid'
...

📋 API

@jnrs/shared 模块

类型 & 接口

  • User
  • DictItem
  • Dict
  • Locale
  • ThemeMode

  • Fullscreen

函数

  • hasPermissionWithSuffix 判断用户是否拥有指定后缀类型的权限(如 '*', ':view', ':edit')
  • objectToFormData 普通对象转 FormData 对象
  • setDefaultLocale
  • formatDateTime
  • formatWeekday

@jnrs/shared/locales 模块

函数

  • changeLocales 修改 @jnrs/shared 语言('zhCn' | 'en')

@jnrs/shared/lodash 模块

@jnrs/shared/uuid 模块

@jnrs/shared/mitt 模块

@jnrs/shared/validate 校验规则模块

@jnrs/shared/validator 校验方法模块