0.0.3 • Published 3 years ago
x-equal v0.0.3
x-equal
Tiny library for comparing if strings are equal.
I got myself rewriting this code again and again in projects, so decided to move the code to its own package.
Install
$ yarn add x-equal
Usage
Import
import { isEqual } from 'x-equal'
Comparing strings
isEqual('hello', 'hello') // Same as 'hello' === 'hello'
Comparing strings (insensitive)
Compare strings ignoring string case, for example: HeLlO
will be equal to hello
.
isEqual('hello', 'hello', {
isSensitive: false,
})
Comparing strings (remove special characters)
Compare strings ignoring diacritical marks (', ^, etc.), this uses lodash.deburr
.
isEqual('João', 'joao', {
deburr: false,
})