JavaScript that scales
卢涛南 Randy
twitter: @randyloop
weibo: @米斯特软的
Github: djyde
http://lutaonan.com
We know less and less
about our data
const { title, members } = this.request.body
But, what `members` means?
Refactor
Self Documenting
Interface
The shape of your object
Type Checking
let age = 21
age = '22' // Error
{
"id": "undefined",
"title": "Breaking News"
}
WTF is "undefiend"?
{
"title": "Breaking news",
"author": "Clark Kent",
"content": "<div><img src=\"foo.jpg\" data-title=\"foo\" /></div>",
"image": [
{
"src": "foo.jpg",
"title": "foo"
}
]
}
Node.js
Java
ES6/7 Superset
ES7 features, now!
$ npm i @types/xxx
twitter: @randyloop
weibo: @米斯特软的
Github: djyde
http://lutaonan.com