{"id":18038,"library":"humanize-plus","title":"Humanize Plus Utilities","description":"Humanize Plus is a utility library designed to make data presented on the web more digestible and 'humane'. It provides a collection of functions for formatting numbers, file sizes, and time-related values into human-readable strings. The current stable version is 1.8.2, with recent releases primarily focusing on minor updates and deprecating older methods in preparation for a potential v2.0. The library's release cadence appears to be slow, with several months or years between significant updates. Key differentiators include its broad range of number and time formatting utilities, such as `compactInteger` for abbreviating large numbers, `fileSize` for converting byte counts, `intComma` for comma-separating integers, `ordinal` for adding suffixes like \"st\" or \"nd\", and `pace` for interpreting rates over time. It supports both Node.js (via CommonJS) and browser environments (via a global `Humanize` object).","status":"maintenance","version":"1.8.2","language":"javascript","source_language":"en","source_url":"git://github.com/HubSpot/humanize","tags":["javascript"],"install":[{"cmd":"npm install humanize-plus","lang":"bash","label":"npm"},{"cmd":"yarn add humanize-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add humanize-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"For Node.js environments, humanize-plus is a CommonJS module that exports a single `Humanize` object containing all utility methods. Named imports (`import { methodName } from 'pkg'`) are not supported.","wrong":"import Humanize from 'humanize-plus';","symbol":"Humanize","correct":"const Humanize = require('humanize-plus');"},{"note":"In a browser environment, after including the script, all utility methods are available on the global `Humanize` object.","wrong":"require('humanize-plus'); // Not for browser global scope","symbol":"Humanize","correct":"// <script src=\"humanize.min.js\"></script>\n// ... then access via global `Humanize` object"},{"note":"Individual methods must be accessed from the main `Humanize` object after importing the entire module. The package does not offer named exports for individual functions.","wrong":"import { compactInteger } from 'humanize-plus';","symbol":"compactInteger","correct":"const Humanize = require('humanize-plus');\nHumanize.compactInteger(123456, 1);"}],"quickstart":{"code":"const Humanize = require('humanize-plus');\n\nconsole.log('Original number:', 123456789);\nconsole.log('Compact integer (1 decimal place):', Humanize.compactInteger(123456789, 1));\n// Expected: \"123.5M\"\n\nconsole.log('Original file size:', 1024 * 2000);\nconsole.log('Human-readable file size:', Humanize.fileSize(1024 * 2000));\n// Expected: \"1.95 Mb\"\n\nconsole.log('Formatting with commas:', Humanize.intComma(987654321));\n// Expected: \"987,654,321\"\n\nconsole.log('Ordinal for 22:', Humanize.ordinal(22));\n// Expected: \"22nd\"","lang":"javascript","description":"Demonstrates importing `humanize-plus` in Node.js and using several core formatting functions like `compactInteger`, `fileSize`, `intComma`, and `ordinal`."},"warnings":[{"fix":"Replace `Humanize.intcomma(...)` with `Humanize.intComma(...)`.","message":"The `intcomma` method is deprecated. Use `Humanize.intComma` (camelCase) instead.","severity":"deprecated","affected_versions":">=1.4.2"},{"fix":"Migrate to using `Humanize.compactInteger(...)` directly for future compatibility.","message":"The `intword` method is deprecated. It is now a thin wrapper around `Humanize.compactInteger` and will be removed in the next major version (v2).","severity":"deprecated","affected_versions":">=1.4.2"},{"fix":"Replace `Humanize.truncatenumber(...)` with `Humanize.boundedNumber(...)`.","message":"The `truncatenumber` method is deprecated. Use `Humanize.boundedNumber` instead.","severity":"deprecated","affected_versions":">=1.4.2"},{"fix":"Replace `Humanize.filesize(...)` with `Humanize.fileSize(...)`.","message":"The `filesize` method is deprecated. Use `Humanize.fileSize` (camelCase) instead.","severity":"deprecated","affected_versions":">=1.4.2"},{"fix":"Upgrade your Node.js runtime to version 0.8.0 or higher.","message":"Support for Node.js v0.6 was dropped in version 1.5.0. Ensure your Node.js environment is v0.8.0 or newer.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Update all calls to deprecated methods to their recommended replacements (e.g., `intComma`, `compactInteger`, `boundedNumber`, `fileSize`) before upgrading to version 2.x.","message":"Several methods (intcomma, intword, truncatenumber, filesize) have been marked as deprecated since v1.4.2 and are explicitly stated to 'not be present in the next major version' (v2). Relying on these will cause breakage.","severity":"breaking","affected_versions":">=1.4.2"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change the method call from `Humanize.intcomma(...)` to `Humanize.intComma(...)`.","cause":"Attempting to use the deprecated lowercase method name `intcomma` instead of `intComma`.","error":"TypeError: Humanize.intcomma is not a function"},{"fix":"Ensure `<script src=\"humanize.min.js\"></script>` is correctly included in your HTML before attempting to use the `Humanize` global object.","cause":"The `humanize-plus` script has not been loaded in the browser, or it's being accessed outside its intended scope.","error":"ReferenceError: Humanize is not defined"},{"fix":"For browser usage, include the library via a `<script>` tag and access the global `Humanize` object. If using a bundler (like Webpack or Rollup), ensure it's configured to handle CommonJS modules.","cause":"Attempting to use Node.js CommonJS `require()` in a browser environment without a module bundler.","error":"ReferenceError: require is not defined"},{"fix":"Use CommonJS `require` syntax: `const Humanize = require('humanize-plus');` and then access methods like `Humanize.compactInteger(...)`.","cause":"Attempting to use ES module named imports for `humanize-plus`, which is a CommonJS module that exports a single object.","error":"SyntaxError: The requested module 'humanize-plus' does not provide an export named 'compactInteger'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}