|
Newf posted:Further playing with js / web / node technologies, and I'm trying to author a command-line program installable via npm. With the following package.json, "Please make sure that your file(s) referenced in bin starts with #!/usr/bin/env node, otherwise the scripts are started without the node executable!" From the npm docs
|
# ¿ Apr 10, 2017 00:51 |
|
|
# ¿ Apr 29, 2024 14:58 |
|
I’ve done a few TDD trainings and always come away thinking “wow that was cool, but there’s no way it scales well or works well with async calls”. I would love to be proven wrong, though. I’ve never done a training that used JS, so maybe that’s part of the issue.
|
# ¿ Nov 17, 2017 03:58 |
|
That's not odd, that makes sense since edges is an array of nodes. Node isn't an accessible key from the array itself. You'd need to do like products.edges[0].node.title Also since edges is an array you can do .map or .forEach or whatever to access each node e: I dunno poo poo about Svelte and I'm having trouble following what exactly your issue is, but this should work better than 4 loops or whatever: code:
camoseven fucked around with this message at 20:38 on Oct 21, 2021 |
# ¿ Oct 21, 2021 20:22 |
|
I probably missed passing the props to the html since I don't know svelte, so make sure you do that
|
# ¿ Oct 21, 2021 21:34 |
|
I hadn't heard of that, but a quick search on it and I'm Is this supposed to be able to replace Moment.js? Because I would loving love to replace Moment.js
|
# ¿ Dec 1, 2021 04:32 |
|
I think we can all agree that typescript kicks rear end, at least
|
# ¿ Feb 19, 2022 01:08 |
|
LifeLynx posted:I think I understand vanilla JS, React, and NextJS enough to attempt Typescript. Should I convert a project or is it better to start fresh? Looking over the typescriptlang.org site I'm not sure what it does for me that ESLint doesn't already (for a small NextJS site at least), but I need to see what the fuss is all about. Have you gone through this: https://www.typescriptlang.org/docs/handbook/intro.html ? It's pretty good.
|
# ¿ Feb 19, 2022 01:57 |
|
Summit posted:All code is terrible and needs careful management and validation to not explode at the worst possible moment. Actually my code is perfect every time
|
# ¿ Feb 24, 2022 22:37 |
|
Ape Fist posted:Javascript 2 announced: It's weird to be on the same team as Microsoft, but drat this proposal kicks rear end
|
# ¿ Mar 10, 2022 13:29 |
|
LongSack posted:I am in the middle of rewriting one of my Blazor server front ends into React. I don't think this is a React question, but more JavaScript related, so here goes. The promise is asynchronous, so basically you are saying "go fetch me three products and let me know when you're done and what they are". But the code doesn't stop and wait for the fetch to happen, it moves right on to the console.log, if block, etc. I assume when you logged out of RandomProducts you were doing it in the "then" block, so it waited til the call was done then logged the data you got back. Also RandomProducts returns null but it actually needs to return a promise, then you can async/await or chain it or whatever. Phone posting but hopefully that helps a bit
|
# ¿ Apr 6, 2022 18:42 |
|
Sab669 posted:Has anyone encountered this error before? You need to set your bundler (probably webpack) to interpret .mjs files as js files. Or use an older version of that library that doesn't use .mjs files
|
# ¿ May 6, 2022 21:05 |
|
LongSack posted:I ripped out all the array stuff when I gave up and went with individual strings, but I'll try to reconstruct it here: Did you try using something like _.cloneDeep? I have had issues where setting a variable equal to the state array just creates a reference to the state array, so when you manipulate what you think is the copy you're actually manipulating the original and can get all kinds of weird bugs. CloneDeep (and related solutions) create a brand new array in memory, which React likes much better. e: so like: code:
camoseven fucked around with this message at 14:45 on May 13, 2022 |
# ¿ May 13, 2022 14:35 |
|
Janitor Ludwich IV posted:Hi friends, I hadn't heard of GAS, but it looks like it IS JavaScript. Not sure you could learn GAS separate from JS
|
# ¿ May 26, 2022 11:42 |
|
Janitor Ludwich IV posted:I think that answers my question then! From what I read is GAS may be missing some newer syntax as it's mostly built on 1.6 / 1.7. it will also have a lot of Google specific functions. https://developers.google.com/apps-script/guides/v8-runtime It looks like GAS uses V8 by default now, so you can use all the latest features of JS. Like you said there will be functions and stuff specific to the GAS environment, but you would be well served by doing a crash course in JS
|
# ¿ May 26, 2022 15:33 |
|
I'm really confused about what y'all are trying to do. Just using TS and setting things to a type will do all the type checking for you at compile time. Why are you trying to add if statements to do what TS already gives you out of the box?
|
# ¿ Jun 1, 2022 15:04 |
|
In nearly 7 years of professional JavaScripting I have never written a class
|
# ¿ Jun 11, 2022 22:41 |
|
echinopsis posted:next step is figuring out date() If you need to do anything complicated I highly recommend using a library instead of trying to deal with the native Date interface directly. We use Day.js at work but there's a bunch of options
|
# ¿ Jun 13, 2022 23:16 |
|
Video Nasty posted:Moment.js is my go-to library when dealing with date\time objects if I can use it (sometimes I can't ) I'm sorry you had to find out this way but here's a note from the Moment devs: Moment.js is a legacy project, now in maintenance mode. In most cases, you should choose a different library.
|
# ¿ Jun 13, 2022 23:26 |
|
echinopsis posted:poo poo this is driving me crazy. You usually want to use import for front end apps, though you can load scripts directly as indicated by the DayJS docs.
|
# ¿ Jun 14, 2022 02:26 |
|
echinopsis posted:I'm trying that final method, and the tricky part seems to be the dayjs.extend(); Capitalization matters for the extend, it's relativeTime
|
# ¿ Jun 14, 2022 02:55 |
|
worms butthole guy posted:Hey goons simple question. It's been a while since I messed around with NodeJS and PUG. Right now that `return account` is returning the value to the outer function (LookUpDB), but LookUpDB is not returning anything so when you invoke it you just get undefined. findOne is already an async function, so you don't need to wrap it like you're doing. edit: i should say I'm pretty sure it's already async. I don't use mongoose but that's what skimming the docs leads me to believe
|
# ¿ Jun 15, 2022 19:37 |
|
No problem. I will say that your abbreviation of "error" to "e" is triggering me lol. In my experience "e" is used in event handlers as the event object, whereas an error check would refer to "err" or "error"
|
# ¿ Jun 15, 2022 20:06 |
|
I'm enjoying following your progress and am looking forward to Committing some Crimes
|
# ¿ Jun 16, 2022 14:33 |
|
Nolgthorn posted:In fact lets just make typescript the official language, starting tomorrow everything written in javascript no longer works. Job done. I second this motion
|
# ¿ Aug 23, 2022 14:11 |
|
Works on my machine
|
# ¿ Dec 7, 2022 22:04 |
|
Jabor posted:It's actually the opposite - the larger the project, the more you need to know the component library being used, and the less you need to care about minutiae of HTML and CSS. This is certainly how upper management imagines that it should work. But it sure does not!
|
# ¿ Dec 30, 2022 16:30 |
|
Honestly a SPA that doesn't hook up to any databases or APIs and just makes pretty graphs based on sliders is dead simple if you know what you're doing, and you should probably hire a contractor to do it in a week instead of spending time trying to figure it out yourself
|
# ¿ Dec 30, 2022 18:42 |
|
I hate web components so much. It's possible there's a good way to use them, but every implementation I've been forced to work with has been an absolute mess
|
# ¿ Feb 1, 2023 02:04 |
|
|
# ¿ Apr 29, 2024 14:58 |
|
Big Day.js fan here
|
# ¿ Mar 20, 2024 02:22 |