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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ano-request

v1.0.2

Published

this is a request library

Downloads

6

Readme

ano-request

##目的:

  • 请求库:一个请求库,包含基本的请求能力,还有一些额外的功能,比如:请求参数的检查,并发请求,请求拦截器,响应拦截器,中断请求,功能也在不断更新中

##有问题反馈 这是我在 NPM上 的第四个插件,也是第一次写请求库,希望各位大佬在使用中有任何问题及性能优化建议,欢迎反馈给我,可以用以下联系方式跟我交流,感谢!

  • 邮件(519855937#qq.com, 把#换成@)
  • 微信:wqn30303
  • QQ: 519855937

##tips:

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。

##关于作者

var author = {
  nickName:"王秋宁",
  direction:"一个平平无奇的小前端~~~~"
}

##关于使用

  • 直接通过 npm install ano-request 下载
    引入 ano-request/index.js 中的 reqMain 方法

    如果你要使用中断请求功能,则需要再引入 globalKey,generateRequestId,abortFn,abortAllFn 三个方法,并在发送每条请求前使用 generateRequestId 生成一个唯一的请求KEY,globalKey这个是生成的key,在你需要的地方使用 abortFn(globalKey) 来中断请求,使用 abortAllFn() 来中断所有请求;

    如果你需要自定义请求并发数,则可以在 index.js 中 25 行的 let concurrentReq = new _fetch() 填入数字,现在默认并发数为 5

    请求方法使用示例:
    
    async function reqFn(){
        let result = await reqMain(
            'xxx',
            {
                // 请求方法
                method:'get',
                // 请求参数
                params:{
                    id:1
                },
                // 自定义请求头
                selfHeader:{
                    'testHeader':'hehehe'
                },
                // 自定义请求拦截器规则
                rulesArr:[
                    {
                        /** 判断条件
                         * params: 参数为已经处理好的参数
                         */
                        rule:function(params){
                            return params.method === 'get';
                        },
                        errorFn:function(){
                            console.log('请求方法错误!')
                        }
                    },
                    {
                        rule:function(params){
                            return params.id === 1;
                        },
                        errorFn:function(){
                            console.log('ID 错误!')
                        }
                    },
                    ...
                    ...
                    ...
                ]
            }
        )
    }