« first day (3344 days earlier)      last day (1587 days later) » 

12:15 AM
> we have an argument
> I blocked him
did you block me as well after the "javascript is actually a language" discussion?
 
 
2 hours later…
1:58 AM
hi
 
 
6 hours later…
7:40 AM
@FélixGagnon-Grenier I'd like to participate in that discussion. Sounds interesting.
 
hey Guys, I am getting wrong AM & PM status using Moment js in RN. Anyone know solution?
code line - {Moment(item.created_at).format("DD-MM-YYYY hh:mm A")}
 
@VishalSenjaliya 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.
 
@VishalSenjaliya what's the input time?
 
@VishalSenjaliya hmm, you sure it's wrong?
 
if using military time (24h clock notation), then
- AM is for [0, 12[
- PM is for [12,24[
 
7:48 AM
for the sake of debugging, you could change hh to HH
verify that if it is 12 or higher, that it does, in fact, show PM and not AM
 
I am using 12 hours format (Indian time) and this my input time "created_at": "2019-12-11 05:38:20" but getting 05:38 AM instead of 05:38 PM
 
that's a correct output.
05:38 PM is in ISO time 17:38
 
Okay thanks guys for suggestion...checking
 
@VishalSenjaliya make sure that your "created_at" value isn't getting formatted using 12 hour time and not 24 hour time
if you think it should be 5:38 pm
your input either needs to use 24-hour time or it needs to have an am/pm itself
 
@Neil yes exactly, Found issue on input date from server side
Thank you for help
 
7:59 AM
@VishalSenjaliya no problem :)
I only knew how to help because I've been through this myself
 
8:19 AM
|| mdn set
 
An error occurred with the request.
[Set - JavaScript | MDN](#)
 
google probably changed their document a bit :P
 
 
1 hour later…
9:42 AM
Hey
I have this this method in an Angular service that call each page of results like entity?page=1 and dispatches an action to update the store with the retrieved result. They use a do..while to request each page of results until it reaches the collectionSizeLimit
How in pseudo would you translate that to an NgRx effect?
 
 
1 hour later…
11:12 AM
How do you consume a promise in a for loop? I'm currently dealing with this issue: stackoverflow.com/questions/59300234/…
 
@asdfasdf 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.
 
11:47 AM
@asdfasdf Depends on what you want. Do you want to do something after they're all completed or serially?
Have a look at Promise.all
 
|| mdn set
 
@geisterfurz007Stopthischaos See ^. Document hasn't changed, I just think there is a bug in my code. I'll take a look.
 
Oh! Lame :P thanks!
 
12:39 PM
how can I add prototype properties to an inside function? like from an API
like:
 
1 message moved to Trash can
@TaylorS Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
var newAPI = new apiFunction();

function apiFunction() {
 this.add = function(args) {

 }
}
Jerk bot
 
use class syntax
 
I dont really understand how classes work
Actually, Karel, what if I added an Inside function into an Inside function
like
this.add = function(args) {
 this.addProp = function(args) {

 }
}
would that allow me to add properties like
 
12:43 PM
api.add().addProp();
> O-O
What?
whats the surprised look...
 
function apiFunction() {
  this.add = function(args) {
    this.addProp = function(args) {
      //Stuff
    }
  }
}
That's not something I want to work with!
 
that
But would it work?
it would limit the property to only function on that 1 internal property
:P
 
Don't think so, no. Couldn't tell you why tho but it looks very wrong :D
 
Not really, internal variables inside internal functions works fine
so would internal functions inside eachother work too
Well, I guess Ill just play around with it and test it out.
See what happens :P
 
function apiFunction() {
  this.add = function(args) {
    this.addProp = function(args) {
      //Stuff
    }
  }
}
const api = new apiFunction();
api.add().addProp

>Type Error: api.add(...) is undefined
 
12:46 PM
@TaylorS the class syntax was new for me as well, when they got included in the ecma standard. I just consulted this informative mdn page to comprehend it. Since then, I am capable to work with it. Don't apply bad practices. Learn to work with best practices, so use class.
 
You'd have to return an object with the addProp function from add.
But don't do that. Use class.
 
you are doing it incorrectly anyways. But I won't tell you how to fix it because that's bad practice.
 
Hey atleast im using internal functions rather then overwriting system prototypes anymore
 
@TaylorS If you are trying to daisy chain, just put return this at the end of all functions that don't return data
 
oh... classes... that syntax looks exactly the same as what Im working with except the first external function is a class instead
ok
well I usually dont return data
 
most of my mini apis written with this are all just small tools
 
Pure functions are more desirable than functions with side effects
 
well, when I want to return data, I usually just use small arrow expression variables to do that
no need to write a bulky return function
 
function apiFunction() {
  this.add = function(args) {
    this.addProp = function(args) {
      //Stuff
    }
    return this;
  }
}
const api = new apiFunction();
api.add().addProp
but don't do ^.
its bad
 
hi, anyone can advise on how to test private methods in unit tests?
 
12:52 PM
it doesn't even make sense.
 
well what im seeing on that class page is basically
 
@avck Please explain more.
 
class api{
 this.add = function(args) {

 }
}
 
no
 
do you just add more internal classes then??
 
12:53 PM
class API { constructor(){ // stuff if needed } add(args){} }
 
Im still a bit confused on the classes
 
read the mdn page
|| mdn classes
 
Not answering more questions until you read the page :)
 
theres no need for a this statement or a function?
I just did
 
12:54 PM
Not answering.
 
Ohh I see now
 
i have to write unit test for a method that is exported from a node.js module. This method uses some other functions say DB call. Now this DB method is a private method ie not exported.

how do i mock/stub this DB method
 
I scrolled down more :>
I see now
 
If you are using TypeScript with Jest you can cheat a little
 
NTY..
I dont know exactly entirely what typescript is, but for now Ill just stick with JS
 
12:56 PM
@TaylorS @TaylorS body's overflow for a reason
 
I am using es6, but please explain how you can cheat.
 
@TaylorS He's not talking to you
 
Oh...
 
const getImageHexStringSpy = jest.spyOn(
  Sender as any,
  '_getImageHexString'
);
 
ok
 
12:57 PM
_getImageHexString is a private function here in the Sender class. Using Sender as any I get around the TypeScript check for private functions and can mock is like anything else.
 
nice, i saw this in one answer too. Is it a good pattern to follow?

There is this module called rewire, which gives me access to all the methods and I can stub/mock them I guess. But will it be good way of doing it?
 
If you are not using TypeScript, you shouldn't really have a problem with private stuff as there is no such thing in JavaScript (even with TypeScript it's exclusively a compile time check).
 
@geisterfurz007Stopthischaos by private I meant something not exported by the file.
 
You are not using classes?
 
@geisterfurz007Stopthischaos no :/ the code is already written. I am tasked with writing unit tests.
 
1:01 PM
Why wouldn't they have the person who wrote the code write the unit tests?
 
well its an open source project
 
There are two things in regard to "doing it correctly".
First thing: Private functions are implicitly tested by testing public functions. If the exported function fails the test, either it or one of the (private) called functions is missing a test.
Second thing: If you want to mock something (in a lot of languages at least), you pass that dependency to the function you are testing. So if you are testing a database call, you would pass a mock of the object/function that does the call.
Now in JavaScript the second case doesn't really fit because stuff like that can be tricked with libraries like Jest (which is what I used so far so I am usin git as example). If the function that does the database call relies on a required/imported module, you can mock that module instead (you might have to look on how to do that in your used library)... cont
 
@geisterfurz007Stopthischaos Do you mean that the method that I am testing should accept the DB object/method as an argument?
 
'cont... That will however not test the private function but just mock the call to the db to be able to test the exported functions within a test environment
 
1:32 PM
I was using classes instead of my previous code like you guys said, and its telling me I cant write with classes before page load Cannot access 'shadowCss' before initialization
do you guys know what it means?
 
@TaylorS Read the damn mdn page
The entire thing
There is literally a section dedicated to your issue.
And that error says nothing about page loading
 
FFS
Its working, but now, once again, my html is disapearing
WHY IS SHADOW DOM SO FRICKING TOUCHY
 
That sounds like a personal problem :P
 
Every time I style something in shadow dom, the element disapears
ive been asking about this for the last week, its not a personal problem
It was for a completely different project, same problem
 
@TaylorS So what did we learn today?
 
1:39 PM
Listen to JBis and read entire MDN pages ._.
 
.-.
ITS NOT ABOUT THE CLASS
 
^^^ exactly
 
ITS ABOUT SHADOW DOM
STOP TELLING ME TO READ THE MDN PAGE
 
|| mdn shadow dom
:P
 
Think I havent tried that??
 
What browser are you using? (Don't tell me about how your school blocks shit, please)
 
Chrome
always
all others have shit-problems and support issues
so Id rather just stick with v8 chrome JS engine
 
Ok. Editing shadow dom in the developer window t to my knowledge should not cause the element to delete
 
@JBis ben (fortune) just write "RTFM"
 
1:43 PM
Is this supposed to look like that?
 
I would sing it
 
read the fucking source
 
Because that looks like something an HTML parser would run away from in tears (I would at least)
 
I dont see nothing about shit disapearing on the mdn page :L
 
1:46 PM
Is there an MDN page on malformed HTML or something?
 
Ive been asking for the past 4-5 days, and well, most of you ignore me, but I cant find any information similar to this except for one issue where the shadow dom ITSELF disapeared, not the actual element
NO
There is not :l
as far as Ive seen, Im the only FRICKING PERSON IN THE WHOLE WIDE WORLD with this problem
 
probably for a reason :')
 
Excuse the anger, people are annoying me IRL
 
Try tickling them :)
 
Bruh
 
1:48 PM
@TaylorS 90% of your questions get a response
 
Yeah, and I appreciate it
 
Hey! I am only making suggestions, you are free to ignore them!
 
but when I finally find something important that I want to learn how to use, and no one will answer it (And I seemingly cant find A SINGLE THING ON THE WHOLE INTERNET ABOUT IT)
thats the thing I DONT appreicate
 
Quite frankly, you are not really in the position to make demands here.
 
I didn't know we were telepathic and can tell when you really really want to know something and then specifically don't answer
also maybe we don't know
 
1:51 PM
@TaylorS shCss.add("#div", background-color: red;color: white;);
Remove the linebreaks.
That's what's causing the parser to break there (I think at least) which would cause it to not even get to the Hello World so it's not displayed.
 
The whole point of the API is to make a Multiline Css-like JS function
 
Then remove the linebreaks in the function
 
@TaylorS all language related information are in essence on MDN or in the specs. I look at there first.
 
Its a `` (literal) and it should support multiline
also no
<slot></slot> made the text appear
Found this just now: codepen.io/johnthad/pen/WXKKwy .-.
 
Ok, Taylor: The linebreaks are causing the issue because they introduce <br> into the middle of a goddamn stylesheet. Remove. The linebreaks. Before you put the style inside.
 
1:53 PM
.replaceAll('<br>', '\n')
or better
.replaceAll(/<(\/\s)?br\s?>/, '\n')
 
in the innerText portion? or directly on the CSS variable that contains the text
 
cssDoc.innerText = `:host{${css.replace(/\n/g, '')}}`;
The <br> is created indirectly through the shadow. Remove the linebreaks and you are good.
 
Never had a string do that before
wierd
 
Now you also see a properly formatted style tag:
 
@KarelG replaceAll...doesn't exist
 
.replace DOES exist though
 
.replace(/<(\/\s)?br\s?>/g, '\n')
 
@JBis blame my Java mind😬
 
:)
 
> Deploy took 223,478 milliseconds
ugh
bah
 
What?
 
*toilet lady time*
 
The?
Hell?
 
|| wiki hell
 
In religion and folklore, Hell is an afterlife location in which evil souls are subjected to punitive suffering, often torture as eternal punishment after death. Religions with a linear divine history often depict hells as eternal destinations, the biggest examples of which are Christianity and Islam, whereas religions with reincarnation usually depict a hell as an intermediary period between incarnations, as is the case in the dharmic religions. Religions typically locate hell in another dimension or under Earth's surface. Other afterlife destinations include Heaven, Paradise, Purgatory, Limbo...
 
1:57 PM
I know what hell is.. :P
 
aww one of my hotswap server is having a slow ping.
 
Did it work Taylor?
 
probably the ethernet cable is bit loosened again 😂
 
Hello everyone
 
|| afk pluggin cable
 
1:59 PM
@KarelG bye KarelG
 
yes
Its somewhat styling it and showing the content
I didnt even think to suspect the css was actually the issue :P
Nor did I have any idea about the <slot></slot> thing
 
Hello, I am looking to learn three.js ? do you guys tried it yet?
 
three.js
f no... im outta here, gotta finish class anyways
 
yup
okay have a nice day
 
@SayedMohdAli Do you have specific question or just looking to discuss?
 
2:07 PM
@JBis if i had specific question i must have posted on stackoverflow. I have discussion that is why i raised the topic here
 
|| back
 
Invalid command! Did you mean: ban, backup, bad? Try help for a list of available commands.
 
now it is smooth
> Deploy took 13,984 milliseconds
:D
stupid cable
 
What exactly did you do? @KarelG
Replaced a slow ethernet cable?
 
no, just stirred and pressed the cable shoe
 
2:11 PM
I want to create 3d object of the product, with color changes attribute. I think in javascript it is only possible with three.js
 
interesting
 
it is slightly broken because someone tripped over it and I am lazy to fix it.
 
is this at work?
 
yes
 
cool. Don't most companies go clouding?
 
2:12 PM
there is a cabin full of cables but the shoe-fitter is lost/gone/placed somewhere tho
@JBis it is a company cloud infrastructure I have built before my current job.
I just maintain it now. Together with the CRM.
 
@KarelG how does that work?
so its just your companies own server instead of using GC or AWS right?
 
yes
backups are sent to google servers tho.
 
Ah. May I ask why your company uses them instead of GC or AWS or Azure?
Just interested why one may choose to do so.
 
specialized servers
 
interesting
 
2:16 PM
eg some servers as as a pure calculator machines, able to crunch many calculations in small time frame
 
Probably cheaper for that
 
thing is, eg AWS might throttle your traffic if you burden their network.
or just add an additional bill cost for "compensation"
 
alright i gtg for now
cya o/
|| afk afking
 
@JBis bye JBis
 
\o
 
2:36 PM
This is weird. I have an infinite loop where the backend function that a fetch() call is calling keeps getting hit over and over again, but when I put a breakpoint on the only place in the javascript that is calling that method, it doesn't get hit.
 
I call that Javascript misdemeanor
When shit doesnt do shit yet it does shit when your not looking at it
excuse french lol
 
JavaScript is misdemeanor
> https://chat.stackoverflow.com/transcript/message/48075117#48075117

Damn!
 
Regular expressions aren't that hard.
What really gets me with that one is using "perl" as a sound effect.
 
hey I wanted to extend my api to add multiple layers
how can I add more properties
class ShadowGate {
 addNew(query) {
  hideHTML(query2, html) {}
  hideCSS(query2, css) {}
  hideJS(query2, js) {}
 }
}
That doesnt function though
so how can I do that again?
I always forget this sort of thing
 
@Hypersapien not everyone understood that tho
 
2:49 PM
?
 
mornings!
any of y'all familiar with derivative calculus? I want to validate that the derivative of the square root of x+1. (\sqrt{x + 1})' = \dfrac{1}{2\sqrt{x}}
@AaditMShah it was a bit funny. just the right amount of cringe
 
Oooh. You're just a bit too late. If you had asked me 20 years ago, I could have helped you with that.
 
hahah :P
I wonder (and haven't found) if there are equation solving online services yet
 
3:08 PM
how do I put a method inside of a method
 
@Hypersapien the "perl" sound
@TaylorS js has "functions", not methods. And erhmmm ._.
what do you intend to do with that "inside" method? method chaining?
 
like I want to call 1 method on a class (add) and then I want to call a 2nd method afterwards
so api.call(query).html(html);
 
@FélixGagnon-Grenier math stackexchange chat maybe be able to help
 
it's called "method chaining". Google has ample resources on how to do that. the general idea is to return "this" at the end of each method.
 
ok
thanks
 
3:15 PM
@JBis yeah, maybe I'll head there...
 
@FélixGagnon-Grenier Wolfram Alpha or Symbolab?
 
Beg your pardon?
 
To verify your equations
 
Symbolab is free and shows the steps, I believe Wolfram Alpha is paid for that feature
 
3:18 PM
I don't know about any of these, let me check that, thanks :)
yeah, symbolab is precisely what I needed :)
 
3 hours ago, by JBis
@TaylorS If you are trying to daisy chain, just put return this at the end of all functions that don't return data
 
@Cameron lol, very nice. So I was getting a different answer from symbolab than what I wrote in chat, then went back to my actual exercise sheet to realize I had mistyped in chat. phew :)
 
That's how I double checked most of my answers in uni
 
I'd use Wolfram Alpha so much more if they made it free
nobody's paying for things these days, it's kind of a bad business model imho
they need to just throw on a couple personalized ads and bingo, profit
have some niche features still under payment if anything
 
@TaylorS because you aren't returning anything, in reality you are just creating functions. See above.
 
3:31 PM
Im just going to create 1 method, (add()) and then put this.name = function()s inside
 
facepalm
 
because a daisy chain wouldnt be able to pass a variable (this.query)
 
yes, it can
 
cant figure out how to make it work
 
third time the charm?
14 mins ago, by JBis
3 hours ago, by JBis
@TaylorS If you are trying to daisy chain, just put return this at the end of all functions that don't return data
||> class Test{ test1(){ console.log("test1"); return this; } test2{ console.log("test2"); return this; } }; const a = new Test(); a.test1().test2();
 
3:36 PM
@JBis "SyntaxError: Unexpected token '{'" Logged: ``
 
Jay
are you trying to embarrass her or help her?
 
@JBis "SyntaxError: Unexpected token '{'" Logged: ``
 
ignore the syntax error
 
...
that's a huge bad practice tho
best to provide a sort of encapsulation
eg
 
jQuery does that I think
 
3:41 PM
I know.
 
Jay
3:53 PM
I'm having a hard time figuring out how to do a delete confirmation with jQuery, can anyone help?
I have a gridview with a delete linkbutton in each row, and I got it deleting
now I'm trying to add a delete confirmation and having no luck
 

« first day (3344 days earlier)      last day (1587 days later) »