Mayson Monorepo Documentation
    Preparing search index...

    Function ensureNotNegative

    • Ensure a value is not negative (floors at zero).

      Parameters

      • decimal: Decimal

        The Decimal instance to check

      Returns Decimal

      The original value if positive, otherwise Decimal(0)

      ensureNotNegative(toDecimal("10"));  // 10
      ensureNotNegative(toDecimal("-5")); // 0