Mayson Monorepo Documentation
    Preparing search index...

    Function toDecimal

    • Convert a string or number value to a Decimal instance. Returns Decimal(0) for null, undefined, or empty string values.

      Parameters

      • value: string | number

        The value to convert (string, number, or null/undefined)

      Returns Decimal

      A Decimal instance representing the value

      const amount = toDecimal("123.456");
      const price = toDecimal(99.99);
      const zero = toDecimal(null); // Returns Decimal(0)