Function platform

  • Accepts an object with the keys as either macos, windows, linux, or default, and picks the appropriate key depending on the current platform. If no platform key is matched, the default key is used if it exists. If the value is a function, it will be executed, and the returned value will be used.

    Type Parameters

    • Macos = never

    • Windows = never

    • Linux = never

    • Default = undefined

    Parameters

    • choices: RequireAtLeastOne<_Choices<Macos, Windows, Linux, Default>, "macos" | "windows" | "linux">

    Returns Macos | Windows | Linux | Default

    Example

    init({
    enableUnicorn: util.platform({
    macos: true,
    windows: false,
    linux: () => false
    })
    });