All Questions
Tagged with design-patterns javascript
108 questions
3
votes
1
answer
414
views
Event sourcing javascript implementation
An event source built around an observer design pattern implementation…
...
1
vote
1
answer
72
views
Buffered source of HTMLElement(s)
Temporary storing the element(s) returned by document.querySelector and document.querySelectorAll methods could improve ...
3
votes
1
answer
77
views
I made a webpage that simulates sharks eating fish in the torrid world of Wa-tor
I've been self-studying HTML/CSS/JS. I read about Wa-tor. It's a population dynamics simulation which simulates fish and sharks breeding and predating. This seemed cool so I decided to implement it....
0
votes
1
answer
58
views
Nodejs Module Pattern And Caching
The question is about nodejs module pattern code structure.
My goal is to initialise the module at one time and export the module using module.export
so that, it's ...
2
votes
0
answers
293
views
Undo/Redo implementation using Memento pattern Javascript
Relatively new to the Design patterns, Generally my works are writing function for the needs.
But now i need to implement a undo redo functionality, so i just read about the different patterns which i ...
0
votes
1
answer
44
views
Function pattern for running DB queries using pool or transaction
Take the following INSERT query. Using knex (JS) just for abstractions
...
2
votes
0
answers
628
views
Cron expression parser
Problem
Write a command line application or script which parses a cron string and expands each field
to show the times at which it will run.
~$ your-program "*/15 0 1,15 * 1-5 /usr/bin/find"...
2
votes
0
answers
165
views
How do I create an "Environment Variable Setter"?
I have a NodeJS/Typescript project.
In server.js, I want to set my environment variables from a .env file. To achieve this, I am ...
0
votes
1
answer
61
views
Avoiding verbose compositional class design
I've written some code which features Eric Elliot's javascript factory function mixin composition (https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1), but since ...
4
votes
2
answers
365
views
web scraper for emails and links
I created a class to scrape URLS, parse and validate emails and get internal links.
How can I achieve the SOLID principles in this class written in Javascript to make a web scraper?
...
2
votes
0
answers
62
views
Pre setup script to get user metadata and check supported api's within the browser/device
Can this code be shortened or optimized,
Written out this script to be used before node.js
starts a few canvas elements and some vide streams.
wondering if the initial checks can be shortend or ...
2
votes
1
answer
88
views
React programming pattern
I create https://github.com/storenth/react-redux-todo and ask to review my Todo-react-app for programming pattern: dividing components into presentational components and container components.
Here’s ...
4
votes
0
answers
60
views
How to split and refactor a large function so it would do only one thing?
I am learning about clean and maintainable code. I heard that functions should be no more than 20 lines long (preferably 5 - 10 lines). I have come across this Bob Martin quote where he said:
“The ...
4
votes
1
answer
5k
views
"Clean Architecture" design pattern with Node.JS and MongoDB
After some time poorly designing my web applications' backends (mixing database calls with the controller, etc.), I have decided to try the "Clean Architecture" approach.
In this example I have a ...
3
votes
1
answer
149
views
Small Javascript Lib to draw SVG file
I'm new to JavaScript and I decided to make a script that allows other developers to show SVG elements in the web browser. (It is just for learning purposes), and it is still under development.
I ...