-
Notifications
You must be signed in to change notification settings - Fork 2
Standard Library
The standard libraries of JsonPatcher are a set of functions that are always available to use in your programs. They are imported automatically and can be used without any extra setup. These docs are automatically generated from doc comment files included with jsonpatcher.
Available at "arrays"
The arrays library contains functions for manipulating arrays. All of them can be used as methods on arrays.
Definition: (array: array, index: number, value: any) -> array
Inserts the specified value at the specified index. The inserted value will be found that the index after the insertion.
Definition: (array: array, value: any) -> array
Appends the specified value to the end of the array. Returns the array.
Definition: (array: array) -> any
Removes the last element from the array and returns it.
Definition: (array: array, value: any) -> array
Removes the first occurrence of the specified value from the array. Returns the array.
Definition: (array: array, index: number) -> array
Removes the value at the specified index from the array. Returns the array.
Definition: (array: array, function: function) -> array
Applies the specified function to each element in the array, creating a new array and returns the result.
Definition: (array: array, function: function) -> array
Applies the specified function to each element in the array modifying them in place
Definition: (array: array, function: function) -> array
Applies the specified function to each element in the array, creating a new array with only the elements that returned true.
Definition: (array: array, function: function) -> array
Applies the specified function to each element in the array, removing the elements that returned false.
Definition: (array: array, function: function, initial: any) -> any
Iterates through the array applying the specified function to each element and the current state, beginning with the initial value and being replaced by the returned value from the function. Returns the last state.
Definition: (array: array, from: number, to?: number) -> array
Returns a slice of the array from the specified start index (inclusive) to the specified end index (exclusive)
Definition: (array: array, value: any) -> number
Returns the index of the index of the value in the array, or -1 if it isn't present
Available at "debug"
Provides various functions for debugging code.
Definition: (value: any, message?: string) -> null
Checks if the value is truthy. If it is nothing happens. If it isn't, then an error is thrown.
Definition: (message: any) -> null
Throws an error. Use this if your code gets in situations it shouldn't.
Available at "functions"
Provides utilities for working with functions. Some of the can be used as methods on function objects.
Definition: (function: function, arg: any, index?: number) -> function
Binds the specified argument to the function at the specified index or 0 if none is provided. Can be used as a method
Definition: (function: function, then: function) -> function
Creates a new function that calls the first function and then calls the second function on it's return value. Can be used as a method
Definition: () -> (value: any) -> any
Returns a function that returns its single argument.
Definition: (value: any) -> () -> any
Returns a function that always returns the specified value.
Available at "math"
The math library contains many functions for performing mathematical operations.
Definition: number
Definition: number
Definition: number
Definition: number
Definition: number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (input: number) -> number
Definition: (first: number, second: number) -> number
Definition: (first: number, second: number) -> number
Available at "objects"
Provides utilities for working with objects.
Definition: (object: object) -> [string]
Returns the list of keys in a object.
Available at "strings"
Provides utilities for manipulating strings. Many of the methods in this module can be used as methods.
Definition: (string: string, regex: string) -> boolean
Checks if the whole string matches a specific regular expression.
Definition: (string: string, pattern: string, replacement: string) -> string
Replaces all instances of pattern in string with replacement.
Definition: (string: string, pattern: string, replacement: string) -> string
Replaces all matches of the regular expression pattern in string with replacement.
Definition: (string: string, delimiter: string) -> array
Splits the string into into an array with the specified delimiter
Definition: (string: string) -> string
Converts the string to lowercase with the root locale
Definition: (string: string) -> string
Converts the string to uppercase with the root locale
Definition: (string: string) -> string
Trim the string by removing leading and trailing whitespace
Definition: (string: string) -> string
Trim the string by removing leading whitespace
Definition: (string: string) -> string
Trim the string by removing trailing whitespace
Definition: (string: string, prefix: string) -> boolean
Returns true if the string starts with the specified prefix
Definition: (string: string, suffix: string) -> boolean
Returns true if the string ends with the specified suffix
Definition: (string: string, substring: string) -> boolean
Returns true if the string contains the specified substring
Definition: (string: string) -> number
Returns the length of the string in unicode code units
Definition: (string: string) -> boolean
Returns true if the string is empty (length == 0)
Definition: (string: string) -> boolean
Returns true if the string only contains whitespace characters
Definition: (string: string, index: number) -> string
Returns a string consisting of only the character at the specified index
Definition: (string: string) -> array
Returns an array of strings with each character from this string
Definition: (string: string, from: number, to?: number) -> string
Returns a substring from the specified start index (inclusive) to the specified end index, if specified (exclusive)
Definition: (value: any) -> string
Converts any value to a string
Definition: (array: array, string: delimiter) -> string
Converts all values in the array to a string and concatenates them with the delimiter in between