Closed Chalarangelo closed 6 years ago
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.
If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!
If the negligible cost of a single dependency is a problem, you can alias it out in your bundler.
What if we changed the only line it's used? from
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
to
var allKeys = Object.keys(props[propName]).concat(Object.keys(shapeTypes));
for (var i = 0; i < allKeys.length; i++) {
var key = allKeys[i]
Object.keys
is supported in more browsers
Another tip since you have babel
var allKeys = assign({...props[propName], ...shapeTypes});
for (var key in allKeys) {
That would be different; Object.keys
doesn’t include symbols, and neither does for..in
.
As the code gets processed anyways, the dependency on a polyfill such as
object-assign
is not necessary. I replaced said dependency with an assignment to the nativeObject.assign
method, so that the code works exactly like before but with one less dependency.