-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrike.js
66 lines (57 loc) · 2.12 KB
/
strike.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict'
// Project: striketext
// Author: Kamil Baraniak
// Source Code: https://github.com/kbaraniak
// Copyright: 2022
class strikeTextModule {
_ra(char, oldText, newText) {
let newchar = String(char)
return newchar.replaceAll(oldText, newText);
}
strike(text) {
let result;
// Unicode Letters
result = this._ra(text, "a", "̶a̶");
result = this._ra(result, "b", "̶b̶");
result = this._ra(result, "c", "̶c̶");
result = this._ra(result, "d", "̶d̶");
result = this._ra(result, "e", "̶e̶");
result = this._ra(result, "f", "̶f̶");
result = this._ra(result, "g", "̶g̶");
result = this._ra(result, "h", "̶h̶");
result = this._ra(result, "i", "̶i̶");
result = this._ra(result, "j", "̶j̶");
result = this._ra(result, "k", "̶k̶");
result = this._ra(result, "l", "̶l̶");
result = this._ra(result, "m", "̶m̶");
result = this._ra(result, "n", "̶n̶");
result = this._ra(result, "o", "̶o̶");
result = this._ra(result, "p", "̶p̶");
result = this._ra(result, "q", "̶q̶");
result = this._ra(result, "r", "̶r̶");
result = this._ra(result, "s", "̶s̶");
result = this._ra(result, "t", "̶t̶");
result = this._ra(result, "u", "̶u̶");
result = this._ra(result, "w", "̶w̶");
result = this._ra(result, "v", "̶v̶");
result = this._ra(result, "x", "̶x̶");
result = this._ra(result, "y", "̶y̶");
result = this._ra(result, "z", "̶z̶");
// Polish Letters
result = this._ra(result, "ą", "̶ą̶");
result = this._ra(result, "ć", "̶ć̶");
result = this._ra(result, "ę", "̶ę̶");
result = this._ra(result, "ł", "̶ł̶");
result = this._ra(result, "ń", "̶ń̶");
result = this._ra(result, "ó", "̶ó̶");
result = this._ra(result, "ś", "̶ś̶");
result = this._ra(result, "ź", "̶ź̶");
result = this._ra(result, "ż", "̶ż̶");
return result;
}
}
const strike = new strikeTextModule()
function strikeText(vars){
return strike.strike(vars);
}
module.exports = strikeText;