diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-10-11 16:30:25 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2023-10-11 16:33:51 +0200 |
commit | 1c1899301a4452582ade76bb5249eaac71cceb22 (patch) | |
tree | 6c1032294a439a7842bf88df3330dc6bc5ce9d25 | |
parent | d25dcb1f0ee49b6ad939b2058b0437e6b90afc4d (diff) |
lib: various documentation fixes
- Consistently use nullable instead of `type|null` expressions
- Use @borrows to reduce some duplicated documentation blocks
- Add typedef for timelocal()/timegm() TimeSpec value
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | lib.c | 101 | ||||
-rw-r--r-- | lib/debug.c | 14 | ||||
-rw-r--r-- | lib/fs.c | 150 |
3 files changed, 112 insertions, 153 deletions
@@ -365,7 +365,7 @@ uc_print(uc_vm_t *vm, size_t nargs) * * @param {Object|Array|string} x - The input object, array, or string. * - * @returns {number|null} - The length of the input. + * @returns {?number} - The length of the input. * * @example * length("test") // 4 @@ -484,7 +484,7 @@ uc_index(uc_vm_t *vm, size_t nargs, bool right) * @param {*} needle * The value to find within the array or string. * - * @returns {number|null} + * @returns {?number} * * @example * index("Hello hello hello", "ll") // 2 @@ -516,7 +516,7 @@ uc_lindex(uc_vm_t *vm, size_t nargs) * @param {*} needle * The value to find within the array or string. * - * @returns {number|null} + * @returns {?number} * * @example * rindex("Hello hello hello", "ll") // 14 @@ -844,7 +844,7 @@ uc_exit(uc_vm_t *vm, size_t nargs) * @param {string} [name] * The name of the environment variable. * - * @returns {string|object} + * @returns {string|Object<string, string>} */ static uc_value_t * uc_getenv(uc_vm_t *vm, size_t nargs) @@ -1037,7 +1037,7 @@ uc_int(uc_vm_t *vm, size_t nargs) * @param {Array} arr * The array to be joined into a string. * - * @returns {string|null} + * @returns {?string} */ static uc_value_t * uc_join(uc_vm_t *vm, size_t nargs) @@ -1073,7 +1073,7 @@ uc_join(uc_vm_t *vm, size_t nargs) * @param {object} obj * The object from which to retrieve the key names. * - * @returns {Array|null} + * @returns {?Array} */ static uc_value_t * uc_keys(uc_vm_t *vm, size_t nargs) @@ -1104,7 +1104,7 @@ uc_keys(uc_vm_t *vm, size_t nargs) * @param {string} s * The input string. * - * @returns {string|null} + * @returns {?string} * The lowercase string. * * @example @@ -1211,7 +1211,7 @@ uc_map(uc_vm_t *vm, size_t nargs) * @param {number} [offset] * The offset of the character. * - * @returns {number|null} + * @returns {?number} * * @example * ord("Abc"); // 65 @@ -1265,7 +1265,7 @@ uc_ord(uc_vm_t *vm, size_t nargs) * @param {*} x * The value to determine the type of. * - * @returns {string|null} + * @returns {?string} */ static uc_value_t * uc_type(uc_vm_t *vm, size_t nargs) @@ -1307,7 +1307,7 @@ uc_type(uc_vm_t *vm, size_t nargs) * @param {Array|string} arr_or_str * The input array or string. * - * @returns {Array|string|null} + * @returns {?(Array|string)} * * @example * reverse([1, 2, 3]); // [ 3, 2, 1 ] @@ -1938,7 +1938,7 @@ uc_time(uc_vm_t *vm, size_t nargs) * @param {*} str * The string to be converted to uppercase. * - * @returns {string|null} + * @returns {?string} * * @example * uc("hello"); // "HELLO" @@ -2040,7 +2040,7 @@ uc_uchr(uc_vm_t *vm, size_t nargs) * @param {*} obj * The object from which to extract values. * - * @returns {Array|null} + * @returns {?Array} * * @example * values({ foo: true, bar: false }); // [true, false] @@ -2774,7 +2774,7 @@ uc_require(uc_vm_t *vm, size_t nargs) * @param {string} address * The IP address string to convert. * - * @returns {number[]|null} + * @returns {?number[]} * * @example * iptoarr("192.168.1.1") // [ 192, 168, 1, 1 ] @@ -2851,7 +2851,7 @@ check_byte(uc_value_t *v) * @param {number[]} arr * The byte array to convert into an IP address string. * - * @returns {string|null} + * @returns {?string} * * @example * arrtoip([ 192, 168, 1, 1 ]) // "192.168.1.1" @@ -2928,7 +2928,7 @@ uc_arrtoip(uc_vm_t *vm, size_t nargs) * @param {RegExp} pattern * The regular expression pattern. * - * @returns {Array|null} + * @returns {?Array} * * @example * match("foobarbaz", /b.(.)/) // ["bar", "r"] @@ -3976,7 +3976,7 @@ uc_trace(uc_vm_t *vm, size_t nargs) * @param {Object} [proto] * The optional prototype object. * - * @returns {Object|null} + * @returns {?Object} * * @example * const arr = [1, 2, 3]; @@ -4222,7 +4222,7 @@ uc_wildcard(uc_vm_t *vm, size_t nargs) * @param {boolean} [dironly] * Whether to return only the directory portion of the source file path. * - * @returns {string|null} + * @returns {?string} * * @example * sourcepath(); // Returns the path of the currently executed file @@ -4426,7 +4426,7 @@ uc_max(uc_vm_t *vm, size_t nargs) * @param {string} str * The base64 encoded string to decode. * - * @returns {string|null} + * @returns {?string} * * @example * b64dec("VGhpcyBpcyBhIHRlc3Q="); // Returns "This is a test" @@ -4576,7 +4576,7 @@ static const char Base64[] = * @param {string} str * The string to encode. * - * @returns {string|null} + * @returns {?string} * * @example * b64enc("This is a test"); // Returns "VGhpcyBpcyBhIHRlc3Q=" @@ -4713,7 +4713,7 @@ uc_uniq_ucv_equal(const void *k1, const void *k2) * @param {Array} array * The input array. * - * @returns {Array|null} + * @returns {?Array} * * @example * uniq([1, true, "foo", 2, true, "bar", "foo"]); // Returns [1, true, "foo", 2, "bar"] @@ -4752,6 +4752,28 @@ uc_uniq(uc_vm_t *vm, size_t nargs) return uniq; } +/** + * A time spec is a plain object describing a point in time, it is returned by + * the {@link module:core#gmtime|gmtime()} and + * {@link module:core#localtime|localtime()} functions and expected as parameter + * by the complementary {@link module:core#timegm|timegm()} and + * {@link module:core#timelocal|timelocal()} functions. + * + * When returned by `gmtime()` or `localtime()`, all members of the object will + * be initialized, when passed as argument to `timegm()` or `timelocal()`, most + * member values are optional. + * + * @typedef {Object} module:core.TimeSpec + * @property {number} sec - Seconds (0..60) + * @property {number} min - Minutes (0..59) + * @property {number} hour - Hours (0..23) + * @property {number} mday - Day of month (1..31) + * @property {number} mon - Month (1..12) + * @property {number} year - Year (>= 1900) + * @property {number} wday - Day of week (1..7, Sunday = 7) + * @property {number} yday - Day of year (1-366, Jan 1st = 1) + * @property {number} isdst - Daylight saving time in effect (yes = 1) + */ static uc_value_t * uc_gettime_common(uc_vm_t *vm, size_t nargs, bool local) { @@ -4782,16 +4804,7 @@ uc_gettime_common(uc_vm_t *vm, size_t nargs, bool local) * containing broken-down date and time information according to the local * system timezone. * - * The resulting dictionary contains the following fields: - * - `sec` Seconds (0-60) - * - `min` Minutes (0-59) - * - `hour` Hours (0-23) - * - `mday` Day of month (1-31) - * - `mon` Month (1-12) - * - `year` Year (>= 1900) - * - `wday` Day of the week (1-7, Sunday = 7) - * - `yday` Day of the year (1-366, Jan 1st = 1) - * - `isdst` Daylight saving time in effect (yes = 1) + * See {@link module:core.TimeSpec|TimeSpec} for a description of the fields. * * Note that in contrast to the underlying `localtime(3)` C library function, * the values for `mon`, `wday`, and `yday` are 1-based, and the `year` is @@ -4802,7 +4815,7 @@ uc_gettime_common(uc_vm_t *vm, size_t nargs, bool local) * @param {number} [epoch] * The epoch timestamp. * - * @returns {Object} + * @returns {module:core.TimeSpec} * * @example * localtime(1647953502); @@ -4828,14 +4841,14 @@ uc_localtime(uc_vm_t *vm, size_t nargs) /** * Like `localtime()` but interpreting the given epoch value as UTC time. * - * See `localtime()` for details on the return value. + * See {@link module:core#localtime|localtime()} for details on the return value. * * @function module:core#gmtime * * @param {number} [epoch] * The epoch timestamp. * - * @returns {Object} + * @returns {module:core.TimeSpec} * * @example * gmtime(1647953502); @@ -4908,9 +4921,9 @@ uc_mktime_common(uc_vm_t *vm, size_t nargs, bool local) } /** - * Performs the inverse operation of `localtime()` by taking a broken-down date - * and time dictionary and transforming it into an epoch value according to the - * local system timezone. + * Performs the inverse operation of {@link module:core#localtime|localtime()} + * by taking a broken-down date and time dictionary and transforming it into an + * epoch value according to the local system timezone. * * The `wday` and `yday` fields of the given date time specification are * ignored. Field values outside of their valid range are internally normalized, @@ -4922,10 +4935,10 @@ uc_mktime_common(uc_vm_t *vm, size_t nargs, bool local) * * @function module:core#timelocal * - * @param {Object} datetimespec + * @param {module:core.TimeSpec} datetimespec * The broken-down date and time dictionary. * - * @returns {number|null} + * @returns {?number} * * @example * timelocal({ "sec": 42, "min": 51, "hour": 13, "mday": 22, "mon": 3, "year": 2022, "isdst": 0 }); @@ -4941,14 +4954,14 @@ uc_timelocal(uc_vm_t *vm, size_t nargs) * Like `timelocal()` but interpreting the given date time specification as UTC * time. * - * See `timelocal()` for details. + * See {@link module:core#timelocal|timelocal()} for details. * * @function module:core#timegm * - * @param {Object} datetimespec + * @param {module:core.TimeSpec} datetimespec * The broken-down date and time dictionary. * - * @returns {number|null} + * @returns {?number} * * @example * timegm({ "sec": 42, "min": 51, "hour": 13, "mday": 22, "mon": 3, "year": 2022, "isdst": 0 }); @@ -4980,7 +4993,7 @@ uc_timegm(uc_vm_t *vm, size_t nargs) * @param {boolean} [monotonic] * Whether to query the monotonic system clock. * - * @returns {Array<number>|null} + * @returns {?number[]} * * @example * clock(); // [ 1647954926, 798269464 ] @@ -5078,7 +5091,7 @@ hexval(unsigned char c, bool lo) * @param {string} [skipchars] * The characters to skip during decoding. * - * @returns {string|null} + * @returns {?string} * * @example * hexdec("48656c6c6f20776f726c64210a"); // "Hello world!\n" @@ -5165,7 +5178,7 @@ uc_hexdec(uc_vm_t *vm, size_t nargs) * @param {*} [argument] * The argument for the operation. * - * @returns {boolean|number|null} + * @returns {?(boolean|number)} * * @example * gc(); // true diff --git a/lib/debug.c b/lib/debug.c index 40b044e..0b227d9 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -667,7 +667,7 @@ debug_setup(uc_vm_t *vm) * @param {string|module:fs.file|module:fs.proc} file * The file path or open file handle to write report to. * - * @return {boolean|null} + * @return {?boolean} */ static uc_value_t * uc_memdump(uc_vm_t *vm, size_t nargs) @@ -818,7 +818,7 @@ uc_traceback(uc_vm_t *vm, size_t nargs) * * @function module:debug#sourcepos * - * @return {module:debug.SourcePosition|null} + * @return {?module:debug.SourcePosition} */ /** @@ -955,7 +955,7 @@ uc_getinfo_upvals(uc_vm_t *vm, uc_closure_t *closure) * @param {*} value * The value to query information for. * - * @return {module:debug.ValueInformation|null} + * @return {?module:debug.ValueInformation} */ /** @@ -1362,7 +1362,7 @@ uc_xlocal(uc_vm_t *vm, uc_value_t *level, uc_value_t *var, uc_value_t **set) * @param {string|number} variable * The variable index or variable name to obtain information for. * - * @returns {module:debug.LocalInfo|null} + * @returns {?module:debug.LocalInfo} */ static uc_value_t * uc_getlocal(uc_vm_t *vm, size_t nargs) @@ -1406,7 +1406,7 @@ uc_getlocal(uc_vm_t *vm, size_t nargs) * @param {*} [value=null] * The value to set the local variable to. * - * @returns {module:debug.LocalInfo|null} + * @returns {?module:debug.LocalInfo} */ static uc_value_t * uc_setlocal(uc_vm_t *vm, size_t nargs) @@ -1552,7 +1552,7 @@ uc_xupval(uc_vm_t *vm, uc_value_t *target, uc_value_t *var, uc_value_t **set) * @param {string|number} variable * The variable index or variable name to obtain information for. * - * @returns {module:debug.UpvalInfo|null} + * @returns {?module:debug.UpvalInfo} */ static uc_value_t * uc_getupval(uc_vm_t *vm, size_t nargs) @@ -1601,7 +1601,7 @@ uc_getupval(uc_vm_t *vm, size_t nargs) * @param {*} value * The value to set the variable to. * - * @returns {module:debug.UpvalInfo|null} + * @returns {?module:debug.UpvalInfo} */ static uc_value_t * uc_setupval(uc_vm_t *vm, size_t nargs) @@ -79,7 +79,7 @@ static int last_error = 0; * @function module:fs#error * * - * @returns {string|null} + * @returns {?string} * * @example * // Trigger file system error @@ -258,6 +258,8 @@ uc_fs_fileno_common(uc_vm_t *vm, size_t nargs, const char *type) * @class module:fs.proc * @hideconstructor * + * @borrows module:fs#error as module:fs.proc#error + * * @see {@link module:fs#popen|popen()} * * @example @@ -276,26 +278,6 @@ uc_fs_fileno_common(uc_vm_t *vm, size_t nargs, const char *type) */ /** - * Query error information. - * - * Returns a string containing a description of the last occurred error or - * `null` if there is no error information. - * - * @function module:fs.proc#error - * - * @returns {string|null} - * - * @example - * // Trigger error - * const fp = popen("command"); - * fp.close(); - * fp.close(); // already closed - * - * // Print error (should yield "Bad file descriptor") - * print(fp.error(), "\n"); - */ - -/** * Closes the program handle and awaits program termination. * * Upon calling `close()` on the handle, the program's input or output stream @@ -316,7 +298,7 @@ uc_fs_fileno_common(uc_vm_t *vm, size_t nargs, const char *type) * * @function module:fs.proc#close * - * @returns {number|null} + * @returns {?number} */ static uc_value_t * uc_fs_pclose(uc_vm_t *vm, size_t nargs) @@ -378,7 +360,7 @@ uc_fs_pclose(uc_vm_t *vm, size_t nargs) * The length of data to read. Can be a number, the string "line", the string * "all", or a single character string. * - * @returns {string|null} + * @returns {?string} * * @example * const fp = popen("command", "r"); @@ -426,7 +408,7 @@ uc_fs_pread(uc_vm_t *vm, size_t nargs) * @param {*} data * The data to be written. * - * @returns {number|null} + * @returns {?number} * * @example * const fp = popen("command", "w"); @@ -448,7 +430,7 @@ uc_fs_pwrite(uc_vm_t *vm, size_t nargs) * * @function module:fs.proc#flush * - * @returns {boolean|null} + * @returns {?boolean} * */ static uc_value_t * @@ -466,7 +448,7 @@ uc_fs_pflush(uc_vm_t *vm, size_t nargs) * * @function module:fs.proc#fileno * - * @returns {number|null} + * @returns {?number} */ static uc_value_t * uc_fs_pfileno(uc_vm_t *vm, size_t nargs) @@ -498,7 +480,7 @@ uc_fs_pfileno(uc_vm_t *vm, size_t nargs) * @param {string} [mode="r"] * The open mode of the process handle. * - * @returns {module:fs.proc|null} + * @returns {?module:fs.proc} * * @example * // Open a process @@ -531,6 +513,8 @@ uc_fs_popen(uc_vm_t *vm, size_t nargs) * @class module:fs.file * @hideconstructor * + * @borrows module:fs#error as module:fs.file#error + * * @see {@link module:fs#open|open()} * @see {@link module:fs#fdopen|fdopen()} * @see {@link module:fs#mkstemp|mkstemp()} @@ -556,26 +540,6 @@ uc_fs_popen(uc_vm_t *vm, size_t nargs) */ /** - * Query error information. - * - * Returns a string containing a description of the last occurred error or - * `null` if there is no error information. - * - * @function module:fs.file#error - * - * @returns {string|null} - * - * @example - * // Trigger error - * const fp = open("file.txt"); - * fp.close(); - * fp.close(); // already closed - * - * // Print error (should yield "Bad file descriptor") - * print(fp.error(), "\n"); - */ - -/** * Closes the file handle. * * Upon calling `close()` on the handle, buffered data is flushed and the @@ -587,7 +551,7 @@ uc_fs_popen(uc_vm_t *vm, size_t nargs) * * @function module:fs.file#close * - * @returns {boolean|null} + * @returns {?boolean} */ static uc_value_t * uc_fs_close(uc_vm_t *vm, size_t nargs) @@ -639,7 +603,7 @@ uc_fs_close(uc_vm_t *vm, size_t nargs) * The length of data to read. Can be a number, the string "line", the string * "all", or a single character string. * - * @returns {string|null} + * @returns {?string} * * @example * const fp = open("file.txt", "r"); @@ -687,7 +651,7 @@ uc_fs_read(uc_vm_t *vm, size_t nargs) * @param {*} data * The data to be written. * - * @returns {number|null} + * @returns {?number} * * @example * const fp = open("file.txt", "w"); @@ -724,7 +688,7 @@ uc_fs_write(uc_vm_t *vm, size_t nargs) * | `1` | The given offset is relative to the current read position. | * | `2` | The given offset is relative to the end of the file. | * - * @returns {boolean|null} + * @returns {?boolean} * * @example * const fp = open("file.txt", "r"); @@ -785,7 +749,7 @@ uc_fs_seek(uc_vm_t *vm, size_t nargs) * * @function module:fs.file#tell * - * @returns {number|null} + * @returns {?number} */ static uc_value_t * uc_fs_tell(uc_vm_t *vm, size_t nargs) @@ -818,7 +782,7 @@ uc_fs_tell(uc_vm_t *vm, size_t nargs) * * @function module:fs.file#isatty * - * @returns {boolean|null} + * @returns {?boolean} * */ static uc_value_t * @@ -847,7 +811,7 @@ uc_fs_isatty(uc_vm_t *vm, size_t nargs) * * @function module:fs.file#flush * - * @returns {boolean|null} + * @returns {?boolean} * */ static uc_value_t * @@ -865,7 +829,7 @@ uc_fs_flush(uc_vm_t *vm, size_t nargs) * * @function module:fs.file#fileno * - * @returns {number|null} + * @returns {?number} */ static uc_value_t * uc_fs_fileno(uc_vm_t *vm, size_t nargs) @@ -913,7 +877,7 @@ uc_fs_fileno(uc_vm_t *vm, size_t nargs) * @param {number} [perm=0o666] * The file creation permissions (for modes `w…` and `a…`) * - * @returns {module:fs.file|null} + * @returns {?module:fs.file} * * @example * // Open a file in read-only mode @@ -1058,6 +1022,8 @@ uc_fs_fdopen(uc_vm_t *vm, size_t nargs) * @class module:fs.dir * @hideconstructor * + * @borrows module:fs#error as module:fs.dir#error + * * @see {@link module:fs#opendir|opendir()} * * @example @@ -1075,26 +1041,6 @@ uc_fs_fdopen(uc_vm_t *vm, size_t nargs) */ /** - * Query error information. - * - * Returns a string containing a description of the last occurred error or - * `null` if there is no error information. - * - * @function module:fs.dir#error - * - * @returns {string|null} - * - * @example - * // Trigger error - * const fp = opendir("/tmp"); - * fp.close(); - * fp.close(); // already closed - * - * // Print error (should yield "Bad file descriptor") - * print(fp.error(), "\n"); - */ - -/** * Read the next entry from the open directory. * * Returns a string containing the entry name. @@ -1105,7 +1051,7 @@ uc_fs_fdopen(uc_vm_t *vm, size_t nargs) * * @function module:fs.dir#read * - * @returns {string|null} + * @returns {?string} */ static uc_value_t * uc_fs_readdir(uc_vm_t *vm, size_t nargs) @@ -1139,7 +1085,7 @@ uc_fs_readdir(uc_vm_t *vm, size_t nargs) * * @function module:fs.dir#tell * - * @returns {number|null} + * @returns {?number} */ static uc_value_t * uc_fs_telldir(uc_vm_t *vm, size_t nargs) @@ -1174,7 +1120,7 @@ uc_fs_telldir(uc_vm_t *vm, size_t nargs) * @param {number} offset * Position value obtained by `tell()`. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * @@ -1218,7 +1164,7 @@ uc_fs_seekdir(uc_vm_t *vm, size_t nargs) * * @function module:fs.dir#close * - * @returns {boolean|null} + * @returns {?boolean} */ static uc_value_t * uc_fs_closedir(uc_vm_t *vm, size_t nargs) @@ -1247,7 +1193,7 @@ uc_fs_closedir(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the directory. * - * @returns {module:fs.dir|null} + * @returns {?module:fs.dir} * * @example * // Open a directory @@ -1282,7 +1228,7 @@ uc_fs_opendir(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the symbolic link. * - * @returns {string|null} + * @returns {?string} * * @example * // Read the value of a symbolic link @@ -1456,7 +1402,7 @@ uc_fs_stat_common(uc_vm_t *vm, size_t nargs, bool use_lstat) * @param {string} path * The path to the file or directory. * - * @returns {module:fs.FileStatResult|null} + * @returns {?module:fs.FileStatResult} * * @example * // Get information about a file @@ -1481,7 +1427,7 @@ uc_fs_stat(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the file or directory. * - * @returns {module:fs.FileStatResult|null} + * @returns {?module:fs.FileStatResult} * * @example * // Get information about a directory @@ -1505,7 +1451,7 @@ uc_fs_lstat(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the new directory. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Create a directory @@ -1539,7 +1485,7 @@ uc_fs_mkdir(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the directory to be removed. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Remove a directory @@ -1574,7 +1520,7 @@ uc_fs_rmdir(uc_vm_t *vm, size_t nargs) * @param {string} path * The path of the symbolic link. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Create a symbolic link @@ -1608,7 +1554,7 @@ uc_fs_symlink(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the file or symbolic link. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Remove a file @@ -1637,7 +1583,7 @@ uc_fs_unlink(uc_vm_t *vm, size_t nargs) * * @function module:fs#getcwd * - * @returns {string|null} + * @returns {?string} * * @example * // Get the current working directory @@ -1692,7 +1638,7 @@ uc_fs_getcwd(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the new working directory. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Change the current working directory @@ -1728,7 +1674,7 @@ uc_fs_chdir(uc_vm_t *vm, size_t nargs) * @param {number} mode * The new mode (permissions). * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Change the mode of a file @@ -1872,7 +1818,7 @@ uc_fs_resolve_group(uc_value_t *v, gid_t *gid) * The new group's ID. When given as number, it is used as-is, when given as * string, the group name is resolved to the corresponding gid first. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Change the owner of a file @@ -1918,7 +1864,7 @@ uc_fs_chown(uc_vm_t *vm, size_t nargs) * @param {string} newPath * The new path of the file or directory. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Rename a file @@ -1980,7 +1926,7 @@ uc_fs_glob(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to extract the directory name from. * - * @returns {string|null} + * @returns {?string} * * @example * // Get the directory name of a path @@ -2029,7 +1975,7 @@ uc_fs_dirname(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to extract the base name from. * - * @returns {string|null} + * @returns {?string} * * @example * // Get the base name of a path @@ -2083,7 +2029,7 @@ uc_fs_lsdir_sort_fn(const void *k1, const void *k2) * @param {string} path * The path to the directory. * - * @returns {string[]|null} + * @returns {?string[]} * * @example * // List the content of a directory @@ -2169,7 +2115,7 @@ uc_fs_lsdir(uc_vm_t *vm, size_t nargs) * @param {string} [template="/tmp/XXXXXX"] * The path template to use when forming the temporary file name. * - * @returns {module:fs.file|null} + * @returns {?module:fs.file} * * @example * // Create a unique temporary file in the current working directory @@ -2261,7 +2207,7 @@ uc_fs_mkstemp(uc_vm_t *vm, size_t nargs) * @param {number} [mode="f"] * Optional access mode. * - * @returns {boolean|null} + * @returns {?boolean} * * @example * // Check file read and write accessibility @@ -2329,7 +2275,7 @@ uc_fs_access(uc_vm_t *vm, size_t nargs) * Number of bytes to limit the result to. When omitted, the entire content is * returned. * - * @returns {string|null} + * @returns {?string} * * @example * // Read first 100 bytes of content @@ -2441,7 +2387,7 @@ uc_fs_readfile(uc_vm_t *vm, size_t nargs) * Truncates the amount of data to be written to the specified amount of bytes. * When omitted, the entire content is written. * - * @returns {number|null} + * @returns {?number} * * @example * // Write string to a file @@ -2522,7 +2468,7 @@ uc_fs_writefile(uc_vm_t *vm, size_t nargs) * @param {string} path * The path to the file or directory. * - * @returns {string|null} + * @returns {?string} * * @example * // Resolve the absolute path of a file @@ -2561,7 +2507,7 @@ uc_fs_realpath(uc_vm_t *vm, size_t nargs) * * @function module:fs#pipe * - * @returns {module:fs.file[]|null} + * @returns {?module:fs.file[]} * * @example * // Create a pipe |