Skip to content

快速上手

@qnvip/core 是一个轻量级的 JavaScript/TypeScript 工具函数库。

安装

bash
npm install @qnvip/core

基本使用

按需引入

typescript
import { debounce, deepClone } from '@qnvip/core'

// 使用防抖函数
const debouncedSearch = debounce((keyword: string) => {
  console.log('搜索:', keyword)
}, 300)

// 使用深拷贝
const original = { name: 'test', items: [1, 2, 3] }
const copied = deepClone(original)

全量引入

typescript
import * as qnCore from '@qnvip/core'

const result = qnCore.isEmpty(null) // true

TypeScript 支持

本库完全基于 TypeScript 开发,提供完整的类型定义:

typescript
import { debounce } from '@qnvip/core'

// 自动类型推断
const fn = debounce((name: string, age: number) => {
  return `${name} is ${age} years old`
}, 300)

// fn 的类型会被正确推断
const result = fn('Alice', 25)

下一步

Released under the MIT License.