-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
496 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = LF | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = 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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"env": { | ||
"commonjs": true, | ||
"node": true, | ||
"es6": true, | ||
"jasmine": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread": true | ||
}, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"no-template-curly-in-string": "error", | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
"default-case": "error", | ||
"no-fallthrough": "error", | ||
"no-global-assign": "error", | ||
"no-extend-native": "error", | ||
"no-invalid-this": "warn", | ||
"eqeqeq": "warn", | ||
"no-alert": "error", | ||
"no-eval": "error", | ||
"no-with": "error", | ||
"consistent-return": "warn", | ||
"curly": "warn", | ||
"no-tabs": "error", | ||
"arrow-spacing": "error", | ||
"no-undefined": "error", | ||
"global-require": "error", | ||
"no-var": "error", | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"max-len": [ | ||
"error", | ||
{ | ||
"ignoreStrings": false, | ||
"ignoreTrailingComments": false, | ||
"ignoreComments": false, | ||
"code": 80 | ||
} | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"dot-location": [ | ||
"error", | ||
"property" | ||
], | ||
"brace-style": [ | ||
"error", | ||
"1tbs" | ||
], | ||
"camelcase": [ | ||
"error", | ||
{ | ||
"properties": "always" | ||
} | ||
], | ||
"no-console": 0, | ||
"space-before-function-paren": [ | ||
"error", | ||
"never" | ||
], | ||
"keyword-spacing": [ | ||
"error", | ||
{ | ||
"before": true, | ||
"after": true | ||
} | ||
], | ||
"array-bracket-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"comma-spacing": [ | ||
"error", | ||
{ | ||
"before": false, | ||
"after": true | ||
} | ||
], | ||
"complexity": [ | ||
"error", | ||
10 | ||
], | ||
"max-depth": [ | ||
"error", | ||
8 | ||
], | ||
"valid-jsdoc": [ | ||
"error", | ||
{ | ||
"prefer": { | ||
"arg": "param" | ||
}, | ||
"requireReturn": false, | ||
"requireReturnDescription": false, | ||
"requireParamDescription": false, | ||
"preferType": { | ||
"Boolean": "boolean", | ||
"Number": "number", | ||
"Object": "object", | ||
"String": "string" | ||
} | ||
} | ||
] | ||
} | ||
} |
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,23 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain | ||
*.md diss=astextplain |
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,14 @@ | ||
# Eclipse | ||
.settings/ | ||
.project | ||
.buildpath | ||
|
||
# Webstorm | ||
.idea/ | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Personal | ||
TODO | ||
npm-debug.log* |
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,31 @@ | ||
{ | ||
"js": { | ||
"indent_char": " ", | ||
"indent_level": 0, | ||
"indent_with_tabs": false, | ||
"wrap_line_length": 80, | ||
"indent_size": 2, | ||
"keep_array_indentation": false, | ||
"jslint_happy": true, | ||
"end_with_newline": true, | ||
"preserve_newlines": true | ||
}, | ||
"html": { | ||
"indent_char": " ", | ||
"indent_level": 0, | ||
"indent_with_tabs": false, | ||
"indent_size": 2, | ||
"extra_liners": [], | ||
"wrap_line_length": 80 | ||
}, | ||
"css": { | ||
"indent_char": " ", | ||
"indent_level": 0, | ||
"indent_with_tabs": false, | ||
"indent_size": 2, | ||
"align_assignments": false, | ||
"convert_quotes": "double", | ||
"preserve_newlines": true, | ||
"newline_between_rules": false | ||
} | ||
} |
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 @@ | ||
language: node_js | ||
node_js: | ||
- "stable" | ||
script: | ||
- npm test |
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,2 @@ | ||
Julian Kühnel <[email protected]> | ||
Rob Garrison <[email protected]> |
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,26 @@ | ||
# Contributing | ||
|
||
## Development | ||
|
||
_Requirements: Latest [Node.js][node-js] (includes npm)_ | ||
|
||
To install the modules needed for developing, you should clone or download this repository then run: | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
If you want to add a new function, please open an issue for discussion first. And after we have discussed and approved the modification, please add appropriate tests before submitting a pull request. | ||
|
||
After you have contributed something check your code by using: | ||
|
||
```bash | ||
$ npm test | ||
``` | ||
|
||
# Contribution and License Agreement | ||
|
||
If you contribute to this project, you are implicitly allowing your code to be distributed under [this license][license]. You are also implicitly verifying that all code is your original work. | ||
|
||
[license]: https://git.io/v1EBe | ||
[node-js]: https://nodejs.org/en/ |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# node-diacritics-transliterator | ||
|
||
> Diacritic transliteration tool using the diacritics.io API | ||
# Installation | ||
|
||
```bash | ||
$ npm install diacritics-transliterator | ||
``` | ||
|
||
# Module | ||
|
||
The module exports an object with the following functions: | ||
|
||
## replace() | ||
|
||
This function replaces a placeholder inside a string with an array of equivalent diacritics and their mappings. You can use it e.g. to create a regular expression. | ||
|
||
**Parameters**: | ||
|
||
_input_ | ||
|
||
Type: `string` | ||
|
||
A string of JavaScript code. | ||
|
||
_options_ | ||
|
||
Type: `object` | ||
Optional: `true` | ||
|
||
An object of options: | ||
|
||
| Name | Type | Default | Description | | ||
|-------------|--------|-----------------------|---------------------------------------------------------------------------------------------------| | ||
| placeholder | string | '// <% diacritics %>' | The placeholder that will be replaced with an array of equivalent diacritics and their mappings | | ||
| type | string | 'const' | The variable type | | ||
| name | string | 'diacritics' | The variable name | |
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,57 @@ | ||
{ | ||
"name": "diacritics-transliterator", | ||
"version": "0.1.0", | ||
"description": "Diacritic transliteration tool using the diacritics.io API", | ||
"main": "src/main.js", | ||
"scripts": { | ||
"start": "nodemon test/test.js", | ||
"test": "npm run lint && npm run jasmine", | ||
"lint": "eslint src/", | ||
"jasmine": "jasmine test/test.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/diacritics/node-diacritics-transliterator.git" | ||
}, | ||
"keywords": [ | ||
"accents", | ||
"alphabet", | ||
"continent", | ||
"diacritic", | ||
"search", | ||
"language", | ||
"variant", | ||
"database", | ||
"latinize", | ||
"decompose", | ||
"normalize", | ||
"transliterate", | ||
"placeholders", | ||
"RegExp", | ||
"unicode", | ||
"utf8" | ||
], | ||
"author": "The Diacritics Authors", | ||
"maintainers": [ | ||
{ | ||
"name": "Julian Kühnel", | ||
"url": "https://github.com/julmot" | ||
}, | ||
{ | ||
"name": "Rob Garrison", | ||
"url": "https://github.com/Mottie" | ||
} | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/diacritics/node-diacritics-transliterator/issues" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.15.0", | ||
"jasmine": "^2.9.0", | ||
"nodemon": "^1.14.11" | ||
}, | ||
"dependencies": { | ||
"node-fetch": "^1.7.3" | ||
} | ||
} |
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,25 @@ | ||
/*!*************************************************** | ||
* node-diacritics-transliterator | ||
* http://diacritics.io/ | ||
* Copyright (c) 2018 The Diacritics Authors | ||
* Released under the MIT license https://git.io/v1EBe | ||
*****************************************************/ | ||
'use strict'; | ||
const nodeFetch = require('node-fetch'); | ||
|
||
const fetch = () => { | ||
const url = 'https://api.diacritics.io/v1/'; | ||
return new Promise((resolve, eject) => { | ||
nodeFetch(url).then(res => res.json(), err => { | ||
return eject(err.message); | ||
}).then(json => { | ||
if (json) { | ||
resolve(json); | ||
} else { | ||
eject(); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
module.exports = fetch; |
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,12 @@ | ||
/*!*************************************************** | ||
* node-diacritics-transliterator | ||
* http://diacritics.io/ | ||
* Copyright (c) 2018 The Diacritics Authors | ||
* Released under the MIT license https://git.io/v1EBe | ||
*****************************************************/ | ||
'use strict'; | ||
const replace = require('./replace.js'); | ||
|
||
module.exports = { | ||
replace | ||
}; |
Oops, something went wrong.