« first day (3560 days earlier)      last day (1371 days later) » 

12:31 AM
Oh wow did not know about the flatMap function. Thanks for the examples guys. I learned something new.
 
 
5 hours later…
5:05 AM
Hi y'all. I am starting with passport.js and had a doubt about why we need to use both cookie-session and passport.js, when passport.js itself sends an ID when serializing user. Why not use that only? Can you please help with that? I also asked the question here: stackoverflow.com/questions/62894933/…
 
@vaibhavS Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
5:15 AM
I had read numerous articles and watched shaun's youtube passport series, he had used cookie-sessoin. Neither got into the details, only walkthrough.
 
 
2 hours later…
7:19 AM
Hmm...

Apparently creating subtype arrays and calling it data-oriented design is the new thing(?)
Ain't it just procedural programming, though?
 
7:36 AM
Also, Laws of UX: lawsofux.com
 
how to get total number of files being uploaded in busboy?
 
8:08 AM
count the file events I guess.
 
8:33 AM
I'm trying to test a vuejs app api interface, and wanted to write tests for my token refresh implementation, which uses axios interceptors. I was trying to use moxios, but looks like moxios bypasses the interceptors? Should moxios works with axios interceptors or should I be testing this another way?
 
@monkut Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
9:13 AM
trying to google an answer for this...

If you import an es6 module and within that module it declares a global const

const myVar = new Object() ...

And then import that file in different places. Is it a new instance of myVar?
 
 
1 hour later…
10:43 AM
@Asheh Modules should be interpreted only once, so if you have export const myVar = new Object() and then import myVar from "myModule" twice, you'd get the same instance as an import.
So, if a module creates objects when it's created, there would be a single copy of the objects created. A module is not re-run for every time it's imported.
 
11:08 AM
Hey guys, I've created this budget management calculator where you can Add Incomes and Expenses and calculates a remainder of your budget. I've finally managed to store the items to my localStorage and Delete from the localStorage. But I am now facing an issue with the Getter, for some reason it updates the UI one step.

For example I add a income of 500, it will say my budget is 0 only until I add a 2nd income / expense and then it updates the previous step. Can someone help me figure out what the problem is?
 
@Lapys laws-o-fux?
 
 
1 hour later…
12:42 PM
@Wietlol law-so-fux
 
1:00 PM
hi guys
anyone is an expert about wai aria?
 
1:20 PM
Honestly I'm wondering why this got a downvote:
-1
Q: Jest how to test if one of a set of mocked function has been called?

paul23I'm using jest-express which mocks the response object for testing. Now in quite a few (post) requests the return is of little importance, it's just important that the function returns. This can be either done by calling send, json or sendStatus (or theoretically sendfile but one doesn't expect t...

And I'd also like some kind of answer/comment, it kind of is making my progress stuck
 
too vague
 
So you think it is too vague? if the question can be improved to get some answers I"m really happy.
The end result is that I wish to test if "either" f(), g() or h() is called. Doesn't matter which as long as either of those is called.
 
that's not how you handle unit tests
there is code coverage tool for that kind of "verification"
 
Well it's for an integration test: I wish to test/make sure that under certain (all) conditions a call will always return - which is done by calling one of several functions (send/sendfile/json).
 
@paul23 probably cause it was posted on SO main
 
1:25 PM
The given return doesn't matter - only the status does.
So any of those 3 functions could be called, for userland it's all the same. However I need to make sure that one is always called to prevent server hanging.
 
@Wietlol laws-of-ux ..
I think though it may be difficult to write a JavaScript library for full cross-compatibility (Chrome, Firefox, Safari, ...) and legacy support (Netscape 4, IE5, ...), it is definitely possible.
 
1:55 PM
@Lapys I guess you could write the library entirely in ES3. Or even ES1. Or transpile to those and polyfill everything. I would not recommend actually using that library in older browsers, though mostly because I wouldn't recomment using older browsers.
 
@paul23 test for status
 
2:36 PM
yeah but then the code might end with:
function(req, res) {
    return res.status(403);
}
which would be perfectly legal if I test just for status. However it is faulty as it doesn't follow the test suite: "it should return a status 403 if no session is found"
Since the code never "returns", no response is actually send
And actually: above code would be the "better code" -> since TDD describes to do as little to fit the unit tests. SO adding extra code (to actually call send...json etc) is "bad".
 
hello! if there is anyone who can give me some help with this error, please do it, thanks
 
missing semicolon in line above?
alternatively: what version of javascript are you running this on?
 
it is node version v12.18.2
the line above is not my code but I will look on it
it is the first line in the file
 
Node v12 doesn't have direct support for modules
you'll have to enable it and then name module files *.mjs
 
thanks a lot
 
2:45 PM
"From version 12.0.0: this feature is behind the --experimental-modules runtime flag."
from 13.2 it's no longer experimental
But the nearest package.json still has to have the line type: "module"
 
thanks
 
3:21 PM
i think i may have fixed a really big issue, either that or i fixed a similar issue i created by trying to fix the original issue last time
 
4:14 PM
 
I need to watch if the user pressed the crtl key and left click or crtl key and pressed the a key(this is for a multi select component). For the first one, I can add a mouse event and check the crtKey(don't know how cross compatible this is) but for the second one, which of the three available onKey events would be appropriate(onKeyDown, onKeyUp or onKeyPress)?
I would say onKeyDown because I would want to check if the crtl key registered the moment they pressed it but I would like to hear what you guys think.
 
4:48 PM
0
Q: Firebase Cloud Functions CORS Error for Stripe API

hello worldthis route gives me the following CORS error has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. The error is related to the async and await code but dont know how to resolve with firebase. import * as functions from 'firebase-functions...

please help
 
5:15 PM
posted on July 15, 2020 by Srinivas Sista

The Dev channel has been updated to 85.0.4183.26 for Windows, Mac, & Linux platforms. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Google Chrome Srinivas Sista  

 
 
2 hours later…
7:40 PM
@phenomnomnominal Different issue, this time Spotify app iOS. The equalizer toggle doesn't work properly in settings. If I put it on "Base Reducer" and then toggle off the Equalizer, the current track still has Base Reducer on. I have uncheck it in order to turn it off. P.S lmk if you want me to stop reporting Spotify bug reports to you lol
 
Okay, I've finally pushed most of a variable-precision number library to feature-completion.

But there is still one more feature that's missing: exponentiation.
Anyone know any good algorithms to raise a number by another for big numbers?
 
@Lapys Uh, that's probably a question for Maths.SE. I am really not sure of how to do it efficiently other than running a loop. I guess you can also check SO itself, though - there is bound to be a decent algorithm somewhere. Although, I suspect it's going to be difficult to find.
 
8:12 PM
@Lapys, use logarithms: multiplication in logarithmic space is equivalent to exponentiation in linear space.
 
Bruh, @VLAZ and @greg-tumolo

Seems the peeps here reply quicker than the guys over at Lounge<C++> chat room. Neat.
@greg-tumolo
I'd have to apply Newton's method for a logarithm algorithm, right?
Would that really be faster than a multiplication loop for variable-precision numbers?
 
8:38 PM
Does anyone know how to initiate session right after signup, when using passport.js and cookie-session? I am a little confused about req.session.save() (is this provided by cookie-session) and req.login by passport.js. Please let me know if you know anything or even if this is a silly question please mention.
 
posted on July 15, 2020 by Daniel Gagnon

The Dev channel has been updated to 85.0.4183.25 (Platform version: 13310.18.0) for most Chrome OS devices. This build contains a number of bug fixes, security updates and feature enhancements. Changes can be viewed here. If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an is

 
This unanswered question aptly describes my problem: stackoverflow.com/questions/62896503/…
 
@Lapys, you shouldn't have to (if you can use the built-in log and exp functions). Exponentiation of *fixed*-precision numbers is usually implemented using logarithms...
x = a**b => Math.log(x) = Math.log(a**b) => Math.log(x) = b*Math.log(a) => x = Math.exp(b*Math.log(a))
So, if necessary, your task will be implementing variable-precision log and exp functions.
 
8:59 PM
Hmm, I see your point

But what if the big number exceeds 308 digits (or `Number.MAX_VALUE`) in length?
`Math.exp()` and `Math.log()` don't seem to work with big numbers...
 
Then, your task will be implementing variable-precision log and exp functions.
The additional benefit: You'll be able to compute a^b where b is not an integer!
 
@greg-tumolo Seems like it, so on to Newton's method then! :']
 
Godspeed!
 
Thanks 👍
 
FYI: You can star the message above containing the equations for later reference.
 
9:40 PM
There's gotta be a hypernym for Greatest Common Divisor
 
9:56 PM
@LuisAverhoff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
@LuisAverhoff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
@LuisAverhoff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
I hit crtl k before sending so I don't know why that didn't work.
addOption(id: string, value: string, event: MouseEvent) {
    const optionNotIncluded = !this.selections.includes(value);

    if (!event.ctrlKey && optionNotIncluded) {
      this.addSingleOption(id, value);
    } else if (event.ctrlKey && optionNotIncluded) {
      this.addMultipleOptions(id, value);
    } else if (event.ctrlKey) {
      this.removeSelectedOption(id, value);
    }
  }
There we go, anyways I wanted to do a small code review on the above function.
This function is used in a multi select dropdown component and it has the following behaviours:

left clicking will do a single select. If they left clicked on a new element it will undo the previous selected element and add the new selected item. Left clicking on item that already has been selected does nothing.

crtl and left clicking allows for toggling an element.

This works but I would like to refactor this a little bit more.
 
10:17 PM
There's some more optimizations you can do but if this way is readable then keep it
@LuisAverhoff
 

« first day (3560 days earlier)      last day (1371 days later) »