タグ

JavaScriptとECMAScriptに関するisdhのブックマーク (8)

  • ES6 Proxy をつかって堅牢なオブジェクトをつくるTips

    What is Proxy The Proxy object is used to define custom behavior for fundamental operations (e.g. property lookup, assignment, enumeration, function invocation, etc). オブジェクトをラップし、オブジェクトが持つ基的な機能(obj.keyと書いてvalueを取得する機能など)を上書くことができるのがProxy Objectです。 (高機能なオブジェクトを生成することができる、けっこうイカした仕様だと思います😋) つかいかた 詳細な用法やパラメータの説明は MDNに任せるとして、基的なSyntaxだけ記します。

    ES6 Proxy をつかって堅牢なオブジェクトをつくるTips
    isdh
    isdh 2020/09/10
    handlerでトラップを上書きする
  • What's new in ECMAScript 2020

    ECMAScript 2020, the 11th installment of our favorite programming language, contains a handful of new features. Some are small ones, but others have the potential to change forever the way we write JavaScript. This article is an attempt at a short and concise overview of those new features. Grab your cup of tea and let's go. Dynamic import() ES2015 introduced the static import syntax. Now you coul

    isdh
    isdh 2020/05/07
    “Dynamic imports, on the other hand, when used wisely, can help with reducing bundle size by loading dependencies on-demand.”
  • io.js - JavaScript I/O

    Run JavaScript EverywhereNode.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts. Download Node.js (LTS)Download Node.js (LTS)Downloads Node.js v22.16.01 with long-term support. Node.js can also be installed via version managers.Want new features sooner? Get Node.js v24.1.01 instead. // server.mjs

    io.js - JavaScript I/O
  • Esprima

    Esprima is a high performance, standard-compliant ECMAScript parser written in ECMAScript (also popularly known as JavaScript). Features Full support for ECMAScript 2019 (ECMA-262 10th Edition) Sensible syntax tree format, with optional node location info Experimental support for JSX, a syntax extension for React Heavily tested (~1600 tests with full code coverage) API Esprima can be used to perfo

  • AST explorer

    An online AST explorer.

  • Promise.allSettled と Promise.any | blog.jxck.io

    Intro Promise.allSettled() と Promise.any() の仕様策定が進んでいる。 両者は近いレイヤの仕様では有るが、作業の進捗には差がある。 Promise.allSettled は Stage 4 であり、 Chrome や Safari TP には実装もされている Promise.any は Stage 2 であり、実装はまだない ここでは、これらがあると何が嬉しいのかを Promise.all(), Promise.race() の特徴を踏まえて解説する。 Promise.all()/race() Promise.all(), Promise.race() は、いずれも複数の Promise をまとめて処理する Utility Method のようなものである。 all は全ての Promise が Resolve したら Resolve し、 race

    Promise.allSettled と Promise.any | blog.jxck.io
    isdh
    isdh 2019/08/30
    “Promise.allFulfilled = Promise.all Promise.allSettled = Promise.allSettled Promise.anyFulfilled = Promise.any Promise.anySettled = Promise.race”
  • ECMAScriptの浮動小数点数の丸め仕様がスゴい - hnwの日記

    ECMAScriptの浮動小数点数の丸め関数である Number.prototype.toFixed() について調べてみたところ、浮動小数点数をわかっている人が作った硬派な仕様だと感じたので、解説してみます。 浮動小数点数の丸めの善し悪しについて 私はプログラミング言語の浮動小数点数の丸め処理に興味があり、過去に関連記事を30以上書いています。こうした活動から得られた知見として、良い丸め関数には次のような性質があると考えています。 仕様がシンプルで直感的であること 仕様が抜け漏れなく文書化されていること バグを作り込みにくい仕様であること どれも良い関数の一般論のような話ですが、丸め処理に限って言えば簡単な話ではありません。そもそも浮動小数点数の性質が人の直感に反するため利用者にとっても実装者にとっても罠が多く、結果として上の条件を満たせないことが多いのです(私が面白いと感じるポイント

    ECMAScriptの浮動小数点数の丸め仕様がスゴい - hnwの日記
    isdh
    isdh 2019/02/27
    “「toFixed()は四捨五入のはずなのに四捨五入にならない」と誤解するかもしれませんが、このような混乱は他の仕様にしたとしても避けようがありません。「浮動小数点数に詳しくなってください」とスパルタ指導していく
  • Array.{of, from}が実装された - JS.next

    概要 配列を作る2つのArrayのスタティックメソッドが実装された。 Array.from(arrayLike, mapfn?, thisArg?) 配列のようなものから配列を作る便利なメソッド。 例 DOMに配列のメソッドを適応したい時、 今までは [].slice.call(document.getElementsByTagNames('p')).map(mapfn, thisArg) これがこう書ける Array.from(document.getElementsByTagNames('p'), mapfn, thisArg) 外部参考リンク Firefox 32 で Array.from が実装された - hogehoge @teramako Array.of(...items) 引数から配列を作るメソッド。 例 Array.of(1) // [1] Array.of(1, 2,

    Array.{of, from}が実装された - JS.next
    isdh
    isdh 2018/08/20
    Array extendがいい感じ
  • 1