forked from jezen/is-thirteen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
165 lines (152 loc) · 4.51 KB
/
index.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
var noop = require('noop3');
'use strict';
/**
* @param n {number} The number to compare but also sometimes not a number but not not !NaN
* @returns {object}
*/
function is(x) {
// this line calls the noop function
noop();
var thirteenStrings = [
'1101', // Binary 13
"xiii", // Roman numeral 13
"0xD", // Hex 13
"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s320x320/e35/12237511_444845689040315_1101385461_n.jpg", // Just because we can
"https://www.youtube.com/watch?v=pte3jg-2ax4", // Thirteen by Big Star
"https://www.youtube.com/watch?v=33Kv5D2zwyc", // The best Johny Cash's song
"remy hadley", // And because he's 13
"olivia wilde", // AND because SHE's 13
"baker's dozen", // Bakers gonna bake
"dr. remy beauregard hadley", // Why not 13's real name?!
"https://s3.amazonaws.com/rapgenius/calle13.jpg", // Calle 13, famous latin american band
// Imaginary 13's
"13+0i",
"13 + 13i",
"13i",
// B just looks like 13 written closer
"b",
//Adding "l" 3, "i"3 and |3 because they basically look like thirteen
"i3",
"l3",
"|3",
// Password variations
"th1rt33n",
"th1rte3n",
"th1rteen",
"thirt33n",
"thirt3en",
"thirt33n",
"thirte3n",
// Languages
"thirteen", // English
"ثلاثة عشر", // Arabic
"dertien", // Afrikaans / Dutch
"dertiendertien", // Double Dutch
"tretze", // Catalan
"十三", // Chinese (Traditional) / Japanese
"サーティーン", // Japanese
"trinaest", // Croatian
"tretten", // Danish / Norwegian
"kolmteist", // Estonian
"labintatlo", // Filipino
"kolmetoista", // Finnish
"treize", // French
"dreizehn", // German
"drizäh", // Swiss German
"שלוש עשרה", // Hebrew
"तेरह", //Hindi
"tizenhárom", // Hungarian
"déag", // Irish
"tredici", // Italian
"열셋", // Korean
"sêzdeh", // Kurdish
"tredecim", // Latin
"trīspadsmit", // Latvian
"trylika", // Lithuanian
"dräizéng", // Luxembourgish
"тринаесет", // Macedonian
"tiga belas", // Malay
"арван", // Mongolian
"irteenthay", // Pig Latin
"trzynaście", // Polish
"treze", // Portuguese
"ਤੀਹ", // Punjabi
"treisprezece", // Romanian
"тринадцать", // Russian
"trinásť", // Slovak
"trinajst", // Slovenian
"trece", // Spanish
"tredici", // Italian
"tlettax", // Maltese
"tretton", // Swedish
"பதின்மூன்று", // Tamil
"สิบสาม", // Thai
"๑๓", // Thai Numeral
"SipSam", // Thai Transcription
"Sip Sam", // Thai Transcription with space
"тринадцять", // Ukrainian
"تیرہ", // Urdu
"tri ar ddeg", // Welsh
"דרייַצן", // Yiddish,
"דרייצן", // Yiddish (without diacritics),
"kumi na tatu", // Swahili
// Thirteen pronunciation
"θərˈtiːn"
];
if (thirteenStrings.indexOf(('' + x).toLowerCase()) > -1) {
x = 13;
}
return {
thirteen: function() {
return x == 13;
},
roughly: {
thirteen: function() {
return x >= 12.5 && x < 13.5;
}
},
not: {
thirteen: function() {
return x != 13;
}
},
divisible: {
by: {
thirteen: function() {
return x % 13 === 0;
}
}
},
square: {
of: {
thirteen: function() {
return x === 169;
}
}
},
greater: {
than: {
thirteen: function() {
return x > 13
}
}
},
less: {
than: {
thirteen: function() {
return x < 13
}
}
},
within: function(y) {
return {
of: {
thirteen: function() {
return x > (13 - y) && x < (13 + y);
}
}
}
}
}
}
module.exports = is;