For a deeply nested object or array of objects, we might want to replace all the keys in some way, such as modifying their case (camel case, snake case, etc.) or adding an underscore at the start of each key or on both sides. Or we may like to change the keys in any other way.
[Read More]JavaScript Find Total Time Duration
Excluding overlapping and idle times
JavaScript Generate Your Own Random Number Without Math Random
A Custom Code for Finding Pseudo-generated Number
Compare Two JavaScript Objects and Get the Updated Keys
Where the Value of the Key Has Changed.
We have two similar JavaScript objects and are interested in finding which key(s), if any, have changed at the first level. A key in the object could hold any data type in its value, including array and object, and it could also be deeply nested. The change could mean anything, such as added, added to, removed, removed from, modified, shuffled, etc.
You may require this kind of key identification in cases where you compare the old and new states, such as previous and new filters, and figure out what exactly changed.
[Read More]JavaScript Token Bucket Algorithm
And its Possible Uses
CPU Scheduling Algorithms - JavaScript
Simulation Code for Scheduler and Task
In this post, I am going to share a JavaScript simulation for some well-known CPU/operation system scheduling algorithms. The ES6 JavaScript code can be run in the Node JS environment.
[Read More]JavaScript Get Information of Week Days Between Two Dates
With and Without Moment JS
JavaScript Flatten Deeply Nested Array of Objects Into Single Level Array
Using plain JavaScript, and lodash's flatMapDeep method.
JavaScript Find Path of Key in Deeply Nested Object or Array
Key Path Finder Using Depth First Search (DFS)
The following two codes go through the whole object, an array of objects, or a collection of both to get the path to a particular key. There are two versions: first gets the path to the key only, and second gets the path where a key has the given value.
[Read More]