Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Node v6 with ES2015
Search
Pine Mizune
June 03, 2016
Programming
1
820
Node v6 with ES2015
Gotanda.js #4 in Retty で発表した資料
http://gotandajs.connpass.com/event/30961/
Pine Mizune
June 03, 2016
Tweet
Share
More Decks by Pine Mizune
See All by Pine Mizune
多言語対応と絵文字ジェネレーター / i18n of Emoji Generator
pine
0
840
C++ 製グラフィックライブラリ Skia の紹介 / Introduction to the graphics library Skia written by C++
pine
0
1.8k
asyncio + aiohttp で作るウェブサービス / How to develop a web service with asyncio and aiohttp
pine
0
680
Lerna による明示的疎結合アーキテクチャ
pine
1
650
CircleCI 2.0 x JavaScript
pine
3
560
Perl 卒業式
pine
0
340
Android Studio の気になる warnings を抑制する方法まとめ
pine
0
510
Emoji Generator meets Browser Extensions
pine
1
3k
近年の OSS 開発における CI 選択のベストプラクティス
pine
3
4.5k
Other Decks in Programming
See All in Programming
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
160
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
AIコーディングエージェント(NotebookLM)
kondai24
0
150
認証・認可の基本を学ぼう前編
kouyuume
0
180
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
420
FluorTracer / RayTracingCamp11
kugimasa
0
200
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
290
AIコーディングエージェント(Gemini)
kondai24
0
180
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
2k
Developing static sites with Ruby
okuramasafumi
0
190
Herb to ReActionView: A New Foundation for the View Layer @ San Francisco Ruby Conference 2025
marcoroth
0
250
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
The Pragmatic Product Professional
lauravandoore
37
7.1k
GitHub's CSS Performance
jonrohan
1032
470k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
What's in a price? How to price your products and services
michaelherold
246
12k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
69k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
YesSQL, Process and Tooling at Scale
rocio
174
15k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Transcript
3 Jun, 2016 / Gotanda.js #4 in Retty Pine Mizune
Node v6 with ES2015
Profile o GitHub: @pine o Twitter: @pine613 o 好きな言語: JavaScript
o 仕事で書いている言語: Kotlin / Perl o Mobile Factory, Inc
Table of contents uNode v6 released uDestructuring assignment (分割代入) uDefault
parameters uRest parameters (残余引数) uProxy API uReflect API Node v6 ~ 対応
Table of contents uNode v6 released uDestructuring assignment (分割代入) uDefault
parameters uRest parameters (残余引数) uProxy API uReflect API Node v6 ~ 対応
Node v6 released [1/4] 04/26 次期 LTS 候補 Node v6
リリース • 2013/03/11 Node v0.10.0 released • 2015/02/06 Node v0.12.0 released • 2015/09/08 Node v4.0.0 released (LTS) • 2015/10/29 Node v5.0.0 released • 2016/04/26 Node v6.0.0 released (次期 LTS) 今日はこの話
Node v6 released [2/4] 04/26 次期 LTS 候補 Node v6
リリース Node v0.10.x / v0.12.x は 2016 年中でサポート切れ
Node v6 released [3/4] 04/26 次期 LTS 候補 Node v6
リリース Node v4.x (LTS) は 2018 年春までサポート
Node v6 released [4/4] 04/26 次期 LTS 候補 Node v6
リリース Node v6.x なら ES2015 が ほぼトランスパイル不要
Table of contents uNode v6 released uDestructuring assignment (分割代入) uDefault
parameters uRest parameters (残余引数) uProxy API uReflect API Node v6 ~ 対応
Destructuring assignment (分割代入) [1/3] 配列、オブジェクトの代入を簡潔に記述する構文 let [ first, second ]
= [ 1, 2 ] console.log(first, second) #=> 1 2 let { name, age } = { name: “rem”, age: 17 } console.log(name, age) #=> rem 17 配列での分割代入 オブジェクトでの分割代入
Destructuring assignment (分割代入) [2/3] 関数の引数でも、分割代入が可能 function foo({ flag = false
} = {}) { console.log(flag) } foo() #=> false foo({ flag: true }) #=> true オプションを受け取る関数が、簡潔に定義可能 呼び出す側は今まで通り
Destructuring assignment (分割代入) [3/3] require / import 文で使うと綺麗 const {assign}
= require(‘lodash’) import/export は Node v6 では非対応、要 Babel require での記述が簡略化可能 import {exec} from ‘child_process’
Default parameters 関数の引数に初期値が設定可能 function foo(a = 1, b, c =
3) { console.log(a, b, c) } 任意の箇所の引数の初期値が指定可能 foo() #=> 1 undefined 3 foo(1, 2, 3) #=> 1 2 3 初期値を指定しない場合は従来通り undefined
Rest parameters (残余引数) 可変長引数を簡潔に記述可能 function foo(a, b, …args) { console.log(a,
b, args) } 任意の箇所の引数の初期値が指定可能 foo(1, 2) #=> 1 2 [] foo(1, 2, 3, 4, 5) #=> 1 2 [ 3, 4, 5 ] arguments と違い本物の配列として扱える
Proxy API [1/2] プロパティアクセスや演算子の処理を上書きする機能 const target = { foo: ‘foo’
} const proxy = new Proxy(target, { get(target, name) { return ‘bar’ } }) プロパティアクセスを上書きする場合 console.log(target.foo) #=> foo console.log(proxy.foo) #=> bar Proxy 経由でのアクセスのみ上書きされる ※ Babel 未対応
Proxy API [2/2] Proxy API で上書き可能な処理な例 名前 上書きできる処理 get obj[‘key’]
set obj[‘key’] = value has ’key’ in obj apply obj() constructor new obj() enumerate for (var key in obj) { ... }
Reflect API Proxy の各処理に対応する関数を提供する API const target = { foo:
‘foo’ } const proxy = new Proxy(target, { get(target, name) { return Reflect.get(target, name) } }) Proxy とセットで用いると有用 console.log(target.foo) #=> foo console.log(proxy.foo) #=> foo Proxy から本来の処理に移譲できている
Fin. ALLPPT.com _ Free PowerPoint Templates, Diagrams and Charts