# vue-plain

> Get plain object from vue getter/setter object

Latest version **0.1.1** (published 2016-04-08) · 0 weekly downloads

## Install

```sh
npm install vue-plain
pnpm add vue-plain
yarn add vue-plain
bun add vue-plain
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-04-08 |
| First published | 2016-03-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | coffce |
| Maintainers | coffcer |
| Keywords | vue, plugin |

## Links

- npm: https://www.npmjs.com/package/vue-plain
- Repository: https://github.com/Coffcer/vue-plain
- Homepage: https://github.com/Coffcer/vue-plain#readme
- Issues: https://github.com/Coffcer/vue-plain/issues
- npm.io page: https://npm.io/package/vue-plain

## Recent versions

- 0.1.1 (latest) — 2016-04-08
- 0.1.0 — 2016-03-26

## README

# vue-plain

Get plain object from vue getter/setter object.

## Install

- #### NPM

  npm install --save `vue-plain`

- #### CommonJS

  ``` js
  var plain = require('vue-plain')
  Vue.use(plain);
  ```

- #### `<script>` Include

  include `vue-plain.js` after `Vue.js`.

## Usage

``` js
let vm = new Vue({
    data: {
        a: {
            a1: 2,
            fn: function(){}
        },
        c: [1, 2, 3]
    }
});

console.log( Vue.plain(vm.a) );  
// { a: { a1: 2 } } 
// The function will be lose, but in general, you should not add function in Vue data

console.log( Vue.plain(vm.c) );  
// [1, 2, 3]
```

with prop.coerce

``` js
childComponent = {
    props: {
        obj: {
            type: Object, // or Array
            coerce (value) {
                return Vue.plain(value);
            }
        }
    },
    created () {
        // this change does not affect parentComponent.obj
        this.obj.a = 1;
    }
}
```

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