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

sauron-library

v2.0.0

Published

This is the npm repository for sauron.pan

Downloads

13

Readme

sauron-library 轻量级,纯净版JS函数库

  • JS浮点数计算全家桶
  • 数组对象去重
  • 深拷贝
  • 防抖截流
  • ...

node环境使用

安装

npm i sauron-library

更新

npm i sauron-library@latest

引入函数,以计算函数为例

let calc = require('sauron-library')
// console.log(calc)    
// handlingDecimals, // 获取小数点长度
// addition, // 加
// subtraction, // 减
// multiply, // 乘
// division, // 除

browser环境

mac环境创建文件夹及相关目录

1.切到根目录下的 Documents

cd ~/Documents

2.创建一个空文件夹 demo

mkdir demo && cd demo

3.文件夹 demo 下创建 main.js, bundle.js 和 n.html 三个文件

touch main.js && touch bundle.js && touch n.html

安装依赖

1.下载 sauron-library

npm i sauron-library

2.下载 browserify (node环境不需要)

npm i browserify
若以上安装方式打包运行时提示
zsh: command not found: browserify
则建议采用全局安装
npm i browserify -g

3.文件内容

main.js

const Smath = require('sauron-library')

window.Smath = Smath

n.html

<html>
  <head>
    <script src="bundle.js"></script>
  </head>
  <body>
    npm html test
  </body>
</html>

<script>
  const Smath = window.Smath

  const resAddition = Smath.addition(0.1, 0.2) // 0.3
  const resSubtraction = Smath.subtraction(0.4, 0.1) // 0.3
  const resMultiply = Smath.multiply(35.41, 100) // 3541
  const resDivision = Smath.division(1.02, 5) // 0.204

  // console.log(0.1 + 0.2) // 0.30000000000000004
  // console.log(0.4 - 0.1) // 0.30000000000000004
  // console.log(35.41 * 100) // 3540.9999999999995
  // console.log(1.02 / 5) // 0.20400000000000001
</script>

打包 & 测试

1.打包main.js并输出到bundle.js,终端执行命令:

browserify main.js -o bundle.js

2.打开浏览器,在控制台查看输出