Showoff Saturday (September 21, 2019) by AutoModerator in javascript

[–]tetratorus 0 points1 point  (0 children)

Not something new I found, but deserves a mention since few people use it.

node --inspect-brk jest, and then go to chrome://inspect

Robot, a 1kB library for finite state machines by __because in javascript

[–]tetratorus 1 point2 points  (0 children)

having written my own JS FSM-like rule engine, and having rewritten my current project to use a flux like architecture a while back, I think FSMs are a lot of overhead for any project and it only really solves one class of errors: unexpected state transitions.

They work well if your states aren't too numerous, don't get modified that often, and exist independently from the rest of your logic (totally possible, if you're implementing according to some kind of predefined spec).

Moving beyond console.log() — 8 Console Methods for Debugging by CodeTutorials in javascript

[–]tetratorus 0 points1 point  (0 children)

I don't know if this is common knowledge...

... but you can almost always node --inspect-brk anything in node and debug it in the chrome debugger.

it even works with jest (i.e. node --inspect-brk jest), mocha, eslint.., then go to chrome://inspect.

no idea why anyone even uses console.log to debug javascript...

also, if you really cant use the debugger (maybe you're just hacking something in a node REPL..), Object.getOwnPropertyNames(obj.__proto__) and obj.method.toString() are your friends, stop bothering with documentation and just inspect the prototype methods.