-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💥 To fixed #22 for a rewrite in TypeScript
✨ Added proper implementation of string normalization in ES6 to fix #21
- Loading branch information
Showing
25 changed files
with
9,755 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
root = true | ||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
.DS_Store | ||
.vscode | ||
node_modules/ | ||
.esm-cache | ||
*.env | ||
.build/ | ||
.nyc_output | ||
.tmp/ | ||
.vscode | ||
npm-debug.log* | ||
*.env | ||
yarn-error.log* | ||
build/ | ||
coverage/ | ||
dist/ | ||
dist/**/__mocks__/ | ||
dist/**/__tests__/ | ||
.nyc_output | ||
out/ | ||
gulpfile.js | ||
logs/**/[^.]* | ||
node_modules/ | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
.DS_Store | ||
.vscode | ||
node_modules/ | ||
*.env | ||
.build/ | ||
.nyc_output | ||
.tmp/ | ||
.vscode | ||
npm-debug.log* | ||
*.env | ||
yarn-error.log* | ||
build/ | ||
coverage/ | ||
dist*/ | ||
dist/**/__mocks__/ | ||
dist/**/__tests__/ | ||
.nyc_output | ||
out/ | ||
dist/**/demo/ | ||
logs/**/[^.]* | ||
node_modules/ | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# User config | ||
package-lock=true | ||
progress=true | ||
quiet=true | ||
update-binary=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
language: node_js | ||
dist: trusty | ||
node_js: | ||
- v6 | ||
- v7 | ||
- v8 | ||
- v9 | ||
script: | ||
- npm run build | ||
- npm run test | ||
after_success: npm run coveralls && npm run codecov |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,142 @@ | ||
[![Stories in Ready](https://badge.waffle.io/motss/normalize-diacritics.png?label=ready&title=Ready)](https://waffle.io/motss/normalize-diacritics?utm_source=badge) | ||
# normalize-diacritics | ||
<div align="center" style="text-align: center;"> | ||
<h1 style="border-bottom: none;">normalize-diacritics</h1> | ||
|
||
[![NPM][nodei-image]][nodei-url] | ||
<p>Remove accents/ diacritics in strings</p> | ||
</div> | ||
|
||
> Simple module to normalize any diacritics in a given string. | ||
<hr /> | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Build status][appveyor-image]][appveyor-url] | ||
[![Dependency Status][daviddm-image]][daviddm-url] | ||
[![Coverage percentage][coveralls-image]][coveralls-url] | ||
[![codecov][codecov-image]][codecov-url] | ||
[![Known Vulnerabilities][snyk-image]][snyk-url] | ||
[![NSP Status][nsp-image]][nsp-url] | ||
[![Inline docs][inch-image]][inch-url] | ||
[![GitHub license][license-image]][license-url] | ||
[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url] | ||
[![NPM][nodei-badge]][nodei-url] | ||
|
||
## Install | ||
[![Build Status][travis-badge]][travis-url] | ||
[![AppVeyor][appveyor-badge]][appveyor-url] | ||
[![Version][version-badge]][version-url] | ||
[![Downloads][downloads-badge]][downloads-url] | ||
[![MIT License][mit-license-badge]][mit-license-url] | ||
[![NSP Status][nsp-badge]][nsp-url] | ||
[![Dependency Status][daviddm-badge]][daviddm-url] | ||
[![Greenkeeper badge][greenkeeper-badge]][greenkeeper-url] | ||
|
||
``` | ||
[![Code of Conduct][coc-badge]][coc-url] | ||
|
||
[![Coverage percentage][coveralls-badge]][coveralls-url] | ||
[![codecov][codecov-badge]][codecov-url] | ||
|
||
<!-- [![Codacy Badge][codacy-badge]][codacy-url] --> | ||
[![Inline docs][inch-badge]][inch-url] | ||
<!-- [![codebeat badge][codebeat-badge]][codebeat-url] --> | ||
|
||
[![Stories in Ready][waffle-badge]][waffle-url] | ||
|
||
> A simple NPM package to remove accents/ diacritics in strings in Javascript. | ||
## Setup | ||
|
||
### Pre-requisites | ||
|
||
Please make sure that you have the followings installed on your machine: | ||
|
||
- `node >= 8.9.0` ___(In Zumata, we internally use the latest LTS version ([node:carbon][node-releases-url]) for all our Node.js applications.)___ | ||
- `npm >= 5.5.1` ___(The minimum NPM version for [node:carbon][node-releases-url].)___ | ||
|
||
### Install the package via NPM | ||
|
||
```sh | ||
# NPM install | ||
$ npm install --save normalize-diacritics | ||
``` | ||
|
||
## Usage | ||
## How to use | ||
|
||
Brief example to show how to use: | ||
### Typescript or Node.js with native ES Modules | ||
|
||
```js | ||
const { diacritics, normalize } = require('normalize-diacritics'); | ||
Snippet for using native ES Modules: | ||
|
||
```ts | ||
import normalize from 'normalize-diacritics'; | ||
|
||
(async () => { | ||
const str = 'söme stüff with áccènts'; | ||
await normalize(str); // some stuff with accents | ||
})(); | ||
``` | ||
|
||
/* To show the list of diacritics */ | ||
console.log(diacritics); // { letter: ' ', diacritics: /[\u00a0]/g } ... | ||
### CommonJS's require | ||
|
||
/* To normalize string */ | ||
const str = 'söme stüff with áccènts'; | ||
normalize(str); // some stuff with accents | ||
```js | ||
const { normalize } = require('normalize-diacritics'); | ||
|
||
(async () => { | ||
const str = 'söme stüff with áccènts'; | ||
await normalize(str); // some stuff with accents | ||
})(); | ||
``` | ||
|
||
## Demo | ||
## API Reference | ||
|
||
### normalize(input) | ||
|
||
- input <[string][string-mdn-url]> Input string that contains accents/ diacritics. | ||
- returns: <[Promise][promise-mdn-url]<[string][string-mdn-url]>> | ||
|
||
This method accepts an input string that contains any accents/ diacritics and normalizes all of them asynchronously and the normalized string will be output as a result. | ||
|
||
[Simple demo on Runkit](https://runkit.com/motss/normalize-diacritics) | ||
### normalizeSync(input) | ||
|
||
- input <[string][string-mdn-url]> Input string that contains accents/ diacritics. | ||
- returns: <[Promise][promise-mdn-url]<[string][string-mdn-url]>> | ||
|
||
This methods works the same as `normalize(input)` except that this is a synchronous version of `normalize(input)`. | ||
|
||
## License | ||
|
||
[MIT License](http://motss.mit-license.org/) © Rong Sen Ng | ||
|
||
[node-releases-url]: https://nodejs.org/en/download/releases | ||
[string-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[promise-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise | ||
|
||
[nodei-badge]: https://nodei.co/npm/normalize-diacritics.png?downloads=true&downloadRank=true&stars=true | ||
|
||
[travis-badge]: https://img.shields.io/travis/rust-lang/rust.svg?style=flat-square | ||
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/g3n1hhl18w3crcrb?svg=true | ||
|
||
[version-badge]: https://img.shields.io/npm/v/delvery.svg?style=flat-square | ||
[downloads-badge]: https://img.shields.io/npm/dm/delvery.svg?style=flat-square | ||
[mit-license-badge]: https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square | ||
[nsp-badge]: https://nodesecurity.io/orgs/motss/projects/92a9a3b3-c0c8-4172-917d-f1c7e0d5ef9f/badge | ||
[daviddm-badge]: https://img.shields.io/david/expressjs/express.svg?style=flat-square | ||
[greenkeeper-badge]: https://badges.greenkeeper.io/motss/normalize-diacritics.svg | ||
|
||
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square | ||
|
||
[coveralls-badge]: https://coveralls.io/repos/github/Zumata/normalize-diacritics/badge.svg?branch=master | ||
[codecov-badge]: https://codecov.io/gh/Zumata/normalize-diacritics/branch/master/graph/badge.svg | ||
|
||
[codacy-badge]: https://api.codacy.com/project/badge/Grade/c84a41b8422245058a8c1acd17fd7e23 | ||
[inch-badge]: http://inch-ci.org/github/zumata/normalize-diacritics.svg?branch=master | ||
[codebeat-badge]: https://codebeat.co/badges/8a0eb7c1-b944-41b1-ad87-5f0bd392873b | ||
|
||
[waffle-badge]: https://badge.waffle.io/Zumata/normalize-diacritics.png?label=ready&title=Ready | ||
|
||
|
||
|
||
[nodei-image]: https://nodei.co/npm/normalize-diacritics.png?downloads=true&downloadRank=true&stars=true | ||
[nodei-url]: https://nodei.co/npm/normalize-diacritics/ | ||
[npm-image]: https://badge.fury.io/js/normalize-diacritics.svg | ||
[npm-url]: https://npmjs.org/package/normalize-diacritics | ||
[travis-image]: https://travis-ci.org/motss/normalize-diacritics.svg?branch=master | ||
|
||
[travis-url]: https://travis-ci.org/motss/normalize-diacritics | ||
[appveyor-image]: https://ci.appveyor.com/api/projects/status/g3n1hhl18w3crcrb/branch/master?svg=true | ||
[appveyor-url]: https://ci.appveyor.com/project/motss/normalize-diacritics/branch/master | ||
[daviddm-image]: https://david-dm.org/motss/normalize-diacritics.svg?theme=shields.io | ||
[version-url]: https://npmjs.org/package/normalize-diacritics | ||
[downloads-url]: http://www.npmtrends.com/normalize-diacritics | ||
[mit-license-url]: https://github.com/Zumata/normalize-diacritics/blob/master/LICENSE | ||
[nsp-url]: https://nodesecurity.io/orgs/motss/projects/02e1b52b-3dc8-4fcf-aa91-8676541b4348 | ||
[daviddm-url]: https://david-dm.org/motss/normalize-diacritics | ||
[coveralls-image]: https://coveralls.io/repos/github/motss/normalize-diacritics/badge.svg?branch=master | ||
[greenkeeper-url]: https://greenkeeper.io/ | ||
|
||
[coc-url]: https://github.com/Zumata/normalize-diacritics/blob/master/CODE_OF_CONDUCT.md | ||
|
||
[coveralls-url]: https://coveralls.io/github/motss/normalize-diacritics?branch=master | ||
[codecov-image]: https://codecov.io/gh/motss/normalize-diacritics/branch/master/graph/badge.svg | ||
[codecov-url]: https://codecov.io/gh/motss/normalize-diacritics | ||
[snyk-image]: https://snyk.io/test/github/motss/normalize-diacritics/badge.svg | ||
[snyk-url]: https://snyk.io/test/github/motss/normalize-diacritics | ||
[nsp-image]: https://nodesecurity.io/orgs/motss/projects/02e1b52b-3dc8-4fcf-aa91-8676541b4348/badge | ||
[nsp-url]: https://nodesecurity.io/orgs/motss/projects/02e1b52b-3dc8-4fcf-aa91-8676541b4348 | ||
[inch-image]: http://inch-ci.org/github/motss/normalize-diacritics.svg?branch=master | ||
|
||
[inch-url]: http://inch-ci.org/github/motss/normalize-diacritics | ||
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg | ||
[license-url]: https://motss.mit-license.org/ | ||
[greenkeeper-image]: https://badges.greenkeeper.io/motss/normalize-diacritics.svg | ||
[greenkeeper-url]: https://greenkeeper.io/ | ||
|
||
[waffle-url]: https://waffle.io/motss/normalize-diacritics?utm_source=badge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.