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

biu-fn

v0.1.1

Published

轻量实用的 TypeScript 函数工具库

Readme

biu-fn

轻量、直接、类型友好的 TypeScript 函数工具库。当前提供常用的数字千分位格式化能力,适合在业务页面、报表、金额展示和数据面板里快速使用。

特性

  • 开箱即用:同时支持 ESM、CommonJS 和 TypeScript 类型声明。
  • 输入宽松:支持 number、数字字符串和空值输入。
  • 格式稳定:默认保留 2 位小数,并显示千分位分隔符。
  • 配置简单:可控制小数位数和是否展示分隔符。

安装

npm install biu-fn

也可以使用你喜欢的包管理器:

pnpm add biu-fn
yarn add biu-fn

快速开始

import { formatThousand } from "biu-fn";

formatThousand(1234567.8);
// '1,234,567.80'

formatThousand("1234567.899");
// '1,234,567.89'

formatThousand(1234567.899, { decimal: 3 });
// '1,234,567.899'

formatThousand(1234567.8, { showSeparator: false });
// '1234567.80'

也支持默认导入:

import fn from "biu-fn";

fn.formatThousand(1234);
// '1,234.00'

API

formatThousand(value, options?)

将数字或数字字符串格式化为带千分位的字符串。

参数

| 参数 | 类型 | 默认值 | 说明 | | ----------------------- | ------------------------------- | ------ | ----------------------------------------------- | | value | number \| string \| undefined | 0 | 要格式化的值。无效值会按 0 处理。 | | options.decimal | number | 2 | 保留的小数位数。小于等于 0 时只保留整数部分。 | | options.showSeparator | boolean | true | 是否显示千分位分隔符。 |

返回值

返回格式化后的字符串。

示例

| 输入 | 配置 | 输出 | | ------------------ | ---------------- | ---------------- | | 1234567 | 默认 | '1,234,567.00' | | 1234567.8 | 默认 | '1,234,567.80' | | 1234567.899 | { decimal: 2 } | '1,234,567.89' | | 1234.5 | { decimal: 0 } | '1,234' | | '1234567.899abc' | 默认 | '1,234,567.89' | | undefined | 默认 | '0.00' |