This commit is contained in:
Kent C. Dodds
2018-09-10 18:26:48 -07:00
commit c8bc20bf21
10 changed files with 3091 additions and 0 deletions

12
src/eslint.js Normal file
View File

@@ -0,0 +1,12 @@
const name = 'Freddy'
typeof name === 'strng'
if (!'serviceWorker' in navigator) {
// you have an old browser :-(
}
const greeting = 'hello'
console
.log('${greting} world!')
[(1, 2, 3)].forEach(x => console.log(x))

27
src/flow.js Normal file
View File

@@ -0,0 +1,27 @@
// @flow
function add(a: number, b: number): number {
return a + b
}
type User = {
name: {
first: string,
middle: string,
last: string,
},
}
function getFullName(user: User): string {
const {
name: {first, middle, last},
} = user
return [first, middle, last].filter(Boolean).join('')
}
add(1, 2)
const one = '1'
add(one, 2)
getFullName({name: {first: 'Joe', middle: 'Bud', last: 'Matthews'}})
getFullName({name: {first: 'Joe', middle: false, last: 'Matthews'}})

7
src/prettier.js Normal file
View File

@@ -0,0 +1,7 @@
const user = {
name: {first: 'Joe', middle: 'Bud', last: 'Matthews'},
age: 25,
birthday: 'October 18th, 1988',
}
console.log(user)