# fit-box

> Fits a box within a boundary while keeping its original aspect ratio

Latest version **1.1.1** (published 2022-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install fit-box
pnpm add fit-box
yarn add fit-box
bun add fit-box
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2022-10-30 |
| First published | 2019-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christian Hamburger Grøngaard |
| Maintainers | christianhg |
| Keywords | geometry, rectangles, boxes, fit |

## Links

- npm: https://www.npmjs.com/package/fit-box
- Repository: https://github.com/christianhg/fit-box
- Issues: https://github.com/christianhg/fit-box/issues
- npm.io page: https://npm.io/package/fit-box

## Recent versions

- 1.1.1 (latest) — 2022-10-30
- 1.1.0 — 2019-09-01
- 1.0.2 — 2019-08-31
- 1.0.1 — 2019-08-30
- 1.0.0 — 2019-08-29

## README

# Fit Box

> Fits a box within a boundary while keeping its original aspect ratio.

[![npm module](https://badge.fury.io/js/fit-box.svg)](https://www.npmjs.org/package/fit-box)

The box will either be scaled up or scaled down within the boundary:

```js
fitBox({
  boundary: { width: 400, height: 300 },
  box: { width: 20, height: 60 },
});
// => { width: 100, height: 300 }

fitBox({
  boundary: { width: 400, height: 300 },
  box: { width: 1280, height: 760 },
});
// => { width: 400, height: 237.5 }
```

---
_Source: https://npm.io/package/fit-box · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
