Skip to content

Instantly share code, notes, and snippets.

View Ravlissimo's full-sized avatar
🧑‍🦯
sergeant (UA Armed Forces)

Ravlissimo Ravlissimo

🧑‍🦯
sergeant (UA Armed Forces)
View GitHub Profile
@killants
killants / findPaths.js
Last active November 10, 2022 04:34
Sharing knowledge
/**
* searches deep into an object recursively...
* @param {Object} obj object to be searched
* @param {any} searchValue the value/key to search for
* @param {Object} [options]
* @param {boolean} options.[searchKeys] whether to search object keys as well as values. Defaults to `true` if `serchValue` is a string, `false` otherwise.
* @param {number} options.[maxDepth=20] maximum recursion depth (to avoid "Maximum call stack size exceeded")
* @returns {string[]} Paths on the object to the matching results
*/
const findPaths = (