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

@mecatoncheir/bmi

v1.0.0

Published

BMI(Body Mass Index)計算と評価を行うJavaScriptライブラリ

Readme

@mecatoncheir/bmi

BMI(Body Mass Index)計算と評価を行うJavaScriptライブラリです。

特徴

  • 精確なBMI計算
  • 日本の肥満学会基準に基づく判定
  • 複数データの一括処理対応
  • 標準体重計算機能
  • TypeScript対応(型定義付き)
  • 軽量(依存関係なし)

インストール

npm install @mecatoncheir/bmi

基本的な使用方法

const { calculateBMI } = require('@mecatoncheir/bmi');

// 身長170cm、体重65kgの場合
const result = calculateBMI(170, 65);

console.log(result);
// {
//   bmi: 22.49,
//   category: "普通体重",
//   height: 170,
//   weight: 65,
//   timestamp: "2025-08-13T12:00:00.000Z"
// }

API リファレンス

calculateBMI(heightCm, weightKg)

BMIを計算し、カテゴリ判定を行います。

パラメータ:

  • heightCm (number): 身長(cm)
  • weightKg (number): 体重(kg)

戻り値:

  • 成功時: {bmi: number, category: string, height: number, weight: number, timestamp: string}
  • エラー時: null

BMI判定基準:

  • 18.5未満: 低体重(やせ型)
  • 18.5以上25未満: 普通体重
  • 25以上30未満: 肥満(1度)
  • 30以上: 肥満(2度以上)

calculateMultipleBMI(dataArray)

複数のBMI値を一度に計算します。

パラメータ:

  • dataArray (Array): [{height: number, weight: number}, ...] の配列

使用例:

const { calculateMultipleBMI } = require('@mecatoncheir/bmi');

const data = [
    { height: 170, weight: 65 },
    { height: 160, weight: 50 },
    { height: 180, weight: 80 }
];

const results = calculateMultipleBMI(data);
console.log(results); // 3つの計算結果の配列

calculateStandardWeight(heightCm)

標準体重を計算します(BMI=22として計算)。

パラメータ:

  • heightCm (number): 身長(cm)

戻り値:

  • 成功時: number (標準体重kg)
  • エラー時: null

使用例:

const { calculateStandardWeight } = require('@mecatoncheir/bmi');

const standardWeight = calculateStandardWeight(170);
console.log(standardWeight); // 63.58

getBMICategories()

BMIカテゴリの一覧を取得します。

戻り値: カテゴリ情報の配列

エラーハンドリング

const { calculateBMI } = require('@mecatoncheir/bmi');

const result = calculateBMI(0, 65); // 無効な身長
if (result === null) {
    console.log('入力値が無効です');
} else {
    console.log(`BMI: ${result.bmi}`);
}

ライセンス

MIT

貢献

プルリクエストや issue の報告を歓迎します。

サポート

更新履歴

1.0.0

  • 初回リリース
  • BMI計算機能
  • 複数データ処理機能
  • 標準体重計算機能