{"id":18823984,"url":"https://github.com/eddyerburgh/vue-add-globals","last_synced_at":"2025-04-14T01:31:09.079Z","repository":{"id":20536745,"uuid":"90185596","full_name":"eddyerburgh/vue-add-globals","owner":"eddyerburgh","description":"Add globals to a Vue instance 🌎","archived":false,"fork":false,"pushed_at":"2022-12-06T20:22:51.000Z","size":596,"stargazers_count":4,"open_issues_count":16,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T23:58:59.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddyerburgh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-03T19:26:29.000Z","updated_at":"2023-04-16T18:59:24.000Z","dependencies_parsed_at":"2023-01-13T21:01:17.133Z","dependency_job_id":null,"html_url":"https://github.com/eddyerburgh/vue-add-globals","commit_stats":null,"previous_names":["eddyerburgh/vue-add-instance-method"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fvue-add-globals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fvue-add-globals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fvue-add-globals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddyerburgh%2Fvue-add-globals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddyerburgh","download_url":"https://codeload.github.com/eddyerburgh/vue-add-globals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248807496,"owners_count":21164694,"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-11-08T00:55:12.963Z","updated_at":"2025-04-14T01:31:08.835Z","avatar_url":"https://github.com/eddyerburgh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-add-globals\n\nAdd globals to Vue. Use it in tests to mock global methods and properties.\n\n## Example\n\nAdding a property and method to Vue\n\n```js\nimport addGlobals from 'vue-add-globals'\nimport Vue from 'vue'\n\nconst $someMethod = () =\u003e ({})\nconst someProp = 'prop'\naddGlobals(Vue, {\n  $someMethod: $someMethod,\n  someProp: someProp\n})\nconst Ctor = Vue.extend(TestComponent)\nconst vm = new Ctor().$mount()\n\nt.is(vm.$someMethod, $someMethod)\nt.is(vm.someProp, someProp)\n```\n\n## Installation\n\n```shell\nnpm install --save-dev vue-add-globals\n```\n\n## Usage\n\n* Import 'vue-add-globals'\n* Call it with object of global properties to add\n\n```js\nimport addGlobals from 'vue-add-globals'\n\naddGlobals(Vue, { $mockedMethod: mockedMethod })\n```\n\nYou can keep the global Vue class clean by using `Vue.extend()`:\n\n```js\nimport addGlobals from 'vue-add-globals'\nimport Vue from 'vue'\n\nconst freshVue = Vue.extend()\n\naddGlobals(freshVue, { $mockedMethod: mockedMethod })\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyerburgh%2Fvue-add-globals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyerburgh%2Fvue-add-globals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyerburgh%2Fvue-add-globals/lists"}