# @snickbit/model

> Simple object modeling library

Latest version **1.2.1** (published 2024-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @snickbit/model
pnpm add @snickbit/model
yarn add @snickbit/model
bun add @snickbit/model
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2024-03-11 |
| First published | 2022-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 14.17 |
| Dependencies | 3 |
| Unpacked size | 27.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | snickbit |

## Links

- npm: https://www.npmjs.com/package/@snickbit/model
- npm.io page: https://npm.io/package/@snickbit/model

## Dependencies (3)

- [object-path](https://npm.io/package/object-path.md) ^0.11.8
- [@snickbit/out](https://npm.io/package/@snickbit/out.md) ^2.2.0
- [@snickbit/utilities](https://npm.io/package/@snickbit/utilities.md) ^3.11.4

## Recent versions

- 1.2.1 (latest) — 2024-03-11
- 1.0.59 (next) — 2022-08-26
- 1.2.0 — 2024-03-11
- 1.1.0 — 2024-03-11
- 1.0.82 — 2023-08-04
- 1.0.81 — 2023-07-25
- 1.0.80 — 2023-07-20
- 1.0.79 — 2023-07-20
- 1.0.78 — 2023-06-29
- 1.0.77 — 2023-05-23
- 1.0.76 — 2023-05-23
- 1.0.75 — 2023-03-27
- 1.0.74 — 2023-03-23
- 1.0.73 — 2023-03-03
- 1.0.72 — 2023-03-03
- … 47 more at https://npm.io/package/@snickbit/model/versions

## README

# @snickbit/model

<!--START_SECTION:readmes-description-->

Simple object modeling library based on [object-path](https://github.com/mariocasciaro/object-path)

<!--END_SECTION:readmes-description-->

## Installation

```bash
yarn add @snickbit/model
```

```bash
npm add @snickbit/model
```

## Basic Usage

```js
import {Model} from '@snickbit/model';
// const { Model } = require('@snickbit/model');

// Use lowercase import for use as a function instead.
// import { model } from '@snickbit/model';

const data = {
	name: 'John Doe',
	age: 30,
	address: {
		street: '123 Main St',
		city: 'Anytown',
		state: 'CA',
		zip: '12345',
	},
}

const person = new Model(data);
// or as a function
// const person = model(data)

console.log(person.get('name')); // John Doe
console.log(person.get('address.street')); // 123 Main St
console.log(person.get('address.city')); // Anytown
console.log(person.get()); // { name: 'John Doe', age: 30, address: { street: '123 Main St', city: 'Anytown', state: 'CA', zip: '12345' } }

person.set('name', 'Jane Doe');
console.log(person.get('name')); // Jane Doe

console.log(person.pull('age')); // 30
console.log(person.has('age')); // false
```

## Documentation

### [API Docs](./docs/README.md)

### [CHANGELOG](CHANGELOG.md)

## License

Copyright (c) 2022 - **Nicholas Lowe** aka **Snickbit**

[MIT License](../../LICENSE)

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