npm.io
0.0.3 • Published 5 years ago

x-equal

Licence
MIT
Version
0.0.3
Deps
1
Size
5 kB
Vulns
0
Weekly
0

x-equal

codecov

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,
})

Made with by Jota.