JSPM

construction-utils

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q26346F
  • License MIT

Construction calculation utilities for building projects — measurements, materials, lumber, drywall, paint, roofing, slope, and cost estimation helpers.

Package Exports

  • construction-utils

Readme

construction-utils

Construction calculation utilities for building projects — measurements, materials, lumber, drywall, paint, roofing, slope, and cost estimation helpers.

Part of the www.slabcalc.co ecosystem. For concrete-specific calculations, see the concrete-calculator package or the online Concrete Slab Calculator.

Install

npm install construction-utils

Quick Start

import { squareFootage, drywallSheets, paintGallons, addMarkup } from "construction-utils";

const area = squareFootage(20, 15);       // 300 sq ft
const sheets = drywallSheets(area);        // 11 sheets (10% waste)
const gallons = paintGallons(area, 2);     // 2 gallons (2 coats)
const price = addMarkup(sheets * 12, 15);  // $151.80 (15% markup)

API Reference

Measurements

Function Description
squareFootage(length, width) Area in sq ft
perimeter(length, width) Perimeter in linear ft
circleArea(diameter) Area of a circle
triangleArea(base, height) Area of a triangle
roofArea(length, width, pitchRise?) Roof area adjusted for pitch

Construction Math

Function Description
gradePercent(rise, run) Slope as percentage
roofPitch(rise, run?) Pitch string (e.g., "6:12")
angleFromSlope(percent) Degrees from slope %
slopeFromAngle(degrees) Slope % from degrees
hypotenuse(rise, run) Rafter/stringer length

Lumber

Function Description
boardFeet(thickness, width, length) Board feet for pricing
studsNeeded(wallLength, spacing?) Stud count (default 16″ OC)
plateLength(wallLength, double?) Linear ft of plates

Drywall

Function Description
drywallSheets(sqft, waste?) 4×8 sheets needed (default 10% waste)
jointCompound(sqft) Gallons of mud
drywallTape(sqft) Feet of tape

Paint

Function Description
paintGallons(sqft, coats?, coverage?) Gallons needed (default 400 sqft/gal)
primerGallons(sqft, coverage?) Primer gallons (default 300 sqft/gal)

Flooring

Function Description
flooringSqft(length, width, waste?) Material sq ft with waste factor
tileBoxes(sqft, sqftPerBox?) Number of tile boxes

Insulation

Function Description
insulationBatts(sqft, sqftPerBundle?) Batt bundles needed

Unit Conversions

Function Description
feetToMeters(ft) / metersToFeet(m) Length conversion
inchesToCm(in) / cmToInches(cm) Length conversion
sqftToSqm(sqft) / sqmToSqft(sqm) Area conversion
psfToKpa(psf) / kpaToPsf(kpa) Pressure conversion

Pricing Helpers

Function Description
addMarkup(cost, percent) Apply markup
tax(subtotal, percent) Tax amount
totalWithTax(subtotal, percent) Subtotal + tax
unitCost(total, qty) Per-unit cost
bulkDiscount(qty, tiers, unitPrice) Tiered bulk pricing

Namespace Imports

Group functions by category:

import { measurements, lumber, drywall, paint, pricing } from "construction-utils";

const area = measurements.squareFootage(20, 15);
const bf = lumber.boardFeet(2, 6, 8);          // 8 board feet
const sheets = drywall.drywallSheets(area);
const gallons = paint.paintGallons(area, 2);
const total = pricing.totalWithTax(500, 8.25);  // $541.25

Common Projects

Project Functions to use
Frame a wall studsNeeded(), plateLength(), boardFeet()
Hang drywall drywallSheets(), jointCompound(), drywallTape()
Paint a room squareFootage(), paintGallons(), primerGallons()
Install flooring flooringSqft(), tileBoxes()
Estimate roof roofArea(), roofPitch(), hypotenuse()
Grade a driveway gradePercent(), angleFromSlope()
Bid a job addMarkup(), totalWithTax(), bulkDiscount()

For concrete work — slabs, footings, cylinders, stairs — use the Concrete Slab Calculator or the concrete-calculator npm package.

TypeScript

Full type declarations included — zero config needed.

import { boardFeet, type BulkDiscountResult } from "construction-utils";

License

MIT — SlabCalc.co