# object-data

> It's object, not just data.

Latest version **1.0.0** (published 2013-08-29) · MIT license · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2013-08-29 |
| First published | 2013-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shallker |
| Maintainers | shallker-wang |
| Keywords | object-data |

## Links

- npm: https://www.npmjs.com/package/object-data
- Repository: https://github.com/shallker/object-data
- Issues: https://github.com/shallker/object-data/issues
- npm.io page: https://npm.io/package/object-data

## Dependencies (2)

- [dever](https://npm.io/package/dever.md) *
- [eventy](https://npm.io/package/eventy.md) *

## Recent versions

- 1.0.0 (latest) — 2013-08-29

## README

object-data
==========

It's object, not just data.


## Installation
```bash
npm install object-data
```


## Quick Start
```javascript
var ObjectData = require('object-data');

var userSchema = {
  id: Number,
  name: {
    first: String,
    last: String
  },
  born: Date,
  password: String,
  email: String,
  hobbies: Array,
  smart: Boolean,
}

var userData = {
  id: 123,
  name: {
    first: 'Jack',
    last: 'Wang'
  },
  born: '1989-09-03',
  join: new Date,
  password: 'secret',
  email: 'jack@mail.com',
  smart: 'yes',
  hobbies: ['music', 'movie'],
  extra: 'invalid'
}

var ObjectUser = ObjectData(userSchema);

var user = new ObjectUser(userData);

user.id.on('update', function(value) {
  console.log('new value', vlaue);
  console.log('new value', this.valueOf());
})
user.id.on('empty', function() {})
user.id.on('remove', function() {})
user.id.on('change', function() {})

user.id.update(25)
user.id.typeOf()
user.id.valueOf()
user.id.lengthOf()
user.id.toString()
user.id.toJSON()
user.id.empty()
user.id.remove()

user.valueOf()
user.toJSON()
user.toString()
user.destroy()
```

---

Copyright (c) 2013 Shallker Wang - MIT License (enclosed)

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