{"id":13424237,"url":"https://github.com/Coffcer/vue-plain","last_synced_at":"2025-03-15T18:34:20.674Z","repository":{"id":96868258,"uuid":"54774081","full_name":"Coffcer/vue-plain","owner":"Coffcer","description":"Get plain object from vue getter/setter object.","archived":false,"fork":false,"pushed_at":"2016-04-05T06:16:41.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T16:41:45.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coffcer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-26T10:28:28.000Z","updated_at":"2016-04-01T08:36:50.000Z","dependencies_parsed_at":"2023-04-12T13:46:30.268Z","dependency_job_id":null,"html_url":"https://github.com/Coffcer/vue-plain","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"47e443438a526927eb7e765829dff1b731807a1f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coffcer%2Fvue-plain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coffcer%2Fvue-plain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coffcer%2Fvue-plain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coffcer%2Fvue-plain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coffcer","download_url":"https://codeload.github.com/Coffcer/vue-plain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775790,"owners_count":20346262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:00:50.548Z","updated_at":"2025-03-15T18:34:15.648Z","avatar_url":"https://github.com/Coffcer.png","language":"JavaScript","funding_links":[],"categories":["Awesome Vue.js [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)","Awesome Vue.js"],"sub_categories":["Libraries \u0026 Plugins"],"readme":"# vue-plain\n\nGet plain object from vue getter/setter object.\n\n## Install\n\n- #### NPM\n\n  npm install --save `vue-plain`\n\n- #### CommonJS\n\n  ``` js\n  var plain = require('vue-plain')\n  Vue.use(plain);\n  ```\n\n- #### `\u003cscript\u003e` Include\n\n  include `vue-plain.js` after `Vue.js`.\n\n## Usage\n\n``` js\nlet vm = new Vue({\n    data: {\n        a: {\n            a1: 2,\n            fn: function(){}\n        },\n        c: [1, 2, 3]\n    }\n});\n\nconsole.log( Vue.plain(vm.a) );  \n// { a: { a1: 2 } } \n// The function will be lose, but in general, you should not add function in Vue data\n\nconsole.log( Vue.plain(vm.c) );  \n// [1, 2, 3]\n```\n\nwith prop.coerce (in Vue@1.0.18 ~ Vue@1.0.20, coerce() has a bug, so you can't do this in these versions)\n\n``` js\nchildComponent = {\n    props: {\n        obj: {\n            type: Object, // or Array\n            coerce (value) {\n                return Vue.plain(value);\n            }\n        }\n    },\n    created () {\n        // this change does not affect parentComponent.obj\n        this.obj.a = 1;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoffcer%2Fvue-plain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCoffcer%2Fvue-plain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoffcer%2Fvue-plain/lists"}