# @typinghare/extrum

> A lightweight data collector library.

Latest version **2.4.2** (published 2024-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typinghare/extrum
pnpm add @typinghare/extrum
yarn add @typinghare/extrum
bun add @typinghare/extrum
```

## 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 | 2.4.2 |
| Published | 2024-07-15 |
| First published | 2023-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Chan |
| Maintainers | typinghare |
| Keywords | metadata, settings |

## Links

- npm: https://www.npmjs.com/package/@typinghare/extrum
- Homepage: https://github.com/typinghare/extrum
- npm.io page: https://npm.io/package/@typinghare/extrum

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.4.2 (latest) — 2024-07-15
- 2.4.1 — 2024-07-15
- 2.4.0 — 2024-07-14
- 2.3.0 — 2024-02-04
- 2.2.0 — 2024-01-13
- 2.1.0 — 2024-01-05
- 2.0.1 — 2023-12-22
- 2.0.0 — 2023-11-02
- 1.1.0 — 2023-07-24
- 1.0.3 — 2023-07-19
- 1.0.2 — 2023-07-19
- 1.0.1 — 2023-07-08
- 1.0.0 — 2023-07-08

## README

# Extrum

## Get Started

Create a `MyConfig` interface and a `MyConfigMetadata` interface, then create a data collection.

```ts
import { DataCollection, Datum } from '@typinghare/extrum'

interface MyConfig {
    username: string,
    fontSize: number
}

interface MyConfigMetadata {
    label: string
    optionList?: any[]
}

const dataCollection = new DataCollection<MyConfig, MyConfigMetadata>({
    username: Datum.of('TypingHare').setMetadata({
        label: 'The username of the user.',
    }),
    fontSize: Datum.of(16).setMetadata({
        label: 'The font size.',
        optionList: [12, 16, 20],
    }),
})
```

Get values from the data collection and set values.

```ts
const username = dataCollection.getValue('username')     // TypingHare 
const fontSize = dataCollection.getValue('fontSize')     // 16

dataCollection.setValue('username', 'James Chan')
dataCollection.setValue('fontSize', 20)
```

Get and set metadata.

```ts
dataCollection.getDatum('username').meta('label')
dataCollection.getDatum('fontSize').meta('optionList')

dataCollection.getDatum('username').meta('label')
dataCollection.getDatum('fontSize').meta('optionList', [8, 12, 16, 20, 24])
```

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