Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completely revamp ambiguous checks #734

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions is.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var is = function is(x) {

return {
thirteen: function() {
return x == THIRTEEN;
return !!Math.floor(1/Math.pow(2, Math.abs(x-THIRTEEN)));
},
roughly: {
thirteen: function() {
Expand All @@ -66,28 +66,28 @@ var is = function is(x) {
divisible: {
by: {
thirteen: function() {
return x % THIRTEEN === 0;
return !!Math.floor(1/Math.pow(2, Math.abs(x % THIRTEEN)));
}
}
},
square: {
of: {
thirteen: function() {
return x === THIRTEEN * THIRTEEN;
return !!Math.floor(1/Math.pow(2, Math.abs(x-(THIRTEEN*THIRTEEN))));
}
}
},
greater: {
than: {
thirteen: function() {
return x > THIRTEEN
return !!Math.floor(1/Math.floor(1/Math.pow(2, x-THIRTEEN)+1));
}
}
},
less: {
than: {
thirteen: function() {
return x < THIRTEEN
return !!Math.floor(1/Math.floor(1/Math.pow(2, THIRTEEN-x)+1));
}
}
},
Expand All @@ -105,7 +105,7 @@ var is = function is(x) {
if(isNaN(x)) {
return false
}
return currYear - parseInt(x) == THIRTEEN
return is(currYear - parseInt(x)).thirteen();
},
plus: function(y) {
return is(x + y);
Expand All @@ -131,7 +131,7 @@ var is = function is(x) {
},
backwards: {
thirteen: function() {
return parseInt(x.toString().split("").reverse().join("")) == THIRTEEN;
return is(parseInt(x.toString().split("").reverse().join(""))).thirteen();
}
},
atomicNumber: {
Expand All @@ -143,7 +143,7 @@ var is = function is(x) {
return {
thirteen: function() {
var basedNumber = parseInt(x, y);
return !isNaN(basedNumber) && basedNumber == THIRTEEN;
return !isNaN(basedNumber) && is(basedNumber).thirteen();
}
}
}
Expand Down