It seems that torwards the end of 2022 the collective hivemind of the TypeScript programming world decided that enums are terrible. While I mostly agree with the premise that TypeScript enums are not good the solutions that are presented often only deal with String enums. For my work on SDL_ts I really need a solution for Numeric enums as SDL is full of them.
Read MoreFor the longest time if I wanted to iterate thru an object in JavaScript I would write code that looked something like this:
const obj = { a: "foo", b: "bar" };
for (const key of Object.keys(obj)) {
console.info(key, obj[key]);
}
Since ES2017 there is a better way of doing this using Object.entries()
and destructuring:
const obj = { a: "foo", b: "bar" };
for (const [ key, value ] of Object.entries(obj)) {
console.info(key, value);
}
Read MoreI commbined the best parts of this StackOverflow answer and this
Super User answer to come up with this solution for a time
function
in Powershell:
function time {
$Command = "$args";
(Measure-Command { Invoke-Expression $Command 2>&1 | Out-Default }).ToString();
}
Example usage:
# time git pull
00:00:01.0804938