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

@hzab/utils

v1.1.11

Published

utils

Readme

@hzab/utils

组件模板

  • Node.js ≥ 24

安装

pnpm add @hzab/utils

本包同时发布到公共 npmregistry.npmjs.org,public access)与企业私有源(ld / old)。 默认源可直接安装,无需额外配置;若团队要求走内网源,见消费方接入指南

消费方需自备 peerDependencies:@hzab/data-modelaxiosreactreact-dom(本包不会随包安装)。

引入方式见下方「组件」章节。

发布形态:本包在本仓以源码直出方式发布——main 指向 src,由消费方打包器编译 TypeScript 与 .less 样式;@hzab/utils/src/* 深路径同样可直接引用。随包发布的 dist/ 仅用于 类型解析(typesdist/index.d.ts),不是运行时入口。

组件

ossUpload 示例

import OssUpload from "@hzab/utils/src/ossUpload";

/**
 * 批量文件上传
 * @param {Array} files
 * @param {Object} opt
 * @returns
 */
export async function handleOssUpload(files, opt) {
  const _files = files;
  const { ossUrl, signatureParams, ossParams, axiosConf, useHashName } = opt || {};
  const ossUpload = new OssUpload({
    axios: opt.axios,
    axiosConf: axiosConf,
    serverUrl: ossUrl || "/api/v1/common/oss/getWebOssConfig",
  });

  const promise = [];
  _files?.forEach((file) => {
    if (!file) {
      return;
    }
    // 数据已经是 url 的情况
    if (typeof file === "string" || file.ossUrl || file.url) {
      promise.push(Promise.resolve(file));
    } else {
      promise.push(
        ossUpload
          .upload(file, {
            signatureParams: {
              isPublic: 1,
              ...(signatureParams || {}),
            },
            ossParams,
            axiosConf,
            useHashName,
          })
          .then((res) => {
            return Promise.resolve(res?.data?.data?.fileUrl);
          }),
      );
    }
  });

  return Promise.all(promise).then((filePromises) => {
    filePromises?.forEach((fileUrl, idx) => {
      if (typeof fileUrl === "string") {
        _files[idx].ossUrl = fileUrl;
        _files[idx].url = fileUrl;
      } else if (_files[idx].url) {
        _files[idx].ossUrl = _files[idx].url;
      }
    });
    return Promise.resolve(_files);
  });
}

API

InfoPanel Attributes

| 参数 | 类型 | 必填 | 默认值 | 说明 | | ------ | ------ | ---- | ------ | ----------------- | | schema | Object | 是 | - | 数据信息的 schema |