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

@202195808yy/simple-math-utils

v1.0.2

Published

Простая библиотека математических функций для демонстрации публикации npm пакета

Readme

markdown

# @202195808yy/simple-math-utils

用于演示 npm 包发布的简单数学函数库。

## 安装

```bash
npm install @202195808yy/simple-math-utils

快速开始

javascript

import { add, subtract, square } from '@202195808yy/simple-math-utils';

console.log(add(2, 3));       // 5
console.log(subtract(5, 2));  // 3
console.log(square(4));       // 16

API

add(a, b)

两数相加。

  • a {number} 第一个加数
  • b {number} 第二个加数
  • 返回 {number} 两数之和

subtract(a, b)

两数相减。

  • a {number} 被减数
  • b {number} 减数
  • 返回 {number} 差

square(x)

计算一个数的平方。

  • x {number}
  • 返回 {number} 平方值

示例

javascript

import { square } from '@202195808yy/simple-math-utils';

const nums = [1, 2, 3, 4];
const squares = nums.map(square);
console.log(squares); // [1, 4, 9, 16]

常见问题

运行示例代码时出现 MODULE_TYPELESS_PACKAGE_JSON 警告

如果你在使用 import 导入本包时看到类似以下警告:

text

Warning: Module type of file ... is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected.

这是因为你的项目 package.json 中没有声明模块类型。解决方法很简单:

在你的项目根目录的 package.json 中添加:

json

"type": "module"

添加后,Node.js 就能正确识别 ES 模块语法,警告就会消失,性能也会更好。

如果你的项目无法使用 "type": "module"(例如因为部分旧代码仍用 require),可以改用该文件扩展名 .mjs,然后用 node index.mjs 运行。

许可证

ISC

作者:Янь Яо

text