Conversion multiplier for degrees to radians conversion (PI / 180).
Path separator used for path related functions such as dirname and basename.
Conversion multiplier for radians to degrees conversion (180 / PI).
Queries the value of a GET parameter.
Name/identifier of the parameter to query for.
Queries window.location.search, or, if not present, window.location.search of the window's top frame.
Allows to specify whether or not assertions should be enabled or disabled/ignored.
If true, assertions will be evaluated and might throw errors.
whether assertions are enabled
Returns the base name of a given file path. If no path separator is found, the input path is returned.
Path string the file/base name should be returned of.
Tests if specific bits are set in a given bitfield and returns true if so, false otherwise.
Returns the directory name of a given (file) path. If no path separator is found, an empty dir name is returned.
Path string the directory name should be returned of.
Tests with binary operations if the number is power of two.
The number to test.
Writes a warning to the console when the evaluated statement is false.
log(,`scale changed to ${scale}, given ${this._scale}`);
Verbosity of log level: user, developer, or module developer.
Message to be passed to the log (if verbosity high enough).
Writes a lo message to the console when the evaluated statement is false.
logIf(!vec2.equals(this._scale, scale), LogLevel.Info, `scale changed to ${scale}, given ${this._scale}`);
Result of an statement expected to be true.
Verbosity of log level: debug, info, warning, or error.
Message to be passed to the log (if thrown and verbosity high enough).
Starts performance measure using the performance API. This call initiates a performance mark and should be
followed by a logPerformanceStop
call later on. Furthermore, the measurement can be tracked using, e.g., the
Chrome built-in performance profiler. Example:
gloperate.auxiliaries.logPerformanceStart('initialization');
...
gloperate.auxiliaries.logPerformanceStop('initialization');
The example above should output something like: [3] initialization | 5.635s
.
Name for the performance measure and base name for the start mark (<mark>-start
).
Invokes logPerformanceStart
iff the statement resolves successfully.
Result of an statement expected to be true in order to invoke logPerformanceStart.
Name for the performance measure mark ... @see logPerformanceStart.
This creates a second, end mark for the given mark name, then creates a performance measure between the start
and end mark (<mark>-start
and <mark>-end
), resolves the duration for logging and, finally, removes/cleans
both marks and the measure. The duration is pretty printed ranging from nanoseconds to seconds. Example:
gloperate.auxiliaries.logPerformanceStart('initialization');
...
gloperate.auxiliaries.logPerformanceStop('initialization', '#items processed: ' + items.length , 48);
The example above should output something like: [3] initialization #items processed: 4096 | 7.172ms
.
Name for the performance measure and base name for the end mark (<mark>-end
).
Optional message to provide to the debug-log output.
Optional indentation of the measure (useful if multiple measurements shall be aligned).
Invokes logPerformanceStop
under the condition that the statement is true.
Result of an expression expected to be true in order to invoke logPerformanceStop.
Name for the performance measure mark ... @see logPerformanceStart.
Optional message to provide to the debug-log output ... @see logPerformanceStart.
Optional indentation of the measure ... @see logPerformanceStart.
Allows to specify the log verbosity. The default verbosity depends on the bundle type, e.g., a production bundle might use a verbosity of 1, a local development bundle might favor a verbosity of 2. Even though verbosity levels can be used arbitrarily, a verbosity of 0 is intended for user info only, 1 for developers, and 2 for developers of this module. However, this semantic breaks when reusing this logging mechanism in other modules as well...
Log level threshold, -1:disabled, 0:user, 1:developer, and 2:module developer.
Prints bytes using ISO/IEC 80000 postfixes for bytes and fixed number of decimal places (3 decimal places if bytes >= KiB).
prettyPrintBytes(27738900); // returns '26.454MiB'
Number of bytes in plain bytes.
Prints given milliseconds in an appropriate seconds-based time unit and fixed number of decimal places.
prettyPrintMilliseconds(0.03277); // returns '32.770μs'
Number of milliseconds as floating point number.
Generates a random value within a given range [min,max].
Minimum random value possible.
Maximum random value possible.
Computes the next upper power of two for the given number. Math is based on https://graphics.stanford.edu/~seander/bithacks.html.
Number to compute next upper power of two for.
Namespace that comprises various utils (also cleans up documentation).