
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
format-strings-ninja
Advanced tools
Format strings like a ninja — slug, cases, accents removal, HTML cleaning, smart titles, counts, etc.
Format your strings like a ninja — fast, precise, and dependency-free.
import { format } from "format-strings-ninja";
format.toSlug("Hello World!"); // "hello-world"
format.titleSmart("the lord of the rings"); // "The Lord of the Rings"
npm i format-strings-ninja
# or
pnpm add format-strings-ninja
# or
yarn add format-strings-ninja
import { format } from "format-strings-ninja";
console.log(format.camelCase("Hello brave world")); // "helloBraveWorld"
console.log(format.toTitleCase("the quick brown fox")); // "The Quick Brown Fox"
const format = require("format-strings-ninja");
console.log(format.toSlug("Hello World!")); // "hello-world"
console.log(format.capitalize("ninja")); // "Ninja"
<script type="module">
import { format } from "https://esm.sh/format-strings-ninja";
console.log(format.randomCase("hello ninja world"));
</script>
format| Function | Example | Output |
|---|---|---|
removeAccents(str) | "canción" | "cancion" |
normalizeWhitespace(str) | " Hello world " | "Hello world" |
reverse(str) | "ninja" | "ajnin" |
stripNonAscii(str) | "héllö 🌎" | "hell " |
| Function | Example | Output |
|---|---|---|
capitalize(str) | "ninja" | "Ninja" |
toTitleCase(str) | "the quick brown fox" | "The Quick Brown Fox" |
toSentenceCase(str) | "hello world" | "Hello world" |
titleSmart(str) | "the lord of the rings" | "The Lord of the Rings" |
nameCase(str) | "jUAN pérez roJas" | "Juan Pérez Rojas" |
| Function | Example | Output |
|---|---|---|
toSlug(str) | "Hello World!" | "hello-world" |
kebabCase(str) | "Hello Ninja World" | "hello-ninja-world" |
snakeCase(str) | "Hello Ninja World" | "hello_ninja_world" |
camelCase(str) | "Hello ninja world" | "helloNinjaWorld" |
| Function | Example | Output |
|---|---|---|
truncate(str, len) | "This text is too long", 10 | "This te..." |
limitWords(str, count) | "This is an example text", 3 | "This is an..." |
pad(str, length, char) | "42", 6, "0" | "002420" |
wrap(str, width) | "This text is too long", 8 | "This text\nis too\nlong" |
| Function | Example | Output |
|---|---|---|
cleanHTML(html) | "<p>Hello <b>world</b></p>" | "Hello world" |
countWords(str) | "The ninja writes code" | 4 |
countOccurrences(str, sub) | "banana", "na" | 2 |
| Function | Example | Output |
|---|---|---|
randomCase(str) | "ninja" | "nInJa" (random) |
alternatingCase(str) | "ninja" | "NiNjA" |
stylize(str, "upper") | "ninja" | "NINJA" |
stylize(str, "lower") | "NINJA" | "ninja" |
stylize(str, "leet") | "hacker" | "h4ck3r" |
stylize(str, "weird") | "ninja" | "ñïñjä" |
npm run build-browser # Build ES2015 modules for browsers (dist-browser/)
npm run build-node # Build CommonJS modules for Node.js (dist-node/)
npm run build # Build both browser and Node.js versions
MIT © Freddy Vincenty
FAQs
Format strings like a ninja — slug, cases, accents removal, HTML cleaning, smart titles, counts, etc.
The npm package format-strings-ninja receives a total of 1 weekly downloads. As such, format-strings-ninja popularity was classified as not popular.
We found that format-strings-ninja 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.