📄️ .JSF()
A function that takes a numerical seed and returns a function that can be used to generate prng based on the JSF algorithm.
📄️ .LCG()
Takes a numerical seed and returns a function that generates PRNG based on the LCG algorithm.
📄️ .add_time()
A function that adds a specified number of milliseconds to a given Date() object.
📄️ .are_ids_eq()
Compares two strings or ObjectIDs and evaluates if they are equal. Useful for comparing MongoDB documents by IDs.
📄️ .caller_is_owner()
A function that checks whether the caller of the script being called is the owner of that script by comparing the scriptname to the caller from the [[context]] object.
📄️ .can_continue_execution()
A function that checks whether a specified number of milliseconds are available for execution.
📄️ .can_continue_execution_error()
A function wrapping .cancontinueexecution() that checks if there is enough time remaining for execution based on a specified number of milliseconds. If not enough time remains, the function returns a user-friendly error message.
📄️ .cap_str_len()
A function to shorten or cap a string to a specified length.
📄️ .clamp()
A function that constrains a value within a specified range, ensuring that a value stays within a minimum and maximimum value (inclusive).
📄️ .clone()
A function that returns a clone of a value. Any type of value may be cloned, including undefined.
📄️ .colors
A string containing the lowercase alphabet, followed by the uppercase alphabet. This is a helper property for coloring strings. It is also used for corruption character functionality in scripts.lib.
📄️ .columnize()
A function that will format an array of strings into columns based on the width of the client that is displaying them.
📄️ .corrupt()
Applies corruption throughout a given string, in the specified frequency.
📄️ .corruption_chars
The possible corruption characters.
📄️ .corruptions
The common corruption frequencies used in-game.
📄️ .count()
A function that counts the number of elements in a given array that satisfy the condition of a specified function.
📄️ .create_rand_string()
A function that generates a string of random lowercase alphanumeric characters.
📄️ .date()
A safe internal Date() constructor.
📄️ .dbir_result_failed()
A function that takes a number and the result of a MongoDB insertion (array) and returns a boolean to check if the insertion was successful or not. (true indicates a Failure)
📄️ .dbu_result_failed()
A function that takes a number and the result of a MongoDB operation (array) and returns a boolean to check if the operation was successful or not. (true indicates a Failure)
📄️ .dump()
A function that formats the input for debugging output.
📄️ .each()
A helper function that allows execution of a specified function for each element of an array.
📄️ .get_date()
A safe internal new Date() invocation.
📄️ .get_date_utcsecs()
A safe internal invocation of new Date().getTime()
📄️ .get_log()
Returns array of logged strings from [[.log()]]
📄️ .get_scriptname_from_script()
A function that extracts the scriptname of a script based on the full formatted script name.
📄️ .get_security_level_name()
A function that takes a number between 0 and 4 (inclusive) and returns the associated security level name.
📄️ .get_user_from_script()
A function that extracts the user name of a script owner based on the full formatted script name.
📄️ .get_values()
A function that extracts the values from all properties of an object.
📄️ .hash_code()
A function which creates a hash code out of an input string.
📄️ .id_to_str()
A function that converts a MongoDB ObjectID to its string representation.
📄️ .is_arr()
A function to test whether the input is an array.
📄️ .is_bool()
A function to test whether the input is a boolean.
📄️ .is_def()
A function to test whether the input type is defined.
📄️ .is_func()
Checks whether input is a function.
📄️ .is_int()
A function to test whether the input is an integer.
📄️ .is_neg()
A function to test whether the input is a number, and if so, if it has a negative value.
📄️ .is_not_today()
A function that checks if a specified date is in the past compared to today's date.
📄️ .is_num()
A function to test whether the input is a number.
📄️ .is_obj()
A function to test whether the input is an object.
📄️ .is_script()
A function that checks if a script is being ran as a subscript, given context and args parameters. Useful for differentiating behavior in a script between calls on the CLI vs in subscripts
📄️ .is_str()
A function to test whether input is a string.
📄️ .is_valid_name()
A function to test whether the input is a valid hackmud username.
📄️ .lerp()
LERP stands for Linear Interpolation; a mathematical function in which a value interpolates between 'start' and 'end' values.
📄️ .log()
Pushes strings into an array that can be returned later for logging/debugging.
📄️ .map()
A function that iterates over a given array and executes a specified function on each element, and then returns an array of the results.
📄️ .max_val_index()
A function that finds the maximimum value in an array and returns both the maximimum value and its index in the array. If multiple elements in the array are the maximum value, the index of the first maximum value will be used.
📄️ .merge()
A function that merges the properties of two objects into one object.
📄️ .mulberry32()
A function that returns a PRNG function from a numerical seed based on the mulberry32 algorithm.
📄️ .not_impl()
Returns a Failure object with error message: "Not Implemented".
📄️ .num_sort_asc
Arguments for .sort() that sort an array of numbers in ascending order.
📄️ .num_sort_desc
Arguments for .sort() that sort an array of numbers in descending order.
📄️ .ok()
Helper function that creates a formatted Success object.
📄️ .one_day_ms
The number of milliseconds equal to 24 hours.
📄️ .pick()
A function that takes an object and creates a new object containing only the specified keys from the original object.
📄️ .rand_int()
A function that returns a random number (integer) between two integer parameters.
📄️ .rjust()
A function that right-justifies a string within a given width by padding it with a specified character, or space by default.
📄️ .sample()
Sample randomly selects one element from an array to return.
📄️ .security_level_names
A predefined list of security level names.
📄️ .select()
The select function behaves similarly to filter in JavaScript. The function iterates over an array and applies a specified function to the array. Each element of the array that is evaluated as true by the specified function will be returned.
📄️ .select_one()
A function that selects the first element of a given array that satisfies the condition of a specified function.
📄️ .sfc32()
A function that takes 4 seed parameters and returns a PRNG function based on the sfc32 algorithm.
📄️ .shuffle()
A function that takes an array and shuffles the elements into a random order.
📄️ .side_by_side()
A function that takes 2 strings and formats them to display side-by-side.
📄️ .sort_asc
Arguments for .sort() that sort an array of strings in ascending order. This is intended for use with alphabetical strings. Numbers will sort by string precedence.
📄️ .sort_desc
Arguments for .sort() that sort an array of strings in descending order. This is intended for use with alphabetical strings. Numbers will sort by string precedence.
📄️ .to_game_timestr()
Takes a JavaScript new Date() object and converts it into a time string in the YYMMDD.HHSS format.
📄️ .to_gc_num()
Takes a GC string and turns it into a number.
📄️ .to_gc_str()
Takes a number and turns it into a formatted GC string.
📄️ .u_sort_num_array_desc()
A function that deduplicates an array of numbers and sorts the deduplicated array in descending order.
📄️ .uniq()
A function that deduplicates elements from an array, while preserving the order of the remaining elements.
📄️ .utc_day_diff()
A function that calculates the difference in days from 2 Date objects.
📄️ .utc_days_ago_str()
A function that calculates the time elapsed in days from a past Date object to the current date.
📄️ .xmur3()
A function that takes a string and returns a function that creates a numerical value based on the xmur3 algorithm. The returned function can be called multiple times to produce multiple seeds. Intended to be used with JSF, LCG, mulberry32, sfc32, and xoshiro128ss.
📄️ .xoshiro128ss()
A function that returns a PRNG function from 4 numerical seeds based on the xoshiro128ss RNG.