npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ms-js-sdk

v1.0.0

Published

美数 JavaScript SDK for QuickApp

Readme

MS JavaScript SDK

美术 JavaScript SDK for QuickApp,提供快应用开发所需的核心功能模块。

安装

npm install @ms/js-sdk

使用方法

基础用法

import MsSdk, { MsHttp, MsStorage, MsUtils, MsAuth } from '@ms/js-sdk'

// 初始化 SDK
const sdk = new MsSdk({
  baseUrl: 'https://your-api.com',
  timeout: 30000,
  apiKey: 'your-api-key'
})

HTTP 请求

const http = new MsHttp('https://api.example.com')

// GET 请求
const response = await http.get('/users')

// POST 请求
const result = await http.post('/users', {
  name: 'John',
  email: '[email protected]'
})

本地存储

const storage = new MsStorage()

// 存储数据
await storage.set('user', { name: 'John', age: 30 })

// 获取数据
const user = await storage.get('user')

// 删除数据
await storage.remove('user')

工具函数

// 格式化日期
const formatted = MsUtils.formatDate(new Date(), 'YYYY-MM-DD')

// 生成 ID
const id = MsUtils.generateId(10)

// 防抖函数
const debouncedFn = MsUtils.debounce(() => {
  console.log('Debounced!')
}, 300)

// 节流函数
const throttledFn = MsUtils.throttle(() => {
  console.log('Throttled!')
}, 1000)

用户认证

const auth = new MsAuth()

// 登录
const { token, userInfo } = await auth.login({
  username: 'john',
  password: 'password123'
})

// 检查登录状态
const isLoggedIn = await auth.isLoggedIn()

// 获取用户信息
const user = await auth.getUserInfo()

// 登出
await auth.logout()

API 文档

MsSdk

主 SDK 类,用于全局配置管理。

构造函数

  • constructor(config?: MsSdkConfig)

方法

  • getConfig(): MsSdkConfig - 获取当前配置
  • updateConfig(newConfig: Partial<MsSdkConfig>): void - 更新配置

MsHttp

HTTP 请求模块。

方法

  • get<T>(url: string, options?: HttpOptions): Promise<HttpResponse<T>>
  • post<T>(url: string, data?: any, options?: HttpOptions): Promise<HttpResponse<T>>
  • put<T>(url: string, data?: any, options?: HttpOptions): Promise<HttpResponse<T>>
  • delete<T>(url: string, options?: HttpOptions): Promise<HttpResponse<T>>

MsStorage

本地存储模块。

方法

  • set(key: string, value: any): Promise<void>
  • get<T>(key: string, defaultValue?: T): Promise<T>
  • remove(key: string): Promise<void>
  • clear(): Promise<void>
  • keys(): Promise<string[]>

MsUtils

工具函数模块。

静态方法

  • formatDate(date: Date, format?: string): string
  • generateId(length?: number): string
  • debounce<T>(func: T, wait: number): T
  • throttle<T>(func: T, limit: number): T
  • deepClone<T>(obj: T): T
  • isValidEmail(email: string): boolean
  • isValidPhone(phone: string): boolean

MsAuth

用户认证模块。

方法

  • login(params: LoginParams): Promise<{ token: string; userInfo: UserInfo }>
  • logout(): Promise<void>
  • getToken(): Promise<string | null>
  • getUserInfo(): Promise<UserInfo | null>
  • isLoggedIn(): Promise<boolean>
  • refreshToken(): Promise<string>

发布到 npm

  1. 构建包:npm run build
  2. 发布:npm publish

许可证

MIT