A lightweight, zero-dependency TypeScript utility for detecting variations of the name Chris/Kris in strings.
Recognizes these patterns (case-insensitive):
- Chris: Chris, Chriss
- Kris: Kris, Kriss, Khris
- Christopher: Christopher, Christoph
- Kristopher: Kristopher, Kristoph
- Other variants: Christofer, Cristofer, Christoffer, Kristoffer
npm install is-krisimport { isKris, isExactlyKris, findKris, countKris, REGEX } from "is-kris";
// Check if string contains any Chris/Kris variation
isKris("Hello Chris"); // true
isKris("John"); // false
// Check if string is exactly a Chris/Kris variation
isExactlyKris("Chris"); // true
isExactlyKris("Hello Chris"); // false
// Find all variations in a string
findKris("Chris and Kris are friends"); // ['Chris', 'Kris']
// Count variations in a string
countKris("Chris, Kris, and Christopher"); // 3
// Access the underlying regex
console.log(REGEX); // /\b(?:c|ch|k|kh)ri(?:s|ss|st(?:o(?:ph(?:er)?|fer|ffer)))\b/i
// You can also use Chris aliases
import { isChris, findChris, countChris, isExactlyChris } from "is-kris";
isChris("Hello Christopher"); // true
findChris("Chris and Kris"); // ['Chris', 'Kris']Checks if a string contains any variation of Chris/Kris.
Checks if a string is exactly a variation of Chris/Kris.
Returns array of all Chris/Kris variations found in the string.
Returns the number of Chris/Kris variations found.
The underlying regular expression pattern.
All functions handle invalid inputs gracefully:
isKris(null); // false
findKris(undefined); // []
countKris(123); // 0- Optimized regex for fast matching
- Lightweight bundle (~2KB)
- Works in Node.js 18+, all modern browsers, Bun, and Deno
git clone https://github.com/RostiMelk/is-kris.git
cd is-kris
bun install
bun test
bun run build