-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES2015ify #14
ES2015ify #14
Conversation
0284f57
to
f0176a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good!
} | ||
} | ||
|
||
CpFileError.prototype.name = 'CpFileError'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct way for ES2015 classes is to set this.name
in the constructor instead.
@@ -0,0 +1,35 @@ | |||
'use strict'; | |||
const EventEmitter = require('events').EventEmitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified now:
const EventEmitter = require('events');
this.dest = dest; | ||
|
||
let written; | ||
Object.defineProperty(this, 'written', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the private state in a WeakMap and make the written
a prototype getter/setter. See: http://www.2ality.com/2016/01/private-data-classes.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, @rauschma rocks 🤘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
I don't really care much what Node.js core does. It's not a great example of good error messages. I prefer the backtick as that's what we also use in Markdown to highlight some kind of value. |
fbff38e
to
f83ae73
Compare
@sindresorhus updated; Thanks for the fast review 🙂 |
* Remove `readable-stream` (only needed for `v0.10`) * Remove `mkdirp` `'EEXIST'` checks * Remove `rewire` in favor of `clear-require` and `require-uncached` Closes: sindresorhus#13
f83ae73
to
502ec17
Compare
Yay! Very nice work @schnittstabil :) |
ES2015ify
readable-stream
(only needed forv0.10
)mkdirp
'EEXIST'
checksrewire
in favor ofclear-require
andrequire-uncached
Closes: #13
Notes:
mkdirp
doesn't throw'EEXIST'
errors (anymore?)rewire
doesn't work with ES2015const
Further improvements, but BC:
ENOENT: no such file or directory, stat 'x'
):