UNPKG

falsejs

Version:
1,085 lines (1,032 loc) 129 kB
/** * 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 */ /* ███████████████████████████████████████████████████████████████████████████████████ FalseJS is a library that helps you get the value of false. It uses the power of Node.js, Vanilla JavaScript, Vapor.js, jQuery, Obfuscator.io, MDE's true and false NPM packages and many other awesome packages, libraries, and 10x things created by great open-source 10x engineer-developers are used to achieve this amazing masterpiece of a library. The library is designed to be very easy to use and understand. It uses loads of dependencies for ensurability and reliability. If you have any questions or need assistance, please don't hesitate to ask. FalseJS is licensed under the MIT License. Enjoy! ███████████████████████████████████████████████████████████████████████████████████ */ // #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 ;(function (factory) { module.exports.default = factory(jQuery) })(function ($) { "use strict" //#endregion FACTORY CODE //* MODULE IMPORTS // #region MODULE IMPORTS const _ = require("lodash") // every project needs lodash const React = require("react") // the best framework 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 underscore = require("underscore") // underscore.js. the predecessor of lodash. const axios = require("axios") // so we can send requests const { generatePhoneNumber } = require("phone-number-generator-js") // phone numbers const emptyString = require("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 { 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 const gabrielBrotasIsOdd = require("gabriel-brotas-is-odd") const returnIfOddNumber = require("return-if-odd-number") const numberIsOdd = require("number-is-odd") const isNumOdd = require("is-num-odd") const isOddNumber = require("is-odd-number") const isNumberOdd = require("is_number_odd") const isThisNumberOdd = require("is-this-number-odd") const isRealBoolean = require("is-real-boolean") const add = require("examplebyraji") // a package const cowsay = require("cowsay") // let's say stuff const lolcatjs = require("lolcatjs") // the rainbow i tastes it const parseBool = require("parse-bool") // parse a boolean const owoifyx = require("owoifyx").default // UwU const Uwuifier = require("uwuifier").default // UwU (x2) const amogus = require("amogusify") const luaParser = require("luaparse") const luaInterpreter = require("lua-interpreter") const exit = require("exit") const appendType = require("append-type") const concatenater = require("concatenater") const generalConcat = require("general-concat") const lowercase = require("convert-to-lower-case") const construct = require("construct-new") // better than the new keyword const variableHolder = {} const $Promise = require("bluebird") const GetIntrinsic = require("get-intrinsic") //#endregion MODULE IMPORTS //#region INTRINSICS // * INTRINSICS const $Array = GetIntrinsic("%Array%") const $BaseError = require("es-errors") const $Boolean = GetIntrinsic("%Boolean%") const $Date = GetIntrinsic("%Date%") const $Function = GetIntrinsic("%Function%") const MathRandom = GetIntrinsic("%Math.random%") const MathFloor = GetIntrinsic("%Math.floor%") const MathRound = GetIntrinsic("%Math.round%") const PI = GetIntrinsic("%Math.PI%") const MathAbs = GetIntrinsic("%Math.abs%") const StringCharAt = GetIntrinsic("%String.prototype.charAt%") //#endregion INTRINSICS //#region APRIL FOOLS IMPORT // * another import const _calculateFalseAprilFools = require("./aprilFoolsCalculateFalse") // april fools //#endregion APRIL FOOLS IMPORT // * HELPER FUNCTIONS FROM OTHER LIBRARIES THAT ARE BY FALSEJS //#region FALSEJS IMPORTS const couldThisCouldItBeTrue = require("@falsejs/is-true-helper") const { returnFalse, isFalse: isPreciselyEqualToFalse } = require("@falsejs/core-ish") //#endregion FALSEJS IMPORTS // * MORE MODULE IMPORTS //#region MORE MODULE IMPORTS const isJanuary = require("is-january") const isFebruary = require("is-february") const isMarch = require("is-march") const isApril = require("is-april") const isMay = require("is-may") const isJune = require("is-june") const isJuly = require("is-july") const isAugust = require("is-august") const isSeptember = require("is-september") const isOctober = require("is-october") const isNovember = require("is-november") const isDecember = require("is-december") const isMonday = require("is-monday") const isTuesday = require("is-tuesday") //#endregion MORE MODULE IMPORTS //#region IS WEDNESDAY SHIM // * A function function isWednesday() { const _isWednesday = require("is-wednesday") return _isWednesday(Today) } //#endregion IS WEDNESDAY SHIM //#region EVEN MORE MODULE IMPORTS // * EVEN MORE MODULE IMPORTS!!! 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") const { returnZero, ZeroCalculationMethod, isZero: zerosurgeIsZero } = require("zerosurge") const one = require("the-number-one").default const Two = require("two") const three = require("numeric-constant-three") const four = require("always-four") const five = require("five") const six = require("number-six") const seven = require("se7en") const eightToolkit = require("eight-toolkit") const ninev9 = require("value-nine") const ten = require("the-number-ten") const eleven = require("eleven") const twelve = require("tw12ve") 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") const nineteenify = require("nineteenify") const numbertwenty = require("numbertwenty") const always21 = require("always-21") const twentytwo = require("twentytwo")() const { TWENTY_THREE } = require("twenty-three-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 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 util = require("node:util") // maybe some built in stuff would be nice const http = require("node:http") // http! const http2 = require("node:http2") //http/2! const https = require("node:https") // https! const crypto = require("node:crypto") // crypto const fs = require("node:fs") // fs const uuid = require("uuid") // UUID const getStringLength = require("utf8-byte-length") // get string length const emoji100 = require("emoji-100") const randomHappyEmoji = require("random-happy-emoji") const randomAngryEmoji = require("random-angry-emoji") const randomFoodEmoji = require("random-food-emoji") const dolphinFact = require("dolphin-fact") const logOne = require("useless-one-log") const Bro = require("brototype") // Bro const literally = require("literally") // better than literally const constant = require("const") const lodashdotconstant = require("lodash.constant") 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") const { undefined } = require("undefined-is-a-function") const isNull = util.isNull || require("is-null") const isUndefined = require("is-undefined") const isNil = require("is-nil") const isUnnull = require("is-unnull") const isNaN = require("is-nan") const isNegativeInfinity = require("negative-infinity").check const is1 = require("is-eq-one") const is0 = require("is-eq-zero") const is0_2 = require("is-zero") const isFour = require("is-equal-four") const isFive = require("is-eq-five") const isSix = require("is-eq-six") const isSeven = require("is-eq-seven") //#endregion EVEN MORE MODULE IMPORTS //#region IS NOT NIL FUNCTION // * A function. const isNotNil = (v) => not(() => isNil(v))() //#endregion IS NOT NIL FUNCTION //#region another section of module imports. //* ANOTHER SECTION OF MODULE IMPORTS. const useGarbage = require("garbage") // trash. const isuseless = require("is-useless").isuseless // is useless. const isAprilFools = require("is-april-fools") const meow = require("meow.js") const immediateError = require("immediate-error") const ERROR = immediateError.ERROR const throwError = require("throw-error") const hello = require("hello-vga-function").default const greet = require("hell0-world") //#endregion another section of 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()))), 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 Checker = class { returnValue constructor(value) { this.returnValue = value } check(value) { return this.returnValue } } 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(), .1), { 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.33333333333333333333333333333333333 ? trueComparison.compare() : _f() const usePlus = rand > 0.333333333333333333333333 && rand < 0.66666666666666666 ? trueComparison.compare() : _f() const usePad = rand > 0.6666666666666666666666666666666666666666666 ? 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(Infinity, _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} loggingEnabled - Indicates whether logging is enabled. * @param {function} shouldDoSomethingAsync - A function that determines whether an asynchronous operation should be performed. * @param {function} shouldDoSomethingAsyncWithIsTenThousand - A function that determines whether an asynchronous operation should be performed based on a condition. * @param {object} logger - An object used for logging messages. * * @returns {boolean} - The calculated boolean value false. */ function _getFalse( random, randomLetterOrNumber, loggingEnabled, shouldDoSomethingAsync = _f(), shouldDoSomethingAsyncWithIsTenThousand = _f(), logger ) { ///* we are kind of required to do this n0p3() noop() noop2()