Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tyxla/remove-accents
Removes the accents from a string, converting them to their non-accented corresponding characters.
https://github.com/tyxla/remove-accents
Last synced: about 17 hours ago
JSON representation
Removes the accents from a string, converting them to their non-accented corresponding characters.
- Host: GitHub
- URL: https://github.com/tyxla/remove-accents
- Owner: tyxla
- License: mit
- Created: 2015-12-07T20:52:16.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-08T10:42:01.000Z (over 1 year ago)
- Last Synced: 2025-01-03T01:05:26.954Z (3 days ago)
- Language: JavaScript
- Size: 40 KB
- Stars: 162
- Watchers: 4
- Forks: 32
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# remove-accents
Removes the accents from a string, converting them to their corresponding non-accented ASCII characters.
```
npm install remove-accents
```[![Unit tests](https://github.com/tyxla/remove-accents/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/tyxla/remove-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 removeAccents from 'remove-accents';removeAccents(inputString)
```Alternatively, you could use the CommonJS syntax to import it:
``` js
const removeAccents = require('remove-accents');
```#### inputString
The string that you wish to remove accents from.
## Usage
Call `removeAccents()` 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 = removeAccents(input);console.log(output); // AAAAAA
```## Methods
The exported function also has helper methods.
#### has
Determine if a string has any accented characters.
``` js
import removeAccents from 'remove-accents';console.log(removeAccents.has('ÀÁÂÃÄÅ')); // true
console.log(removeAccents.has('ABC')); // false
```#### remove
Alias of `removeAccents`.
``` js
import removeAccents from 'remove-accents';console.log(removeAccents.remove('ÀÁÂÃÄÅ')); // AAAAAA
```## License
MIT