baluster

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i baluster

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

11.5 kB

Total Files

8

Last publish

Collaborators

  • cjsaylor