Repository navigation
Remove hasown package from dependencies - #111
Conversation
|
It's also useful to prevent breaking when someone does |
|
I almost certainly added this dep to clear an ESLint warning about the potential global prototype mutation.
|
|
Thank you for your feedback!
This is technically correct, but I don't think we need to account for such cases here.
|
|
I gather I'm not reflexively afraid of small-package dependencies. But @takaram would you like to push a commit adding yourself to I'd also appreciate a quick comment on the PR that you're licensing Apache 2.0, like the rest of us. |
|
@kemitchell this is totally fine ofc, but to be clear it's not fundamentally about shimming a language feature - that's https://npmjs.com/object.hasown - it's fundamentally about providing the functionality in a way that's robust to builtins being mutated. |
|
@ljharb, you're clearly right about your own packages. Thanks again for contributing them. As you can tell, I've been a user! I'm seeing the current rec, e.g. ESLint's, is to sub I'm generally fine telling anybody who mucks with built-ins—globals or prototypes—that it's not part of my API to aid and abet them in monkey-patching the platform. I could see this as a patch release. |
I agree to license my contributions under Apache License 2.0. |
Thanks! |
This PR removes hasown from
package.jsonand replaces it withObject.hasOwn.The package is useful when you need to support old JS runtimes which don't have
Object.hasOwn, but it is not the case with licensee.js anymore as all supported Node.js versions haveObject.hasOwn.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn#browser_compatibility