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

Made a part of the code 13 lines long and also added a misspelled "Thirteen". #757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ var thirteenStrings = [
"Washington Luís", // Brazil's thirteenth president
"Millard Fillmore", // Thirteenth President of the United States
"Louis XIII", // Thirteenth king of France
"teurteen", //its still Thirteen when you say it
"https://s3.amazonaws.com/rapgenius/calle13.jpg", // Calle 13, famous latin american band



// ALL HAIL ZALGO
"1̵̧̨̡̢̡̧̨̪͍̮̗̯̮̲͖̥̳̲̯͔͉̬̘͍͔͙̳͚̠͓̳̪̯̣͚͍͎͇̦̗͙͕̬̭̝͕̱̺̮̼̞̤̙̹̙̘̗̘͔͎̼͙̤̝̖̝̫̝̲̼̫̙͚̗͖̳̱̳͕͙̜̖̘͎̖̭̝̖͔̠̦̜̎̀͌̈́̇͜͜͠ͅͅ3̷̧̢̡̛͖̘͎͎̥̼͙̱̜͖̩̪̼̫̭̙̓̽͆̌̀̈́͗̈͗̿̀̔̏͂́̏̅͛͒̓̐́͗̋̎̓̄͛̇͋̊̇́̅̔̇̉͌̈́̊̍͗̑̌̈͆̉͐̂́̉̓̇͛̃͑̾̌̄͐̀̔́̈̐͛̈́͛̇́̍́͊͛̐́̇͆͆́͒͑̃̾̿̏̀́͆̾̀̀̆̚̕͘͘̚͜͝͝͝͝͝͝͝͝",

Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
// Load the 'is' module from the local './is' file
var is = require('./is');

// Export the 'is' module as the main export of this file
module.exports = is;

// 'is' module likely checks if input is "13" or derivatives
// Use 'is' module's functionality in this module
// Export 'is' module for use in other parts of application
// This is necessary because, why wouldn't there be a library to check if the number is 13?
// The number 13 is a very important number in the world of programming, and it's important to have a library to check if the number is 13.
// This is the BEST npm library out there, fuck everything other than "13"
// This file is 13 lines long
166 changes: 13 additions & 153 deletions is.js
Original file line number Diff line number Diff line change
@@ -1,153 +1,13 @@
var noop = require('noop3');
var consts = require('./consts');

const THIRTEEN = consts.THIRTEEN;
const THIRTEEN_FUZZ = consts.THIRTEEN_FUZZ;
const thirteenStrings = consts.thirteenStrings;

'use strict';

/**
* @param n {number} The number to compare but also sometimes not a number but not not !NaN
* @returns {object}
*/
var is = function is(x) {
// the next line calls the noop function
noop();

// Every element should be lower case

if (thirteenStrings.indexOf(('' + x).toLowerCase()) > -1) {
x = THIRTEEN;
}
// check agin without lower case
else if (thirteenStrings.indexOf(('' + x)) > -1) {
x = THIRTEEN;
}
else if( (typeof x) === "string" && /^[Il1]{13,13}$/.test(x) ) {
x = THIRTEEN;
}
else if (typeof x === 'string') {
var chars = (x).split('');
if (chars.length == THIRTEEN && chars.every(function(e) { return e === chars[0]})) {
x = THIRTEEN;
}
else if (chars.length == 26 && '\ud800' <= chars[0] && chars[0] <= '\udbff'
&& '\udc00' <= chars[1] && chars[1] <= '\udfff'
&& chars.every(function(e, idx) { return e === chars[idx % 2]})) {
x = THIRTEEN;
}
}

return {
thirteen: function() {
return x == THIRTEEN;
},
roughly: {
thirteen: function() {
for (var i = 0, len = thirteenStrings.length; i < len; i++) {
if (('' + x).toLowerCase().indexOf(('' + thirteenStrings[i])) > -1) {
return true;
}
}
return x >= (THIRTEEN - THIRTEEN_FUZZ) && x < (THIRTEEN + THIRTEEN_FUZZ);
}
},
returning : {
thirteen : function(){
return is(x()).thirteen();
}
},
not: {
thirteen: function() {
return !is(x).thirteen();
}
},
divisible: {
by: {
thirteen: function() {
return x % THIRTEEN === 0;
}
}
},
square: {
of: {
thirteen: function() {
return x === THIRTEEN * THIRTEEN;
}
}
},
greater: {
than: {
thirteen: function() {
return x > THIRTEEN
}
}
},
less: {
than: {
thirteen: function() {
return x < THIRTEEN
}
}
},
within: function(y) {
return {
of: {
thirteen: function() {
return x > (THIRTEEN - y) && x < (THIRTEEN + y);
}
}
}
},
yearOfBirth: function() {
var currYear = new Date().getFullYear()
if(isNaN(x)) {
return false
}
return currYear - parseInt(x) == THIRTEEN
},
plus: function(y) {
return is(x + y);
},
minus: function(y) {
return is(x - y);
},
times: function(y) {
return is(x * y);
},
dividedby: function(y) {
return is(x / y);
},
canSpell: {
thirteen: function(){
return x.toLowerCase().includes("t","h","i","r","t","e","e","n");
}
},
anagramOf:{
thirteen:function(){
return x.toLowerCase().split('').sort().join('').trim() == "thirteen".split('').sort().join('').trim();
}
},
backwards: {
thirteen: function() {
return parseInt(x.toString().split("").reverse().join("")) == THIRTEEN;
}
},
atomicNumber: {
thirteen: function() {
return x.toLowerCase().includes("a","l","u","m","i","n","u","m");
}
},
base: function(y) {
return {
thirteen: function() {
var basedNumber = parseInt(x, y);
return !isNaN(basedNumber) && basedNumber == THIRTEEN;
}
}
}
}
};

module.exports = is;
var noop = require('noop3'), consts = require('./consts'), { THIRTEEN, THIRTEEN_FUZZ, thirteenStrings } = consts;
var is = x => ({
thirteen: () => thirteenStrings.includes((''+x).toLowerCase()) || /^[Il1]{13,13}$/.test(x) || (typeof x === 'string' && (x.length === 13 && x[0] === x[12]) || (x.length === 26 && /^\ud800[\udc00-\udfff]$/.test(x))),
roughly: { thirteen: () => thirteenStrings.some(s => (''+x).toLowerCase().includes(s)) || x >= THIRTEEN-THIRTEEN_FUZZ && x < THIRTEEN+THIRTEEN_FUZZ },
returning: { thirteen: () => is(x()).thirteen() },
not: { thirteen: () => !is(x).thirteen() },
divisible: { by: { thirteen: () => x % THIRTEEN === 0 } },
square: { of: { thirteen: () => x === THIRTEEN*THIRTEEN } },
greater: { than: { thirteen: () => x > THIRTEEN } },
less: { than: { thirteen: () => x < THIRTEEN } },
within: y => ({ of: { thirteen: () => x > THIRTEEN-y && x < THIRTEEN+y } }),
yearOfBirth: () => !isNaN(x) && (new Date().getFullYear() - parseInt(x)) === THIRTEEN
}); module.exports = is;