-
-
Save jalexanderfox/1e91b099a9f0e59bb3f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("Usage Syntax: scanScope($scope.model, 'SCANFOR');"); | |
function scanScope(whatToScan, scanValue, parentTree) { | |
var insertString = ''; | |
for (var key in whatToScan) { | |
if (((whatToScan[key] != null) && (whatToScan[key].indexOf != undefined) && whatToScan[key].indexOf(scanValue) > -1) || key.indexOf(scanValue) >= 0) { | |
if (parentTree != null) { | |
insertString = parentTree + '.'; | |
} else { | |
insertString = ''; | |
} | |
console.log(insertString + key + ' = ' + whatToScan[key]); | |
} else { | |
if( (typeof whatToScan[key] === "object") && (key !== null) ) { | |
if (parentTree != null) { | |
insertString = parentTree + '.' + key; | |
} else { | |
insertString = '' + key; | |
} | |
scanScope(whatToScan[key], scanValue, insertString); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed your fork of this (thanks!) and just wanted to let you know that I updated it since; it's now case insensitive for both key and value searches.