Skip to content

Number.parseInt #4453

Open
Open
@jessekelly881

Description

@jessekelly881

What is the problem this feature would solve?

Like Number.parse this would be a nice addition.

What is the feature you are proposing to solve the problem?

const parseInt = (str: string, radix?: number): Option.Option<number> => {
  const num = Number.parseInt(str, radix);
  if (Number.isNaN(num)) {
    return Option.none();
  }
  return Option.some(num);
};

Exists internally here:

const parseInteger = (str: string): Option.Option<number> => {

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions