Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@Raynos
CreatedJanuary 23, 2012 19:48
    • Star(28)You must be signed in to star a gist
    • Fork(0)You must be signed in to fork a gist
    Save Raynos/1665192 to your computer and use it in GitHub Desktop.
    Shim status of ES6

    Currently only lists things that can be shimmed or are experimentally implemented

    Note that for any kind of decent ES6 support we need an ES6 transpiler. A few projects are attempting thisReference SO question

    • WeakMaps, Maps and Sets
    • Old proxies (not direct proxies)
    • let,const

    Chrome (requires harmony flags on)

    • let,const
    • WeakMaps, Maps and Sets
    • old proxies.

    The following are currently shimmed. Note a lot of these are not natively implemented anywhere yet.

    String extras

    ByES6-shim

    • String.prototype.repeat
    • String.prototype.startsWith
    • String.prototype.endsWith
    • String.prototype.contains

    Array extras

    By ES6-shim]1

    • Array.from
    • Array.of

    Number extras

    ByES6-shim

    • Number.isFinite
    • Number.isNaN
    • Number.toInteger
    • Number.isInteger

    Object extras

    ByES6-shim

    • Object.getOwnPropertyDescriptors
    • Object.getPropertyDescriptor
    • Object.getPropertyNames
    • Object.is
    • Object.isnt

    Math extras

    ByES6-shim

    • Math.sign

    Byfdlibm

    • Math.log10
    • Math.log1p
    • Math.expm1
    • Math.cosh
    • Math.sinh
    • Math.tanh
    • Math.acosh
    • Math.asinh
    • Math.atanh
    • Math.hypot
    • Math.trunc
    • Math.sign

    Byrwldrn

    • Math.cbrt

    Maps, Sets and WeakMaps

    ES6-shim coversMap andSet.WeakMap shim.ES6 collections also has alternative shims with special note on Andrea's WeakMap implementation choice.

    These cannot be shimmed currently.

    Any new syntax

    Can not be shimmed. This includes

    • let
    • const
    • typeof null === "null"

    Proxies

    I've not seen any implementation. It's nearly impossible to emulate without severe restrictions. Note it's possible to emulate the newer specification of proxies from the older specification (firefox/chrome have the older implementation lying around)

    Modules

    module syntax cannot be shimmed. Depending on what the programmatic module API is like it may be possible to shim but it's not finalized.

    @paulmillr
    Copy link

    I've added more math extras to es6-shim: Math.log10, Math.log2, Math.log1p, Math.expm1, Math.cosh, Math.sinh, Math.tanh, Math.acosh, Math.asinh, Math.atanh, Math.hypot, Math.trunc.

    @paulmillr
    Copy link

    Needs to be added tounshimmable.md:

    • default function params
    • rest parameters
    • spread operator
    • is / isnt egal operators
    • Array comprehensions
    • Generator expressions
    • Iterators
    • Generators (yield)
    • Quasi-literals
    • RegExp "y" flag
    • Structs

    @Raynos
    Copy link
    Author

    I've kept the unshimmables inline with the experimental subset of es6 in ff/chrome.

    @paulmillr
    Copy link

    @Yaffle
    Copy link

    Math extras via fdlibm -https://gist.github.com/2427837

    @rwaldron
    Copy link

    Updates from last face to face TC39 meeting...

    Remove:

    • String.prototype.toArray is out and will be removed from the next draft. (same assplit(""))
    • typeof null === "null"; is out (too much web breaking)

    Add:

    • Math.cbrt(x) as defined by:
    15.8.2.32 cbrt(x)Returns an implementation-dependent approximation to the cube root of x.1. If x is NaN, the result is NaN. 2. If x is +0, the result is +0. 3. If x is -0, the result is -0.4. If x is +Infinity, the result is +Infinity.5. If x is -Infinity, the result is -Infinity.

    @Raynos
    Copy link
    Author

    @rwldrn thanks updated.

    @rwaldron
    Copy link

    My pleasure :)

    @Raynos
    Copy link
    Author

    Also rage at TC39 not breaking the web withnull === "null" the web should just break and die ¬_¬

    @Yaffle
    Copy link

    Compare:

    ES 6 draft:
    15.8.2.19 log10 (x)

    Returns an implementation-dependent approximation to the base 10 logarithm of x.* If x is 1, the result is +0. ... other special cases ...

    log10 implementation from fdlibm
    http://www.netlib.org/fdlibm/e_log10.c

    Special cases: *  log10(10**N) = N  for N=0,1,...,22. ... other special cases ...

    why ES6 implementation for log10 does not guarante results for some special cases?
    this makes it less usefull

    p.s.
    https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L205 - this implementation fails for such cases too, although if you not interested in such cases, log10 can be implemented as here, without any ES6

    @cscott
    Copy link

    es6-shim now includes support for Promise and support for most uses of Iterator.

    @arthurvr
    Copy link

    Hi there! The name of theString.prototype.contains method must be changed ;-)

    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp