forked from jezen/is-thirteen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (49 loc) · 1.34 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
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
"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s320x320/e35/12237511_444845689040315_1101385461_n.jpg", // Just because we can
"rem hadley", // And because he's 13
// Languages
"thirteen", // English
"тринадцать", // Russia
"trzynaście", // Polish
"trece", // Spanish
"tredici", // Italian
"dreizehn", // German
"שלוש עשרה", // Hebrew
"13+0i", //Imaginary 13's
"13 + 13i",
"13i"
]
if (thirteenStrings.indexOf(x.toLowerCase()) > -1) {
x = 13;
}
return {
thirteen: function() {
return x == 13;
},
roughly: {
thirteen: function() {
return x >= 12.5 && x < 13.5;
}
},
within: function(y) {
return {
of: {
thirteen: function() {
return x > (13 - y) && x < (13 + y)
}
}
}
}
}
}
module.exports = is;