Menu

Modeling US Nominal Lumber Sizes and Concrete Displacement in a TypeScript Yard Calculator
📰

Modeling US Nominal Lumber Sizes and Concrete Displacement in a TypeScript Yard Calculator

DEV Community: javascript·八哥·8 days ago
#AD9mqtrg
#devtojavascript#devto#dev#number#input
Long article (468 words) — no AI summary yet.
Reading 0:00
15s threshold

When homeowners plan a weekend landscaping or fencing project in the US, the hardest part is rarely digging—it is ordering the right amount of material without paying for a second delivery truck.

Most online estimators either oversimplify the geometry or bury the actual math behind cluttered forms. While building Easy Yard Calculator , I ran into two subtle domain details that make a surprisingly big difference in TypeScript calculation accuracy.

1. Converting Mixed Imperial Units Cleanly

US landscaping quotes mix three units in a single job: length and width in feet , depth in inches , and bulk supplier pricing in cubic yards or tons . Keeping the pure calculation function stateless makes unit testing straightforward:

export interface AreaCalcInput { lengthFt : number ; widthFt : number ; depthIn : number ; wastePct : number ; tonsPerCubicYard : number ; pricePerCubicYard : number ; }

export function calculateAreaMaterial ( input : AreaCalcInput ) { const depthFt = Math . max ( 0 , input .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.