
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@iusername/percentile
Advanced tools
本工具根据 excel 中 percentile 算法计算百分位数值
如果你是需要求数据中最接近所给百分位的值的话可以使用percentile而非@iusername/percentile
npm i @iusername/percentile
// 或者
yarn add @iusername/percentile
// node
const Percentile = require('@iusername/percentile')
// ES Module
import Percentile from '@iusername/percentile'
只求值一次的情况
var percentile = new Percentile()
// mock data
const data = [2, 3, 5, 5, 5, 7, 20, 21]
var res = percentile.incsOnce(data, [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100])
// res: [2, 2.7, 3.8, 5, 5, 5, 5.4, 6.8, 14.8, 20.3, 21]
var res = percentile.incOnce(data, 90)
// res: 20.3
需要多次求值时,可以通过初始化时传入 data 或者 init(data) 来缓存处理好的 data 数据减少每次求值所耗时间
const data = [2, 3, 5, 5, 5, 7, 20, 21]
var percentile = new Percentile(data)
// 或者下面注释部分也行
// PS: init 后会覆盖上一次 init 或者初始化时的缓存数据
/*
var percentile = new Percentile()
percentile.init(data)
*/
// inc 方式
var res = percentile.incValue(90)
// res: 20.3
var res = percentile.incValues([80, 90, 100])
// res: [14.8, 20.3, 21]
// exc 方式
var res = percentile.excValue(90)
// res: '#NUM!'
var res = percentile.incValues([80, 90, 100])
// res: [20.2, '#NUM!', '#NUM!']
初始化 percentile对象数据,后续则不需要再传入相同数据进行计算了
根据 PERCENTILE.INC 获取结果
根据 PERCENTILE.INC 获取多个对应结果
根据 PERCENTILE.EXC 获取结果
根据 PERCENTILE.EXC 获取多个对应结果
根据 PERCENTILE.INC 获取结果,data 不会被缓存,适用于只计算一次即可的情况,用完后实例对象会恢复原先缓存data
incOnce 的多值用法
根据 PERCENTILE.EXC 获取结果,data 不会被缓存,适用于只计算一次即可的情况,用完后实例对象会恢复原先缓存data
excOnce 的多值用法
查看计算说明
计算说明
// 运行下面代码后再控制台查看
Percentile.help()
FAQs
Calculate a percentile for given array of values
We found that @iusername/percentile demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.