baluster
v0.1.0
Published
Library to estimate baluster quantity and spacing for railings.
Downloads
1
Readme
Baluster
Baluster is a javascript library to enable estimation of balusters and calculating the spacing to get an even distribution on a constructed railing.
Note: Please consult your local building codes for maximum spacing requirements. This library assumes maximum spacing distance of 4".
Usage
npm install baluster
For babel/webpack apps:
import { estimateQuantity } from 'baluster'
console.log(estimateQuantity(41.625))
// 7
For nodejs (commonjs) apps:
const { estimateQuantity } from 'baluster'
console.log(estimateQuantity(41.625))
// 7
API
estimateQuantity
int estimateQuantity(
float widthBetweenPosts,
float balusterWidth = 1.75
)
Given widthBetweenPosts
which is the measurement in inches measured on the interior of the posts, this will calculate the number of balusters needed.
calculateSpacing
float calculateSpacing(
float widthBetweenPosts,
int balusterQuantity,
float balusterWidth = 1.75
)
Calculate the spacing that is needed between each baluster to make them all equidistant.
Throws an exception if the balusterQuantity
is not enough to satisfy maximum spacing requirements.
spacingMeasurements
array spacingMeasurements(
float widthBetweenPosts,
int balusterQuantity,
float balusterWidth = 1.75
)
As with calculateSpacing
, this will specify the measurements for each baluster on the rail (measurement centered on the baluster).
nearest16th
int nearest16th(
float number
)
Utility method to calculate the nearest 16th of an inch.
console.log(nearest16th(0.5))
// 8