-
Notifications
You must be signed in to change notification settings - Fork 27
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
true is not always true #5
Comments
Yep, and I think it's definitely the responsibility of this true library to ensure that it handles every single edge case and odd usage/impact from other third parties... |
Yes, exactly! What we need is a way to make setInterval(function() {
if (require('true')() !== true) {
// Fix it!
require.cache[require.resolve('true')].exports = function() {
return true;
};
}
}, 10); This guarantees that |
This is brilliant, although I wonder if perhaps the correct place to fix this problem is at the language-level. Perhaps you should submit something like this solution directly to TC39: http://www.ecma-international.org/memento/TC39.htm They have a long history of being incredibly receptive to outside feedback. |
Good idea. I will also include a recommendation to fix truthiness in JavaScript. I can't begin to tell you how many times I have been bitten by the following problem with JavaScript: assert.equal(true, 'true'); // Error! Clearly they are the same... It's issues like this that almost make we want to switch back to Bash for all of my programming needs. |
Object.defineProperty(require.cache, require.resolve('true'), {
writable: false,
configurable: false,
enumerable: true,
value: module.exports
}) |
This could be really useful for ensuring the integrity of this module. A PR would be helpful to solicit comments, to make sure we get adequate feedback about this potential approach. |
Is this serious or just joke? |
What could possibly be funny about tiny modules? The good thing about tiny modules is that they're composable! |
I think this function should be available in v8 |
I'm so grateful it's 2022 and all of the npm issues which were so problematic in 2014 have been solved forever. Truly it's a great time to be alive. |
I also included many other crucial fixes such as misexamples in the README.md and following the single responsibility principle and getting some things off this package's hands |
I ran into problems when trying to use this module. I added the following code for debugging:
I expected to see the program output
true
, but I instead sawfalse
!After spending hours tracing the problem down I found that another library was doing the following:
I'm not sure why this particular third party library is doing this, but I feel like something should be done to prevent it since truthiness being correct is very important for any application.
The text was updated successfully, but these errors were encountered: