MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromString

Function fromString

packages/effect/src/Rational.ts:350–356  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

348 * @since 4.1.3
349 */
350export const fromString = (s: string): Option.Option<Rational> => {
351 const match = FRACTION_REGEXP.exec(s)
352 if (match === null) {
353 return Option.none()
354 }
355 return make(BigInt(match[1]), match[2] === undefined ? bigint1 : BigInt(match[2]))
356}
357
358/**
359 * Parses an integer or fraction string into a `Rational`.

Callers 1

fromStringUnsafeFunction · 0.70

Calls 3

makeFunction · 0.70
BigIntInterface · 0.70
execMethod · 0.45

Tested by

no test coverage detected