-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
src: Remove ES5/6 shim dependencies #15
Conversation
This project is a pretty lightweight module and can be implemented as a zero dependency library. The actual implementation is basically 20 lines itself. Since this module already depends on ES5 & global.Promise I inlined the other 3 dependencies it has (all pretty trivial). This makes this module zero dependency which makes it really lightweight! The motiviation for this is to simplify `aws-sdk` ; Currently for aws-sdk; 50% of the transitive dependencies are the dependencies of `util.promisify` itself ( 24 ). This is quite a lot of weight.
@@ -19,11 +19,21 @@ var slice = Function.call.bind(Array.prototype.slice); | |||
var concat = Function.call.bind(Array.prototype.concat); | |||
var forEach = Function.call.bind(Array.prototype.forEach); | |||
|
|||
var hasSymbols = require('has-symbols')(); | |||
var hasSymbols = typeof global.Symbol !== 'function'; |
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.
this will cause it to pass on a symbol sham; the intention is to only have it be true for native symbols. (also, you inverted the logic, breaking it)
var hasSymbols = typeof global.Symbol !== 'function'; | |
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; |
|
||
var kCustomPromisifiedSymbol = hasSymbols ? Symbol('util.promisify.custom') : null; | ||
var kCustomPromisifyArgsSymbol = hasSymbols ? Symbol('customPromisifyArgs') : null; | ||
|
||
var getOwnPropertyDescriptors = function _getOwnPropertyDescriptors(obj) { | ||
var out = {}; | ||
var keys = Object.keys(obj); |
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.
this means the implementation is reliant on nobody doing delete Object.keys
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.
:(
Willfix. |
I just pushed up baa0cf6 which uses es-abstract's |
That dependency has more transitive deps then the ones I am removing. I don't think there's any point left. |
This project is a pretty lightweight module and can be implemented
as a zero dependency library.
The actual implementation is basically 20 lines itself.
Since this module already depends on ES5 & global.Promise I
inlined the other 3 dependencies it has (all pretty trivial).
This makes this module zero dependency which makes it really
lightweight!
The motiviation for this is to simplify
aws-sdk
;Currently for aws-sdk; 50% of the transitive dependencies are
the dependencies of
util.promisify
itself ( 24 ). This isquite a lot of weight.
Fixes #14