Skip to content

1978 - Percentage Parser #32007

Closed
Closed

Description

@PassionZale
type PercentageParser<A extends string> =
  A extends `${infer First}${infer Rest}`
    ? First extends "+" | "-"
      ? Rest extends `${infer S}%`
        ? [First, S, "%"]
        : [First, Rest, ""]
      : A extends `${infer S}%`
      ? ["", S, "%"]
      : ["", A, ""]
    : ["", "", ""];

Activity

  1. added
    answer
    zh-CN
    on Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1978answerzh-CN

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions