MCPcopy Create free account
hub / github.com/effect-app/libs / fromNumber

Function fromNumber

repos/effect/packages/effect/src/BigDecimal.ts:1331–1343  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

1329 *
1330 * **Details**
1331 *
1332 * Accepts the same syntax as `fromString`. Use `fromString` when invalid input
1333 * should be represented as `Option.none` instead of throwing.
1334 *
1335 * **Example** (Parsing decimal strings unsafely)
1336 *
1337 * ```ts import.meta.vitest
1338 * import { BigDecimal } from "effect"
1339 *
1340 * BigDecimal.fromStringUnsafe("123") // => BigDecimal.fromBigInt(123n)
1341 * BigDecimal.fromStringUnsafe("123.456") // => BigDecimal.make(123456n, 3)
1342 * ```
1343 *
1344 * @see {@link fromString} for returning `Option.none` on invalid input
1345 *
1346 * @category constructors

Callers 1

fromNumberUnsafeFunction · 0.70

Calls 5

someMethod · 0.80
fromStringFunction · 0.70
makeFunction · 0.70
BigIntInterface · 0.70
splitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…