import * as 30SecondsOfTypescript from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";
Variables
Returns an array of partial sums.
Use | |
v all | Returns |
Check if all elements in an array are equal. | |
v and | Returns |
v any | Returns |
Returns an array of | |
Checks if two numbers are approximately equal to each other. | |
Converts a 2D array to a comma-separated values (CSV) string. | |
Converts the given array elements into | |
v ary | Creates a function that accepts up to |
Attempts to invoke a function with the provided arguments, returning either the result or the caught error object. | |
Attempts to invoke a function with the provided arguments, returning either the result or the caught error object. | |
Returns the average of two or more numbers. | |
Splits values into two groups. If an element in | |
Splits values into two groups according to a predicate function, which specifies which group an element in the input collection belongs to. If the predicate function returns a truthy value, the collection element belongs to the first group; otherwise, it belongs to the second group. | |
Creates a function that accepts up to two arguments, ignoring any additional arguments.
Call the provided function, | |
v bind | Creates a function that invokes |
Binds methods of an object to the object itself, overwriting the existing method
Use | |
Evaluates the binomial coefficient of two integers | |
v both | Returns |
v call | Given a key and a set of arguments, call them when given a context. Primarily useful in composition. |
Capitalizes the first letter of a string. | |
Capitalizes the first letter of every word in a string.
Use | |
Casts the provided value as an array if it's not one. | |
Converts Celsius to Fahrenheit.
Follows the conversion formula | |
Chunks an array into smaller arrays of a specified size. | |
Add special characters to text to print in color in the console (combined with | |
Add special characters to text to print in color in the console (combined with | |
Removes falsy values from an array.
Use | |
Returns a string with whitespaces compacted.
Use | |
Returns a function that is the logical complement of the given function, | |
Performs right-to-left function composition. | |
Performs left-to-right function composition. | |
Returns | |
Returns | |
Groups the elements of an array based on the given function and returns the count of elements in each group. | |
Counts the occurrences of a value in an array. | |
Creates an element from a string (without appending it to the document). if the given string contains multiple elements, only the first one will be returned. | |
Creates a pub/sub (publish–subscribe) event hub with | |
Converts a comma-separated values (CSV) string to a 2D array. | |
Curries a function. | |
dayOfYear: Gets the day of the year from a | |
Creates a debounced function that delays invoking the provided function until at least | |
Creates a deep clone of an object. | |
Performs a deep comparison between two values to determine if they are equivalent. Same as | |
Deep flattens an array. | |
Deep freezes an object. | |
Returns the target value in a nested JSON object, based on the | |
Assigns default values for all properties in an object that are | |
Invokes the provided function after | |
Return a promise, Resolve after | |
Convert array(csv) string to doanloadable file | |
Returns | |
ellipsis a string up to a specified length. | |
Performs a deep comparison between two values to determine if they are equivalent. | |
Escapes a string for use in HTML. | |
Escapes a string to use in a regular expression. | |
Calculates the factorial of a number. | |
Converts Fahrenheit to Celsius. | |
Initializes and fills an array with the specified values. | |
Filters out the non-unique values in an array. | |
Filters out the non-unique values in an array, based on a provided comparator function. | |
Returns the first key that satisfies the provided testing function. Otherwise | |
Flattens an array up to the specified depth. | |
Executes a provided function once for each array element, starting from the array's last element. | |
Returns the human readable format of the given number of milliseconds. | |
v get | Retrieve a set of properties indicated by the given selectors from an object. |
Retrieve a set of properties indicated by the given selectors(string[]) from an object. | |
Returns the current URL without any parameters.
Use | |
Returns the native type of a value. | |
Groups the elements of an array based on the given function. | |
Check if the current arguments contain the specified flags. | |
Converts a color code to a | |
Converts a color code to a | |
v hide | Hides all the elements specified. |
Redirects the page to HTTPS if its currently in HTTP. Also, pressing the back button doesn't take it back to the HTTP page as its replaced in the history. | |
Converts a string to humanize string url | |
Returns | |
Indents each line in the provided string. | |
Initializes and fills an array with the specified values. | |
Checks if the given number | Date | string falls within the given range. | |
Mutates the original array to insert the given values at the specified index. | |
Insert the given values at the specified index. | |
Returns a list of elements that exist in both arrays. | |
Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both. | |
Returns a list of elements that exist in both arrays, using a provided comparator function. | |
v is | |
Check if a date is after another date. | |
Checks if the given argument is a array like | |
Check if a date is before another date. | |
Determines if the current runtime environment is a browser so that front-end modules can run on the server (Node) without throwing errors. | |
Returns true if the a value is an empty object, collection, has no enumerable properties or is any type that is not considered a collection. | |
Checks if the given argument is a string. Only works for string primitives. | |
Returns | |
Checks if a string is lower case. | |
Returns | |
Returns | |
Checks if the given argument is a number. | |
Returns a boolean determining if the passed value is an object or not. | |
Checks if the provided value is an object created by the Object constructor. | |
Returns a boolean determining if the passed value is primitive or not. | |
Check if a date is the same as another date. | |
Returns | |
Checks if the given argument is a string. Only works for string primitives. | |
Checks if a string is upper case. | |
Checks if the provided string is a valid JSON. | |
Converts an array of objects to a comma-separated values (CSV) string that contains only the | |
v last | Returns the last element in an array. |
Adds an event listener to an element that will only run the callback the first time the event is triggered. | |
Creates a new object from the specified object, where all the keys are in lowercase. | |
v map | Creates a new map with the results of calling a provided function on every value in the calling function. |
Creates an object with keys generated by running the provided function for each key and the same values as the provided object. | |
Maps the values of an array to an object using a function, where the key-value pairs consist of the original value as the key and the result of the function as the value. | |
Creates a new string with the results of calling a provided function on every character in the calling string. | |
v mask | Replaces all but the last |
Compares two objects to determine if the first one contains equivalent property values to the second one. | |
Compares two objects to determine if the first one contains equivalent property values to the second one, based on a provided function. | |
Returns the maximum value of an array, after mapping each element to a value using the provided function. | |
Returns the maximum of the given dates. | |
v maxN | Returns the |
Returns the memoized (cached) function. | |
Creates a new object from the combination of two or more objects. | |
Returns the minimum value of an array, after mapping each element to a value using the provided function. | |
Returns the most frequent element in an array. | |
Returns the index of the function in an array of functions which executed the fastest. | |
Negates a predicate function. | |
v nest | Given a flat array of objects linked to one another, it will nest them recursively. Useful for nesting comments, such as the ones on reddit.com. |
Converts a | |
v none | Returns |
v not | Returns the logical inverse of the given value. |
Creates a function that gets the argument at index | |
Returns a query string generated from the key-value pairs of the given object. | |
Moves the specified amount of elements to the end of the array. | |
v omit | Omits the key-value pairs corresponding to the given keys from an object. |
Creates an object composed of the properties the given function returns falsy for. The function is invoked with two arguments: (value, key). | |
v or | Returns |
Returns a sorted array of objects ordered by properties and orders. | |
Returns a sorted array of objects ordered by properties and orders. | |
v pad | Pads a string on both sides with the specified character, if it's shorter than the specified length. |
Parse an HTTP Cookie header string and return an object of all cookie name-value pairs. | |
Creates a function that invokes | |
Creates a function that invokes | |
Groups the elements into two arrays, depending on the provided function's truthiness for each element. | |
Applies | |
v pick | Picks the key-value pairs corresponding to the given keys from an object. |
Creates an object composed of the properties the given function returns truthy for. The function is invoked with two arguments: (value, key). | |
Performs left-to-right function composition. | |
Returns the singular or plural form of the word based on the input number. | |
Returns the prefixed version (if necessary) of a CSS property that the browser supports. | |
Converts a number in bytes to a human-readable string. | |
Template String funtion, Same as prettyBytes but more cleaner way | |
Converts an asynchronous function to return a promise. | |
Converts an angle from radians to degrees. | |
Generates a random hexadecimal color code. | |
Returns a random integer in the specified range. | |
Returns a random number in the specified range. | |
Returns the minimum/maximum value of an array, after applying the provided function to set comparing rule. | |
Removes non-printable ASCII characters. | |
Renders the given DOM tree in the specified DOM element. | |
Reverses a string. | |
Converts the values of RGB components to a color code. | |
Rounds a number to a specified amount of digits. | |
Smooth-scrolls to the top of the page. | |
Serialize a cookie name-value pair into a Set-Cookie header string. | |
v show | Shows all the elements specified. |
Randomizes the order of the values of an array, returning a new array. | |
v size | Gets the size of an array, object or string. |
Delays the execution of an asynchronous function. | |
v some | Same as any |
Sort by based on the key. | |
Splits a multiline string into an array of lines. | |
Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function. | |
Performs stable sorting of an array, preserving the initial indexes of items when their values are the same. Does not mutate the original array, but returns a new array instead. | |
Removes HTML/XML tags from string. | |
v sum | Returns the sum of two or more numbers/arrays. |
Returns the sum of an array, after mapping each element to a value using the provided function. | |
v tail | Returns all elements in an array except for the first one. |
v take | Returns an array with n elements removed from the beginning. |
Returns an array with n elements removed from the end. | |
Removes elements from the end of an array until the passed function returns | |
Removes elements in an array until the passed function returns | |
Iterates over a callback | |
Measures the time taken by a function to execute. | |
Converts a | |
Converts a string to camelcase. | |
Converts a number to a decimal mark formatted string. | |
Converts a string to kebab case. | |
Adds an ordinal suffix to a number. | |
Creates an array of key-value pair arrays from an object or other iterable (object, array, string, set etc.). | |
Break the string into words and combine them adding | |
Converts a string to title case. | |
Applies a function against an accumulator and each key in the object (from left to right). | |
Triggers a specific event on a given element, optionally passing custom data. | |
Truncates a string up to a specified length. | |
Creates a function that accepts up to one argument, ignoring any additional arguments. | |
Uncurries a function up to depth | |
Unescapes escaped HTML characters. | |
Returns every element that exists in any of the two arrays once. | |
Returns every element that exists in any of the two arrays once, after applying the provided function to each array element of both. | |
Returns all unique values in an array. | |
Returns all unique values of an array, based on a provided comparator function. | |
Returns all unique values of an array, based on a provided comparator function, starting from the right. | |
Creates an array of arrays, ungrouping the elements in an array produced by zip. | |
Creates an array of elements, ungrouping the elements in an array produced by zip and applying the provided function. | |
Joins all given URL segments together, then normalizes the resulting URL. | |
Joins all given URL segments together, then normalizes the resulting URL. | |
Generates a UUID in a browser. | |
Returns | |
Returns |
Functions
Validate date |