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

@yangguoxin/fin-request

v2.0.15

Published

xmlhttprequest封装,支持h5签名

Readme

fin-request

支持基础参数h5加签base64的ajax库

安装

安装前,请确保已经切换到小黑鱼NPM

$ npm install @blackfish/fin-request --save

使用

例如:

import { request } from '@blackfish/fin-request'
// ...
request({
  url: 'https://api.XXX.com',
  method: 'POST',
  merge: true, // 采用合并方式
  sign: true, // 生成签名
  data: {
    baseParams: {pValue},
    bizParams: data
  }
}).then(res => successHandle(res)) // 成功处理
  .catch(error => errorHandle(error)) // 失败处理

参数说明

参数 | 默认值 | 说明 ------- | ------- | -------- url | '' | 请求地址 method | 'GET' | 请求方式 async | true | 是否异步 data | null | 请求参数 contentType | 'text/plain;charset=UTF-8' | dataType | 'json' | response数据类型,可选'text' timeout | 30000 | 超时时间 withBase | false | 追加基础参数 merge | false | 和基础参数做合并,用于修改基础参数,withBase=false 生效 sign | false | 是否生成签名 debug | false | 是否走测试环境

单独使用签名函数

如果你只想单独使用签名功能,可以参考如下例子

import { sign } from '@blackfish/fin-request'

let data = { // 请求入参
  baseParams: {
    // ...
  },
  bizParams: {
    // ...
  },
  timestamp: '1525952105841' // 请求时间戳
}
// 加签
sign(data) // sign(data, true) 走测试环境拿盐值
// data 已增加签名字段
console.log(data)

// { // 请求入参
//   baseParams: {
//     // ...
//   },
//   bizParams: {
//     // ...
//   },
//   sign: XXXXXXXXXXXXXXXX,
//   timestamp: '1525952105841' // 请求时间戳
// }

单独使用基础参数

import { getDefaultParams } from '@blackfish/fin-request'

url query 参数

bf_ai

appId 通过url形式设置,用于在app外的页面需要设置appId的情况。

appId枚举

说明

为了更符合现代框架,减小包的体积,最新打包>=2.0.0的打包已经不将es6的polyfil打包进入库中,需要业务项目单独引入babel-polyfill。或者babel-loader include本库进行transform-runtime

更新日志

v2.0.7

  • ios baseParams 不能覆盖问题

v2.0.6

  • stringify 循环引用报错

v2.0.5

  • deviceIdXhy 新增字段

v2.0.4

  • ajax 请求error 返回
  • 风控设备指纹区分环境

v2.0.3

  • 基础参数添加风控设备指纹

v2.0.2

  • 采用mini-shim 判断是否小程序环境