utils/secret-storage.js
function searchPath(object, path) {
    var currentChild = object;
    var comps = path.toLowerCase().split('/');
    for (var i = 0; i < comps.length; i++) {
        // Search for a child object with a case-insensitive matching key
        var matchingChild = null;
        for (var key in currentChild) {
            if (key.toLowerCase() === comps[i]) {
                matchingChild = currentChild[key];
                break;
            }
        }
        // Didn't find one. :'(
        if (matchingChild === null) {
            return null;
        }
        // Now check this child...
        currentChild = matchingChild;
    }
    return currentChild;
}
function searchPath(object, path) {
    var currentChild = object;
    var comps = path.toLowerCase().split('/');
    for (var i = 0; i < comps.length; i++) {
        // Search for a child object with a case-insensitive matching key
        var matchingChild = null;
        for (var key in currentChild) {
            if (key.toLowerCase() === comps[i]) {
                matchingChild = currentChild[key];
                break;
            }
        }
        // Didn't find one. :'(
        if (matchingChild === null) {
            return null;
        }
        // Now check this child...
        currentChild = matchingChild;
    }
    return currentChild;
}
function searchPath ( object , path ) { var currentChild = object ; var comps = path . toLowerCase ( ) . split ( '/' ) ; for ( var i = 0 ; i < comps . length ; i ++ ) { // Search for a child object with a case-insensitive matching key var matchingChild = null ; for ( var key in currentChild ) { if ( key . toLowerCase ( ) === comps [ i ] ) { matchingChild = currentChild [ key ] ; break ; } } // Didn't find one. :'( if ( matchingChild === null ) { return null ; } // Now check this child... currentChild = matchingChild ; } return currentChild ; }
Search an Object and its children recursively, caselessly.
Search an Object and its children recursively caselessly .