# breakpoint-model-indexer

> loads and exports breakpoint model data

Latest version **0.4.3** (published 2022-03-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install breakpoint-model-indexer
pnpm add breakpoint-model-indexer
yarn add breakpoint-model-indexer
bun add breakpoint-model-indexer
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2022-03-07 |
| First published | 2021-05-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 8 |
| Unpacked size | 167.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jogitt |
| Maintainers | npmjoes |
| Keywords | breakpoint |

## Links

- npm: https://www.npmjs.com/package/breakpoint-model-indexer
- npm.io page: https://npm.io/package/breakpoint-model-indexer

## Dependencies (8)

- [gtin](https://npm.io/package/gtin.md) ^1.0.2
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [commander](https://npm.io/package/commander.md) ^7.2.0
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.170
- [builtin-modules](https://npm.io/package/builtin-modules.md) ^3.2.0
- [breakpoint-data-handler](https://npm.io/package/breakpoint-data-handler.md) ^0.14.0
- [rollup-plugin-node-externals](https://npm.io/package/rollup-plugin-node-externals.md) ^2.2.0

## Recent versions

- 0.4.3 (latest) — 2022-03-07
- 0.4.2 — 2021-12-20
- 0.4.1 — 2021-12-09
- 0.4.0 — 2021-12-09
- 0.3.0 — 2021-12-08
- 0.2.3 — 2021-06-10
- 0.2.2 — 2021-06-03
- 0.2.1 — 2021-06-03
- 0.2.0 — 2021-06-01
- 0.1.0 — 2021-05-31

## README

# Breakpoint model Indexer
### Created 2021-05-31, @jogitt
package with functions to create indexes for models like breakpoint products, vendors and departments.

### Updated - 2021-12-08
- now also works with mixMatches, subDepartments, and families

### Usage
can create indexes for products, vendors, and departments from breakpoint export and json files.
- create department index:
```typescript
// load departments is any function to get an array of appropriate breakpoint data
const departments: IDepartment[] = await loadDepartments()
const departmentIndexer = new DepartmentIndexer();
const departmentIndexes = departmentIndexer.start(departments);
```

### classes:
- DepartmentIndexer()
```typescript
const d = new DepartmentIndexer();
d.start(departments);
```
- VendorIndexer()
```typescript
const v = new VendorIndexer();
v.start(vendors);
```
- ProductIndexer()
```typescript
const p = new ProductIndexer();
p.start(products);
```

### using index searches
```typescript
const itemIndexes: ProductIndexes = productIndexer.start(products);
const nameMatches: number[] = BreakpointIndexSearches.getIndexMatch(itemIndexes.nameIndex, namePattern, "gi");
const itemCodeMatches: number[] = BreakpointIndexSearches.getIndexMatch(itemIndexes.upcIndex, itemCodePattern, "i");
const upcMatches: number[] = BreakpointIndexSearches.getProductUPCMatches(itemIndexes.upcIndex, upcPattern);

const vendorIndexes: VendorIndexes = vendorIndexer.start(vendors);
const vendorNameMatches: number[] = BreakpointIndexSearches.getIndexMatch(vendorIndexes.vendorCodeIndex, vendorNamePattern, "gi");

const departmentIndexes: DepartmentIndexes = departmentIndexer.start(departments);
const departmentNameMatches: number[] = BreakpointIndexSearches.getIndexMatch(departmentIndexes.departmentCodeIndex, departmentNamePattern, "gi");
```

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