init
This commit is contained in:
45
node_modules/unhomoglyph/CHANGELOG.md
generated
vendored
Normal file
45
node_modules/unhomoglyph/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
1.0.6 / 2020-05-18
|
||||
------------------
|
||||
|
||||
- Update mapping data to version 13.0.0
|
||||
http://www.unicode.org/Public/security/latest/confusables.txt
|
||||
- Encode `\u2028` & `\u2029` as text, #7.
|
||||
- Dev deps bump.
|
||||
|
||||
|
||||
1.0.5 / 2020-03-03
|
||||
------------------
|
||||
|
||||
- Include missed TS definition into npm package.
|
||||
|
||||
|
||||
1.0.4 / 2020-02-05
|
||||
------------------
|
||||
|
||||
- Added TS definition.
|
||||
|
||||
|
||||
1.0.3 / 2019-11-04
|
||||
------------------
|
||||
|
||||
- Update mapping data to version 12.1.0
|
||||
http://www.unicode.org/Public/security/latest/confusables.txt
|
||||
- Dev deps bump.
|
||||
|
||||
1.0.2 / 2017-03-05
|
||||
------------------
|
||||
|
||||
- Update mapping data to version 9.0.0
|
||||
http://www.unicode.org/Public/security/latest/confusables.txt
|
||||
|
||||
|
||||
1.0.1 / 2016-12-09
|
||||
------------------
|
||||
|
||||
- Fix repo link.
|
||||
|
||||
|
||||
1.0.0 / 2016-12-09
|
||||
------------------
|
||||
|
||||
- First release.
|
||||
22
node_modules/unhomoglyph/LICENSE
generated
vendored
Normal file
22
node_modules/unhomoglyph/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2016 Vitaly Puzrin.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
54
node_modules/unhomoglyph/README.md
generated
vendored
Normal file
54
node_modules/unhomoglyph/README.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# unhomoglyph
|
||||
|
||||
[](https://travis-ci.org/nodeca/unhomoglyph)
|
||||
[](https://www.npmjs.org/package/unhomoglyph)
|
||||
|
||||
> Replace all homoglyphs with base characters. Useful to detect similar strings.
|
||||
For example, to prohibit register similar looking nicknames at websites.
|
||||
|
||||
Data source - [Recommended confusable mapping for IDN](http://www.unicode.org/Public/security/latest/confusables.txt), v13.0.0.
|
||||
|
||||
__Note!__ Text after transform is NOT intended be read by humans. For example,
|
||||
`m` will be transformed to `r` + `n`. Goal is to compare 2 strings after
|
||||
transform, to check if sources looks similar or not. If sources look similar,
|
||||
then transformed strings are equal.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install unhomoglyph --save
|
||||
```
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const unhomoglyph = require('unhomoglyph');
|
||||
|
||||
console.log(unhomoglyph('AΑАᎪᗅᴀꓮ')); // => AAAAAAA
|
||||
console.log(unhomoglyph('m')); // => rn (r + n)
|
||||
|
||||
//
|
||||
// Compare nicknames
|
||||
//
|
||||
|
||||
const username1 = 'm';
|
||||
const username2 = 'rn';
|
||||
|
||||
if (unhomoglyph(username1) === unhomoglyph(username2)) {
|
||||
console.log(`"${username1}" and "${username2} look similar`);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Update
|
||||
|
||||
```bash
|
||||
npm run update
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/nodeca/unhomoglyph/blob/master/LICENSE)
|
||||
6313
node_modules/unhomoglyph/data.json
generated
vendored
Normal file
6313
node_modules/unhomoglyph/data.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
node_modules/unhomoglyph/index.d.ts
generated
vendored
Normal file
4
node_modules/unhomoglyph/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare module 'unhomoglyph' {
|
||||
const unhomoglyph: (s: string) => string;
|
||||
export default unhomoglyph;
|
||||
}
|
||||
20
node_modules/unhomoglyph/index.js
generated
vendored
Normal file
20
node_modules/unhomoglyph/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var data = require('./data.json');
|
||||
|
||||
function escapeRegexp(str) {
|
||||
return str.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
|
||||
}
|
||||
|
||||
var REPLACE_RE = RegExp(Object.keys(data).map(escapeRegexp).join('|'), 'g');
|
||||
|
||||
function replace_fn(match) {
|
||||
return data[match];
|
||||
}
|
||||
|
||||
function unhomoglyph(str) {
|
||||
return str.replace(REPLACE_RE, replace_fn);
|
||||
}
|
||||
|
||||
module.exports = unhomoglyph;
|
||||
25
node_modules/unhomoglyph/package.json
generated
vendored
Normal file
25
node_modules/unhomoglyph/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "unhomoglyph",
|
||||
"version": "1.0.6",
|
||||
"description": "Replace all homoglyphs with base characters.",
|
||||
"keywords": [
|
||||
"homoglyph",
|
||||
"homoglyphs"
|
||||
],
|
||||
"repository": "nodeca/unhomoglyph",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"data.json",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && mocha",
|
||||
"update": "node update.js && npm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.0.0",
|
||||
"mocha": "^7.1.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user