# eden-document

> Eden Node JS Generic Document Definition

Latest version **0.0.32** (published 2015-06-01) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install eden-document
pnpm add eden-document
yarn add eden-document
bun add eden-document
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.32 |
| Published | 2015-06-01 |
| First published | 2014-09-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Christian Blanquera |
| Maintainers | cblanquera |
| Keywords | eden, library |

## Links

- npm: https://www.npmjs.com/package/eden-document
- Repository: https://github.com/edenjs/document
- Issues: https://github.com/edenjs/document/issues
- npm.io page: https://npm.io/package/eden-document

## Dependencies (2)

- [eden-hash](https://npm.io/package/eden-hash.md) 0.0.32
- [eden-model](https://npm.io/package/eden-model.md) 0.0.32

## Recent versions

- 0.0.32 (latest) — 2015-06-01
- 0.0.31 — 2014-11-28
- 0.0.30 — 2014-11-28
- 0.0.28 — 2014-11-11
- 0.0.27 — 2014-11-11
- 0.0.26 — 2014-11-07
- 0.0.25 — 2014-11-06
- 0.0.24 — 2014-11-03
- 0.0.23 — 2014-10-17
- 0.0.21 — 2014-10-13
- 0.0.20 — 2014-10-08
- 0.0.17 — 2014-10-02
- 0.0.16 — 2014-10-02
- 0.0.15 — 2014-10-01
- 0.0.14 — 2014-09-29
- … 3 more at https://npm.io/package/eden-document/versions

## README

#Document

DESCRIPTION

[![Build Status](https://api.travis-ci.org/edenjs/document.png)](https://travis-ci.org/edenjs/document)

## General

### Installation

```
npm install eden-document
```

### Usage

```
var document = require('eden-document');
```

## Methods

  * [path](#path)

  * [set](#set)

  * [unset](#unset)

---

<a name="path"></a>

### path

```
 mixed path('social', 'facebook', 'name');
```

Returns a value in document given the key path

#### Parameters

  1. 'social', 'facebook', 'name' - string[,string..]

#### Returns

 mixed

#### Example

##### Code

```
var user = document({ name: 'chris', social: { facebook: { name: 'Chris12' }, twitter: { name: 'Chris23' } } });
user.path('social', 'facebook', 'name');
user.path('social', 'twitter').getName());
user.path('social', 'twitter').get().name);
```

##### Outputs

```
'Chris12'
'Chris23'
'Chris23'
```

---

<a name="set"></a>

### set

```
 this set('social', 'google', {name: 'Chris34'}).getSocial().getGoogle().getName());
```

Sets a value in document given the key path where the last argument is the value to set

#### Parameters

  1. 'social', 'google', {name: 'Chris34'}).getSocial().getGoogle().getName() - string[,string..]

  2. mixed

#### Returns

 this

#### Example

##### Code

```
var user = document({ name: 'chris', social: { facebook: { name: 'Chris12' }, twitter: { name: 'Chris23' } } });

user.set('social', 'google', {name: 'Chris34'}).getSocial().getGoogle().getName());
user.set('social', 'google', 'name', 'foo', 'bar').get().social.google.name.foo);
```

##### Outputs

```
'Chris34'
'bar'
```

---

<a name="unset"></a>

### unset

```
 this unset('social', 'facebook').get().social.facebook);
```

Removes a value in model given the key path

#### Parameters

  1. 'social', 'facebook').get().social.facebook - string[,string..]

  2. mixed

#### Returns

 this

#### Example

##### Code

```
var user = document({ name: 'chris', social: { facebook: { name: 'Chris12' }, twitter: { name: 'Chris23' } } });

typeof user.unset('social', 'facebook').getSocial().getFacebook());
typeof user.unset('social', 'facebook').get().social.Facebook);
typeof user.unset('social', 'twitter', 'name').getSocial().getTwitter().name);
```

##### Outputs

```
'undefined'
'undefined'
'undefined'
```

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