2.2.0 • Published 11 months ago

accent-folding v2.2.0

Weekly downloads
404
License
MIT
Repository
github
Last release
11 months ago

accent-folding


Description

A case-insensitive accent folding function that replaces accented characters with their unaccented equivalents

Key Features:

  • Accent-insensitive matching
  • Customizable highlight wrapping (can use any HTML tag)
  • Preserves original string formatting in the output
  • Handles various Unicode characters, including fullwidth ASCII
  • wraps string fragment in <b> html tag by default.

Potential Use Cases:

  • Search functionality in applications where accents should be ignored
  • Highlighting matched terms in search results

Usage

Install with npm:

npm install accent-folding

or with pnpm:

pnpm install accent-folding
yarn add accent-folding

Simple use-case

import AccentFolding from 'accent-folding';

const af = new AccentFolding()

af.highlightMatch("Fulanilo López", "lo"); // --> "Fulani<b>lo</b> <b>Ló</b>pez"

Using with custom html tag

af.highlightMatch("Fulanilo López", "lo", "strong"); // --> "Fulani<strong>lo</strong> <strong>Ló</strong>pez"

Requirements

Node.js version 14.7 or higher

Legacy usage (v1)

Install with npm:

npm install accent-folding@1

Example:

const accentFoldedHighlight = require('accent-folding');

accentFoldedHighlight("Fulanilo López", "lo"); // --> "Fulani<b>lo</b> <b>Ló</b>pez"
accentFoldedHighlight("Fulanilo López", "lo", "strong"); // --> "Fulani<strong>lo</strong> <strong>Ló</strong>pez"

Roadmap

See the Roadmap for planned features and future improvements.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

2.2.1-next.1

11 months ago

2.2.0

11 months ago

2.1.1

11 months ago

2.1.0-next.1

11 months ago

1.0.0-next.1

11 months ago

1.0.0-next.2

11 months ago

2.0.0-next.2

11 months ago

2.0.0-next.1

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago