Code Monkey home page Code Monkey logo

es6features's Introduction

Welcome ๐Ÿ‘‹.

I'm Luke Hoban, currently CTO at Pulumi where I lead our product, engineering, design and data teams in building the future of cloud engineering and infrastructure-as-software โ˜๏ธ.

Previously, co-founder of the TypeScript project, representative to the ECMA TC39 standards body working on ECMAScript/JavaScript, product manager on EC2 at AWS, and many other developer tools and cloud platform roles.

Twitter

๐Ÿ‘จโ€๐Ÿ’ป Work

TypeScript

Pulumi

EC2

VS Code

C# and F#

๐ŸŽ Side Projects

๐Ÿ“บ Media

es6features's People

Contributors

adamclerk avatar aheuermann avatar amatiasq avatar bnjmnt4n avatar chrisoverzero avatar cpeterso avatar domenic avatar gaspard avatar getify avatar gr0uch avatar graue avatar iamolivinius avatar jaketrent avatar jamesmanning avatar jhnns avatar laoujin avatar ljharb avatar lukehoban avatar luser avatar majorbreakfast avatar mathiasbynens avatar matthisk avatar noullet avatar pgilad avatar rstacruz avatar shamrin avatar timbaileyjones avatar turbo87 avatar urish avatar yeah568 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

es6features's Issues

this in arrow block

for this statement:
Unlike functions, arrows share the same lexical this as their surrounding code.

can I simply consider

'()=>{}' 

equals to

'function(){}.bind(this)'

React + Flux Store Example in ES6

How would you write this in ES6?

var EventEmitter = require("events").EventEmitter
var assign = require("react/lib/Object.assign")
...
var ProductStore = assign({}, EventEmitter.prototype, {
...
emitChange: function() {
this.emit("change")
},

Show new error modes?

I'd love to see what happens when new things go wrong -- like what happens when destructuring assignment doesn't match?

regex sticky?

I'm currently trying to figure out what the heck the y regex sticky mode actually does (lots of varied examples that conflict, and mis-information), but I was surprised to see it's not listed here at all. Plans to cover it?

If I get to some sort of complete understanding of it soon, I'll submit a PR. But perhaps you might already have a good way to explain it that would clear up the confusion?

"Modules" section clarification

The description for modules says the following:

Implicitly async model โ€“ no code executes until requested modules are available and processed.

Wouldn't that be an implicitly synchronous model? Would be great to have this clarified.

Rewrite?

The examples are useful, but plenty of sections are too difficult to understand or just lacking ๐Ÿ˜ญ

For example, important concepts like Symbols are not given enough attention and the given explanation.

interpolation on key value within a multiline string?

Hey everyone! I'm currently converting our React coffeescript files over to ES6 and i ran into this error where I tried to add a multiline string to interpolate a variable within the key's value. I came across the error below, i was wondering if this is possible to do or if i'm trying something impossible :) Thanks!

add explainer for getASTNode function

For me it was quite hard to understand what kind of values this arbitrary function returns, so I didn't understand at the beginning how the assignment works for object matching. We could just use an object instead of this function, no?

Call method inside other class with EcmaScript 6 in Node JS

I have Javascript link this.

someClass.js

class someClass {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }

    sayName() {
        console.log(this.name);
    }

    sayAge() {
        console.log(this.age);
    }
}

var myInstance = new someClass('dwayne', 27);
myInstance.sayName();

In cmd:

node someClass.js
It's show dwayne.

But show I want to use this class in another class like: someClassTest.js How can I call someClass.js for same result

Thanks.

Module lookup in ES6.

I'm trying to understand the way modules are loaded in ES6. I was googling this question for like half of hour but never found the exact definition. See the example:

import * as smth from 'dir1/dir2/dir3/file'

You can see that it's different from relative path like ./dir1/dir2/dir3/file. I was messing with this in TypeScript + NodeJS and it's lookup strategy is different from the one I used to work with in NodeJS. What I found is that

  1. it will lookup for dir1 which is defined ABOVE the current file.
  2. If it finds dir1 it tries to find dir2/dir3/file there.
  3. if it fails it continues step 1-2 again and so on.

Is my assumption correct?

Iterator clarification

Your explanation is great, but I have tried to find definitive answer to what api the iterator will have. Your explanation is another example to support one of the two I have found, do you know if it is the latest? And could you make that clear in the document?

The two I have found are:

// Yours and (https://people.mozilla.org/~jorendorff/es6-draft.html#sec-common-iteration-interfaces)
var iterable = {
  [Symbol.iterator]() {
    let pre = 0, cur = 1;
    return {
      next() {
        [pre, cur] = [cur, pre + cur];
        return { done: false, value: cur }
        // alt. return { done: true, value: IteratorReturn || undefined }
      }
    }
  }
}

and

// Harmony wiki. (http://wiki.ecmascript.org/doku.php?id=harmony:iterators)
var iterable = {
  [Symbol.iterator]() {
    let pre = 0, cur = 1;
    return {
      next() {
        [pre, cur] = [cur, pre + cur];
        return cur
        // alt. throw new StopIteration()
      }
    }
  }
}

Performance

It would be awesome to be able to see performance comparisons between ES6 features and the ES5 way of doing the same or similar thing.

For instance, with fat arrows, I've love to see the performance comparison between:

  • (function(){})()
  • (function(){}).bind(this)()
  • (=>)()

Add strftime to es6

In other languages, we always a method to format datetime which called strftime.
I think we should add this method to es6 or es7

Add links to further information on MDN

Hi, this summary is great! It's a great balance of concise and thorough.

Sometimes I do want more details and end up on a relevant MDN page. What do you think about adding links to further information on MDN?

I can put together a PR if that sounds useful.

Thx,
Dan

`Proxy` is not a `Function` now

I test new Proxy in io.js(v3.1.0), an error was threw: "Proxy is not a function". And I found that we should create Proxy with Proxy.create now. So, maybe you should update this.

Could you let me know about the license?

Thank you for your great work!!
I'd like to translate this to Japanese, so I want to know the license of this article.
Could you add a license note or something.
Thanks for your kindness.

Add destructuring defaults example

Fail-soft destructuring is already shown, so it may make sense to add destructuring defaults, too.

// Fail-soft destructuring with defaults
var [a = 1] = [];
a === 1;

var {b = 2} = {};
b === 2;

var {c = 3} = {c: undefined};
c === 3;

Example of 'Construct an HTTP request prefix' no clear

Example of 'Construct an HTTP request prefix' in 'Template Strings' is not clear.

The following code:

// Construct an HTTP request prefix is used to interpret the replacements and construction
GET`http://foo.org/bar?a=${a}&b=${b}
    Content-Type: application/json
    X-Credentials: ${credentials}
    { "foo": ${foo},
      "bar": ${bar}}`(myOnReadyStateChangeHandler);

is not clear to me. Is GET a function defined in ES6 spec?. How can I test it? Is there a simpler example that would show intention of this example?

Broken comment?

// Construct a DOM query

This seems to be left overs from an earlier example.

An interesting addition to the template strings section

function valueToUpper(strings, ...values) {
    // Set the values i.e. first and last name to upper-case
    values[0] = values[0].toUpperCase();
    values[1] = values[1].toUpperCase();

    // Re-create the template
    return `${strings[0]}${values[0]}${strings[1]}${values[1]}${strings[2]}`;
}

// Create first and last name variables
let firstName = 'Joe';
let lastName = 'Bloggs';

// Pass the template to a custom format function
let template = valueToUpper`Welcome ${firstName} ${lastName} to the site.`;

// Diplsay the new template
console.log(template);

Add typed arrays

They're a somewhat major new ES6 feature, despite being in browsers already.

for-of example should use array destructuring to group-assign without a temp

Instead of

var fibonacci = {
  [Symbol.iterator]() {
    var pre = 0, cur = 1;
    return {
      next() {
        var temp = pre; pre = cur; cur += temp;
        return { done: false, value: cur }
      }
    }
  }
}

use this:

let fibonacci = {
  [Symbol.iterator]() {
    let pre = 0, cur = 1;
    return {
      next() {
        [pre, cur] = [cur, pre + cur];
        return { done: false, value: cur }
      }
    }
  }
}

I threw in let usage over var for free :-P.

/be

More emphasis on `const` gotchas?

const x = { 'hello': 'world' };
x['hello'] = 'alien';
console.log(x['hello']); // prints 'alien'
x = { }                  // fails silently.
console.log(x['hello']); // still prints 'alien'

This (correctly) prints 'alien' but may not be apparent to many people. I think this should be at least noted in the example.

Tail Calls example is wrong

When you return from the inner call to factorial, there is still a pending * operation, so the call is not actually in tail position. I believe you want to add an accumulator.

more on subclassable built-ins

You might want to mention that String methods that accept RegExp arguments delegate to the RegExp which means that you can do things like:

class SpecialRegExp extends RegExp {
//define a new kind of RegExp where }{ has special meaning
...
}
found = someString.match(SpecialRegExp("}{"));

ES2015

Does it make sense to rename this repository to ES2015?

Or at least make reference to it in the content so that teh googles can find it?

Just a thought.

Thanks for the good work on this repo!

Maybe a typo

Maybe you have a typo in Modules (in Readme) in mathplusplus

export * from "lib/math";
should be
import * from "lib/math";

or maybe I am wrong :)

Template Strings - Confusing Example

GET`http://foo.org/bar?a=${a}&b=${b}
    Content-Type: application/json
    X-Credentials: ${credentials}
    { "foo": ${foo},
      "bar": ${bar}}`(myOnReadyStateChangeHandler);

I don't understand this example; can we have more explanation on this? Otherwise it looks bugged for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.