From 6761d5bf83e07e384be87a954f0c7422d689aaff Mon Sep 17 00:00:00 2001 From: haithium <128622475+haithium@users.noreply.github.com> Date: Mon, 15 Jun 2026 17:01:44 +0000 Subject: [PATCH] docs: generate docs --- docs/api/calendar.md | 36 ++- docs/api/date.md | 142 ++++----- docs/api/duration.md | 106 ++++--- docs/api/fs.md | 18 +- docs/api/glob.md | 21 +- docs/api/is.md | 3 +- docs/api/json.md | 3 +- docs/api/keyword.md | 26 +- docs/api/list.md | 70 +++-- docs/api/log.md | 16 +- docs/api/ntpath.md | 11 +- docs/api/operator.md | 9 +- docs/api/path.md | 18 +- docs/api/posixpath.md | 3 +- docs/api/runtime.md | 7 +- docs/api/set.md | 74 +++-- docs/api/str.md | 22 +- docs/api/stringcase.md | 3 +- docs/api/stringify.md | 3 +- docs/api/tbl.md | 13 +- docs/api/template.md | 13 +- docs/api/utils.md | 32 +- docs/api/validate.md | 3 +- docs/types.md | 684 +++++++++++++++++++++++++++++++++++++++++ 24 files changed, 1045 insertions(+), 291 deletions(-) create mode 100644 docs/types.md diff --git a/docs/api/calendar.md b/docs/api/calendar.md index 99c1756..994aff9 100644 --- a/docs/api/calendar.md +++ b/docs/api/calendar.md @@ -1,9 +1,8 @@ --- +title: "calendar" description: "Calendar and date helpers." --- -# `calendar` - Calendar and date helpers. > [!WARNING] @@ -56,7 +55,7 @@ Return the default first weekday. **Return**: -- `firstweekday` (`1|2|3|4|5|6|7`) +- `firstweekday` (`modsCalendarWeekday`) **Example**: @@ -77,7 +76,7 @@ Set the default first weekday. **Parameters**: -- `firstweekday` (`1|2|3|4|5|6|7`) +- `firstweekday` (`modsCalendarWeekday`) **Example**: @@ -148,7 +147,7 @@ Return the first weekday and number of days for a month. **Return**: -- `weekday` (`1|2|3|4|5|6|7`) +- `weekday` (`modsCalendarWeekday`) - `ndays` (`integer`) **Example**: @@ -168,13 +167,12 @@ Return weekday number where Monday is `1` and Sunday is `7`. **Parameters**: - `year` (`integer`) -- `month` (`1|2|3|4|5|6|7|8|9|10|11|12`) -- `day` - (`1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31`) +- `month` (`modsCalendarMonth`) +- `day` (`modsCalendarMonthday`) **Return**: -- `weekday` (`1|2|3|4|5|6|7`) +- `weekday` (`modsCalendarWeekday`) **Example**: @@ -194,7 +192,7 @@ Return the formatted weekday header string. **Parameters**: - `width?` (`integer`) -- `firstweekday?` (`1|2|3|4|5|6|7`) +- `firstweekday?` (`modsCalendarWeekday`) **Return**: @@ -221,8 +219,8 @@ Iterate `(year, month, day, weekday)` tuples for a full calendar grid. **Parameters**: - `year` (`integer`) -- `month` (`1|2|3|4|5|6|7|8|9|10|11|12`) -- `firstweekday?` (`1|2|3|4|5|6|7`) +- `month` (`modsCalendarMonth`) +- `firstweekday?` (`modsCalendarWeekday`) **Return**: @@ -269,7 +267,7 @@ Iterate weekday numbers for one full week. **Parameters**: -- `firstweekday?` (`1|2|3|4|5|6|7`) +- `firstweekday?` (`modsCalendarWeekday`) **Return**: @@ -290,7 +288,7 @@ print(table.concat(weekdays, ", ")) --> "1, 2, 3, 4, 5, 6, 7" -### `days` (`mods.List`) +### `days` ([`mods.List`]``) Weekday names indexed from `1` (Monday) to `7` (Sunday). @@ -301,7 +299,7 @@ print(cal.days[7]) --> Sunday -### `firstweekday` (`1|2|3|4|5|6|7`) +### `firstweekday` (`modsCalendarWeekday`) The default first weekday field. @@ -318,7 +316,7 @@ print(cal.firstweekday) --> 7 -### `months` (`mods.List`) +### `months` ([`mods.List`]``) Month names indexed from `1` to `12`. @@ -326,3 +324,9 @@ Month names indexed from `1` to `12`. print(cal.months[1]) --> January print(cal.months[12]) --> December ``` + + + +[`mods.List`]: /mods/api/list.html + + diff --git a/docs/api/date.md b/docs/api/date.md index c39f439..222621d 100644 --- a/docs/api/date.md +++ b/docs/api/date.md @@ -1,9 +1,8 @@ --- +title: "date" description: "Timezone-naive date helpers and immutable date values." --- -# `date` - Timezone-naive date helpers and immutable date values. ## Usage @@ -173,7 +172,7 @@ Create a Date from a string using an optional pattern. **Return**: -- **value** (`mods.Date`) +- **value** ([`mods.Date`]) **Example**: @@ -190,12 +189,12 @@ Create a Date from a Unix timestamp (milliseconds) or a DateParts table. **Parameters**: -- `input?` (`number|mods.DateParts`): Unix timestamp (ms) or table of date +- `input?` (`number` | [`mods.DateParts`]): Unix timestamp (ms) or table of date components. **Return**: -- **value** (`mods.Date`) +- **value** ([`mods.Date`]) **Example**: @@ -214,15 +213,13 @@ Return a copy shifted by the given amount and unit. **Parameters**: -- `amount` (`integer|mods.DateDurationParts`): Signed amount to add, or a +- `amount` (`integer` | [`mods.DateDurationParts`]): Signed amount to add, or a duration-style table. -- `unit?` - (`'ms'|'milliseconds'|'millisecond'|'s'|'secs'|'sec'|'seconds'|'second'|'m'|'mins'|'min'|'minutes'|'minute'|'h'|'hours'|'hour'|'d'|'days'|'day'|'w'|'weeks'|'week'|'M'|'months'|'month'|'q'|'quarters'|'quarter'|'y'|'years'|'year'`): - Unit for the addition. +- `unit?` ([`mods.DateUnit`]): Unit for the addition. **Return**: -- `shifted` (`mods.Date`): Shifted date value. +- `shifted` ([`mods.Date`]): Shifted date value. **Example**: @@ -244,10 +241,8 @@ Return the signed difference to another Date in the requested unit. **Parameters**: -- `date` (`mods.Date`): Date to compare against. -- `unit?` - (`'ms'|'milliseconds'|'millisecond'|'s'|'secs'|'sec'|'seconds'|'second'|'m'|'mins'|'min'|'minutes'|'minute'|'h'|'hours'|'hour'|'d'|'days'|'day'|'w'|'weeks'|'week'|'M'|'months'|'month'|'q'|'quarters'|'quarter'|'y'|'years'|'year'`): - Unit used for the difference. Defaults to `"ms"`. +- `date` ([`mods.Date`]): Date to compare against. +- `unit?` ([`mods.DateUnit`]): Unit used for the difference. Defaults to `"ms"`. **Return**: @@ -270,15 +265,13 @@ Return a copy shifted backward by the given amount and unit. **Parameters**: -- `amount` (`integer|mods.DateDurationParts`): Signed amount to subtract, or a - duration-style table. -- `unit?` - (`'ms'|'milliseconds'|'millisecond'|'s'|'secs'|'sec'|'seconds'|'second'|'m'|'mins'|'min'|'minutes'|'minute'|'h'|'hours'|'hour'|'d'|'days'|'day'|'w'|'weeks'|'week'|'M'|'months'|'month'|'q'|'quarters'|'quarter'|'y'|'years'|'year'`): - Unit for the subtraction. +- `amount` (`integer` | [`mods.DateDurationParts`]): Signed amount to subtract, + or a duration-style table. +- `unit?` ([`mods.DateUnit`]): Unit for the subtraction. **Return**: -- `shifted` (`mods.Date`): Shifted date value. +- `shifted` ([`mods.Date`]): Shifted date value. **Example**: @@ -301,11 +294,11 @@ Return the end boundary for the given unit. **Parameters**: -- `unit` (`mods.DateUnit|"isoWeek"`): Boundary unit. +- `unit` ([`mods.DateUnit`] | `"isoWeek"`): Boundary unit. **Return**: -- `bounded` (`mods.Date`): Date clamped to the end of the unit. +- `bounded` ([`mods.Date`]): Date clamped to the end of the unit. **Example**: @@ -326,11 +319,11 @@ Return the start boundary for the given unit. **Parameters**: -- `unit` (`mods.DateUnit|"isoWeek"`): Boundary unit. +- `unit` ([`mods.DateUnit`] | `"isoWeek"`): Boundary unit. **Return**: -- `bounded` (`mods.Date`): Date clamped to the start of the unit. +- `bounded` ([`mods.Date`]): Date clamped to the start of the unit. **Example**: @@ -357,8 +350,8 @@ Return or set the day of the year. **Return**: -- `dayOrDate` (`integer|mods.Date`): Current day-of-year number, or a shifted - Date when `day_of_year_number` is provided. +- `dayOrDate` (`integer` | [`mods.Date`]): Current day-of-year number, or a + shifted Date when `day_of_year_number` is provided. **Example**: @@ -396,8 +389,8 @@ Return or set the ISO week-of-year number. **Return**: -- `isoWeekOrDate` (`integer|mods.Date`): Current ISO week number, or a shifted - Date when `iso_week_number` is provided. +- `isoWeekOrDate` (`integer` | [`mods.Date`]): Current ISO week number, or a + shifted Date when `iso_week_number` is provided. **Example**: @@ -435,8 +428,8 @@ Return or set the ISO weekday number where Monday is `1` and Sunday is `7`. **Return**: -- `isoWeekdayOrDate` (`modsCalendarWeekday|mods.Date`): Current ISO weekday - number, or a shifted Date when `iso_weekday_number` is provided. +- `isoWeekdayOrDate` (`modsCalendarWeekday` | [`mods.Date`]): Current ISO + weekday number, or a shifted Date when `iso_weekday_number` is provided. **Example**: @@ -493,8 +486,8 @@ Return or set the quarter of the year. **Return**: -- `quarterOrDate` (`integer|mods.Date`): Current quarter number, or a shifted - Date when `quarter_number` is provided. +- `quarterOrDate` (`integer` | [`mods.Date`]): Current quarter number, or a + shifted Date when `quarter_number` is provided. **Example**: @@ -516,8 +509,8 @@ Return or set the non-ISO week-of-year number. **Return**: -- `weekOrDate` (`integer|mods.Date`): Current week-of-year number, or a shifted - Date when `week_number` is provided. +- `weekOrDate` (`integer` | [`mods.Date`]): Current week-of-year number, or a + shifted Date when `week_number` is provided. **Example**: @@ -555,8 +548,8 @@ Return or set the locale-relative weekday like Day.js `weekday()`. **Return**: -- `weekdayOrDate` (`integer|mods.Date`): Current locale-relative weekday number, - or a shifted Date when `weekday_number` is provided. +- `weekdayOrDate` (`integer` | [`mods.Date`]): Current locale-relative weekday + number, or a shifted Date when `weekday_number` is provided. **Example**: @@ -568,7 +561,7 @@ print(d:weekday(-7)) --> 2026-03-23 00:00:00 ``` The getter returns a number in the range `0..6`, relative to the current -`mods.calendar.firstweekday`. Passing an integer returns a shifted copy in the +[`mods.calendar.firstweekday`]. Passing an integer returns a shifted copy in the same locale-relative week space, with negative and overflow values moving into previous or next weeks. @@ -598,12 +591,12 @@ Return the latest value from the given dates. **Parameters**: -- `...` (`mods.Date|mods.Date[]`): Date values to compare. Each argument may be - a date or a list of dates. +- `...` ([`mods.Date`] | [`mods.Date`]`[]`): Date values to compare. Each + argument may be a date or a list of dates. **Return**: -- `date` (`mods.Date`): Latest date value. +- `date` ([`mods.Date`]): Latest date value. **Example**: @@ -622,12 +615,12 @@ Return the earliest value from the given dates. **Parameters**: -- `...` (`mods.Date|mods.Date[]`): Date values to compare. Each argument may be - a date or a list of dates. +- `...` ([`mods.Date`] | [`mods.Date`]`[]`): Date values to compare. Each + argument may be a date or a list of dates. **Return**: -- `date` (`mods.Date`): Earliest date value. +- `date` ([`mods.Date`]): Earliest date value. **Example**: @@ -646,13 +639,13 @@ Return the earliest and latest values from the given dates. **Parameters**: -- `...` (`mods.Date|mods.Date[]`): Date values to compare. Each argument may be - a date or a list of dates. +- `...` ([`mods.Date`] | [`mods.Date`]`[]`): Date values to compare. Each + argument may be a date or a list of dates. **Return**: -- `minDate` (`mods.Date`): Earliest date value. -- `maxDate` (`mods.Date`): Latest date value. +- `minDate` ([`mods.Date`]): Earliest date value. +- `maxDate` ([`mods.Date`]): Latest date value. **Example**: @@ -675,7 +668,7 @@ Return `true` when the value is later than `other`. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -697,7 +690,7 @@ Return `true` when the value is earlier than `other`. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -722,8 +715,8 @@ pass `true` as the third argument to include the endpoints. **Parameters**: -- `start_date` (`mods.Date`): One bound. -- `end_date` (`mods.Date`): The other bound. +- `start_date` ([`mods.Date`]): One bound. +- `end_date` ([`mods.Date`]): The other bound. - `inclusive?` (`boolean`): Whether to include the endpoints. Defaults to `false`. @@ -750,7 +743,7 @@ Return `true` when the value is equal to `other`. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -772,7 +765,7 @@ Return `true` when the value is later than or equal to `other`. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -797,7 +790,7 @@ Return `true` when the value is earlier than or equal to `other`. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -876,7 +869,7 @@ Return `true` when the value is a duration created by `date.duration(...)`. **Return**: -- `isDuration` (`boolean`): Whether the value is a `mods.Duration`. +- `isDuration` (`boolean`): Whether the value is a [`mods.Duration`]. **Example**: @@ -1017,7 +1010,7 @@ By default the result includes a suffix like `ago` or a prefix like `in`. Pass **Parameters**: -- `date` (`mods.Date`): Reference date. +- `date` ([`mods.Date`]): Reference date. - `without_suffix?` (`boolean`): Whether to omit `ago` / `in`. **Return**: @@ -1065,7 +1058,7 @@ By default the result includes a suffix like `ago` or a prefix like `in`. Pass **Parameters**: -- `date` (`mods.Date`): Reference date. +- `date` ([`mods.Date`]): Reference date. - `without_suffix?` (`boolean`): Whether to omit `ago` / `in`. **Return**: @@ -1116,7 +1109,7 @@ Create a Date from a Unix timestamp in whole or fractional seconds. **Return**: -- `date` (`mods.Date`): Date value for the given Unix timestamp. +- `date` ([`mods.Date`]): Date value for the given Unix timestamp. **Example**: @@ -1138,8 +1131,8 @@ Unlike `Date(...)`, this helper never raises for invalid input; it just returns **Parameters**: -- `input?` (`string|number|mods.DateParts`): Value accepted by `Date(...)`. - `nil` returns `false`. +- `input?` (`string` | `number` | [`mods.DateParts`]): Value accepted by + `Date(...)`. `nil` returns `false`. - `pattern?` (`string`): Custom parse pattern used for string input. **Return**: @@ -1167,12 +1160,12 @@ This works as either `date + ms` or `ms + date`. **Parameters**: -- `a` (`integer|mods.Date`): Milliseconds to add, or another Date. -- `b` (`integer|mods.Date`): Milliseconds to add, or another Date. +- `a` (`integer` | [`mods.Date`]): Milliseconds to add, or another Date. +- `b` (`integer` | [`mods.Date`]): Milliseconds to add, or another Date. **Return**: -- `sum` (`mods.Date`): Sum of the two dates. +- `sum` ([`mods.Date`]): Sum of the two dates. **Example**: @@ -1190,7 +1183,7 @@ Return `true` when both Date values have identical components. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -1210,7 +1203,7 @@ Return `true` when the left Date is earlier than or equal to the right. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -1231,7 +1224,7 @@ Return `true` when the left Date is earlier than the right. **Parameters**: -- `date` (`mods.Date`): Date to compare against. +- `date` ([`mods.Date`]): Date to compare against. **Return**: @@ -1255,12 +1248,12 @@ subtracting another Date, it returns the signed millisecond difference. **Parameters**: -- `a` (`integer|mods.Date`): Milliseconds to subtract, or another Date. -- `b` (`integer|mods.Date`): Milliseconds to subtract, or another Date. +- `a` (`integer` | [`mods.Date`]): Milliseconds to subtract, or another Date. +- `b` (`integer` | [`mods.Date`]): Milliseconds to subtract, or another Date. **Return**: -- `delta` (`mods.Date|integer`): Difference between dates. +- `delta` ([`mods.Date`] | `integer`): Difference between dates. **Example**: @@ -1390,3 +1383,14 @@ Year component. ```lua print(Date("2026-03-30").year) --> 2026 ``` + + + +[`mods.Date`]: /mods/api/date.html +[`mods.DateDurationParts`]: /mods/types.html#mods-datedurationparts +[`mods.DateParts`]: /mods/types.html#mods-dateparts +[`mods.DateUnit`]: /mods/types.html#mods-dateunit +[`mods.Duration`]: /mods/api/duration.html +[`mods.calendar.firstweekday`]: /mods/api/calendar.html + + diff --git a/docs/api/duration.md b/docs/api/duration.md index 3386860..840161e 100644 --- a/docs/api/duration.md +++ b/docs/api/duration.md @@ -1,10 +1,9 @@ --- +title: "duration" description: "Reusable immutable duration values for date arithmetic and formatting." --- -# `duration` - Reusable immutable duration values for date arithmetic and formatting. ## Usage @@ -20,9 +19,9 @@ print(shift:format("D [days] HH:mm")) --> 2 days 03:00 | Function | Description | | --------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| [`is_duration(value)`](#fn-is-duration) | Return `true` when the value is a duration created by `mods.duration(...)` or `mods.date.duration(...)`. | | [`new(input, unit?)`](#fn-new) | Create a duration from a numeric amount and unit. | | [`new(input?)`](#fn-new) | Create a duration from numeric parts, an ISO 8601 string, or another duration. | +| [`is_duration(value)`](#fn-is-duration) | Return `true` when the value is a duration created by `mods.duration(...)` or `mods.date.duration(...)`. | **Duration**: @@ -49,71 +48,71 @@ print(shift:format("D [days] HH:mm")) --> 2 days 03:00 | [`__eq(duration)`](#fn-eq) | Return `true` when both duration values have identical components. | | [`__tostring()`](#fn-tostring) | Return the same result as `tostring()` when coerced to a string. | - + -### `is_duration(value)` +### `new(input, unit?)` -Return `true` when the value is a duration created by `mods.duration(...)` or -`mods.date.duration(...)`. +Create a duration from a numeric amount and unit. **Parameters**: -- `value` (`any`) +- `input` (`number`): Numeric amount to convert into a duration. +- `unit?` ([`mods.DateUnit`]): Unit used with the numeric amount. Defaults to + `"ms"`. **Return**: -- `isDuration` (`boolean`) +- `duration` ([`mods.Duration`]) **Example**: ```lua -local Duration = require "mods.duration" -print(Duration.is_duration(Duration({ day = 2 }))) --> true -print(Duration.is_duration({ day = 2 })) --> false +local d = Duration(90, "minute") ``` -### `new(input, unit?)` +### `new(input?)` -Create a duration from a numeric amount and unit. +Create a duration from numeric parts, an ISO 8601 string, or another duration. **Parameters**: -- `input` (`number`): Numeric amount to convert into a duration. -- `unit?` (`mods.DateUnit`): Unit used with the numeric amount. Defaults to - `"ms"`. +- `input?` (`string` | [`mods.DurationParts`] | [`mods.Duration`]): Duration + parts, an ISO 8601 string, or another duration. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: ```lua -local d = Duration(90, "minute") +local a = Duration({ day = 2, hour = 3 }) +local b = Duration("PT1H30M") ``` - + -### `new(input?)` +### `is_duration(value)` -Create a duration from numeric parts, an ISO 8601 string, or another duration. +Return `true` when the value is a duration created by `mods.duration(...)` or +`mods.date.duration(...)`. **Parameters**: -- `input?` (`string|mods.DurationParts|mods.Duration`): Duration parts, an ISO - 8601 string, or another duration. +- `value` (`any`) **Return**: -- `duration` (`mods.Duration`) +- `isDuration` (`boolean`) **Example**: ```lua -local a = Duration({ day = 2, hour = 3 }) -local b = Duration("PT1H30M") +local Duration = require "mods.duration" +print(Duration.is_duration(Duration({ day = 2 }))) --> true +print(Duration.is_duration({ day = 2 })) --> false ``` ### Duration @@ -126,13 +125,13 @@ Return a new duration with another duration or unit amount added. **Parameters**: -- `value` (`number|mods.DurationParts|mods.Duration`): Signed amount to add, or - another duration value. -- `unit?` (`mods.DateUnit`): Unit used when `value` is a number. +- `value` (`number` | [`mods.DurationParts`] | [`mods.Duration`]): Signed amount + to add, or another duration value. +- `unit?` ([`mods.DateUnit`]): Unit used when `value` is a number. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -151,7 +150,7 @@ Return the duration expressed in the requested unit. **Parameters**: -- `unit` (`mods.DateUnit`) +- `unit` ([`mods.DateUnit`]) **Return**: @@ -173,7 +172,7 @@ Return a shallow copy of the duration value. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -194,7 +193,7 @@ Returns `-1` when smaller, `0` when equal, and `1` when larger. **Parameters**: -- `other` (`number|string|mods.DurationParts|mods.Duration`) +- `other` (`number` | `string` | [`mods.DurationParts`] | [`mods.Duration`]) **Return**: @@ -264,10 +263,10 @@ output or explicit unit clamping. **Parameters**: -- `with_suffix_or_options?` (`boolean|mods.DurationHumanizeOptions`): Whether to - include `ago` / `in` style wording, or an options table. -- `options?` (`mods.DurationHumanizeOptions`): Additional options when the first - argument is a boolean. +- `with_suffix_or_options?` (`boolean` | [`mods.DurationHumanizeOptions`]): + Whether to include `ago` / `in` style wording, or an options table. +- `options?` ([`mods.DurationHumanizeOptions`]): Additional options when the + first argument is a boolean. **Return**: @@ -291,7 +290,7 @@ Return a compacted duration using the module's canonical carry rules. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -308,13 +307,13 @@ Return a new duration with another duration or unit amount subtracted. **Parameters**: -- `value` (`number|mods.DurationParts|mods.Duration`): Signed amount to - subtract, or another duration value. -- `unit?` (`mods.DateUnit`): Unit used when `value` is a number. +- `value` (`number` | [`mods.DurationParts`] | [`mods.Duration`]): Signed amount + to subtract, or another duration value. +- `unit?` ([`mods.DateUnit`]): Unit used when `value` is a number. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -370,12 +369,12 @@ Create a duration from a numeric amount and unit. **Parameters**: - `input` (`number`): Numeric amount to convert into a duration. -- `unit?` (`mods.DateUnit`): Unit used with the numeric amount. Defaults to +- `unit?` ([`mods.DateUnit`]): Unit used with the numeric amount. Defaults to `"ms"`. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -392,12 +391,12 @@ Create a duration from numeric parts, an ISO 8601 string, or another duration. **Parameters**: -- `input?` (`string|mods.DurationParts|mods.Duration`): Duration parts, an ISO - 8601 string, or another duration. +- `input?` (`string` | [`mods.DurationParts`] | [`mods.Duration`]): Duration + parts, an ISO 8601 string, or another duration. **Return**: -- `duration` (`mods.Duration`) +- `duration` ([`mods.Duration`]) **Example**: @@ -415,7 +414,7 @@ Return `true` when both duration values have identical components. **Parameters**: -- `duration` (`mods.Duration`): Duration to compare against. +- `duration` ([`mods.Duration`]): Duration to compare against. **Return**: @@ -444,3 +443,12 @@ Return the same result as `tostring()` when coerced to a string. local Duration = require "mods.duration" print(Duration({ day = 2 })) --> duration(days=2) ``` + + + +[`mods.DateUnit`]: /mods/types.html#mods-dateunit +[`mods.DurationHumanizeOptions`]: /mods/types.html#mods-durationhumanizeoptions +[`mods.DurationParts`]: /mods/types.html#mods-durationparts +[`mods.Duration`]: /mods/api/duration.html + + diff --git a/docs/api/fs.md b/docs/api/fs.md index a646a9b..1f6f392 100644 --- a/docs/api/fs.md +++ b/docs/api/fs.md @@ -1,9 +1,8 @@ --- +title: "fs" description: "Filesystem I/O, metadata, and filesystem path operations." --- -# `fs` - Filesystem I/O, metadata, and filesystem path operations. > [!NOTE] @@ -522,9 +521,8 @@ Return file attributes. **Return**: -- `attrs` - (`string|integer|LuaFileSystem.AttributeMode|LuaFileSystem.Attributes?`): File - attributes, or `nil` on failure. +- `attrs` (`string` | `integer` | `LuaFileSystem.AttributeMode` | + `LuaFileSystem.Attributes?`): File attributes, or `nil` on failure. - `errmsg` (`string?`): Error message when the check fails. - `errcode` (`integer?`): OS error code when available. @@ -562,7 +560,7 @@ Iterator over items in `path`. - `iterator` (`(fun(state:table, prev?:string):basename:string?, type:modsFsEntryType?)?`): Iterator, or `nil` on failure. -- `state` (`table|string`): Iterator state on success, or error message on +- `state` (`table` | `string`): Iterator state on success, or error message on failure. **Example**: @@ -597,7 +595,7 @@ Return direct children of a directory. **Return**: -- `paths` (`mods.List?`): Direct child paths, or basenames when +- `paths` ([`mods.List`]`?`): Direct child paths, or basenames when `opts.names` is `true`. - `err` (`string?`): Error message when traversal setup fails. @@ -651,3 +649,9 @@ Read full file in text mode. ```lua fs.read_text("README.md") ``` + + + +[`mods.List`]: /mods/api/list.html + + diff --git a/docs/api/glob.md b/docs/api/glob.md index 045a163..be55e80 100644 --- a/docs/api/glob.md +++ b/docs/api/glob.md @@ -1,9 +1,8 @@ --- +title: "glob" description: "Glob-style matching and filesystem expansion helpers." --- -# `glob` - Glob-style matching and filesystem expansion helpers. ## Usage @@ -105,7 +104,7 @@ Return the values from `names` that match the glob pattern. **Return**: -- `matches` (`mods.List`): Matching values from `names`. +- `matches` ([`mods.List`]``): Matching values from `names`. **Example**: @@ -130,13 +129,11 @@ Return glob matches under `path`. - `path` (`string`): Input path. - `pattern?` (`string`): Optional pattern to match. -- `opts?` - (`{hidden?:boolean, recursive?:boolean, follow?:boolean, ignorecase?:boolean}`): - Optional glob options. +- `opts?` (`modsGlobOptions`): Optional glob options. **Return**: -- `paths` (`mods.List`): Matching paths under `path`. +- `paths` ([`mods.List`]``): Matching paths under `path`. **Example**: @@ -183,9 +180,7 @@ Iterator over glob matches under `path`. - `path` (`string`): Input path. - `pattern?` (`string`): Optional pattern to match. -- `opts?` - (`{hidden?:boolean, recursive?:boolean, follow?:boolean, ignorecase?:boolean}`): - Optional glob options. +- `opts?` (`modsGlobOptions`): Optional glob options. **Return**: @@ -265,3 +260,9 @@ print(matches == translated_matches) --> true > print(("src/x.lua"):match(glob.translate(pattern))) --> nil > print(glob.match("src/x.lua", pattern)) --> true > ``` + + + +[`mods.List`]: /mods/api/list.html + + diff --git a/docs/api/is.md b/docs/api/is.md index 0505cbd..b6db0b4 100644 --- a/docs/api/is.md +++ b/docs/api/is.md @@ -1,9 +1,8 @@ --- +title: "is" description: "Type predicates for Lua values and filesystem path types." --- -# `is` - Type predicates for Lua values and filesystem path types. ## Usage diff --git a/docs/api/json.md b/docs/api/json.md index f123b42..0209339 100644 --- a/docs/api/json.md +++ b/docs/api/json.md @@ -1,9 +1,8 @@ --- +title: "json" description: "JSON encoding and decoding helpers." --- -# `json` - JSON encoding and decoding helpers. > [!NOTE] diff --git a/docs/api/keyword.md b/docs/api/keyword.md index 738d8c4..0785e5c 100644 --- a/docs/api/keyword.md +++ b/docs/api/keyword.md @@ -1,9 +1,8 @@ --- +title: "keyword" description: "Helpers for Lua keywords and identifiers." --- -# `keyword` - Helpers for Lua keywords and identifiers. ## Usage @@ -19,10 +18,10 @@ kw.isidentifier("hello_world") --> true **Collections**: -| Function | Description | -| ------------------------ | ------------------------------------- | -| [`kwlist()`](#fn-kwlist) | Return Lua keywords as a `mods.List`. | -| [`kwset()`](#fn-kwset) | Return Lua keywords as a `mods.Set`. | +| Function | Description | +| ------------------------ | --------------------------------------- | +| [`kwlist()`](#fn-kwlist) | Return Lua keywords as a [`mods.List`]. | +| [`kwset()`](#fn-kwset) | Return Lua keywords as a [`mods.Set`]. | **Normalization**: @@ -43,11 +42,11 @@ kw.isidentifier("hello_world") --> true #### `kwlist()` -Return Lua keywords as a `mods.List`. +Return Lua keywords as a [`mods.List`]. **Return**: -- `words` (`mods.List`): List of Lua keywords. +- `words` ([`mods.List`]``): List of Lua keywords. **Example**: @@ -60,11 +59,11 @@ kw.kwlist():contains("global") --> true -- Lua 5.5+ #### `kwset()` -Return Lua keywords as a `mods.Set`. +Return Lua keywords as a [`mods.Set`]. **Return**: -- `words` (`mods.Set`): Set of Lua keywords. +- `words` ([`mods.Set`]``): Set of Lua keywords. **Example**: @@ -138,3 +137,10 @@ Return `true` when `v` is a reserved Lua keyword. kw.iskeyword("function") --> true kw.iskeyword("hello") --> false ``` + + + +[`mods.List`]: /mods/api/list.html +[`mods.Set`]: /mods/api/set.html + + diff --git a/docs/api/list.md b/docs/api/list.md index 7a6bba1..44ec0ae 100644 --- a/docs/api/list.md +++ b/docs/api/list.md @@ -1,10 +1,9 @@ --- +title: "List" description: "A list class for creating, transforming, and querying sequences of values." --- -# `List` - A list class for creating, transforming, and querying sequences of values. ## Usage @@ -159,7 +158,7 @@ Return a shallow copy of the list. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -209,7 +208,7 @@ Extend the list with another list or set. **Parameters**: -- `t` (`mods.List|mods.Set|any[]`): Values to append. +- `t` ([`mods.List`] | [`mods.Set`] | `any[]`): Values to append. **Return**: @@ -238,7 +237,7 @@ Extract values matching the predicate and remove them from the list. **Return**: -- `ls` (`mods.List`): Extracted values. +- `ls` ([`mods.List`]): Extracted values. **Example**: @@ -473,7 +472,7 @@ Compare two lists using shallow element equality. **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -524,7 +523,7 @@ Compare two lists lexicographically. **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -549,7 +548,7 @@ Compare two lists lexicographically. **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -722,7 +721,7 @@ Return a new list with values not in the given list or set. **Parameters**: -- `t` (`mods.List|mods.Set|any[]`): Values to remove. +- `t` ([`mods.List`] | [`mods.Set`] | `any[]`): Values to remove. **Return**: @@ -750,7 +749,7 @@ Return a new list without the first n elements. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -770,7 +769,7 @@ Return a new list with values matching the predicate. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -787,7 +786,7 @@ Flatten one level of nested lists. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -846,11 +845,11 @@ Return values that are also present in the given list or set. **Parameters**: -- `t` (`mods.List|mods.Set|any[]`): Other list/set. +- `t` ([`mods.List`] | [`mods.Set`] | `any[]`): Other list/set. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -934,7 +933,7 @@ Return a new list by mapping each value. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -971,7 +970,7 @@ Return a new list repeated `n` times (list multiplication behavior). **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1019,7 +1018,7 @@ Reverse the list in place. **Return**: -- `ls` (`mods.List`): Same list, reversed in place. +- `ls` ([`mods.List`]): Same list, reversed in place. **Example**: @@ -1040,7 +1039,7 @@ Return a new list containing items from i to j (inclusive). **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1064,7 +1063,7 @@ Return the first n elements as a new list. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1080,7 +1079,7 @@ Convert the list to a set. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -1116,7 +1115,7 @@ Return a new list with duplicates removed (first occurrence kept). **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1132,11 +1131,11 @@ Zip two collections into a list of 2-element tables. **Parameters**: -- `t` (`mods.List|mods.Set|any[]`): Values to pair with. +- `t` ([`mods.List`] | [`mods.Set`] | `any[]`): Values to pair with. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1160,11 +1159,11 @@ left-hand list reference (`+`). **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: -- `self` (`mods.List|any[]`): Current list. +- `self` ([`mods.List`] | `any[]`): Current list. **Example**: @@ -1186,7 +1185,7 @@ Compare two lists using shallow element equality (`==`). **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -1235,7 +1234,7 @@ Compare two lists lexicographically (`<=`). **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -1259,7 +1258,7 @@ Compare two lists lexicographically (`<`). **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: @@ -1283,11 +1282,11 @@ Repeat a list `n` times (`*`). **Parameters**: -- `n` (`integer|mods.List`): Right operand. +- `n` (`integer` | [`mods.List`]): Right operand. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1308,11 +1307,11 @@ Return values from the left list that are not present in the right list (`-`). **Parameters**: -- `ls` (`mods.List|any[]`): Other list value. +- `ls` ([`mods.List`] | `any[]`): Other list value. **Return**: -- `ls` (`mods.List`): New list. +- `ls` ([`mods.List`]): New list. **Example**: @@ -1341,3 +1340,10 @@ Render the list to a string like `{ "a", "b", 1 }`. ```lua s = tostring(List({ "a", "b", 1 })) --> '{ "a", "b", 1 }' ``` + + + +[`mods.List`]: /mods/api/list.html +[`mods.Set`]: /mods/api/set.html + + diff --git a/docs/api/log.md b/docs/api/log.md index 749b4f0..3e05945 100644 --- a/docs/api/log.md +++ b/docs/api/log.md @@ -1,11 +1,10 @@ --- +title: "log" description: "Logger factory that emits normalized records through an optional custom handler." --- -# `log` - Logger factory that emits normalized records through an optional custom handler. When `opts.handler` is omitted, records are written to `io.stderr`. @@ -44,11 +43,11 @@ logger:warn("config missing") --> writes: [WARN]: config missing Create a new logger. **Parameters**: -- `opts?` (`mods.log.new.opts`): Logger configuration. +- `opts?` ([`mods.log.new.opts`]): Logger configuration. **Return**: -- `logger` (`mods.log.logger`): Logger instance. +- `logger` ([`mods.log.logger`]): Logger instance. ### Logger Methods @@ -82,7 +81,7 @@ Emit an `info` record. **Parameters**: Emit a record for `level` when it passes the logger filter. **Parameters**: -- `levelname` (`string|"debug"|"info"|"warn"|"error"|"off"`): Log level to emit. +- `levelname` (`modsLogLevel`): Log level to emit. - `...` (`any`): Additional values joined with spaces. @@ -92,3 +91,10 @@ Emit a record for `level` when it passes the logger filter. **Parameters**: Emit a `warn` record. **Parameters**: - `...` (`any`): Additional values joined with spaces. + + + +[`mods.log.logger`]: /mods/api/log.html +[`mods.log.new.opts`]: /mods/api/log.html + + diff --git a/docs/api/ntpath.md b/docs/api/ntpath.md index cdb218c..684eece 100644 --- a/docs/api/ntpath.md +++ b/docs/api/ntpath.md @@ -1,9 +1,8 @@ --- +title: "ntpath" description: "Windows/NT-style path operations." --- -# `ntpath` - Windows/NT-style path operations. > 💡Python `ntpath`-style behavior, ported to Lua. @@ -19,7 +18,7 @@ print(ntpath.splitdrive([[C:\Users\me]])) --> "C:", [[\Users\me]] print(ntpath.isreserved([[C:\Temp\CON.txt]])) --> true ``` -> ✨ Same API as `mods.path`, but with Windows/NT path semantics. +> ✨ Same API as [`mods.path`], but with Windows/NT path semantics. ## Functions @@ -74,3 +73,9 @@ Return `true` when `path` contains a reserved NT filename. ```lua ntpath.isreserved([[a\CON.txt]]) --> true ``` + + + +[`mods.path`]: /mods/api/path.html + + diff --git a/docs/api/operator.md b/docs/api/operator.md index 31670a5..06e3035 100644 --- a/docs/api/operator.md +++ b/docs/api/operator.md @@ -1,9 +1,8 @@ --- +title: "operator" description: "Lua operators exposed as functions." --- -# `operator` - Lua operators exposed as functions. ## Usage @@ -375,7 +374,7 @@ Evaluate `a and b` with Lua short-circuit semantics. **Return**: -- `andValue` (`T1|T2`): Result of `a and b`. +- `andValue` (`T1` | `T2`): Result of `a and b`. **Example**: @@ -416,7 +415,7 @@ Evaluate `a or b` with Lua short-circuit semantics. **Return**: -- `orValue` (`T1|T2`): Result of `a or b`. +- `orValue` (`T1` | `T2`): Result of `a or b`. **Example**: @@ -455,7 +454,7 @@ Return the length of a string or table using Lua's `#` operator. **Parameters**: -- `a` (`string|table`): Value supporting Lua's `#` operator. +- `a` (`string` | `table`): Value supporting Lua's `#` operator. **Return**: diff --git a/docs/api/path.md b/docs/api/path.md index 1e52564..76cb569 100644 --- a/docs/api/path.md +++ b/docs/api/path.md @@ -1,9 +1,8 @@ --- +title: "path" description: "Cross-platform path operations with host-platform semantics." --- -# `path` - Cross-platform path operations with host-platform semantics. ## Usage @@ -190,7 +189,7 @@ Return logical parent paths from nearest to farthest. **Return**: -- `parents` (`mods.List`): Ancestor paths from nearest to farthest. +- `parents` ([`mods.List`]``): Ancestor paths from nearest to farthest. **Example**: @@ -211,7 +210,7 @@ Split path into logical parts, including anchor when present. **Return**: -- `paths` (`mods.List`): Path parts including anchor when present. +- `paths` ([`mods.List`]``): Path parts including anchor when present. **Example**: @@ -254,7 +253,7 @@ Return all filename suffixes in order. **Return**: -- `suffixes` (`mods.List`): Filename suffixes. +- `suffixes` ([`mods.List`]``): Filename suffixes. **Example**: @@ -693,7 +692,7 @@ path.normcase("/A/B") --> "\\a\\b" > [!NOTE] > -> On POSIX semantics this returns the input unchanged. Use `mods.ntpath` to +> On POSIX semantics this returns the input unchanged. Use [`mods.ntpath`] to > force Windows-style case folding and separator normalization. @@ -845,3 +844,10 @@ path.with_suffix("a/b.gz", ".lua") --> "a/b/.lua" path.with_suffix("a/b", "gz") --> nil, "invalid suffix 'gz'" path.with_suffix("//a/b", "gz") --> nil, "'//a/b' has an empty name" ``` + + + +[`mods.List`]: /mods/api/list.html +[`mods.ntpath`]: /mods/api/ntpath.html + + diff --git a/docs/api/posixpath.md b/docs/api/posixpath.md index 31d90cc..cfcec0a 100644 --- a/docs/api/posixpath.md +++ b/docs/api/posixpath.md @@ -1,9 +1,8 @@ --- +title: "posixpath" description: "POSIX-style path operations." --- -# `posixpath` - POSIX-style path operations. > 💡 Python `posixpath`-style behavior, ported to Lua. diff --git a/docs/api/runtime.md b/docs/api/runtime.md index 805d576..2b78068 100644 --- a/docs/api/runtime.md +++ b/docs/api/runtime.md @@ -1,9 +1,8 @@ --- +title: "runtime" description: "Lua runtime metadata and version compatibility flags." --- -# `runtime` - Lua runtime metadata and version compatibility flags. ## Usage @@ -112,7 +111,7 @@ print(runtime.major) --> 5 -### `minor` (`1|2|3|4|5`) +### `minor` (`1` | `2` | `3` | `4` | `5`) Minor version number parsed from `version`. @@ -122,7 +121,7 @@ print(runtime.minor) --> 1 | 2 | 3 | 4 | 5 -### `version` (`501|502|503|504|505`) +### `version` (`501` | `502` | `503` | `504` | `505`) Numeric version encoded as `major * 100 + minor`. diff --git a/docs/api/set.md b/docs/api/set.md index 84124f5..3dcc281 100644 --- a/docs/api/set.md +++ b/docs/api/set.md @@ -1,9 +1,8 @@ --- +title: "set" description: "A set class for creating, combining, and querying unique values." --- -# `set` - A set class for creating, combining, and querying unique values. ## Usage @@ -128,7 +127,7 @@ Remove elements found in another set (in place). **Parameters**: -- `set` (`T|mods.List`): Other set/list. +- `set` (`T` | [`mods.List`]): Other set/list. **Return**: @@ -148,7 +147,7 @@ Keep only elements common to both sets (in place). **Parameters**: -- `set` (`T|mods.List`): Other set/list. +- `set` (`T` | [`mods.List`]): Other set/list. **Return**: @@ -185,7 +184,7 @@ Update the set with elements not shared by both (in place). **Parameters**: -- `set` (`T|mods.List`): Other set/list. +- `set` (`T` | [`mods.List`]): Other set/list. **Return**: @@ -206,7 +205,7 @@ Add all elements from another set (in place). **Parameters**: -- `set` (`T|mods.List`): Other set/list. +- `set` (`T` | [`mods.List`]): Other set/list. **Return**: @@ -228,7 +227,7 @@ Return true when both sets contain exactly the same members. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: @@ -255,7 +254,7 @@ Return true if sets have no elements in common. **Parameters**: -- `set` (`T|mods.List`): Other set/list. +- `set` (`T` | [`mods.List`]): Other set/list. **Return**: @@ -291,7 +290,7 @@ Return true if all elements of this set are also in another set. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: @@ -316,7 +315,7 @@ Return true if this set contains all elements of another set. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: @@ -377,7 +376,7 @@ Return a shallow copy of the set. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -393,11 +392,11 @@ Return elements in this set but not in another. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -440,11 +439,11 @@ Return elements common to both sets. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -484,11 +483,11 @@ Return elements not shared by both sets. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -509,11 +508,11 @@ Return a new set with all elements from both. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -566,7 +565,7 @@ Return a new set by mapping each value. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -614,7 +613,7 @@ Return a list of all values in the set. **Return**: -- `values` (`mods.List`): List of set values. +- `values` ([`mods.List`]): List of set values. **Example**: @@ -632,11 +631,11 @@ Return the union of two sets using `+`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -658,11 +657,11 @@ Return the intersection of two sets using `&`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -684,11 +683,11 @@ Return the union of two sets using `|`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -710,11 +709,11 @@ Return elements present in exactly one set using `^`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -736,7 +735,7 @@ Return true if both sets contain exactly the same members using `==`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: @@ -760,7 +759,7 @@ Return true if the left set is a subset of the right set using `<=`. **Parameters**: -- `t` (`mods.Set|mods.List|table`): Other set/list. +- `t` ([`mods.Set`] | [`mods.List`] | `table`): Other set/list. **Return**: @@ -786,7 +785,7 @@ Return true if the left set is a proper subset of the right set using `<`. **Parameters**: -- `set` (`mods.Set|table`): Other set. +- `set` ([`mods.Set`] | `table`): Other set. **Return**: @@ -808,11 +807,11 @@ Return the difference of two sets using `-`. **Parameters**: -- `set` (`mods.Set|table`): Other set. +- `set` ([`mods.Set`] | `table`): Other set. **Return**: -- `set` (`mods.Set`): New set. +- `set` ([`mods.Set`]): New set. **Example**: @@ -841,3 +840,10 @@ Render the set via `tostring(set)`. ```lua s = tostring(Set({ "b", "a", 1 })) --> '{ 1, "a", "b" }' ``` + + + +[`mods.List`]: /mods/api/list.html +[`mods.Set`]: /mods/api/set.html + + diff --git a/docs/api/str.md b/docs/api/str.md index 7a5091e..00b7834 100644 --- a/docs/api/str.md +++ b/docs/api/str.md @@ -1,10 +1,9 @@ --- +title: "str" description: "String operations for searching, splitting, trimming, and formatting text." --- -# `str` - String operations for searching, splitting, trimming, and formatting text. ## Usage @@ -92,7 +91,7 @@ Return true if string starts with prefix. **Parameters**: - `s` (`string`): Input string. -- `prefix` (`string|string[]`): Prefix string. +- `prefix` (`string` | `string[]`): Prefix string. - `start?` (`integer`): Optional start index (defaults to `1`). - `stop?` (`integer`): Optional exclusive end index (defaults to `#s + 1`). @@ -291,7 +290,7 @@ Return true if string ends with suffix. **Parameters**: - `s` (`string`): Input string. -- `suffix` (`string|string[]`): Suffix string. +- `suffix` (`string` | `string[]`): Suffix string. - `start?` (`integer`): Optional start index (defaults to `1`). - `stop?` (`integer`): Optional exclusive end index (defaults to `#s + 1`). @@ -377,7 +376,7 @@ s = format_map("hi {name}", { name = "bob" }) --> "hi bob" > [!NOTE] > > `format_map` is a lightweight `{key}` replacement helper. For richer -> templating, use `mods.template`. +> templating, use [`mods.template`]. ### Layout @@ -916,7 +915,7 @@ Split from the right by separator, up to maxsplit. **Return**: -- `parts` (`mods.List`): Split parts. +- `parts` ([`mods.List`]): Split parts. **Example**: @@ -938,7 +937,7 @@ Split by separator (or whitespace) up to maxsplit. **Return**: -- `parts` (`mods.List`): Split parts. +- `parts` ([`mods.List`]): Split parts. **Example**: @@ -959,10 +958,17 @@ Split on line boundaries. **Return**: -- `lines` (`mods.List`): Split lines. +- `lines` ([`mods.List`]): Split lines. **Example**: ```lua lines = splitlines("a\nb\r\nc") --> { "a", "b", "c" } ``` + + + +[`mods.List`]: /mods/api/list.html +[`mods.template`]: /mods/api/template.html + + diff --git a/docs/api/stringcase.md b/docs/api/stringcase.md index 977d9c8..2e25083 100644 --- a/docs/api/stringcase.md +++ b/docs/api/stringcase.md @@ -1,9 +1,8 @@ --- +title: "stringcase" description: "String case conversion and word splitting." --- -# `stringcase` - String case conversion and word splitting. ## Usage diff --git a/docs/api/stringify.md b/docs/api/stringify.md index 7d6a3b2..6adb4a1 100644 --- a/docs/api/stringify.md +++ b/docs/api/stringify.md @@ -1,9 +1,8 @@ --- +title: "stringify" description: "Render Lua values as readable source-like text." --- -# `stringify` - Render Lua values as readable source-like text. ## Usage diff --git a/docs/api/tbl.md b/docs/api/tbl.md index 28c8f22..48f8694 100644 --- a/docs/api/tbl.md +++ b/docs/api/tbl.md @@ -1,10 +1,9 @@ --- +title: "tbl" description: "Table operations for querying, copying, merging, and transforming tables." --- -# `tbl` - Table operations for querying, copying, merging, and transforming tables. ## Usage @@ -395,7 +394,7 @@ Return a list of all keys in the table. **Return**: -- `keys` (`mods.List`): List of keys in `t`. +- `keys` ([`mods.List`]``): List of keys in `t`. **Example**: @@ -464,10 +463,16 @@ Return a list of all values in the table. **Return**: -- `values` (`mods.List`): List of values in `t`. +- `values` ([`mods.List`]``): List of values in `t`. **Example**: ```lua vals = values({ a = 1, b = 2 }) --> { 1, 2 } ``` + + + +[`mods.List`]: /mods/api/list.html + + diff --git a/docs/api/template.md b/docs/api/template.md index 0d5bdc2..df9a21e 100644 --- a/docs/api/template.md +++ b/docs/api/template.md @@ -1,9 +1,8 @@ --- -description: "String template rendering with {{." +title: "template" +description: "String template rendering with {{." --- -# `template` - String template rendering with {{...}} placeholders. ## Usage @@ -85,7 +84,7 @@ template("Hi {{name_func}}", view) --> "Hi Ada" ## Table Values -Table placeholders are rendered using `mods.stringify`. +Table placeholders are rendered using [`mods.stringify`]. ```lua view = { data = { a = 1, b = true } } @@ -121,3 +120,9 @@ as-is. view = { name = "Ada" } template("Hi {{name", view) --> "Hi {{name" ``` + + + +[`mods.stringify`]: /mods/api/stringify.html + + diff --git a/docs/api/utils.md b/docs/api/utils.md index 1309acd..e5b7752 100644 --- a/docs/api/utils.md +++ b/docs/api/utils.md @@ -1,9 +1,8 @@ --- +title: "utils" description: "Shared utility helpers used across the Mods library." --- -# `utils` - Shared utility helpers used across the Mods library. ## Usage @@ -32,11 +31,11 @@ print(utils.quote('hello "world"')) --> 'hello "world"' **Validation**: -| Function | Description | -| ------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| [`assert_arg(argn, v, validator?, optional?, lv?)`](#fn-assert-arg) | Assert argument value using `mods.validate` and raise a Lua error on failure. | -| [`validate(name, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using `mods.validate` and raise a Lua error on failure. | -| [`validate(path, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using `mods.validate` and raise a Lua error on failure. | +| Function | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| [`assert_arg(argn, v, validator?, optional?, lv?)`](#fn-assert-arg) | Assert argument value using [`mods.validate`] and raise a Lua error on failure. | +| [`validate(name, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using [`mods.validate`] and raise a Lua error on failure. | +| [`validate(path, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using [`mods.validate`] and raise a Lua error on failure. | ### Formatting @@ -144,7 +143,7 @@ print(stringify({ a = 1 })) #### `assert_arg(argn, v, validator?, optional?, lv?)` -Assert argument value using `mods.validate` and raise a Lua error on failure. +Assert argument value using [`mods.validate`] and raise a Lua error on failure. **Parameters**: @@ -178,7 +177,7 @@ utils.assert_arg(3, "x", "number", false, "need {{expected}}, got {{got}}") #### `validate(name, v, validator?, optional?, msg?)` -Validate a value using `mods.validate` and raise a Lua error on failure. +Validate a value using [`mods.validate`] and raise a Lua error on failure. **Parameters**: @@ -186,7 +185,7 @@ Validate a value using `mods.validate` and raise a Lua error on failure. - `v` (`any`): Value to validate. - `validator?` (`modsValidatorName`): Validator name (defaults to `"truthy"`). - `optional?` (`boolean`): Skip errors when `v` is `nil` (defaults to `false`). -- `msg?` (`string`): Optional override template passed to `mods.validate`. +- `msg?` (`string`): Optional override template passed to [`mods.validate`]. **Return**: @@ -205,7 +204,7 @@ utils.validate("count", "x", "number") #### `validate(path, v, validator?, optional?, msg?)` -Validate a value using `mods.validate` and raise a Lua error on failure. +Validate a value using [`mods.validate`] and raise a Lua error on failure. **Parameters**: @@ -213,7 +212,7 @@ Validate a value using `mods.validate` and raise a Lua error on failure. - `v` (`any`): Value to validate. - `validator?` (`modsValidatorName`): Validator name (defaults to `"truthy"`). - `optional?` (`boolean`): Skip errors when `v` is `nil` (defaults to `false`). -- `msg?` (`string`): Optional override template passed to `mods.validate`. +- `msg?` (`string`): Optional override template passed to [`mods.validate`]. **Return**: @@ -229,4 +228,11 @@ utils.validate({ "ctx", "users", 1, "name" }, 123, "string") > [!NOTE] > -> On failure, `path` is rendered with `mods.utils.keypath`. +> On failure, `path` is rendered with [`mods.utils.keypath`]. + + + +[`mods.utils.keypath`]: /mods/api/utils.html +[`mods.validate`]: /mods/api/validate.html + + diff --git a/docs/api/validate.md b/docs/api/validate.md index 196af83..d4e9a4d 100644 --- a/docs/api/validate.md +++ b/docs/api/validate.md @@ -1,9 +1,8 @@ --- +title: "validate" description: "Validation helpers for Lua values and filesystem path types." --- -# `validate` - Validation helpers for Lua values and filesystem path types. ## Usage diff --git a/docs/types.md b/docs/types.md new file mode 100644 index 0000000..182cdb1 --- /dev/null +++ b/docs/types.md @@ -0,0 +1,684 @@ +--- +title: "Types" +description: "Type aliases defined in the mods module." +--- + +Type aliases defined in the mods module. + +## [`M.Block`] + +Returns `true` when `v` is a block device path. + +```lua +is.block("/dev/sda") +``` + +`` + +## [`M.Block`] + +Returns `true` when `v` is a block device path. Otherwise returns `false` and an +error message. + +```lua +ok, err = validate.block(".") +``` + +`` + +## [`M.Boolean`] + +Returns `true` when `v` is a boolean. + +```lua +is.boolean(true) +``` + +`` + +## [`M.Boolean`] + +Returns `true` when `v` is a boolean. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.boolean(true) --> true, nil +ok, err = validate.boolean(1) --> false, "boolean expected, got number" +``` + +`` + +## [`M.Callable`] + +Returns `true` when `v` is callable. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.callable(type) --> true, nil +ok, err = validate.callable(1) --> false, "callable value expected, got 1" +``` + +`` + +## [`M.Callable`] + +Returns `true` when `v` is callable. + +```lua +is.callable(function() end) +``` + +`` + +## [`M.Char`] + +Returns `true` when `v` is a character device path. + +```lua +is.char("/dev/null") +``` + +`` + +## [`M.Char`] + +Returns `true` when `v` is a char device path. Otherwise returns `false` and an +error message. + +```lua +ok, err = validate.char(".") +``` + +`` + +## [`M.Device`] + +Returns `true` when `v` is a block or character device path. + +```lua +is.device("/dev/null") +``` + +`` + +## [`M.Device`] + +Returns `true` when `v` is a block or char device path. Otherwise returns +`false` and an error message. + +```lua +ok, err = validate.device(".") +``` + +`` + +## [`M.Dir`] + +Returns `true` when `v` is a directory path. Otherwise returns `false` and an +error message. + +```lua +ok, err = validate.dir(".") +``` + +`` + +## [`M.Dir`] + +Returns `true` when `v` is a directory path. + +```lua +is.dir("/tmp") +``` + +`` + +## [`M.Falsy`] + +Returns `true` when `v` is falsy. + +```lua +is.falsy(false) +``` + +`` + +## [`M.Falsy`] + +Returns `true` when `v` is falsy. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.falsy(false) --> true, nil +ok, err = validate.falsy(1) --> false, "falsy value expected, got 1" +``` + +`` + +## [`M.Fifo`] + +Returns `true` when `v` is a FIFO path. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.fifo(".") +``` + +`` + +## [`M.Fifo`] + +Returns `true` when `v` is a FIFO path. + +```lua +is.fifo("/path/to/fifo") +``` + +`` + +## [`M.File`] + +Returns `true` when `v` is a file path. + +```lua +is.file("README.md") +``` + +`` + +## [`M.File`] + +Returns `true` when `v` is a file path. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.file(".") +``` + +`` + +## [`M.Integer`] + +Returns `true` when `v` is an integer. + +```lua +is.integer(42) +``` + +`` + +## [`M.Integer`] + +Returns `true` when `v` is an integer. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.integer(1) --> true, nil +ok, err = validate.integer(1.5) --> false, "integer value expected, got 1.5" +``` + +`` + +## [`M.Link`] + +Returns `true` when `v` is a symlink path. Otherwise returns `false` and an +error message. + +```lua +ok, err = validate.link(".") +``` + +`` + +## [`M.Link`] + +Returns `true` when `v` is a symlink path. + +```lua +is.link("/path/to/link") +``` + +`` + +## [`M.Number`] + +Returns `true` when `v` is a number. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.number(42) --> true, nil +ok, err = validate.number("x") --> false, "number expected, got string" +``` + +`` + +## [`M.Number`] + +Returns `true` when `v` is a number. + +```lua +is.number(3.14) +``` + +`` + +## [`M.Path`] + +Returns `true` when `v` is a valid filesystem path. + +```lua +is.path("README.md") +``` + +> [!NOTE] +> +> Returns `true` for broken symlinks. + +`` + +## [`M.Path`] + +Returns `true` when `v` is a valid filesystem path. Otherwise returns `false` +and an error message. + +```lua +ok, err = validate.path("README.md") +``` + +`` + +## [`M.Socket`] + +Returns `true` when `v` is a socket path. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.socket(".") +``` + +`` + +## [`M.Socket`] + +Returns `true` when `v` is a socket path. + +```lua +is.socket("/path/to/socket") +``` + +`` + +## [`M.String`] + +Returns `true` when `v` is a string. + +```lua +is.string("hello") +``` + +`` + +## [`M.String`] + +Returns `true` when `v` is a string. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.string("hello") --> true, nil +ok, err = validate.string(1) --> false, "string expected, got number" +``` + +`` + +## [`M.Table`] + +Returns `true` when `v` is a table. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.table({}) --> true, nil +ok, err = validate.table(1) --> false, "table expected, got number" +``` + +`` + +## [`M.Table`] + +Returns `true` when `v` is a table. + +```lua +is.table({}) +``` + +`` + +## [`M.Thread`] + +Returns `true` when `v` is a thread. Otherwise returns `false` and an error +message. + +```lua +co = coroutine.create(function() end) +ok, err = validate.thread(co) --> true, nil +ok, err = validate.thread(1) --> false, "thread expected, got number" +``` + +`` + +## [`M.Thread`] + +Returns `true` when `v` is a thread. + +```lua +is.thread(coroutine.create(function() end)) +``` + +`` + +## [`M.Truthy`] + +Returns `true` when `v` is truthy. Otherwise returns `false` and an error +message. + +```lua +ok, err = validate.truthy(1) --> true, nil +ok, err = validate.truthy(false) --> false, "truthy value expected, got false" +``` + +`` + +## [`M.Truthy`] + +Returns `true` when `v` is truthy. + +```lua +is.truthy("non-empty") +``` + +`` + +## [`M.Userdata`] + +Returns `true` when `v` is a userdata value. Otherwise returns `false` and an +error message. + +```lua +ok, err = validate.userdata(io.stdout) --> true, nil +ok, err = validate.userdata(1) --> false, "userdata expected, got number" +``` + +`` + +## [`M.Userdata`] + +Returns `true` when `v` is userdata. + +```lua +is.userdata(io.stdout) +``` + +`` + +## [`mods.dateMod`] + +Timezone-naive date helpers and immutable date values. + +## Usage + +```lua +local Date = require "mods.date" + +local a = Date("2026-03-30T14:45:06") +local b = Date("2026-03-30 14:45:06.123") +local c = Date("2026-03-31") +local d = Date("12-25-1995", "MM-DD-YYYY") +local e = Date({ year = 2026, month = 3, day = 30, hour = 14, min = 45 }) +local f = Date({ year = 2026 }) + +print(a) --> 2026-03-30 14:45:06 +print(b.ms) --> 123 +print(a:format("YYYY/MM/DD HH:mm:ss")) --> 2026/03/30 14:45:06 +print(a:is_before(c)) --> true +print(a < c) --> true +print(d) --> 1995-12-25 00:00:00 +print(e.sec) --> 0 +print(f) --> 2026-01-01 00:00:00 +``` + +> [!NOTE] +> +> - String inputs accept [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) +> forms, variants using a space instead of `T`, and custom formats via +> `Date(input, pattern)`: +> +> ```lua +> Date("2026-03-30T14:45:06") +> Date("2026-03-30 14:45:06") +> Date("12/25/1995", "MM/DD/YYYY") +> ``` +> +> - When `input` is a number, it is treated as Unix milliseconds. Use +> [`Date.unix(ts)`](#fn-unix) if you have a timestamp in seconds. +> +> ```lua +> local a = Date(1745155206123) -- Milliseconds +> local b = Date.unix(1745155206.123) -- Seconds +> print(a == b) --> true +> ``` +> +> - When calling `Date` without arguments, it uses +> [mstime](https://github.com/luamod/mstime) for millisecond precision if +> installed; otherwise it falls back to +> [`os.time`](https://www.lua.org/manual/5.1/manual.html#pdf-os.time). + +| Field | Type | Optional | Description | +| ---------- | ------------------------------------------------------- | -------- | ------------------ | +| `duration` | [`mods.durationMod`](/mods/types.html#mods-durationmod) | No | +| `private` | `__call` | No | fun(...):mods.Date | + +## [`mods.DateParts`] + +| Field | Type | Optional | +| ------- | --------- | -------- | +| `day` | `integer` | Yes | +| `hour` | `integer` | Yes | +| `isdst` | `boolean` | Yes | +| `min` | `integer` | Yes | +| `month` | `integer` | Yes | +| `ms` | `integer` | Yes | +| `sec` | `integer` | Yes | +| `wday` | `integer` | Yes | +| `yday` | `integer` | Yes | +| `year` | `integer` | No | + +## [`mods.DateUnit`] + + `"d"`  `"day"`  `"days"`  `"h"`  `"hour"` + `"hours"`  `"M"`  `"m"`  `"millisecond"` + `"milliseconds"`  `"min"`  `"mins"`  `"minute"` + `"minutes"`  `"month"`  `"months"`  `"ms"`  `"q"` + `"quarter"`  `"quarters"`  `"s"`  `"sec"`  `"second"` + `"seconds"`  `"secs"`  `"w"`  `"week"`  `"weeks"` + `"y"`  `"year"`  `"years"` + +## [`mods.DurationHumanizeOptions`] + +| Field | Type | Optional | Description | +| ------------- | ----------------------------------------------------------------------------------- | -------- | ------------------------------------------------------- | +| `max_unit` | [`mods.DateUnit`](/mods/types.html#mods-dateunit) | Yes | Largest unit allowed when choosing the displayed unit. | +| `min_unit` | [`mods.DateUnit`](/mods/types.html#mods-dateunit) | Yes | Smallest unit allowed when choosing the displayed unit. | +| `round` | [`mods.DurationHumanizeRoundMode`](/mods/types.html#mods-durationhumanizeroundmode) | Yes | Rounding mode for custom unit output. | +| `short` | `boolean` | Yes | Whether to use abbreviated unit labels like `2h`. | +| `with_suffix` | `boolean` | Yes | Whether to include `ago` / `in` style wording. | + +## [`mods.DurationHumanizeRoundMode`] + + `"ceil"`  `"floor"`  `"round"`  `boolean` + +## [`mods.DurationParts`] + +| Field | Type | Optional | +| -------------- | -------- | -------- | +| `days` | `number` | Yes | +| `hours` | `number` | Yes | +| `milliseconds` | `number` | Yes | +| `minutes` | `number` | Yes | +| `months` | `number` | Yes | +| `quarters` | `number` | Yes | +| `seconds` | `number` | Yes | +| `weeks` | `number` | Yes | +| `years` | `number` | Yes | + +## [`mods.log.new.opts`] + +| Field | Type | Optional | Description | +| --------- | ---------------- | -------- | ---------------------------------------------------------------------------- | +| `handler` | `modsLogHandler` | Yes | Optional handler function that receives each emitted record. | +| `level` | `modsLogLevel` | Yes | Minimum enabled level; use `"off"` to disable logging. Defaults to `"warn"`. | +| `name` | `string` | Yes | Optional logger name included in emitted records. | + +## [`mods.log.record`] + +| Field | Type | Optional | Description | +| ----------- | ---------------------------- | -------- | ------------------------------------ | +| `args` | `{[integer]:any, n:integer}` | No | Original variadic arguments. | +| `levelname` | `modsLogLevel` | No | Log level name. | +| `levelno` | `integer` | No | Numeric severity used for filtering. | +| `line` | `string` | No | Formatted plain-text log line. | +| `message` | `string` | No | Joined message string. | + +## [`modsCalendarMonth`] + + `1`  `2`  `3`  `4`  `5`  `6`  `7`  `8` + `9`  `10`  `11`  `12` + +## [`modsCalendarMonthday`] + + `1`  `2`  `3`  `4`  `5`  `6`  `7`  `8` + `9`  `10`  `11`  `12`  `13`  `14`  `15` + `16`  `17`  `18`  `19`  `20`  `21`  `22` + `23`  `24`  `25`  `26`  `27`  `28`  `29` + `30`  `31` + +## [`modsCalendarWeekday`] + + `1`  `2`  `3`  `4`  `5`  `6`  `7` + +## [`modsFsEntryType`] + + `"block"`  `"char"`  `"directory"`  `"fifo"`  `"file"` + `"link"`  `"socket"`  `"unknown"` + +## [`modsGlobOptions`] + +| Field | Type | Optional | +| ------------ | --------- | -------- | +| `follow` | `boolean` | Yes | +| `hidden` | `boolean` | Yes | +| `ignorecase` | `boolean` | Yes | +| `recursive` | `boolean` | Yes | + +## [`modsLogHandler`] + +`fun(record: mods.log.record)` + +## [`modsLogLevel`] + + `"debug"`  `"error"`  `"info"`  `"off"`  `"warn"` + `string` + +## [`modsValidatorMessages`] + +| Field | Type | Optional | +| ---------- | -------- | -------- | +| `[string]` | `string` | No | +| `block` | `string` | Yes | +| `boolean` | `string` | Yes | +| `callable` | `string` | Yes | +| `char` | `string` | Yes | +| `device` | `string` | Yes | +| `dir` | `string` | Yes | +| `false` | `string` | Yes | +| `falsy` | `string` | Yes | +| `fifo` | `string` | Yes | +| `file` | `string` | Yes | +| `function` | `string` | Yes | +| `integer` | `string` | Yes | +| `link` | `string` | Yes | +| `nil` | `string` | Yes | +| `number` | `string` | Yes | +| `path` | `string` | Yes | +| `socket` | `string` | Yes | +| `string` | `string` | Yes | +| `table` | `string` | Yes | +| `thread` | `string` | Yes | +| `true` | `string` | Yes | +| `truthy` | `string` | Yes | +| `userdata` | `string` | Yes | + +## [`modsValidatorName`] + + `"block"`  `"callable"`  `"char"`  `"device"`  `"dir"` + `"false"`  `"falsy"`  `"fifo"`  `"file"`  `"integer"` + `"link"`  `"path"`  `"socket"`  `"true"`  `"truthy"` + `string`  `type` + + + +[`M.Block`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L308-L308 +[`M.Block`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L410-L410 +[`M.Boolean`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L90-L90 +[`M.Boolean`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L155-L155 +[`M.Callable`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L248-L248 +[`M.Callable`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L344-L344 +[`M.Char`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L322-L322 +[`M.Char`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L426-L426 +[`M.Device`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L336-L336 +[`M.Device`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L442-L442 +[`M.Dir`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L350-L350 +[`M.Dir`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L458-L458 +[`M.Falsy`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L234-L234 +[`M.Falsy`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L327-L327 +[`M.Fifo`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L364-L364 +[`M.Fifo`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L474-L474 +[`M.File`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L378-L378 +[`M.File`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L490-L490 +[`M.Integer`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L262-L262 +[`M.Integer`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L361-L361 +[`M.Link`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L392-L392 +[`M.Link`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L506-L506 +[`M.Number`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L132-L132 +[`M.Number`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L207-L207 +[`M.Path`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L294-L294 +[`M.Path`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L394-L394 +[`M.Socket`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L406-L406 +[`M.Socket`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L522-L522 +[`M.String`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L146-L146 +[`M.String`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L224-L224 +[`M.Table`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L160-L160 +[`M.Table`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L241-L241 +[`M.Thread`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L174-L174 +[`M.Thread`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L259-L259 +[`M.Truthy`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L276-L276 +[`M.Truthy`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L378-L378 +[`M.Userdata`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L188-L188 +[`M.Userdata`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L276-L276 +[`mods.DateParts`]: https://github.com/BlueLua/mods/blob/main/types/date.d.lua#L3-L5 +[`mods.DateUnit`]: https://github.com/BlueLua/mods/blob/main/types/date.d.lua#L3-L5 +[`mods.DurationHumanizeOptions`]: https://github.com/BlueLua/mods/blob/main/types/duration.d.lua#L6-L12 +[`mods.DurationHumanizeRoundMode`]: https://github.com/BlueLua/mods/blob/main/types/duration.d.lua#L3-L5 +[`mods.DurationParts`]: https://github.com/BlueLua/mods/blob/main/types/duration.d.lua#L3-L5 +[`mods.dateMod`]: https://github.com/BlueLua/mods/blob/main/types/date.d.lua#L6-L62 +[`mods.log.new.opts`]: https://github.com/BlueLua/mods/blob/main/types/log.d.lua#L23-L27 +[`mods.log.record`]: https://github.com/BlueLua/mods/blob/main/types/log.d.lua#L15-L22 +[`modsCalendarMonth`]: https://github.com/BlueLua/mods/blob/main/types/calendar.d.lua#L3-L6 +[`modsCalendarMonthday`]: https://github.com/BlueLua/mods/blob/main/types/calendar.d.lua#L3-L6 +[`modsCalendarWeekday`]: https://github.com/BlueLua/mods/blob/main/types/calendar.d.lua#L3-L6 +[`modsFsEntryType`]: https://github.com/BlueLua/mods/blob/main/types/fs.d.lua#L3-L4 +[`modsGlobOptions`]: https://github.com/BlueLua/mods/blob/main/types/glob.d.lua#L3-L4 +[`modsLogHandler`]: https://github.com/BlueLua/mods/blob/main/types/log.d.lua#L3-L5 +[`modsLogLevel`]: https://github.com/BlueLua/mods/blob/main/types/log.d.lua#L3-L5 +[`modsValidatorMessages`]: https://github.com/BlueLua/mods/blob/main/types/validate.d.lua#L3-L31 +[`modsValidatorName`]: https://github.com/BlueLua/mods/blob/main/types/is.d.lua#L6-L26 + +