# trackable-object

> track object changes deeply

Latest version **1.0.5** (published 2023-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install trackable-object
pnpm add trackable-object
yarn add trackable-object
bun add trackable-object
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-02-12 |
| First published | 2023-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | codexline |
| Maintainers | mahmoudshahin1111 |
| Keywords | object, trackable-object, object-changed |

## Links

- npm: https://www.npmjs.com/package/trackable-object
- Repository: https://github.com/mahmoudshahin1111/trackable-object
- Homepage: https://github.com/mahmoudshahin1111/trackable-object#readme
- Issues: https://github.com/mahmoudshahin1111/trackable-object/issues
- npm.io page: https://npm.io/package/trackable-object

## Recent versions

- 1.0.5 (latest) — 2023-02-12
- 1.0.4 — 2023-02-12
- 1.0.3 — 2023-02-12
- 1.0.1-b — 2023-02-12
- 1.0.0 — 2023-02-12

## README

[![npm version](https://badge.fury.io/js/trackable-object.svg)](https://badge.fury.io/js/trackable-object)
![example workflow](https://github.com/mahmoudshahin1111/trackable-object/actions/workflows/main.yml/badge.svg)

# Trackable Object ***(Up your object limits 🐢)***

![banner500x500](https://user-images.githubusercontent.com/46138189/218281811-09448382-b37e-4df4-92fd-3eaac852c177.png)

Track object deeply 🔍 so you can check if it changed or any of it's nested properties had changed.

## Installation
### CDN
```html
<script src="https://cdn.jsdelivr.net/npm/trackable-object@latest/build/trackable-object.js"></script>
```

### NPM
```bash
npm i trackable-object
```


## How it works?
```html
<script src="https://cdn.jsdelivr.net/npm/trackable-object@latest/build/trackable-object.js"></script>

<script>

const parentTO = TrackableObject.create({
    name:'parent_name'
});

parentTO.name = 'parent_name_updated';

console.log(trackableObject.t_changes()); //  Output: {name : 'parent_name_updated'}

console.log(JSON.stringify(person)); // and you can serialize your object as well 

</script>
```

## Use Cases:
- Check if the property changed before sending another request so will save the APIs cost.
- Warning the client before leaving regarding he can loss his changes.


Notes:
- If your object property get back to the old value then will not be exists in the `t_changes()` output.

## API

|   Name   |                  Description                   |            Type             |
| :------: | :--------------------------------------------: | :-------------------------: |
|  t_changes   |              Get all the changed properties               |           function():Map<string,string>            |

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