« first day (4426 days earlier)      last day (505 days later) » 

mr5
3:47 AM
Can somebody remind me what is the purpose of session store?
This answer -> https://stackoverflow.com/a/33901493/2304737, mentions that sessions could be stored from memory/cookie/database
Why is the database one of the option?
 
 
2 hours later…
6:00 AM
> Database session store, is going to be safe with app re-lauch. And at some point you will have alot of session objects which you might want to clean up. And same session stored in database can be even accessed from different apps.
I was going to say basically the same thing but looked at the answer and it was already there.
Basically, you can have persistent session in that way.
 
mr5
6:29 AM
@VLAZ but why not just file system / cookie?
You don't need to clean up session if it's stored in cookie with same key
> And same session stored in database can be even accessed from different apps.
does it mean they don't need to login from that other app?
 
6:58 AM
@mr5 They would need to log in. You need to connect to that session somehow, after all. But once logged in, you can share the session data.
@mr5 File system is basically the same. It's equivalent to "database" in most contexts where storage is concerned. In that, the data is persistent. A database is the same. There are obviously differences in how you store, retrieve, and manipulate data but the point is the data stays. While a client cookie is only going to work for the same browser. A server cookie will work across devices but you still need to store the data somewhere and then send it to the client.
The major difference in how you keep sessions is persistent vs non-persistent and also the latter can be split into client and server.
 
mr5
I mean by file system / cookie is that data will reside in client side whereas on database, it would be from another computer
@VLAZ can you give some specific data from that session?
Aside from user ID
 
Here is an example of persistent/non-persistent: I can log into Amazin and add stuff to my cart. It stays there. I can log into another device and then do the checkout. Or continue adding to the same cart, if I wish. This is a persistent session. There is a food delivery app/website I can use where I live. I can add a pizza to my cart from my phone but if I go to the website, the cart is empty. That's client-side session.
 
mr5
Yeah, I'm fairly certain that's a good user experience. I guess, I am missing some information from my question
In NodeJS, specifically this library -> expressjs.com/en/resources/middleware/session.html
 
@mr5 Not sure what you mean. Essentially a DB stored session is just some data in the database. You can query it as you can anything else. You could have different "subsections" for different apps. E.g., you have an online store and online streaming service that share a session. Store might have userName, deliveryDetails, and cart while the streaming service might have userName, and playList. So they share some data but you keep all of it under the user.
 
mr5
It attaches a session object from request. And then further encourages devs to store the session in other data store
Oh alright, I think I'm getting the gist of it.
 
7:12 AM
OK, maybe to clear things up a bit - a server-side cookie isn't where the session is stored. You just have some data related to the user. That's the session. From this data a cookie is made and sent to the browser.
 
mr5
So do you think just storing partial details, like IDs, in a session is how it should be done?
 
Yes, perhaps. A session can be thought of "customising" the service to a user. Basic example might be that you have light and dark theme and the user chooses one which is then stored in their session. But the app itself just changes for them. Anything that can be user-specific can be in the session. A cart is probably the typical example here.
 
mr5
If you store something from a session that cannot be derived from any existing data store you currently have in your app, do you think that's a bad way of implementing a session?
 
What exactly you need in a session may depend on the app.
@mr5 If you already have some data for a user, then you might not need to keep much in their session. The session is sort of "storage while the user is logged in". So if you don't have such a concept, you can just leave the basic one which just says the user is logged in.
 
mr5
Let's say from your example, deliveryDetails is contained in the session. If you cannot derive this from any of your existing data store, then I think session is not the right context this should be stored?
If you happen to store your session in memory of your server, and it restarts for some reason, then you lose a crucial information
And so, it make sense to persist the session
 
7:19 AM
Persistent sessions are pretty much equivalent with just other persistent storage. E.g., if you already have user data then having it also in the session is duplication. And probably not very useful. It's usually one or the other. However, you can indeed mesh the two by keeping identifiers. E.g., you have a list of delivery addresses for a user and in the session you can keep preferredDeliveryAddressId or similar. So, just point to one, rather than keep it.
Of course, that's if you don't already have a marker for the preferred address.
 
mr5
But then again, session is almost always paired with lifespan that is shortlived
 
@mr5 Yes, non-persistent sessions will be destroyed. There are two things to keep into consideration: 1. don't keep crucial information in those. 2. you should be OK with the data being destroyed. You might actually want the users to re-supply delivery details. Can't really think of a good reason but let's say for security or something.
 
mr5
If you are storing something that is crucial in the session, why not just store it directly, e.g, in the table of that particular category
@VLAZ So, do you think we should only store something in session that can be derived from existing data store?
What I mean by data store is also database
 
@mr5 If you have the data in the database, then probably just use that.
 
mr5
So there is no point of using a persistent session in this case?
 
7:27 AM
Sessions are a "light" way to store things. Essentially, sessions are less structured than a database. They might be completely unstructured, or not. But they allow a bit more freedom. Which means you can usually more easily store new things in a session without re-designing your database. If you have no use of that in the long term (to do it persistently), then probably don't do it. Do keep in mind that in that case, user session data will be gone. That might be acceptable, depends.
There is a website which allows me to choose a theme. And every once in a while it resets to the original one. Whatever they do, they drop my preference. And that's annoying.
That's an example of most likely non-persistent session. I've investigated and the data for the theme comes in as a session cookie. So at some point it times out or something.
The food delivery app also destroys my cart after a while. Probably a day or thereabout. Which makes a lot more sense - if I add a pizza today and try to order it tomorrow, the pizza place might not work. Different restaurants you can order from have different working times.
Unlike Amazon which works all the time
 
mr5
I see, those examples are actually solid use cases
I was focusing on session that is specific for user
And I can't think of a valid use case why one would need to use a persistent storage for managing user session
Let's just say the session only contains user ID
Welp, this is actually not my problem. I was just curious as to why our webapp team is looking for persistent storage to replace the memoryStore of expressjs
 
7:53 AM
@mr5 As I said - session is a "light" storage. You can leverage that to more dynamically change the data stored. Let's say you can add a seasonal thing like halloweenTheme="pumkins". Let's say that adds pumpkins on some buttons in the UI but only around Halloween. And the users can choose between pumpkins, bats, ghosts, or nothing. You can update the frontend only to add the theme(s) but no need to add that to the database for the entire application.
After Halloween the key can just be dropped and you're done with the feature.
Next year you can just add it again.
Similarly, you can have many other types of temporary data. Holiday themes are just an example.
Again, though, you don't have to do that. It's one way to leverage sessions. You can totally ignore persistent sessions and keep the user data as part of the application data. Then you don't really need to persist the session. At worse, the user will be logged out if the session is destroyed. Which tends to be acceptable.
 
8:51 AM
== and === are never equally valid as they behave differently, @JaromandaX. They have specific use cases, and 99% of the time, what you're looking for is the strict equals operator. — Cerbrus 1 min ago
I can't believe I have to tell someone with a JS gold badge that...
 
9:30 AM
tbf, either == or === will work here
if you want to teach standard guidelines and follow them consistently throughout the entire codebase, you should probably leave the JS ecosystem :)
 
It's a newbie that clearly doesn't know = from == from ===, so I'd argue it does actual harm to suggest ==
And "It works" isn't exactly a good reason not to use the right operator :D
 
that depends on the background knowledge of the receiver
I think == could "harm" as much as === could
that doesnt take away that === would be a better option
but showing both would probably be safer as you have more chance that the receiver has already seen one of them
and they will continue to use whatever they were taught
 
I don't see how === can do harm?
 
if you consider that they have learned about = and ==, and they just made a typo that just had to be shown to refresh their memory, introducing === would initially add to the confusion
 
You're assuming they learned about ==
 
9:38 AM
I assume they learned about either == or ===
or both
 
Considering they consistently didn't use either equals operator...
I think it's just as likely they've never seen either
 
I have seen a lot of people learn programming lanugages for the first time... if (assignment) is a very common mistake
even after just having talked about the equality comparisons
 
So they're confused alreay, any way
Best show them the proper operator
 
perhaps
 
The one that does exactly what you expect it to do, instead of the one that also does some trickery that you need to know about
 
9:44 AM
they both do exactly what I expect them to do
and both do not what I want them to do
but maybe next year we get ====
 
... what
 
exactly that
 
I'm gonna regret asking, but what do they not do that you want them to?
 
I want them to be a syntactic sugar for a.equals(b), allowing the class/prototype to define how equality should be defined
obviously adding in some undefined/null validation though
so, a === undefined ? b === undefined : a === null ? b === null : a.equals(b)
 
Not sure why you'd need that validation, but that actually makes sense
 
9:51 AM
same with < <= > >= <=>
although I heard there is some trickery you could do with converting the object to a number to do less-than or greater-than comparisons
 
less than and stuff like that makes no sense on objects
unless you, indeed, manually add a .toNumber-kind of method
 
depends on what the object represents
if you have for example a Date object, it would make sense to be able to compare it to other Date objects
 
@Wietlol And that's why you can't add it to the default prototype
 
oh yea, it shouldnt be the default prototype
 
Well sure, but then we're not talking about Object, but about Date
 
9:53 AM
if I do a < b, I should get an error if a has no function compareTo
 
Also, > works on dates
 
because Date is special
 
Yea, but you're using it as an example of a comparable object
 
but don't we all use libraries that introduce better date/time management?
 
I don't see another usecase for <> on objects
 
9:54 AM
any other form of comparable objects
 
Like what?
 
Timespan, Angle, Version, LogLevel, etc
maybe there is a library for bigger numbers or base10 numbers rather than IEEE-754
 
None of those are JS types
 
I assume there is a library that handles version number comparisons
 
So the library that adds those objects would have to implement the comparisons
 
10:00 AM
and I would love to be able to do a.version < b.version
rather than compareVersions(a.version, b.version) < 0
or a.version.number < b.version.number
 
!!> '1.1.1.1' < '1.1.1.2'
 
@Cerbrus true Logged: [ ] Took: 0ms
 
That... works
 
!!> "10.1" < "9.8"
 
@Wietlol true Logged: [ ] Took: 1ms
 
10:02 AM
wow, it does indeed /s
 
Right
But how should JS know that those are version numbers?
Without you telling JS so?
 
as developer, you know
 
That's not what I asked
 
maybe because version is of type Version rather than string
 
And then you're working on a custom prototype, with a custom comparison
 
10:03 AM
but I guess since it is not a vanilla JS type, it wouldnt work that easily
 
No that's actually not too hard
 
I mean, considering it would come from a library, I'd assume no one would use it by default
while in something like Java, where it is part of the SDK, you would use Version over String because you choose the type that most accurately describes the value
 
class Version{
    constructor(value){
        this.v = value;
    }

    valueOf() {
        console.log(this.v);
        return Number(this.v.split('.')[0]);
    }
}



const a = new Version('9.1.0');
const b = new Version('10.1.0');

console.log(a > b);
It's really not hard to implement
Obviously my valueOf implementation is lazy, but still
 
does tht work though?
 
... Dump in in your console and see for yourself?
 
10:12 AM
ah, does JS internally turn a > b into valueOf(a) > valueOf(b) ?
 
Yeap
Well, a.valueOf() > b.valueOf()
 
ah, I guess that could work then
or yea, that
although I am not sure it would
 
That's why I put the console log in there so you can see it being called
 
the only way to do this would be to set a limit on each segment in the version
for example 100
 
Oh, the implementation of valueOf is a different story
 
10:15 AM
and then turn 1.2.3.4 into 1*100^3 + 2*100^2 + 3*100^1 + 4*100^0
but then you set a limit..
 
Which is why you generally use .equals for more complex comparison
 
or .compareTo()
but compareTo is ugly
as you would have to do a.compareTo(b) < 0
or provide a bunch of overloads for a.isLessThan(b) etc
 
compareTo? That's not JS is it?
 
not yet ;)
in other languages, there is a common interface that would introduce a function compareTo(other: ThisType): number
which would return 0 if this and other are the same
>0 if this is greater, and <0 if this is less
 
Ah
Yea that'd be helpful
 
10:34 AM
@Wietlol ||> "10.1".localeCompare("9.8", undefined, {numeric: true})
||> "9.8".localeCompare("10.1", undefined, {numeric: true})
 
@VLAZ -1 Logged: [ ] Took: 44ms
 
hmm, first one wasn't evaluated
||> "10.1".localeCompare("9.8", undefined, {numeric: true})
 
@VLAZ 1 Logged: [ ] Took: 1ms
 
||> "9.10.4".localeCompare("10.3.1", undefined, {numeric: true})
 
@Wietlol -1 Logged: [ ] Took: 0ms
 
10:35 AM
hmm...
 
You can do numeric collation with strings. It sort of works. As long as your strings are of the same format. Might not work with 1.2.3 vs 1.3
 
how does the localeCompare work though?
 
|| MDN localeCompare
 
ah, it cuts it into segments?
 
10:36 AM
@Wietlol it collates all the numeric part together and then does numeric comparison on them.
 
so it compares ["9", ".", "10", ".", "4"] to ["10", ".", "3", ".", "1"]
 
So, instead of checking character by character, if you have "abc111" vs "abc21" it checks "a", then "b", then "c", then "111" vs "21" as a numbers
So, yes. Basically what you said.
It's not a cure-all. But if you normalise versions to the same format, they can be compared, at least.
E.g., if you have v9.10 vs 10.3.1 you need to make them equal.
Actually, not sure what happens if it's the same version but one is shorter. Let's see:
||> "9.10".localeCompare("9.10.1", undefined, {numeric: true});
 
@VLAZ -1 Logged: [ ] Took: 0ms
 
I guess it's correct, then.
Since 9.10 should be the same as 9.10.0
 
@1.21gigawatt
how to get .forEach(year) with for loop
 
11:01 AM
@Wietlol yea, all math operators perform the abstract operation of imlicit convertion (coercion) as per ECMA spec. The semantics, though...
 
11:12 AM
@Wietlol string comparison is done lexicographically - meaning first the compared strings are checked for length, if one is different from the other, the comparison resolves early. After that, characters are compared one-by-one, left-to-right by their character codes. Since in Unicode numbers, general latin, and other language sets are grouped in sequential blocks, it's easy for the engine to make a comparison.
This behavior is extremely useful for comparing dates in their ISO8601 format, e.g. '2022-10-01' < '2022-11-01'
 
is it though?
 
not sure what the rules are for years before 1000
or after 9999
but I guess by then we will just have a new standard
 
same, if those are strings that is
as for numeric-based dates, we are going to get the Temporal proposal up and running pretty soon - it exists to address most of date-related concerns
 
meh, I just use js-joda and not bother with anything :D
 
11:20 AM
soon, there'll be no need to use it :) Temporal. Every cool library eventually suffers from the fate of jQuery
this is probably one of the most exciting proposals we had in years if you ask me.
certainly better than the .at(<index>) BS we got :)
 
@Wietlol ISO 8601 years should be at least four digits. so, 91-01-01 is first of January, year 91. Not 1991 nor 891. For higher than 9999, they have more digits.
 
||> "999-12-31" < "1000-01-01"
 
@Wietlol false Logged: [ ] Took: 0ms
 
@Wietlol lexicographical comparison :)
 
I dont understand difficult words :D
 
11:28 AM
what I mentioned above :) if strings are of different length, the comparison resolves immediately in favor of the longer/shorter string (depending on the operator, ofc)
 
@OlegValteriswithUkraine I like the .at() things. Just...it's extremely minor. Helps simplify code like arr.at(-1) but that's probably the largest use-case. Second biggest arr.at(-2). As you mostly need the last or second to last. For positive arr[n] works exactly the same. Since it's a bit rare to need the last item or similar, it's not a huge help. It's OK but that's about it. "Meh, OK" and move on.
@Wietlol should be "0999-12-31" < "1000-01-01"
Oh...my bad. I somehow forgot the zeroes. In the same message that said it has to be at least four digits.
 
regardless, I just leave the date comparisons to js-joda :D
 
@VLAZ same - the only thing that annoys me somewhat about it is that we need to worry about backward compatibility for such a minor thing. I don't remember if TSC downlevels it to arr[arr.length - index]...
 
im sure Jon Skeet does a better job than me :D
 
@Wietlol and you are right to do so :) There is no benefit to handling all that crap DIY-style in any production project
 
11:33 AM
@Wietlol Jon Skeet does my job so much better than everybody, I had to legally change my name to Jon Skeet, so I get my paychecks.
 
12:09 PM
@VLAZ do you send them to them after getting them?
 
No. Otherwise I'd starve.
 
you won't starve for Skeet's sake?
 
12:32 PM
Sacrilege, I know.
 
for Jon's sake, @VLAZ! You need to atone
 
 
4 hours later…
4:27 PM
@1.21gigawatts Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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.
1 message moved to Trash can
@1.21gigawatts Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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.
1 message moved to Trash can
 
@MileMijatović I believe you can use a basic for loop:
for (var i=0;i<items.length;i++) {
    var item = items[i];
}
forEach documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#converting_a_for_loop_to_foreach
 
4:58 PM
Btw. I resolved an issue without forEach and for loop
I used just .filter
because filter also loop through an array
 
ok good to hear
 
Thank you
do you have experience with tape unit testing ?
 
with unit testing yes
what is "tape"
 
npm package
https://www.npmjs.com/package/tape
 
i haven't used it
I'm learning about typescript and nodejs and in examples I see two things:
const mylibrary = require("somelibrary")
import mylibrary from "@somelibrary/something";
What's the difference and can they be used interchangeably?
 
5:14 PM
no
the former is CJS, the latter is ESM
different module systems
 
*commonJS and ES modules?
 
what do i want to use? and why?
currently my project is using require
 
veeeeery context-dependent
ESM isn't really stable yet, although more and more projects are moving towards it
ES modules are definitely the future of dependency management in JS for sure. As an advice - if you are using TypeScript, go for ESM if you can, you will save time on refactoring down the line
 
5:18 PM
for now, writing in ESM and compiling to CJS is the most common solution
there is a lot of differences between the systems, so be careful
 
Hey guys, in my career I have heard again and again that TypeScript does not affect JavaScript code in runtime. I personally disagree with that as TypeScript uses enums and decorators which produce JavaScript and ultimately affect the runtime.
 
@OvidijusParsiunas 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.
 
Hypothetically speaking, if I use enums and upgrade my TypeScript from one version to another, I can't be 100% sure that my existing code works as expected because my enums are fully controlled by TypeScript and there is a chance that a new version may affect on how it is implemented.
Hence, do you people here agree that TypeScript does in-fact affect JavaScript or am I missing something?
 
typescript is compiled down to javascript
what runs in the browser is javascript
typescript does not validate input when the code is running
 
5:33 PM
But does TypeScript AFFECT result JavaScript? :/
 
i don't know what you mean
it creates javascript
how can it not affect it?
it isn't javascript until it creates javascript
 
@OvidijusParsiunas hypothetically speaking, when writing in JavaScript, you can't be 100% your code works as expected because all execution is controlled by the engine.
 
ok, we are on the same page :D
@OlegValteriswithUkraine Absolutely
 
the point being - yes, a new version of TypeScript can change what enums are compiled down to or introduce a bug
however, that's as likely as getting killed by a satellite falling on your head at 10AM on Tuesday :)
 
@OvidijusParsiunas typescript can be exported to es5, es6, es2017 etc and uses different module types
 
5:37 PM
The reason why I brought this topic up is because from time to time I introduce/explain TypeScript to new/existing developers and I often see a misinterpretation that TypeScript is just an IDE/CI tool to help validate code.
 
or we get real enums and some point in the core language - that has a chance of screwing up TS users too. Although it's doubtful any such proposal will go under Microsoft's radar
 
I hear this so often that I started question it myself :D
 
how do you mean "does it affect javascript"?
 
@OvidijusParsiunas god help you with dealing with that xD That said, many do use TS just as a means to get some autocompletion or whatever.
@1.21gigawatts I presume they meant changing the emitted JavaScript code. Which can, however unlikely, theoretically happen.
 
@OvidijusParsiunas I mean...it is. It's only there at compile time. You get no runtime changes to the code. E.g., const num: number = getString() as number; will actually just give you a string at runtime. Not a number. However, the compiler can be fooled into accepting num as a number then doing num + 2 will concatenate rather than sum the two.
 
5:40 PM
@1.21gigawatts Does it generate JavaScript code (which it does), but I began to question it myself from the perspective of - would I need to retest my code if I update the TypeScript package, or can I deploy it to prod with a blindfold on :D
 
ok iiuc you do not
it will export your file.ts to file.js and the resulting js should be the execution path no matter the typescript version
 
that's not strictly true
the code should certainly perform the same task,
but producing the same js?
 
*yep sorry thats what i meant i edited it
not producing it but having the same result
 
yea
 
It should, but if I update the TypeScript package to a different version - it hypothetically may not, correct?
 
5:44 PM
i think you'd have to ask the ts developers to see if they ever change the output. but i think if they did they would have another target for that or make a major announcement
 
*May not result in the same code as the previous package version
 
hypothetically a different version could produce buggy code, yes, given that it could produce different code
 
ok, makes sense
 
As long as it is properly annotated and compiled (you don't cheat the type system), then what you should get is JS that is sound to run. You won't get strings concatenated with numbers or unchecked null usage and so on. Such TS code is safe. However, any TS code which bypasses the type system is not necessarily safe.
 
^
 
5:45 PM
if you have the time you could test it. get the current TS version and then a few previous versions and then run it on your code. then check the exported js to see if there are any changes
 
@OvidijusParsiunas probably a good idea to rerun all the test suites at least once when updating. And read the release notes for any major version bump. It's unlikely something is gonna break, but it is not impossible.
 
if you're writing code the typescript way, everything properly typed and avoiding unnecessary "any"'s etc, you can reasonably expect it to produce reliable code
 
Thankyou guys, my core concern here is that developers should not think think that TypeScript is for type safety ONLY :)
 
why not though?
 
It's overwhelmingly for type safety. The transpilation process is not quite as important.
 
5:46 PM
Because it can generate JavaScript code, e.g. enums
 
I mean, from my perspective that's what it's there for. It's a guardrail to help prevent mistakes through enforcing type safety
 
i'm going through this now @OvidijusParsiunas +1 for reasons to use typescript?
 
what's kind of ironic is that the team actually considers enums to be a mistake they should've never included in the language
 
There are a few TS-only constructs that get transpiled to different JS code but most of the features are available in JS. Well, nowadays, at least. And you can always transpile downlevel with Babel instead.
 
For sure
@OlegValteriswithUkraine Enums can be really buggy, I watched this talk and can agree that using them may not be the best :D youtu.be/0fTdCSH_QEU
 
5:49 PM
can someone help me convert this code to commonJS syntax?
 
What is the require syntax for:
import Psd from "@webtoon/psd";
 
@OvidijusParsiunas well, I personally go for enums often, both const and "normal" ones. Mostly when you need a fixed set of values to exist both at runtime and compile time-wise as types without any extra setup
> Since @webtoon/psd is provided as an ES module, you must use dynamic import() or a bundler to run it in CommonJS code
^ @1.21gigawatts
 
I read that. I don't know what that means
 
if your module system is CJS, you'll have to use the dynamic import or a tool that walks the dependency tree and inlines them (bundling, roughly)
 
5:53 PM
I get error TS2304: Cannot find name 'webtoons'.
const Psd = require("webtoon");
 
The import statement comes in two flavours: 1. static where it's at the top and looks like import foo from "bar" 2. dynamic which can be placed anywhere like a function import("bar").then(foo => {/* use foo */}) (it produces a promise).
 
|| mdn dynamic import
 
very helpful... Fine, I'll do it myself
 
Also possible to use it with await: const foo = await import("bar") The dynamic version is more similar to CJS require. But it returns promises.
 
5:56 PM
also: I don't think webtoon is provided as an unscoped NPM package. @scope/package
webtoon is an unscoped package, @webtoon/psd is a psd package scoped to webtoon
 
interesting
seems i have to go back to javascript school
 
nah, it's not necessarily about JS, more about the package manager
 
6:11 PM
i spent two hours and i haven't wrote any code yet
 
and, frankly, dependency management is such a mess on JS right now, I wouldn't blame ya for not keeping all of it in your head
 
error this
error that
"you can't do that"
"you can't do this"
Must use import to load ES Module:
 
you can't get errors if you aren't writing code
 
rename index.js to end in .cjs, change the requiring code to use import()
 
takes time to adjust, you'll get a hang of it :)
 
6:13 PM
@KevinB ha
 
but what Kevin said is true, though - it's an inevitable part of being a programmer. I'am getting worried when there are no errors
 
it's often useful to cause an error to occur when your code isn't doing what you expect it to
 
6:27 PM
@OlegValteriswithUkraine Yeah. Occasionally I have to write a bunch of code before properly integrating with another thing. And rarer still is when I get no error when the integration does happen. That's the time I'm most suspicious of code I've written.
 
6:49 PM
posted on November 28, 2022 by Prudhvikumar Bommana

The Beta channel has been updated to 108.0.5359.62 for Windows, Mac and Linux . A full list of changes in this build is available in the log. Interested in switching release channels? Find out how here. If you find a new issues, 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. Prudhvikumar Bommana Google Chr

 
7:11 PM
@Ber Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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.
1 message moved to Trash can
 
Ber
This doesn't work...
        else if( fieldName == ("MO" || "MO_3") ){
            field.value = assetObject["month"];
        }
But this does...
        else if( fieldName == "MO" || fieldName == "MO_3" ){
            field.value = assetObject["month"];
        }
Anyone know why? Or how to make the syntax work in the first example?
 
@Ber You can't.
||> 1 || 2
 
@VLAZ 1 Logged: [ ] Took: 0ms
 
|| mdn logical OR
 
An error occurred with the request.
 
7:14 PM
?
|| mdn logical OR
^ that's why it doesn't work in the first example. And why it cannot work.
Now, did I kill James?
@JamesBot alive?
@JamesBot status
Uh...I killed James with logic. Or dunno, something went wrong, but the last thing I said was to look up logic. RIP James.
 
Ber
Thanks, I will have to read up on that
 
7:27 PM
||> 42;
 
@OlegValteriswithUkraine 42 Logged: [ ] Took: 0ms
 
if you kill a bot with logic, you know who to call, @VLAZ
 
|| mdn logical or
 
8:23 PM
!!mdn or logical
 
 
2 hours later…
10:01 PM
posted on November 28, 2022 by Ben Mason

Hi everyone! We've just released Chrome Beta 108 (108.0.5359.61) for Android. It's now available on Google Play. You can see a partial list of the changes in the Git log. For details on new features, check out the Chromium blog, and for details on web platform updates, check here. If you find a new issue, please let us know by filing a bug. Krishna Govind Google Chrome

 
 
2 hours later…
11:37 PM
I got the import statement sort of correct but now it's throwing other errors
import Psd from "@webtoon/psd";
[Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:
require() of ES modules is not supported.
require() of /Users/project/node_modules/@webtoon/psd/dist/index.js from /Users/project/MyClass.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/project/node_modules/@webtoon/psd/package.json.
I read up the links at:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
and dynamic import
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
is there anything else i can read to help solve this?
still reading the "scope" page
hold on...
nope
I tried const {default: myDefault } = await import("@webtoon/psd");
The import statement was at the top of the file while the await import was inside a function
ok so scoped packages are no different than regular packages
 

« first day (4426 days earlier)      last day (505 days later) »