This repository has been archived on 2026-02-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
swift-duct-calc/Sources/Styleguide/Number.swift
Michael Housh a3fb87f86e
All checks were successful
CI / Linux Tests (push) Successful in 5m30s
feat: Removes api routes and controller as they're currently not used.
2026-01-30 17:10:14 -05:00

27 lines
472 B
Swift

import Elementary
import Foundation
import ManualDCore
public struct Number: HTML, Sendable {
let fractionDigits: Int
let value: Double
public init(
_ value: Double,
digits fractionDigits: Int = 2
) {
self.value = value
self.fractionDigits = fractionDigits
}
public init(
_ value: Int
) {
self.init(Double(value), digits: 0)
}
public var body: some HTML<HTMLTag.span> {
span { value.string(digits: fractionDigits) }
}
}