@karinkuto/palind
v1.0.1
Published
A simple palindromic string checker
Maintainers
Readme
@karinkuto/palind
A lightweight utility to check if a string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization).
Installation
Using npm:
npm install @karinkuto/palindUsing yarn:
yarn add @karinkuto/palindUsing pnpm:
pnpm add @karinkuto/palindUsage
import { isPalindrome } from '@karinkuto/palind';
console.log(isPalindrome('A man, a plan, a canal: Panama')); // true
console.log(isPalindrome('race a car')); // falseAPI
isPalindrome(str: string): boolean
Checks if the input string is a palindrome.
Parameters
str(string): The string to check
Returns
boolean:trueif the string is a palindrome,falseotherwise
Features
- Case-insensitive comparison
- Ignores non-alphanumeric characters
- Handles empty strings and whitespace
- Written in TypeScript with full type definitions
License
MIT
