function detectUuids(obj) { let Q = [ obj ]; let matches = {}; while (Q.length > 0) { let item = Q.pop(); if (!item) continue; if (typeof(item) === 'string') { // use regexes let rx = /[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/g; for (let m = rx.exec(item); m; m = rx.exec(item)) matches[m[0]] = true; } else if (typeof(item) === 'object') { Object.keys(item).map(k => Q.push(item[k])); } } matches = Object.keys(matches); return matches; } export default detectUuids;