Skip to content

Commit

Permalink
🎨 use Prettier code style on sources
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorLuizC committed Jun 2, 2020
1 parent 18452d5 commit ed0584a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ npm i vue-uuid
Vue's `use` method will do the trick adding to Vue.

```js
import Vue from 'vue';
import UUID from 'vue-uuid';
import Vue from "vue";
import UUID from "vue-uuid";

Vue.use(UUID);
```
Expand Down
13 changes: 6 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import Vue from 'vue';
import v1 from 'uuid/v1';
import v4 from 'uuid/v4';
import v5 from 'uuid/v5';
import Vue from "vue";
import v1 from "uuid/v1";
import v4 from "uuid/v4";
import v5 from "uuid/v5";

export interface UUID {
v1: typeof v1;
v4: typeof v4;
v5: typeof v5;
}

declare module 'vue/types/vue' {
declare module "vue/types/vue" {
interface VueConstructor {

/**
* An object with uuid's v1, v4 and v5 functions.
*/
Expand Down Expand Up @@ -41,4 +40,4 @@ export const uuid: UUID;
* ```
* @param Vue - Vue constructor.
*/
export default function install (Vue: Vue): void;
export default function install(Vue: Vue): void;
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import v1 from 'uuid/v1';
import v4 from 'uuid/v4';
import v5 from 'uuid/v5';
import v1 from "uuid/v1";
import v4 from "uuid/v4";
import v5 from "uuid/v5";

/**
* @typedef {{ v1: typeof v1, v4: typeof v4, v5: typeof v5 }} UUID
Expand Down Expand Up @@ -29,6 +29,6 @@ export const uuid = { v1, v4, v5 };
* ```
* @param {import('vue').default} Vue Vue constructor.
*/
export default function install (Vue) {
export default function install(Vue) {
Vue.prototype.$uuid = uuid;
}
36 changes: 18 additions & 18 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import test from 'ava'
import install from './'
import test from "ava";
import install from "./";

const generateVue = () => {
class Vue {
static use (install) {
install(Vue)
static use(install) {
install(Vue);
}
}

return Vue
}
return Vue;
};

test('Exposes uuid as Vue\'s property $uuid', (context) => {
const Vue = generateVue()
test("Exposes uuid as Vue's property $uuid", (context) => {
const Vue = generateVue();

Vue.use(install)
Vue.use(install);

context.true(typeof Vue.prototype.$uuid === 'object')
})
context.true(typeof Vue.prototype.$uuid === "object");
});

test('Exposed $uuid has v1, v4 & v5', (context) => {
const Vue = generateVue()
test("Exposed $uuid has v1, v4 & v5", (context) => {
const Vue = generateVue();

Vue.use(install)
Vue.use(install);

context.true(typeof Vue.prototype.$uuid.v1 === 'function')
context.true(typeof Vue.prototype.$uuid.v4 === 'function')
context.true(typeof Vue.prototype.$uuid.v5 === 'function')
})
context.true(typeof Vue.prototype.$uuid.v1 === "function");
context.true(typeof Vue.prototype.$uuid.v4 === "function");
context.true(typeof Vue.prototype.$uuid.v5 === "function");
});

0 comments on commit ed0584a

Please sign in to comment.