
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Fast JavaScript implementation of the porter2 English stemming algorithm.
$ npm install porter2
The package is simple: it has no dependencies and exports a single function
named stem.
Import using CommonJS:
const { stem } = require('porter2')
Or, import using EcmaScript Modules (through interoperability with CommonJS):
import { stem } from 'porter2'
Use the stemmer:
const word = stem('animadversion')
console.log(word) //=> animadvers
This stemmer expects a lowercase English word.
The code is compatible with ES5. TypeScript type declarations are included.
On my machine, the 29.4k test suite executes in ~5.25ms (~5.6M/s throughput) in a hot loop (~31ms for the first run).
Here is a comparison with some other libraries (you probably should take it with a little grain of salt):
| library | throughput (node) | throughput (bun) |
|---|---|---|
| porter2 1.0.3 | 5621 kops/s | 6780 kops/s |
| stemr 1.0.0 | 840 kops/s | 920 kops/s |
| wink-porter2-stemmer 1 2.0.1 | 340 kops/s | 420 kops/s |
Here are libraries that implement the older porter version 1 (note the behavior is not identical):
| library | throughput (node) | throughput (bun) |
|---|---|---|
| porter-stemmer-js 2 1.1.2 | 3280 kops/s | 3373 kops/s |
| stemmer 3 2.0.1 | 2100 kops/s | 1549 kops/s |
| @stdlib/nlp-porter-stemmer 0.2.2 | 1712 kops/s | 1604 kops/s |
| porter-stemmer 0.9.1 | 951 kops/s | 1264 kops/s |
The benchmark code is in bench/run.mjs. This was tested with Node.js v22.14.0
and bun v1.2.10 on Zen 3 (4.5 GHz boosted).
FAQs
Fastest JavaScript implementation of the porter2 stemmer
The npm package porter2 receives a total of 7,498 weekly downloads. As such, porter2 popularity was classified as popular.
We found that porter2 demonstrated a healthy version release cadence and project activity because the last version was released less than 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.