IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

detect-uuids.js 574B

123456789101112131415161718192021222324252627
  1. function detectUuids(obj) {
  2. let Q = [ obj ];
  3. let matches = {};
  4. while (Q.length > 0) {
  5. let item = Q.pop();
  6. if (!item)
  7. continue;
  8. if (typeof(item) === 'string') {
  9. // use regexes
  10. let rx = /[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/g;
  11. for (let m = rx.exec(item); m; m = rx.exec(item))
  12. matches[m[0]] = true;
  13. } else if (typeof(item) === 'object') {
  14. Object.keys(item).map(k => Q.push(item[k]));
  15. }
  16. }
  17. matches = Object.keys(matches);
  18. return matches;
  19. }
  20. export default detectUuids;