https://github.com/idimetrix/no-accents
Convert the accented characters in the string to their corresponding non-accented ASCII characters.
https://github.com/idimetrix/no-accents
Last synced: 6 months ago
JSON representation
Convert the accented characters in the string to their corresponding non-accented ASCII characters.
- Host: GitHub
- URL: https://github.com/idimetrix/no-accents
- Owner: idimetrix
- License: other
- Created: 2024-08-27T20:00:55.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T18:52:30.000Z (8 months ago)
- Last Synced: 2024-11-17T01:07:43.460Z (6 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# no-accents
Convert the accented characters in the string to their corresponding non-accented ASCII characters.
You can install no-accents using npm, yarn, or pnpm:
```
npm install no-accents
``````
yarn add no-accents
``````
pnpm add no-accents
```[](https://github.com/idimetrix/no-accents/actions/workflows/unit-tests.yml)
## About
An easy to use solution for converting all accented characters to their corresponding non-accented ASCII characters.
## Syntax
``` js
import accents from 'no-accents';const outputString = accents.normalize(inputString)
```Alternatively, you could use the CommonJS syntax to import it:
``` js
const accents = require('no-accents');const outputString = accents.normalize(inputString)
```#### inputString
The string that you wish to remove accents from.
#### outputString
Normalized string without accents.
## Usage
Call `accents.normalize()` by passing the string you wish to remove accents from, and you will get the non-accented
string as result.``` js
const input = 'ÀÁÂÃÄÅ';
const output = accents.normalize(input);console.log(output); // AAAAAA
```## Methods
#### has
Determine if a string has any accented characters.
``` js
import accents from 'no-accents';console.log(accents.has('ÀÁÂÃÄÅ')); // true
console.log(accents.has('ABC')); // false
```## License
MIT