// default exports
export default 42;
export default {};
export default [];
export default (1 + 2);
export default foo;
export default function () {}
export default class {}
export default function foo () {}
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 { RouteConfig } from 'vue-router'; | |
const Home = () => import(/* webpackChunkName: "home" */ '../views/Home.vue'); | |
const About = () => import(/* webpackChunkName: "about" */ '../views/About.vue'); | |
export const HomeRoutes: RouteConfig[] = [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home, |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Jest All", | |
"program": "${workspaceFolder}/node_modules/.bin/jest", | |
"args": ["--runInBand", "--config", "jest.config.js"], | |
"console": "integratedTerminal", |
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
async function asyncForEach(array, callback) { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array); | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50); | |
console.log(num); |
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
// https://github.com/alfonsomunozpomer/react-fetch-mock | |
import React from 'react' | |
import fetchMock from 'fetch-mock' | |
import Enzyme from 'enzyme' | |
import {shallow, mount, render} from 'enzyme' | |
import Adapter from 'enzyme-adapter-react-16' | |
Enzyme.configure({ adapter: new Adapter() }) |
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
/** | |
* TypeScript version of @istarkov's cancellable Promise wrapper. | |
* | |
* @see https://github.com/facebook/react/issues/5465#issuecomment-157888325 | |
*/ | |
const makeCancelable = <T>(promise: Promise<T>): { promise: Promise<T>; cancel(): void } => { | |
let hasCanceled = false; | |
const wrappedPromise = new Promise<T>((resolve, reject) => { | |
promise.then( |
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
#!/bin/bash | |
# Looks for changes to package.json and automates running tasks. | |
# An adaptation of https://gist.github.com/stefansundin/82051ad2c8565999b914 | |
echo "Check installed dependencies and execute npm install and pod install" | |
# post-checkout hook - looks for changes to package.json, | |
# when you change branches, and if found, reinstalls the given packages every | |
# Exit early if this was only a file checkout, not a branch change ($3 == 1) | |
[[ $3 == 0 ]] && exit 0 |
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
<body> | |
<script> | |
const printResult = (item) => console.log(`Selected option '${item}'.`); | |
const mappedObject = { | |
option1: printResult, | |
option2: printResult, | |
option3: printResult, | |
option4: printResult, | |
option5: printResult, | |
option6: printResult, |
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
describe('Login Mappers test', () => { | |
describe('mapLoginResponseToUserSession function', () => { | |
const invalidTestCases = [null, undefined, {}]; | |
it.each(invalidTestCases)( | |
'given a %s value should return an empty user session', | |
actual => { | |
expect(mapLoginResponseToUserSession(actual as any)).toEqual({ | |
userName: '', | |
token: '', |