@falsejs/falsejs
Version:
1,050 lines (1,006 loc) • 136 kB
JavaScript
/**
* FalseJS
* The ultimate library for getting the value of false.
* I didn't choose the 10x life. The 10x life chose me.
* @author tj-commits
* @license MIT
* @version whatever_the_version_in_the_package.json_is
*/ /*
███████████████████████████████████████████████████████████████████████████████████
sanity
███████████████████████████████████████████████████████████████████████████████████ */
// #region IMPORTANT CHECKS
let doesItWork
try {
doesItWork = require("is-require-working")
} catch (e) {
doesItWork = !e
}
if (!doesItWork) {
//o crap
throw new Error("require not working, exiting node")
} else {
const isComputerOn = require("is-computer-on")
const isComputerOff = require("is-computer-off")
if (!isComputerOn() || isComputerOff()) {
throw new Error(
"no point doing anything if computer is not on, exiting node"
)
} else {
const isComputerOnFire = require("is-computer-on-fire").isComputerOnFire
if (isComputerOnFire()) {
throw new Error(
"OH MY GOSH YOUR COMPUTER IS ON FIRE WHY ARE YOU WASTING TIME USING A JOKE POINTLESS NPM PACKAGE GET YOUR FIRE EXTINGUISHER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
} else {
const isNodeRunning = require("node-script-running")
if (!isNodeRunning()) {
// there's no point doing anything if node is not running
} else {
//#endregion IMPORTANT CHECKS
// #region BEGINNING REQUIRES
require("vanilla-javascript") // * because we are making something awesome!
require("vapor-js-npm") // the most awesome and flexible javascript framework
require("none")() // this improves load times and performance
require("-") // very, very, important
require("whatev") // also very, very, important
require("get-member")() // no silent undefined values
require("array-get-member")() // no silent undefined values for arrays
require("make-jquery-global")() // i <3 jQuery
require("jquery-basic-arithmetic-plugin") // why not exploit jQuery for math
require("console.dog") // bark
require("user")() // idk why this has so many downloads
require("ecto1")() // the most advanced thing ever
// #endregion BEGINNING REQUIRES
// #region FACTORY CODE
var jQuery = global.jQuery // have to define it as a variable so ESLint doesn't yell at me
;(function (factory) {
// Export everything
module.exports.default = factory(jQuery)
})(function ($) {
"use strict"
//#endregion FACTORY CODE
//* MODULE IMPORTS
// #region MODULE IMPORTS
const GetIntrinsic = require("get-intrinsic") // cache our intrinsics
const variableHolder = {} // store our variables
const _ = require("lodash") // every project needs lodash
const underscore = require("underscore") // underscore.js. the predecessor of lodash.
const React = require("react") // the hype framework everyone uses for some reason
const ReactDOMServer = require("react-dom/server") // part of react
const cheerio = require("cheerio") // cheerio!
const { JSDOM } = require("jsdom") // a fake dom
const striptags = require("striptags") // strip tags!
const chalk = require("chalk") // color is the best!*/
var clc = require("cli-color") // another color module
const colors = require("@colors/colors/safe") // colors
const chalkbox = require("chalkbox") // with a box
const c = require("ansi-colors") // nothing wrong with even more colors
const pc = require("picocolors") // maybe even more colors libraries
const axios = require("axios") // so we can send requests
const { generatePhoneNumber } = require("phone-number-generator-js") // generate some phone numbers
const emptyString = require("empty-string") // an empty string
const n0p3 = require("n0p3") // a noop
const noop2 = require("noop2") // nothing wrong with another noop
const noop3 = require("noop3") // nothing wrong with yet another noop
const noop4 = require("noop4") // noop factory
const noop6 = require("noop6") // again, nothing wrong with more noops
const noop7 = require("noop7") // i think you see where i'm going
const noop8 = require("noop8") //another...
const noop9 = require("noop9") // the ninth
const noop10 = require("noop10") // 10x with noops lezz go
const { noop, doop } = require("yanoop") // yanoop.
const asyncUtilNoop = require("async.util.noop") // i think you see where i'm going
const blankSpaceFullObject = require("blank-space") // this exports two noops
const blankSpaceNoop = blankSpaceFullObject.noop // noop one
const blankSpace = blankSpaceFullObject._ // and noop two
const noopGenerator = require("co-noop") // a noop generator!
const fjNoop = require("fj-noop").FUNC // fj noop
const lodashNoop = require("lodash.noop") // lodash noop
const lodash_Noop = require("lodash._noop") // another lodash noop!
const noOp = require("no-op") // noop with a dash
const nodeNoop = require("node-noop").noop // a noop
const noopUtility = require("@stdlib/utils-noop") // the most practical
const trueNoop = require("true-noop") // one of few true noops.
const noopFn = require("noop-fn") // it ends with a fn
const noopaam = require("noopaam") // noopaaaaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmm
const nop = require("nop") // just nop. what a funny name
// nop. nop. bop bop. boop. nop. boop. nop. nop. bop. bop bop nop.
// back to the code
const es2015Noop = require("es2015-noop") // the future is here
const kgryteNoop = require("@kgryte/noop") // how do you pronounce this guy's name
const blackHole = require("a-black-hole") // OH NO WE ARE GOING IN TO THE BLACK HOLE
const infinoop = require("infinoop") // noop. for ever. for. ev. er. FOR. EV. ER
const mNoop = require("m.noop").noop // the only other true noop i could find besides true-noop itself
const ahsmNoop = require("@ahsm/noop") // ahsm noop
const { noop: qcCoreNoop, nullFn: Null } = require("qc-core") // the qc core
const nooop = require("nooop") // someone put too many o's
const ryotahNoop = require("@ryotah/noop") // ryotah made a noop
const zodashNoop = require("@zodash/noop").noop // zodash made a noop
const jacobZuma = require("jacob-zuma") // south african flavored noop
const onceNoopFactory = require("once-noop/factory") // make a noop which can only be called once
const noopTS = require("noop-ts").default // noop ts
const voidFn = require("voidfn") // void fn
const noopExec = require("noop-exec") // exec
const attempt = require("attempt-statement") // has more features than trycatch statement
const assert = require("assert-fn") // more simple and elegant than built in node:assert
const hasSelfEquality = require("has-self-equality") // most things have self equality but lets make sure
const hasNoSelfEquality = require("has-no-self-equality") // again self equality
const isNumberOddOrEven = require("is-number-odd-or-even") // this function isn't made to return a certain value if it's even, or a certain value if it's odd, this function returns if a value is odd or even like (isOdd || isEven) in an illustration not isOdd ? "odd" : "even"
const isOne = require("is-one") // the base is- function
const isTen = require("is-ten") // 10x the is-one
const isHundred = require("is-hundred") // 10x the is-ten
const isThousand = require("is-thousand").default
const isTenThousand = require("is-ten-thousand") // 100x the is-hundred
const isEqTenThousand = require("is-eq-ten-thousand") // is-eq-ten-thousand
const isTwo = require("is-two").isTwo // the successor of one
const isThree = require("is-three") // the successor of two
const isNegativeZero = require("is-negative-zero") // isNegativeZero
const isNegativeZero2 = require("negative-zero") // can't hurt to have another negative zero checker
const isPositiveZero = require("positive-zero") // positive zero
const isTrue = require("is-true") // true
const isPreciselyTrue = require("is-precisely-true") // real true
const is = require("is-thirteen") // comparison-against-twelve-free environment
const isThreeHundred = require("is-three-hundred") // is-three-hundred
const isNumber = require("is-number") // jonschlinkert
const isActualNumber = require("is-actual-number") // my is-number
const isIsOdd = require("is-is-odd") // isIsOdd
const isOdd = require("is-odd") //isOdd
const isOd = require("is-od") // isOd
const isOddAndrew = require("is-odd-andrew") // isOddAndrew
const isOddNum = require("is-odd-num") // another odd checker
const isIntegerOdd = require("is-integer-odd") // another!!!!
const noteven = require("not-even") // not even
const isUneven = require("is-uneven") // whysomany
const numberKind = require("number-kind") // this exports two fns!
const isOddFaster = require("is-odd-faster").isOdd // is Odd but faster
const gabrielBrotasIsOdd = require("gabriel-brotas-is-odd") // gabriel made an is odd
const returnIfOddNumber = require("return-if-odd-number") // if odd number
const numberIsOdd = require("number-is-odd") // check if a number is odd
const isNumOdd = require("is-num-odd") // check if a num is odd
const isOddNumber = require("is-odd-number") // check if a od is number
const isNumberOdd = require("is_number_odd") // check if a number is odd
const isThisNumberOdd = require("is-this-number-odd") // check if a this is number odd
const isRealBoolean = require("is-real-boolean") // BOOLEANS
const add = require("examplebyraji") // a package
const cowsay = require("cowsay") // let's say stuff
const lolcatjs = require("lolcatjs") // the rainbow i tastes it
const owoifyx = require("owoifyx").default // UwU
const Uwuifier = require("uwuifier").default // UwU (x2)
const amogus = require("amogusify") // amogusify our amogus
const luaParser = require("luaparse") // parse lua
const luaInterpreter = require("lua-interpreter") // interpret lua
const exit = require("exit") // 10x better than process.exit
const appendType = require("append-type") // PUT THE TYPE NEXT TO A VALUE!!
const concatenater = require("concatenater") // CONCATENATE STUFF!!!
const generalConcat = require("general-concat") // GENERALLY CONCATENATE STUFF!!!
const lowercase = require("convert-to-lower-case") // CONVERT TO LOWER CASE
const construct = require("construct-new") // better than the new keyword
const $Promise = require("bluebird") // promise ponyfill cuz why not
//#endregion MODULE IMPORTS
//#region INTRINSICS
// * INTRINSICS
const $Array = GetIntrinsic('%Array%') // arary
const $Boolean = GetIntrinsic("%Boolean%") // blooean
const $Date = GetIntrinsic("%Date%") // dtae
const MathRandom = GetIntrinsic("%Math.random%") // rnadom
const MathFloor = GetIntrinsic("%Math.floor%") // folor
const MathRound = GetIntrinsic("%Math.round%") // ruond
const PI = GetIntrinsic("%Math.PI%") // ip
const MathAbs = GetIntrinsic("%Math.abs%") // asb
const StringCharAt = GetIntrinsic("%String.prototype.charAt%") // chraAt
//#endregion INTRINSICS
//#region MORE MODULE IMPORTS
const _calculateFalseAprilFools = require("./aprilFoolsCalculateFalse") // april fools
const couldThisCouldItBeTrue = require("@falsejs/is-true-helper") // check if a value is true
const {
returnFalse,
isFalse: isPreciselyEqualToFalse
} = require("@falsejs/core-ish") // some core ish functions
const isJanuary = require("is-january") // month 1
const isFebruary = require("is-february") // month 2
const isMarch = require("is-march") // month 3
const isApril = require("is-april") // month 4
const isMay = require("is-may") // month 5
const isJune = require("is-june") // month 6
const isJuly = require("is-july") // month 7
const isAugust = require("is-august") // month 8
const isSeptember = require("is-september") // month 9
const isOctober = require("is-october") // month 10
const isNovember = require("is-november") // month 11
const isDecember = require("is-december") // month 12
const isMonday = require("is-monday") // day of the week 1 according to international standard, day of the week 2 according to the us
const isTuesday = require("is-tuesday") // day of the week 2 according to international standard, day of the week 3 according to the us
const isWednesday = () => require('is-wednesday')(Today) // day of the week 3 according to the international standard, day of the week 4 according to the us
// now we gotta sing rebecca black's song
const isThursday = require("is-thursday") /// Yesterday was thursdayyyy
const isFriday = require("is-friday") // tooo-ddadayy is friday! we so ecited
const isSaturday = require("is-saturday") // tomorrow will be saturday
const isSunday = require("is-sunday") // and sunday comes after
const isWeekend = require("is-weekend") // looking forward to the weeeeekeend
const zr0 = require("integer-value-positive-zero") // get the number zero 1
const {
returnZero,
ZeroCalculationMethod,
isZero: zerosurgeIsZero
} = require("zerosurge") // get the number zero 2
const one = require("the-number-one").default // get the number one
const Two = require("two") // get number 2
const three = require("numeric-constant-three") // get number 3
const four = require("always-four") // number 4
const five = require("five") // num5
const six = require("number-six") // n6
const seven = require("se7en") // 7
const eightToolkit = require("eight-toolkit") // it's 8, in a toolkit!
const ninev9 = require("value-nine") // it's v9 of 9, when there was only v1 of 9 first, so it's 9x better (but 10x engineered)
const ten = require("the-number-ten") // 10
const eleven = require("eleven") // 11
const twelve = require("tw12ve") // 12
const thirteenResolver = require("always-thirteen") // 13
const fourteen = require("fourteen") // 14
const fifteen = require("number-fifteen") //15
const fifteenPointEightThreeFiveTwoSixSixEightTwoAndSoOn = require("fifteen-point-eight-three-five-two-six-six-eight-two-and-so-on") //-this-can-be-rounded-to-sixteen
const sixteen = require("sixteen-constant") //thisisthenumbersixteenomg161616
const integer17 = require("seventeen-integer") //17
const Eighteen = require("eighteen-positive-number-interactions") // Interact positively with eighteen
const nineteenify = require("nineteenify") // Hey there what our you doing? *nineteenifies*
const numbertwenty = require("numbertwenty") // 20
const always21 = require("always-21") // 21
const twentytwo = require("twentytwo")() // 22
const { TWENTY_THREE } = require("twenty-three-tools") // 23 tools
const hundred = require("number-one-hundred") // 100!
const numberOneHundred = hundred // alias!
const theNumberSeven =
require("@onesneakymofo/the-number-seven").default // this is actually a string for some reason
const inf = require("infinities") // INFINITE
const bool = require("true-bool") // booleans
const successor = require("successor") // successor
const tru = require("tru") // if statements arent verbose enough
const If = require("if") // always good to have another if statement!
const not = require("@not-js/not") // safer negation with not
const { functions, _return } = require("returndotjs/safe") // better returning
const vretriever = require("vretriever") // a constant function
const immo = require("@_immo/return") // also a constant function
const isEqualTo = require("is-equal-to") // cant hurt to have a better way to check if something is equal
const isEqual = require("is-equal") // more complex ways too.
const strictlyEqual = require("are-strictly-equal") // and strict equality.
const getTypeOf = require("get-ecmascript-type-of") // better typeof
const extremejs = require("@extremejs/utils") // TO THE EXTREME
var trueValue = require("true-value") // the sister of falsejs
var t = require("true") // the prequel to trueValue
var tVal = trueValue // tVal sounds cool so i put it here too
const _f = require("false") // the sequel to the prequel to trueValue
const { mGenbaneko } = require("genbaneko") // i like cats
const leftPad = require("left-pad") //every project needs leftpad.
const rightPad = require("right-pad") //to the right, to the right.
const zeropad = require("zeropad") //every project could use a third pad.
const pad = require("pad") //this is the pad to end all pads.
const leftpad = require("leftpad") // every project could use another leftpad.
const rightpad = require("rightpad") // another right pad too.
const WestPad = require("west-pad").default // better than any other pad (except pad itself)
const tacoWrap = require("@sir_wernich/taco-wrap").default // pad our strings in tacos.
const isWindwos = require("is-windows") // did i misspell the variable name? of course not
const isWindows = isWindwos // i totally didnt misspell the above variable and this line doesnt exist
const isLinux = require("is-linux") // linux the os
const isOSX = require("is-osx") // more like is darwin
// TODO: Implement is Windows 12
const isFreeBSD = require("is-freebsd").isFreeBSD // i've never even heard of this operating system until now.
const thirteen = require("thirteen") // multiply by thirteen
const os = require("node:os") // maybe node js itself can help us calculate more operating systems
const http = require("node:http") // http!
const http2 = require("node:http2") //http/2!
const https = require("node:https") // https!
const crypto = require("node:crypto") // mine me some crypto
const fs = require("node:fs") // write our files
const uuid = require("uuid") // generate some uuids
const getStringLength = require("utf8-byte-length") // get string length
const emoji100 = require("emoji-100") // 100 emoji
const randomHappyEmoji = require("random-happy-emoji") // HAPPY
const randomAngryEmoji = require("random-angry-emoji") // ANGRY
const randomFoodEmoji = require("random-food-emoji") // FOOD
const dolphinFact = require("dolphin-fact") // DOLPHIN FACT
const logOne = require("useless-one-log") // log the number one
const Bro = require("brototype") // Bro
const literally = require("literally") // better than literally
const constant = require("const") // can't even name this variable after the actual library
const lodashdotconstant = require("lodash.constant") // lodash's version
const WeirdInstanceof = require("weird-instanceof") // drunk programming only
const { log: ltc, setLogFuntion } = require("logtoconsole") // best logger
const weirdLtc = WeirdInstanceof(ltc) // weird
const yesNo = require("yes-no") // YES NO YES NO YES NO
const { undefined } = require("undefined-is-a-function") // eslint-disable-line no-shadow-restricted-names
const isNull = require("@is-(unknown)/is-null") // IS null
const isUndefined = require("@is-(unknown)/is-undefined") // IS undefined
const isNil = require("@is-(unknown)/is-nil") // IS null OR undefined :O
const isUnnull = require("is-unnull") // IS UNNULL
const isNaN = require("is-nan") // IS NAN
const isNegativeInfinity = require("negative-infinity").check // IS NEGATIVE INFINITY
const is1 = require("is-eq-one") // is 1
const is0 = require("is-eq-zero") // is 0
const is0_2 = require("is-zero") // is 0 (x2)
const isFour = require("is-equal-four") // is 4
const isFive = require("is-eq-five") // is 5
const isSix = require("is-eq-six") // is 6
const isSeven = require("is-eq-seven") // is 7
const useGarbage = require("garbage") // trash.
const isuseless = require("is-useless").isuseless // super useless
const isAprilFools = require("is-april-fools") // Is it april fools
const meow = require("meow.js") // library for meowing
const { ErrorType: ERROR, immediateError } = require("immediate-error") // throw errors
const throwError = require("throw-error") // throw errors
const hello = require("hello-vga-function").default // hello vga function
const greet = require("hell0-world") // greet our guys
//#endregion MORE MODULE IMPORTS
// *number formatter
// #region Number Formatter
const NumberFormatter = Intl.NumberFormat
const numberFormatter = construct({ target: NumberFormatter })
//#endregion Number Formatter
//#region MKDIR .FALSEJS
// * create .falsejs folder if doesn't already exist
tru(not(fs.existsSync)(".falsejs"))
.then(() => {
fs.mkdirSync(".falsejs")
})
.end()
//#endregion MKDIR .FALSEJS
// * CONSTANTS
//#region CONSTANTS
variableHolder._lilmessage = colors.red(
`[falsejs] This error should never be shown. If you are seeing this error in the console, please file an issue on the github repo. Thank you.`
)
const my = {
cons: {
tants: {
STARTING_SUCCESSOR_HELPER_STACK: zr0(),
FALSE: _f(),
ERROR_THAT_WILL_NEVER_BE_SHOWN: isEqualTo(
concatenater(
construct({
target: $Array,
args: [...isThreeHundred.split(isThreeHundred)]
})
.getMember(zr0())
.concat(variableHolder._lilmessage)
)
.append(
construct({
target: $Array,
args: [...noop2.toString().split(noop2.toString())]
}).getMember(zr0())
)
.toString(),
variableHolder._lilmessage
)
? construct({
target: $Array,
args: [...voidFn.toString().split(voidFn.toString())]
})
.getMember(zr0())
.concat(variableHolder._lilmessage)
: isThreeHundred.toString(),
TEN_THOUSAND: 10e3,
LEFT_PAD_INPUT: jQuery.multiply(
five(),
jQuery.add(five(), jQuery.divide(five(), five()))
),
RIGHT_PAD_INPUT: jQuery.multiply(
five(),
jQuery.add(five(), jQuery.divide(five(), five())) // i cant even comprehend life and existence anymore
),
PAD_INPUT: five(),
LEFTPAD_INPUT: jQuery.multiply(
five(),
jQuery.add(five(), jQuery.divide(five(), five()))
),
RIGHTPAD_INPUT: jQuery.multiply(
five(),
jQuery.add(five(), jQuery.divide(five(), five()))
),
WEST_PAD_INPUT: jQuery.multiply(
five(),
jQuery.add(five(), jQuery.divide(five(), five()))
),
ZEROPAD_INPUT: jQuery.subtract(
five(),
jQuery.divide(five(), five())
),
WEST_PAD_DEVICE_DIRECTION: "N",
SPACE: " ",
STARTING_VVALUE_USER_MINUS: zr0(),
STARTING_VVALUE_USER_PLUS: zr0(),
STARTING_VVALUE_USER_PAD: zr0(),
NO: getNo(), // the string no
YES: "yes", // the string yes
FALSEJS_HTTP_PORT: 32573, // "FALSE" in telephone number letters
FALSEJS_HTTP2_PORT: 32574,
FALSEJS_HTTPS_PORT: 32575,
TODAY: construct({
target: $Date
}),
USERNAME: (function () {
var username = undefined()
attempt(() => {
username = os.userInfo().username
})
.rescue(() => {
username = "user"
})
.else(nodeNoop)
.ensure(nop)
.end()
return username
})()
}
}
}
const {
STARTING_SUCCESSOR_HELPER_STACK,
FALSE,
ERROR_THAT_WILL_NEVER_BE_SHOWN,
TEN_THOUSAND,
LEFT_PAD_INPUT,
RIGHT_PAD_INPUT,
PAD_INPUT,
ZEROPAD_INPUT,
LEFTPAD_INPUT,
RIGHTPAD_INPUT,
WEST_PAD_INPUT,
SPACE,
STARTING_VVALUE_USER_MINUS,
STARTING_VVALUE_USER_PLUS,
STARTING_VVALUE_USER_PAD,
NO,
YES,
FALSEJS_HTTP_PORT,
FALSEJS_HTTP2_PORT,
FALSEJS_HTTPS_PORT,
TODAY: Today,
USERNAME: username
} = my.getMember("cons").getMember("tants")
//#endregion CONSTANTS
// *CLASSES
//#region CLASSES
let Logger = class {
constructor(enableLogging) {
this.enableLogging = enableLogging
}
log(log) {
if (isEqualTo(this.enableLogging, t())) {
log instanceof weirdLtc
}
}
}
let FalseJSValidationFailedToPassError = class extends Error {}
let SuccessorHelper = class {
s(value) {
let result
result = add(value, one)
return result
}
}
let TernaryCompare = class {
constructor(condition, ifTrue, ifFalse) {
this.condition = condition
this.ifTrue = ifTrue
this.ifFalse = ifFalse
}
compare() {
return this.condition ? this.ifTrue : this.ifFalse
}
}
let ObjectOrFunctionParemeterName = class {
constructor(name) {
this.name = name
}
getName() {
const name = this.name // use a static variable for performance
const compare = construct({
target: TernaryCompare,
args: [not(() => isNil(name))(), name, Null()]
})
return compare.compare()
}
}
let CLIColorInstance = class {
constructor(booleanValue) {
tru(
isTrue(
{ booleanValue },
construct({
target: ObjectOrFunctionParemeterName,
args: ["booleanValue"]
}).getName()
)
)
.then(n0p3)
.otherwise(n0p3)
.end()
this.instance = require("cli-color")
}
getInstance() {
return this.instance
}
}
//#endregion CLASSES
// * creation of classes
//#region creation of classes
const trueComparison = construct({
target: TernaryCompare,
args: [tVal, tVal, not(() => tVal)()]
})
const { s } = construct({ target: SuccessorHelper }) // our successorhelper
const clc_ = construct({
target: CLIColorInstance,
args: [useGarbage()]
}).getInstance() // colors are the best! chalk chalk chalk
clc = clc_ // setit
const uwuifier = construct({ target: Uwuifier })
const westPad = construct({ target: WestPad, args: ["N"] })
//#endregion creation of classes
// * A CHECK
//#region A CHECK
// lets make sure jquery-basic-arithmetic-plugin works
if (not(() => Bro($).doYouEven("add"))()) {
var True_Logger = construct({ target: Logger, args: [t()] })
// uh oh... jquery basic arithmetic plugin didn't work
True_Logger.log(
colors.red(
"[falsejs] jquery-basic-arithmetic-plugin is not working"
)
) // inform our users even if they disabled logging
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin")
require("jquery-basic-arithmetic-plugin") // now it should work
if (not(() => Bro($).doYouEven("add"))()) {
True_Logger.log(
colors.red(
"[falsejs] jquery-basic-arithmetic-plugin is still not working"
)
) // inform our users even if they disabled logging
$.add = (...nums) => {
var total = zr0()
// let's use underscore instead of forEach
underscore.each(nums, (num) => {
total += num // we have to use the operators because we are redefining the functions :(
})
return total
}
$.subtract = (...nums) => {
var total = zr0()
// this time we'll use lodash
_.each(nums, (num) => {
total -= num
})
return total
}
$.equals = (v1, v2) => {
if (not(() => isActualNumber(v1) && !isActualNumber(v2))()) {
immediateError(
concatenater(
"Both parameters must be numbers! Instead what was passed in was "
)
.append(appendType(v1))
.toString()
.concat(
concatenater(" or ").append(appendType(v2)).toString()
)
) // not the same message as the original but i dont know what it is and am too lazy to look into the source code
return exit(one) // just in case it doesn't exit
}
return isEqualTo(v1, v2) /// not usnig $.equals because we are literally redefining that
}
if (not(() => Bro($).doYouEven("add"))()) {
True_Logger.log(
colors.red(
`[falsejs] Either your Node.js is broken, or jQuery is immutable. Something went wrong.`
)
)
} else {
True_Logger.log(
pc.green(
`[falsejs] jquery-basic-arithmetic-plugin is not working so falsejs defined the functions that are injected into jquery by itself`
)
)
}
} else {
True_Logger.log(
pc.green(
`[falsejs] jquery-basic-arithmetic-plugin is now working`
)
)
}
}
// #region SETLOGFUNTION INIT
// * SETLOGFUNTION
const surpriseArray = [] // define empty array
// set a log function
setLogFuntion(() => {
// create an ending random number for our users eventually
surpriseArray.push(
construct({
target: TernaryCompare,
args: [
isEqualTo(
randomBoolean(
jQuery.multiply(five(), jQuery.divide(one, ten)),
{ log: noop3 }
),
t()
),
jQuery.multiply(MathRandom(), TEN_THOUSAND),
jQuery.multiply(
MathRandom(),
MathFloor(
jQuery.divide(
jQuery.multiply(TEN_THOUSAND, MathRandom()),
ten
)
)
)
]
}).compare()
)
})
//#endregion SETLOGFUNTION INIT
//* HELPERS
//#region HELPER FUNCTIONS
// define a little helper function
/**
* Performs an asynchronous operation and logs a message.
*
* @async
* @function doSomethingAsync
* @param {Logger} logger - An instance of the Logger class used for logging.
* @returns {Promise<Logger>} - A Promise that resolves with the logger instance after a 200ms delay.
*
* @example
* const logger = new Logger();
* doSomethingAsync(logger)
* .then((logger) => {
* // use logger here
* });
*/
async function doSomethingAsync(logger) {
logger.log(clc.cyan(`[falsejs] Doing something async`))
return construct({
target: $Promise,
args: [
(resolve) =>
setTimeout(
() => resolve(logger),
$.multiply(numberOneHundred, Two())
)
]
})
}
/**
* Logs a message. Used as the callback for the function doSomethingAsync
*
* @function resultOfDoingSomethingAsync
* @param {Logger} logger - An instance of the Logger class used for logging.
* @returns {void}
*
* @example
* const logger = new Logger(t());
* resultOfDoingSomethingAsync(logger);
* // Logs: [falsejs] Did something async
*/
function resultOfDoingSomethingAsync(logger) {
logger.log(pc.green(`[falsejs] Did something async`))
}
/**
* Calculates the predecessor of a given number by subtracting 1.
*
* @function predecessor
* @param {number} n - The number to find the predecessor of.
* @returns {number} The predecessor of the given number.
*
* @example
* predecessor(five()); // Returns 4
*/
function predecessor(n) {
return jQuery.subtract(n, one)
}
/**
* Returns the same value based on the input number, using various mathematical operations and padding.
*
* @param {number} num - The input number.
* @returns {number} - The calculated value.
*
* @example
* vValue(1000) // Returns 1000
*/
function vValue(num) {
if (not(strictlyEqual)(getTypeOf(num), extremejs.TYPE.NUMBER)) {
return num
}
const rand = MathRandom()
const rand2 = MathRandom()
const useMinus =
rand < 0.3333333333333333
? trueComparison.compare()
: _f()
const usePlus =
rand > 0.3333333333333333 && rand < 0.6666666666666666
? trueComparison.compare()
: _f()
const usePad =
rand > 0.6666666666666666
? trueComparison.compare()
: _f()
const useLeftPad = rand2 < 0.5
const useRightPad = !useLeftPad
if (useMinus) return $.subtract(num, STARTING_VVALUE_USER_MINUS)
if (usePlus) return $.add(num, STARTING_VVALUE_USER_PLUS)
if (usePad) {
if (useLeftPad)
return parseInt(
leftPad(num.toString(), STARTING_VVALUE_USER_PAD).trim()
)
if (useRightPad)
return parseInt(
rightPad(num.toString(), STARTING_VVALUE_USER_PAD).trim()
)
}
return num
}
// * SAY FUNCTION
/**
* This function uses the cowsay library to print a message in a cow's speech bubble.
* The cow's speech bubble is customized with the provided message and a random cow face.
*
* @param {string} message - The message to be printed in the cow's speech bubble.
*
* @returns {undefined} - This function does not return a value. It only prints the message.
*/
function sayIt(message) {
lolcatjs.fromString(
cowsay.say({ text: message, r: bool([one, Two()]) })
)
}
// * CHECK FUNCTIONS THAT GET CALLED LATER
// our ten thousand should be ten thousand
function isTenThousandTenThousand(
shouldDoSomethingAsync = _f(),
logger
) {
const TEN_THOUSAND1 = TEN_THOUSAND
const TEN_THOUSAND2 = $.subtract($.add(TEN_THOUSAND, one), one)
const TEN_THOUSAND3 = predecessor(successor(TEN_THOUSAND))
const TEN_THOUSAND4 = TEN_THOUSAND.valueOf()
const TEN_THOUSAND5 = $.subtract(
TEN_THOUSAND,
STARTING_SUCCESSOR_HELPER_STACK
)
const TEN_THOUSAND6 = $.add(
TEN_THOUSAND,
STARTING_SUCCESSOR_HELPER_STACK
)
const TEN_THOUSAND7 = vValue(TEN_THOUSAND)
attempt(() => {
assert(
isTenThousand(TEN_THOUSAND1, shouldDoSomethingAsync),
"10,000 is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND2, shouldDoSomethingAsync),
"10,000 + 1 - 1 is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND3, shouldDoSomethingAsync),
"successor(10,000) - 1 is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND4, shouldDoSomethingAsync),
"(10000).valueOf() is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND5, shouldDoSomethingAsync),
"10,000 - 0 is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND6, shouldDoSomethingAsync),
"10,000 + 0 is not 10,000"
)
assert(
isTenThousand(TEN_THOUSAND7, shouldDoSomethingAsync),
"the vvalue of 10,000 is not 10,000"
)
})
.rescue((error) => {
logger.log(
colors.red(
"[falsejs] Failed to verify that 10,000 is equal to 10,000 with error ".concat(
error
)
)
)
})
.else(() =>
logger.log(
pc.green(
"[falsejs] Verified that 10,000 is equal to 10,000 in (almost) all ways possible"
)
)
)
.ensure(n0p3)
.end()
}
function doSelfEqualityChecks(loggingEnabled) {
const logger = construct({ target: Logger, args: [loggingEnabled] })
const loggingENabled = loggingEnabled // an alias for loggingenabled in case we accidentally do the wrong capitalization on the n
assert(
hasSelfEquality(isThreeHundred),
StringValueof("[falsejs] IsThreeHundred has no self equality")
)
logger.log(
pc.green(
`[falsejs] Verified that the string "Vladimir" has self equality`
)
)
assert(
hasNoSelfEquality(NaN),
StringValueof("[falsejs] NaN-has-self-equality")
)
logger.log(
pc.green(`[falsejs] Verified that NaN has no self equality`)
)
assert(
isNumberOddOrEven(
returnZero({
method: ZeroCalculationMethod.CreashaksOrganzine,
loggingEnabled
}),
loggingEnabled
),
StringValueof("[falsejs] 0 is not odd or even")
)
assert(
isNumberOddOrEven(
returnZero({
method: ZeroCalculationMethod.NumberPrototypeValue,
loggingENabled
}),
_f()
),
StringValueof("[falsejs] 0 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-0-is-odd-or-even`))
assert(
isNumberOddOrEven(one, _f()),
StringValueof("[falsejs] 1 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-1-is-odd-or-even`))
assert(
isNumberOddOrEven(Two(), _f()),
StringValueof("[falsejs] 2 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-2-is-odd-or-even`))
assert(
isNumberOddOrEven(three(), _f()),
StringValueof("[falsejs] 3 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-3-is-odd-or-even`))
assert(
isNumberOddOrEven(four(), _f()),
StringValueof("[falsejs] 4 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-4-is-odd-or-even`))
assert(
isNumberOddOrEven(five(), _f()),
StringValueof("[falsejs] 5 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-5-is-odd-or-even`))
assert(
isNumberOddOrEven(six(), _f()),
StringValueof("[falsejs] 6 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-6-is-odd-or-even`))
assert(
isNumberOddOrEven(seven(), _f()),
StringValueof("[falsejs] 7 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-7-is-odd-or-even`))
assert(
isNumberOddOrEven(eightToolkit.constants.EIGHT, _f()),
StringValueof("[falsejs] 8 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-8-is-odd-or-even`))
assert(
isNumberOddOrEven(ninev9(), _f()),
StringValueof("[falsejs] 9 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-9-is-odd-or-even`))
assert(
isNumberOddOrEven(ten, _f()),
StringValueof("[falsejs] 10 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-10-is-odd-or-even`))
assert(
isNumberOddOrEven(eleven(), _f()),
StringValueof("[falsejs] 11 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-11-is-odd-or-even`))
assert(
isNumberOddOrEven(twelve(), _f()),
StringValueof("[falsejs] 12 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-12-is-odd-or-even`))
assert(
isNumberOddOrEven(thirteenResolver(), _f()),
StringValueof("[falsejs] 13 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-13-is-odd-or-even`))
assert(
isNumberOddOrEven(fourteen, _f()),
StringValueof("[falsejs] 14 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-14-is-odd-or-even`))
assert(
isNumberOddOrEven(fifteen, _f()),
StringValueof("[falsejs] 15 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-15-is-odd-or-even`))
assert(
isNumberOddOrEven(sixteen, _f()),
StringValueof("[falsejs] 16 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-16-is-odd-or-even`))
assert(
isNumberOddOrEven(integer17(), _f()),
StringValueof("[falsejs] 17 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-17-is-odd-or-even`))
assert(
isNumberOddOrEven(Eighteen(), _f()),
StringValueof("[falsejs] 18 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-18-is-odd-or-even`))
assert(
isNumberOddOrEven(nineteenify(loggingEnabled), _f()),
StringValueof("[falsejs] 19 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-19-is-odd-or-even`))
assert(
isNumberOddOrEven(numbertwenty(loggingEnabled), _f()),
StringValueof("[falsejs] 20 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-20-is-odd-or-even`))
assert(
isNumberOddOrEven(always21(), _f()),
StringValueof("[falsejs] 21 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-21-is-odd-or-even`))
assert(
isNumberOddOrEven(twentytwo, _f()),
StringValueof("[falsejs] 22 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-22-is-odd-or-even`))
assert(
isNumberOddOrEven(TWENTY_THREE, _f()),
StringValueof("[falsejs] 23 is not odd or even")
)
logger.log(pc.green(`[falsejs]-Verified-that-23-is-odd-or-even`))
assert(
!isNumberOddOrEven(inf.positiveInfinity(), _f()),
StringValueof("[falsejs] Infinity is odd or even")
)
logger.log(
pc.green(`[falsejs]-Verified-that-Infinity-is-not-odd-or-even`)
)
}
//#endregion HELPER FUNCTIONS
//#region FALSEJS LOGIC
// * FALSEJS LOGIC
// the _getFalse Function
// :O :O :O
/**
* Calculates the boolean value false using various techniques.
*
* @param {number} random - A random number used in the calculation.
* @param {boolean} loggi