Skip to content

Packrift/packaging-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@packrift/packaging-utils

Small dependency-free packaging calculators for ecommerce, warehouse, and fulfillment workflows.

This package is useful when a checkout, warehouse tool, or agent needs to:

  • calculate dimensional weight for UPS, FedEx, USPS, or custom divisors
  • normalize item and carton dimensions
  • check whether an item fits in a carton with padding
  • rank cartons by fit efficiency

Packrift also hosts interactive versions of these workflows:

Install

npm install @packrift/packaging-utils

Usage

import {
  calculateDimensionalWeight,
  cartonFitsItem,
  rankCartonsByFit
} from "@packrift/packaging-utils";

const dimWeight = calculateDimensionalWeight({
  length: 16,
  width: 12,
  height: 8,
  divisor: 139
});

const fits = cartonFitsItem(
  { length: 10, width: 6, height: 4 },
  { length: 12, width: 8, height: 6 },
  { padding: 1 }
);

const ranked = rankCartonsByFit(
  { length: 10, width: 6, height: 4 },
  [
    { id: "12x8x6", length: 12, width: 8, height: 6 },
    { id: "14x10x8", length: 14, width: 10, height: 8 }
  ],
  { padding: 1 }
);

API

calculateDimensionalWeight({ length, width, height, divisor, roundUp })

Returns dimensional weight in pounds. divisor defaults to 139, a common domestic parcel divisor. roundUp defaults to true.

cartonFitsItem(item, carton, options)

Returns whether an item can fit inside a carton after applying padding. Dimensions are rotation-aware, so the item can be turned to find a valid orientation.

rankCartonsByFit(item, cartons, options)

Returns fitting cartons sorted by unused volume, smallest first.

Guides

License

MIT

About

Small packaging calculators for dimensional weight, carton fit, and shipping-supply selection.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors