1- Pick: [solution](https://www.typescriptlang.org/play?#code/PQKgUABBAsELQQAoEsDGBrS8491gRgJ4QCCAdgC4AWA9mcQGICuEAFAAICGlAZkwJQQAxAFNOAZ2JCmZZHWH4myADYU4yMlixCdEAIpMR4inM1QsASQC2AB2UirIyhGoiIilWo0QABigwAPAAqADQQANIAfD4QAOZOIgBOaBAA7sjUNEwUEEziGrEQGQB0WlAAwnTGiUyoFOIQnC6ENm5EEDZo6AUuVG7iIjk0PB2JNK2JJka+4TE8Y1a+QT5lEAw0iRAiAB6ctvarPkf1WBoUSTycqG5BNAAmNBAA3lhQJhT2AFwQ1QWvEHcjKhkjYTHRvr8yLF-qgaPtBiI7t98DQaPZuFgAL6rCgtG73GiIRIiABuyBEqQgAF4IABZQj+dDBAlhADk73srIgAB8IKzYfDzndWZFVrCyMYXATvrcHkTSeTKTSXlBVS4Ml8+eV0WQIGM4ayQv8oAK7AikRBLsoBkaoNioEcVuYoJEIAA1RUQeQAcQyAAkmPhvlQKBQbOJPsBgPVUFRigArcTFDaxYDQMAgYBgbOgCAAfQLhaLhYgAE0sptKoCIH6km5iw2CxBM9nca06QyusEwuEtttzmQ7g10CJCMMIEFXcqsABtRBFXXhAC6MrnS7A2JzIHzjeLE6MOXKEmmu73LeQtg2OSeEAAogBHJicZRhW-bVp1CCYy0LPnsNsiHAsbPvYUJGMA2QqOIrKtniECoMeDQ0jOWBvh+FABA+T7KJh74iHUiIAIxhPSjLMg8bIciIIqRJEtp3nhdSYY+z64ehiIAEwkZ2gSyjQlEatRPJ8qa9hCjRdFYFGED-uIcA7Oh8mJGMiRYKRXZ8QJHxCby-Jwma4nCayGgks+yD
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
/* eslint-disable */ | |
const fs = require('fs') | |
const urlExists = require('url-exists') | |
const parser = require('xml2js') | |
const { PromisePool } = require('@supercharge/promise-pool') | |
async function init() { | |
const sitemapXml = fs.readFileSync('./public/sitemap.xml', 'utf8') | |
parser.parseString(sitemapXml, async (err, result) => { | |
const urls = result.urlset.url.map(({ loc }) => loc).flat() |
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
// utils.d.ts | |
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` | |
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` | |
: Lowercase<S> | |
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? | |
`${T extends Capitalize<T> ? "_" : ""}${Lowercase<T>}${CamelToSnakeCase<U>}` : | |
S | |
export type KeysToCamelCase<T> = { |
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
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` | |
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` | |
: Lowercase<S> | |
type KeysToCamelCase<T> = { | |
[K in keyof T as CamelCase<string & K>]: T[K] | |
} | |
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 fs = require("fs"); | |
const path = require("path"); | |
const ffmpegStatic = require("ffmpeg-static"); | |
const ffmpeg = require("fluent-ffmpeg"); | |
ffmpeg.setFfmpegPath(ffmpegStatic); | |
const allowCors = fn => async (req, res) => { | |
res.setHeader("Access-Control-Allow-Credentials", true); | |
res.setHeader("Access-Control-Allow-Origin", "*"); | |
res.setHeader( |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
jest.mock('@/guards'); | |
import router from "@/router"; | |
import { guardToken, guardCustom } from "@/guards"; | |
describe("router", () => { | |
it("calls 'guardToken' before each route transition", () => { | |
router.push({ name: 'dashboard' }); | |
expect(guardToken).toHaveBeenCalled(); | |
}); |
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 { shallowMount, mount, createLocalVue } from '@vue/test-utils' | |
import ElementUI from 'element-ui' | |
import VUserSearchForm from '@/components/VUserSearchForm' | |
const localVue = createLocalVue() | |
localVue.use(ElementUI) | |
describe('VUserSearchForm', () => { | |
const build = () => { | |
const options = { localVue } |
NewerOlder