Skip to content

Instantly share code, notes, and snippets.

View manimal1's full-sized avatar

Jeremiah McCurdy manimal1

  • Avantgarde Finance
View GitHub Profile
@manimal1
manimal1 / machine.js
Created September 23, 2022 09:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@manimal1
manimal1 / flattenArray.js
Last active November 26, 2019 10:33
JavaScript utility function to flatten an array of arrays
export const flattenArray = (arr, depth = arr.length) => {
return depth > 0
? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flattenArray(val, depth - 1) : val), [])
: arr.slice();
};