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 🙏

© 2024 – Pkg Stats / Ryan Hefner

think-js-lib

v1.1.3

Published

This is the ThinkJS core dependency.

Downloads

7

Readme

  • 💪 减少造轮子拿来即用
  • 🔥 集成了众多常用SDK

think-js-lib

think-js-libThinkJS框架 的核心依赖,两者互相依托不可分开。之所以将核心功能拆分成单独的依赖包,是为了避免核心包版本迭代过程中影响 ThinkJS框架层的业务逻辑。如果想使用 think-js-lib 升级后的新功能,只需要修改 ThinkJS框架中 package.jsonthink-js-lib 的版本,重新 install 即可。

目录结构

.
├── lib                          // 依赖目录
│   ├── config.js                // 全局配置文件
│   ├── controller.js            // 控制器
│   ├── elasticsearch.js         // ES封装
│   ├── error.js                 // 全局异常处理
│   ├── errorcode.js             // 状态码枚举
│   ├── exception.js             // 重写异常处理
│   ├── log4j.js                 // 日志输出
│   ├── model.js                 // 模型
│   ├── mongodb.js               // mongodb封装
│   ├── route.js                 // 路由实现
│   ├── start.js                 // 初始化文件
│   ├── thinkdb.js               // mysql封装
│   ├── thinkredis.js            // redis封装
│   ├── utils.js                 // 常用工具函数
│   └── validate.js              // 参数验证器
├── index.js                     // 入口文件
├── package.json                 // 配置文件
└── README.md                    // 项目介绍

更新

卸载旧版重新安装

pnpm uninstall think-js-lib

pnpm install [email protected]

修改 package.json 里版本号安装

"think-js-lib": "1.1.1"

pnpm install

常用功能

  • this.Utils   // 常用工具函数调用,注意这是一个属性
  • this.getToken()   // 生成JWT TOKEN
  • this.validateToken()   // 验证JWT TOKEN是否正确
  • this.getParams()   // 获取GET POST传参,同时可校验参数
  • this.showSuccess()   // 返回JSON格式数据
  • this.ApiException()   // 返回一个异常
  • this.Db()   // 使用MySql数据库
  • this.RDb()   // 使用Redis
  • this.EDb()   // 使用ElasticSearch
  • this.MDb()   // 使用MongoDB
  • this.M()   // 使用模型
  • this.Log4j()   // 使用日志处理
  • this.WxPay()   // 使用微信支付
  • this.AliPay()   // 使用支付宝支付
  • this.SMS()   // 使用阿里短信服务
  • this.OSS()   // 使用阿里对象存储
  • this.Fetch()   // 使用网络请求

执照

ThinkJS已申请软件著作,可在中国版权保护中心中查看 CPCC.