This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const KEY_ESCAPE_REG = /[\s-.:|#@$£*%]/ | |
const MAX_SINGLE_LINE_ARRAY_LENGTH = 3 | |
export function formatObjectToSource (obj) { | |
return printLines(Array.isArray(obj) ? arrayToSourceLines(obj) : objectToSourceLines(obj)) | |
} | |
function objectToSourceLines (object, indentCount = 0) { | |
return createLines(indentCount, lines => { | |
lines.push('{') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://cdn.rawgit.com/luizbills/feather-icon-font/v4.7.0/dist/feather.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function useEagerComputed() { | |
const properties = [] | |
function eagerComputed(definitions) { | |
const computedProps = {} | |
for (const key in definitions) { | |
const effect = definitions[key] | |
properties.push({ key, effect }) | |
computedProps[key] = function () { | |
return this.$data[key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dedupeReferences (existing, incoming) { | |
// Dedupe items | |
const idMap = {} | |
for (const item of existing) { | |
idMap[item.__ref] = true | |
} | |
const validated = [] | |
for (const item of incoming) { | |
if (!idMap[item.__ref]) { | |
validated.push(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hookable } from '../src/hookable' | |
describe('hookable', () => { | |
test('hook with one callback', async () => { | |
const hooks = new Hookable<{ | |
invert:(value: boolean) => boolean | Promise<boolean> | |
}>() | |
hooks.hook('invert', value => !value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import { ref, computed } from 'vue' | |
import gql from 'graphql-tag' | |
import { client } from './weather' | |
const document = gql`query getCityWeather ($name: String!) { | |
city: getCityByName (name: $name) { | |
id | |
name | |
country |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Doesn't work with Vue 2 scoped slots nor Vue 3 slots in some cases --> | |
<template> | |
<div> | |
<div v-if="$slots.foo"> | |
<slot name="foo" title="Title" /> | |
</div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { updateLobby, subscribeToLobby } from './lobby' | |
// ... | |
updateLobby('some-id', { title: 'Foo' }) | |
subscribeToLobby('xxx-xxx-xxx') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=\s\(\) => import\([\s\n]*(\/\*.*?\*\/[\s\n]*)?'.*?\.vue'[\s\n]*\) |