# @types/bin-pack

> TypeScript definitions for bin-pack

Latest version **1.0.3** (published 2023-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/bin-pack
pnpm add @types/bin-pack
yarn add @types/bin-pack
bun add @types/bin-pack
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-11-06 |
| First published | 2018-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51429 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/bin-pack
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bin-pack
- npm.io page: https://npm.io/package/@types/bin-pack

## Recent versions

- 1.0.3 (latest) — 2023-11-06
- 1.0.1 (ts3.6) — 2021-07-07
- 1.0.0 (ts2.0) — 2018-06-04
- 1.0.2 — 2023-10-17

## README

# Installation
> `npm install --save @types/bin-pack`

# Summary
This package contains type definitions for bin-pack (https://github.com/bryanburgers/bin-pack).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bin-pack.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bin-pack/index.d.ts)
````ts
/**
 * Packs objects that have a width and a height into as small of a square as
 * possible, using a binary tree bin packing algorithm. After packing, each
 * object is given an (x, y) coordinate of where it would be optimally packed.
 * @param bins List of rectangular bins to pack
 * @param options Packing options.  Use inPlace: true to modify the bins
 *    argument in-place.
 */
declare function pack<T extends pack.Bin>(bins: T[], options?: pack.Options): pack.PackResult<T>;

declare namespace pack {
    /** Packing options. */
    interface Options {
        /** Use inPlace=true to add x,y fields to the bins argument. */
        inPlace?: boolean | undefined;
    }

    /** Specifies the dimensions of a bin to pack. */
    interface Bin {
        width: number;
        height: number;
    }

    /** Describes the location of a packed bin. */
    interface PackedItem<T> {
        /** X coordinate of the packed bin. */
        x: number;

        /** Y coordinate of the packed bin. */
        y: number;

        /** Width of the bin. */
        width: number;

        /** Height of the bin. */
        height: number;

        /** The original bin object. */
        item: T;
    }

    /** The return value from the pack function. */
    interface PackResult<T> {
        /** Width of the bounding box around all bins. */
        width: number;

        /** Height of the bounding box around all bins. */
        height: number;

        /** List of packed bins. */
        items: Array<PackedItem<T>>;
    }
}

export = pack;

````

### Additional Details
 * Last updated: Mon, 06 Nov 2023 22:41:04 GMT
 * Dependencies: none

# Credits
These definitions were written by [Oren Trutner](https://github.com/orentrutner).

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