Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Node v6 with ES2015
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Pine Mizune
June 03, 2016
Programming
1
840
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
860
C++ 製グラフィックライブラリ Skia の紹介 / Introduction to the graphics library Skia written by C++
pine
0
1.9k
asyncio + aiohttp で作るウェブサービス / How to develop a web service with asyncio and aiohttp
pine
0
690
Lerna による明示的疎結合アーキテクチャ
pine
1
670
CircleCI 2.0 x JavaScript
pine
3
570
Perl 卒業式
pine
0
360
Android Studio の気になる warnings を抑制する方法まとめ
pine
0
520
Emoji Generator meets Browser Extensions
pine
1
3k
近年の OSS 開発における CI 選択のベストプラクティス
pine
3
4.5k
Other Decks in Programming
See All in Programming
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
180
Docコメントで始める簡単ガードレール
keisukeikeda
1
130
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
160
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
780
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
200
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
ロボットのための工場に灯りは要らない
watany
11
3k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
160
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
490
Understanding Apache Lucene - More than just full-text search
spinscale
0
130
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
270
Featured
See All Featured
Crafting Experiences
bethany
1
89
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
130
Statistics for Hackers
jakevdp
799
230k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Docker and Python
trallard
47
3.8k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
220
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
230
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
150
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Exploring anti-patterns in Rails
aemeredith
2
290
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