Skip to content

Instantly share code, notes, and snippets.

View AlexanderIstomin's full-sized avatar

Alexander Istomin AlexanderIstomin

View GitHub Profile

KB Maintenance Protocol

Use this guide when asking an LLM to update the knowledge base files:

  • docs/KB_INDEX.md
  • docs/<feature-slug>/IDMAP.md
  • docs/<feature-slug>/KG.adj
  • docs/<feature-slug>/FACTS.jsonl

KB Index Policy

@AlexanderIstomin
AlexanderIstomin / array reducer
Last active July 10, 2019 16:07
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
const flattenArray = (arr) => arr.reduce((prev, curr) => (Array.isArray(curr) ? prev.concat(flattenArray(curr)) : prev.concat(curr)), []);