deburr

Utility that simplifies substring search by normalizing character set. Diacritic marks and supplementary letters are converted to nearest ASCII character sequence before search.

  • deburr

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
deburr
0.0.38 years ago8 years agoMinified + gzip package size for deburr in KB

Readme

Deburr v0.0.3 Build Status
Utility that simplifies substring search by normalizing character set. Diacritic marks and supplementary letters are converted to nearest ASCII character sequence before search. ```javascript new Deburr('Flíeßendes wáßer').lookup('wasser'); // → {offset: 11, length: 5} ```

API

new Deburr ( value)

Creates new Deburr instance. Provided value is casted to string and for equal string representation same Deburr instance is returned.

String toString ()

Returns normalized string representation of this Deburr instance.

{offset, length} lookup(String substring, Number beginIndex = 0)

Returns object that describes range of substring that matches substring. If no matches were found null is returned.

Array.<{offset, length}> lookupAll(String substring, Number beginIndex = 0, Number count)

Returns array of ranges of matched substrings.

License

The code is available under MIT licence.