I’m struggling to figure out a Regex pattern for JavaScript that will trim a path of it’s preceding and trailing slashes (or hashes/extensions) For example: Should return: I felt like I was getting close with the following, but it only selects text without any slashes, hashes, or periods. I’…
Category: Questions
Javascript sort array of objects alphabetically AND put first objects with value
I’m trying to sort this data which contains various arrays of objects, the console.log of myData is something like: I’m trying to sort it alphabetically (based on value of name) and if the object has the parameter url , put it at the beginning. So the output would be: what I tried is this, and man…
electron js – cannot get button to perform simple actions from click
Long story short I am working on a single page application that sends commands over a local network. Testing out Electron JS and I can’t even seem to get a simple button to work. I feel like I am not linking the logic between main.js and index.js somehow but for the life of me I cannot figure out the co…
Why is my client side code being compiled and ran on node backend?
I’m new to SSR so I’m not sure if this problem and my solution is standard practices but I can’t imagine so. My goal is to have a dynamic page that allows users to add/remove items on the page. I originally programmed this component with the intention of it only being a client side react pro…
Two new urls but second one missing path variable in Cypress
Maybe a bit difficult to explain but I have the following issue. I have created a link and Cypress wants to click it, but it seems to click it twice. The second time the path variable is missing (the ID of an incident) and now it stores ‘undefined’ as incident ID, while the ID is ‘458868R…
Display JSON file content in Vue
I’ve json file with some data. I’ve to fetch this data and display them in the component. In my vuex store in actions I have: mutations: and state: And now how to get this todos in state and display them when Homepage is mounted? JSON file example: Answer Well you can use mapState in your componen…
delete a collection with document and collection again inside (firestore react native)
I am having trouble deleting on firestore here’s my delete but everytime i try to delete nothing happens . There’s no error at all . this is how I set that collection Answer If you want to delete all the docs of the messages (sub)collection, you need to query the collection and delete each documen…
AVL Tree implementation: Insert function – Reference get twisted
I got the bug when adding 13 to the tree, the left and right pointer of node 10 have reference back to the root, and create cycle reference. I think it’s because I understand Javascript syntax wrong. code (open the console) Any suggestion? Answer The problem is that you don’t use the returned node…
React Redux bundle.js being thrown into request
I have an issue with how my React Redux SSR application is handling site navigation I have a route for list pages which will display different data depending on the params in the URL. Routes.js file In my Index.JS file where my express backend is running I iterate through my routes directory to see the path(s…
Vue 3 defineEmits breaks defineProps types
I’m using Vue 3 and TS 4.4. I’ve got a component that defines its prop types with defineProps. When I add a call to defineEmits, VS Code starts telling me my props variable doesn’t exist in the component template. Here’s the source code: And a couple of screenshots to better show what …