Skip to content

includesBeforeSeparator

Generated reference page for the includesBeforeSeparator function export.

Signatures

ts
function includesBeforeSeparator(argv: readonly string[], token: string): boolean;
ParameterTypeDescription
argvreadonly string[]Raw argument strings.
tokenstringExact flag token to look for (e.g. --version).

Members

Members

includesBeforeSeparator

Whether token appears in argv before the -- end-of-options separator.

Everything at or after the first -- is a literal positional, so root-level flag interception (--help / --version / --json) must use this instead of a naive Array.includes() — otherwise a post-separator literal (-- --json) is wrongly treated as the flag.

ts
(argv: readonly string[], token: string): boolean;

See Also

Released under the MIT License.