The array of row objects or arrays
The header as an array of strings
Returns a function that will return true if called with argument equal to @value.
The value to compare with.
Escapes a value a value for use in delimited formats like CSV or TSV
The value to escape
The escaped value
Walk a directory recursively and find files that match the @filter if its a RegExp, or for which @filter returns true if its a function.
Path to directory
Returns a flattened array of the structure of an object or array. For example:
{a:1, b:{c:2,d:3}, e:4} -> ["a", "b.c", "b.d", "e"]
{a:1, b:[ 2, 3 ], e: 4} -> ["a", "b.0", "b.1", "e"]
[1, {a: 3, b: 4}, 2, 3] -> ["0", "1.a", "1.b", "2", "3"]
The object to inspect
Returns the float representation of the first argument or the "defaultValue" if the int conversion is not possible.
The argument to convert
The resulting floating point number.
Walks thru an object (ar array) and returns the value found at the provided path. This function is very simple so it intentionally does not support any argument polymorphism, meaning that the path can only be a dot-separated string. If the path is invalid returns undefined.
The object (or Array) to walk through
Whatever is found in the path or undefined
Returns the int representation of the first argument or the "defaultValue" if the int conversion is not possible.
The argument to convert
The fall-back return value. This is going to be converted to integer too.
The resulting integer.
Tests if the given argument is a function
The value to test
Tests if the given argument is an object
The value to test
Walks a directory recursively in a synchronous fashion and yields JSON
objects. Only .json
and .ndjson
files are parsed. Yields ane JSON object
for each line of an NDJSON file and one object for each JSON file. Other
files are ignored.
A path to a directory
Merges the second argument into the first one but also throws if an object property is about to be overridden with scalar (or the opposite).
The object which should be extended
The object which should be merged into the other one
Returns the extended first argument
Splits the line into cells using the provided delimiter (or by comma by default) and returns the cells array. supports quoted strings and escape sequences.
The line to parse
The delimiter to use (defaults to ",")
The cells as array of strings
Reads a file line by line in a synchronous fashion. This will read the file line by line without having to store more than one line in the memory (so the file size does not really matter). This is much easier than an equivalent readable stream implementation. It is also easier to debug and should produce reliable stack traces in case of error.
The path to the file to read (preferably an absolute path)
Obtains a human-readable file size string (1024 based).
The file size in bytes
Rounds the given number @n using the specified precision.
Returns a number, unless a fixed precision is used
Finds a path in the given object and sets its value
Adds whitespace to the end of the string until it reaches the specified length
The input string
The target length of the result string
Converts the input argument @x to unsigned (positive) float. Negative numbers are converted to their absolute value.
The value to convert. Should be a number or numeric string.
The default value that is returned in case the conversion is not possible. Note that this will also be converted to unsigned float. Defaults to 0.
Converts the input argument @x to unsigned (positive) integer. Negative numbers are converted to their absolute value.
The value to convert. Should be a number or numeric string.
The default value that is returned in case the conversion is not possible. Note that this will also be converted to unsigned integer. Defaults to 0.
List all files in a directory recursively in a synchronous fashion.
Generated using TypeDoc
Loops over an array of objects or arrays (rows) and builds a header that matches the structure of the rows.