Works the same as Partial<T>
except it applies Partial
to sub elements.
The initial value to check against. If any check function returns a value other than the initial all further checks will be skipped.
Get the key of an object based on its address.
E.g. user.phonenumber
The object to pull values from
The address to pull
@see AddressObjectOptions
Move an index to another within the given array.
The array to move objects in.
The index to move.
The index to move the entry to.
The array with the elements moved.
Runs the supplied itterator for all elements in the array asyncronously.
The array to itterate through.
The async function to run for each element.
Runs Array.map asyncronously.
The array to map
The function to run for each
Repeat the given function number
times asyncronously
The number of times to itterate
The function to run
A crude caching system that will cache values for the given time.
See CacheForOptions
.
The promise function that returns the cached value.
A crude caching system that will cache values for the given time.
See CacheForOptions
.
The function that returns the cached value.
Cache the given value in the supplied key if the key doesn't already exist.
The key to store.
Does the supplied key exist in the cache?
Key to check.
Create a co-ordinate grid
The maximum X value.
The maximum Y value.
The default value for all cells.
(Optional) The minimum X value, defaults to 0
(Optional) The minimum Y value, defaults to 0
Check if an array exists inside an array
The arraay of arrays to check
The array to check for existance of
true
id the exact array matches, false
if not.
Deeply applies defaults to an object.
The supplied options, a DeepPartial
of defaultValues
.
The default values to fallback on. Should represent a full copy of the options object.
Returns an object with 2 parameters. additional
which is elements in compare
that are not in original
, and missing
which are elements in original
that are not in compare
The base array to compare against
The array to compare to
Convert em number to a plain number
Delete the supplied key from the cache.
Key to delete.
Takes an array of objects and returns an object with a property for each value in the key
containing an array of all the objects that have that value.
The key to group by.
The array of objects.
Creates a one line true/false function
const ifLongString = ifFn((s: string) => {
return s.length > 10
})
ifLongString('short', 'yes', 'no') // 'no'
ifLongString('Longer string that is long', 'yes', 'no') // 'yes'
A single argument function that returns a boolean value
A function which when called takes the single argument for the function and then returns the truthy or falsy value as needed
Returns an object indexed by the given field from the array of objects.
The key to index by.
The array of Objects.
See IndexedByOptions
Returns an array of keys that matches the type keyof T
Any object.
Takes a date (or string) and returns it formatted as a last modified header date.
A Date
or date string to be converted.
The given date in the required format for Last-Modified
headers.
Takes an array of objects and returns an array of values from the given property
The array of objects
The property to extract
Adds
for new lines in a string
The multi line string to add
tags to
Conver a number to em
Conver a number to px
Conver a number to rem
Conver a number to vh
Conver a number to vw
Pragmatic version of Typescripts Omit<Object, Fields>
The object to omit fields from.
The fields to omit.
An object without the supplied fields.
Takes a string and makes it safe for url slugs.
For Example: My Article's title
becomes my-articles-title
The string to parameterize
Pragmatic version of Typescripts `Pick<Object, Fields>
The Object to pick fields from.
An array of fields to pick,
An object with the picked fields.
Find all entires in an array where prop
equals value
.
The Items to filter
The property to filter
The value to check for
Find all entires in an array where prop
does not equals value
.
The Items to filter
The property to filter
The value to check for
Convert px number to a plain number
Picks a random element from the given array.
A random entry from the array.
Returns an array of ranges
e.g. [[1,3], [5,6], [10,15], [20,20]]
An array of integers to describe
Returns an array of string describing the range.
e.g. ['1-3','5,6','10-15','20']
Reduce the array into a single boolean value for if the check function returns false.
once the first true
is encountered check
is not run again
The array to test
The function to check the array entries with
true
if check
only ever returned false
, otherwise false
Reduce the array into a single boolean value for if the check function returns true.
once the first false
is encountered check
is not run again
The array to test
The function to check the array entries with
true
if check
only ever returned true
, otherwise false
Boolean reduction function. Takes a check function and an initial state.
Uses a time-effecient method of only checking values that could change the result from the initial value.
The array to reduce
The function to run on each element. Must return a boolean.
See ReducioOptions
A boolean
Convert rem number to a plain number
Replace a property on an objcet with a different type
The object
The property to replace
Function to take the value and return the new value
An object with the property replaced
Removes all keys from the cache.
Repeat the given function number
times
The number of times to itterate
The function to run
Returns an array of unique values from the given array.
Array of values.
Returns the supplied value if it is not undefined otherwise it returns the or value.
The Value that could be undefined
The fallback value
Convert vh number to a plain number
Convert vw number to a plain number
Normalises a promise that errors into an awaitable [result, error] array.
The resolveable promise
Generated using TypeDoc
Turns array elements into a type.
['name', 'email']
becomes'name' | 'email'