1 | <div align="center" style="text-align: center;">
|
2 | <h1 style="border-bottom: none;">normalize-diacritics</h1>
|
3 |
|
4 | <p>Remove accents/ diacritics in string</p>
|
5 | </div>
|
6 |
|
7 | <hr />
|
8 |
|
9 | [![Version][version-badge]][version-url]
|
10 | [![Node version][node-version-badge]][node-version-url]
|
11 | [![MIT License][mit-license-badge]][mit-license-url]
|
12 |
|
13 | [![Downloads][downloads-badge]][downloads-url]
|
14 | [![Total downloads][total-downloads-badge]][downloads-url]
|
15 | [![Packagephobia][packagephobia-badge]][packagephobia-url]
|
16 | [![Bundlephobia][bundlephobia-badge]][bundlephobia-url]
|
17 |
|
18 | [![Build Status][travis-badge]][travis-url]
|
19 | [![CircleCI][circleci-badge]][circleci-url]
|
20 | [![Dependency Status][daviddm-badge]][daviddm-url]
|
21 | [![codecov][codecov-badge]][codecov-url]
|
22 | [![Coverage Status][coveralls-badge]][coveralls-url]
|
23 |
|
24 | [![codebeat badge][codebeat-badge]][codebeat-url]
|
25 | [![Codacy Badge][codacy-badge]][codacy-url]
|
26 | [![Code of Conduct][coc-badge]][coc-url]
|
27 |
|
28 | > Simple [NPM][npm-url] package to remove any accents/ diacritics found in a string.
|
29 |
|
30 | ## Table of contents
|
31 |
|
32 | - [Table of contents](#table-of-contents)
|
33 | - [Pre-requisite](#pre-requisite)
|
34 | - [How to use](#how-to-use)
|
35 | - [Install](#install)
|
36 | - [ES Modules or TypeScript](#es-modules-or-typescript)
|
37 | - [Node.js](#nodejs)
|
38 | - [API Reference](#api-reference)
|
39 | - [normalize([input])](#normalizeinput)
|
40 | - [normalizeSync([input])](#normalizesyncinput)
|
41 | - [License](#license)
|
42 |
|
43 | ## Pre-requisite
|
44 |
|
45 | - [Node.js][node-js-url] >= 8.9.0
|
46 | - [NPM][npm-url] >= 5.5.1 ([NPM][npm-url] comes with [Node.js][node-js-url] so there is no need to install separately.)
|
47 |
|
48 | ## How to use
|
49 |
|
50 | ### Install
|
51 |
|
52 | ```sh
|
53 | # Install via NPM
|
54 | $ npm install --save normalize-diacritics
|
55 | ```
|
56 |
|
57 | ### ES Modules or TypeScript
|
58 |
|
59 | Snippet for using native ES Modules:
|
60 |
|
61 | ```ts
|
62 | // @ts-check
|
63 |
|
64 | import normalize from 'normalize-diacritics';
|
65 |
|
66 | (async () => {
|
67 | const str = 'söme stüff with áccènts';
|
68 |
|
69 | assert.equal(await normalize(str), some stuff with accents); // OK
|
70 | })();
|
71 | ```
|
72 |
|
73 | ### Node.js
|
74 |
|
75 | ```js
|
76 | const { normalize } = require('normalize-diacritics');
|
77 |
|
78 | (async () => {
|
79 | const str = 'söme stüff with áccènts';
|
80 |
|
81 | assert.equal(await normalize(str), some stuff with accents); // OK
|
82 | })();
|
83 | ```
|
84 |
|
85 | ## API Reference
|
86 |
|
87 | ### normalize([input])
|
88 |
|
89 | - `input` <[?string][string-mdn-url]> Input string that contains accents/ diacritics.
|
90 | - returns: <[Promise][promise-mdn-url]<[string][string-mdn-url]>> Promise which resolves with normalized input string.
|
91 |
|
92 | This method normalizes any accents/ diacritics found in a given input string and output a normalized string as a result.
|
93 |
|
94 | ### normalizeSync([input])
|
95 |
|
96 | This methods works the same as `normalize([input])` except that this is the synchronous version.
|
97 |
|
98 | ## License
|
99 |
|
100 | [MIT License](http://motss.mit-license.org/) © Rong Sen Ng
|
101 |
|
102 |
|
103 | [node-js-url]: https://nodejs.org
|
104 | [npm-url]: https://www.npmjs.com
|
105 | [node-releases-url]: https://nodejs.org/en/download/releases
|
106 |
|
107 |
|
108 | [map-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
109 | [string-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
|
110 | [object-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
111 | [number-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
|
112 | [boolean-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
113 | [html-style-element-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement
|
114 | [promise-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
115 |
|
116 |
|
117 | [version-badge]: https://flat.badgen.net/npm/v/normalize-diacritics
|
118 | [node-version-badge]: https://flat.badgen.net/npm/node/normalize-diacritics
|
119 | [mit-license-badge]: https://flat.badgen.net/npm/license/normalize-diacritics
|
120 |
|
121 | [downloads-badge]: https://flat.badgen.net/npm/dm/normalize-diacritics
|
122 | [total-downloads-badge]: https://flat.badgen.net/npm/dt/normalize-diacritics?label=total%20downloads
|
123 | [packagephobia-badge]: https://flat.badgen.net/packagephobia/install/normalize-diacritics
|
124 | [bundlephobia-badge]: https://flat.badgen.net/bundlephobia/minzip/normalize-diacritics
|
125 |
|
126 | [travis-badge]: https://flat.badgen.net/travis/motss/normalize-diacritics
|
127 | [circleci-badge]: https://flat.badgen.net/circleci/github/motss/normalize-diacritics
|
128 | [daviddm-badge]: https://flat.badgen.net/david/dep/motss/normalize-diacritics
|
129 | [codecov-badge]: https://flat.badgen.net/codecov/c/github/motss/normalize-diacritics?label=codecov
|
130 | [coveralls-badge]: https://flat.badgen.net/coveralls/c/github/motss/normalize-diacritics?label=coveralls
|
131 |
|
132 | [codacy-badge]: https://api.codacy.com/project/badge/Grade/c84a41b8422245058a8c1acd17fd7e23
|
133 | [inch-badge]: http://inch-ci.org/github/motss/normalize-diacritics.svg?branch=master
|
134 | [codebeat-badge]: https://codebeat.co/badges/8a0eb7c1-b944-41b1-ad87-5f0bd392873b
|
135 | [coc-badge]: https://flat.badgen.net/badge/code%20of/conduct/pink
|
136 |
|
137 |
|
138 | [version-url]: https://www.npmjs.com/package/normalize-diacritics
|
139 | [node-version-url]: https://nodejs.org/en/download
|
140 | [mit-license-url]: https://github.com/motss/normalize-diacritics/blob/master/LICENSE
|
141 |
|
142 | [downloads-url]: http://www.npmtrends.com/normalize-diacritics
|
143 | [packagephobia-url]: https://packagephobia.now.sh/result?p=normalize-diacritics
|
144 | [bundlephobia-url]: https://bundlephobia.com/result?p=normalize-diacritics
|
145 |
|
146 | [travis-url]: https://travis-ci.org/motss/normalize-diacritics
|
147 | [circleci-url]: https://circleci.com/gh/motss/normalize-diacritics/tree/master
|
148 | [daviddm-url]: https://david-dm.org/motss/normalize-diacritics
|
149 | [codecov-url]: https://codecov.io/gh/motss/normalize-diacritics
|
150 | [coveralls-url]: https://coveralls.io/github/motss/normalize-diacritics?branch=master
|
151 |
|
152 | [codebeat-url]: https://codebeat.co/projects/github-com-motss-normalize-diacritics-master
|
153 | [codacy-url]: https://www.codacy.com/app/motss/normalize-diacritics?utm_source=github.com&utm_medium=referral&utm_content=motss/normalize-diacritics&utm_campaign=Badge_Grade
|
154 | [coc-url]: https://github.com/motss/normalize-diacritics/blob/master/CODE_OF_CONDUCT.md
|