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

ts-axios-anthony

v1.0.3

Published

a lib for typescript to use axios

Readme

ts-axios-anthony

a lib for typescript to use axios

1.前言

本项目脱胎于黄轶老师在慕课网发布的项目(基于TypeScript从零重构axios):

基于TypeScript从零重构axios

经过几个库的更新,原项目代码部分依赖已经不可用,于是重新搭建整个项目,作为自己的学习过程。

2.需求分析

axios,基于Promise的HTTP客户端,用于浏览器和node.js

重构之前,我们需要简单地做一些需求分析,看一下我们这次重构需要支持哪些 Features。官方支持的Features如下:

  • Make XMLHttpRequests from the browser
  • ~~Make http requests from node.js~~
  • Supports the Promise API
  • Intercept request and response
  • Transform request and response data
  • Cancel requests
  • Automatic transforms for JSON data
  • Client side support for protecting against XSRF

这次重构,我们只实现官方支持的8个Features中的7个,其中axios在node中的应用不打算实现,因为这部分在日常使用中相对较少。

3.目录介绍

本项目分为客户端(examples文件夹)和服务端(server文件夹):客户端主要是用来检验重构功能的demo,采用TypeScript按照模块化进行编写;服务端是用来响应demo中发出的请求,采用express编写。

├─.gitignore
├─index.html
├─package.json
├─README.md
├─tsconfig.json       // TypeScript 编译配置文件
├─tslint.json         // TypeScript lint 文件
├─examples            // 每个功能点的demo
├─test                // 测试代码(待完善)
└─src                 // 源码目录
    ├─axios.ts
    ├─defaultes.ts  
    ├─cancel    
    ├─core    
    ├─helpers   
    └─types

4.项目运行

# 克隆项目到本地
git clone [email protected]:Anthony-01/ts-axios-anthony.git

# 进入项目目录
cd ts-axios

# 安装依赖
(国内可先 npm config set registry https://registry.npm.taobao.org)
npm install

# 开启调试模式
npm run dev

# 发布到npm
npm run pub

5.使用npm安装ts-axios-anthony

npm install ts-axios-anthony