index.js
function findObject(c, obj, path, alreadyParsed) {
    if (!path) {
        path = [];
    }

    // Recursive reference : boooh, very wrong
    if (!alreadyParsed) {
        alreadyParsed = [];
    }
    var keys = Object.keys(obj);
    alreadyParsed.push(obj);
    for (var key = 0; key < keys.length; key++) {
        var i = keys[key];
        if (i == "NativeModule" && isElectron) {
            break;
        }
        if (obj[i] === c) {
            path.push(i);
            return path;
        } else if (["object", "function"].indexOf(typeof(obj[i])) >= 0 && alreadyParsed.indexOf(obj[i]) == -1 && obj[i] !== null && obj[i] !== undefined) {
            path.push(i);
            var founded = findObject(c, obj[i], path, alreadyParsed);
            if (founded) {
                return founded;
            } else {
                path.pop();
            }
        }
    };
    return null;
}
function findObject(c, obj, path, alreadyParsed) {
    if (!path) {
        path = [];
    }

    // Recursive reference : boooh, very wrong
    if (!alreadyParsed) {
        alreadyParsed = [];
    }
    var keys = Object.keys(obj);
    alreadyParsed.push(obj);
    for (var key = 0; key < keys.length; key++) {
        var i = keys[key];
        if (i == "NativeModule" && isElectron) {
            break;
        }
        if (obj[i] === c) {
            path.push(i);
            return path;
        } else if (["object", "function"].indexOf(typeof(obj[i])) >= 0 && alreadyParsed.indexOf(obj[i]) == -1 && obj[i] !== null && obj[i] !== undefined) {
            path.push(i);
            var founded = findObject(c, obj[i], path, alreadyParsed);
            if (founded) {
                return founded;
            } else {
                path.pop();
            }
        }
    };
    return null;
}
function findObject ( c , obj , path , alreadyParsed ) { if ( ! path ) { path = [ ] ; } // Recursive reference : boooh, very wrong if ( ! alreadyParsed ) { alreadyParsed = [ ] ; } var keys = Object . keys ( obj ) ; alreadyParsed . push ( obj ) ; for ( var key = 0 ; key < keys . length ; key ++ ) { var i = keys [ key ] ; if ( i == "NativeModule" && isElectron ) { break ; } if ( obj [ i ] === c ) { path . push ( i ) ; return path ; } else if ( [ "object" , "function" ] . indexOf ( typeof ( obj [ i ] ) ) >= 0 && alreadyParsed . indexOf ( obj [ i ] ) == - 1 && obj [ i ] !== null && obj [ i ] !== undefined ) { path . push ( i ) ; var founded = findObject ( c , obj [ i ] , path , alreadyParsed ) ; if ( founded ) { return founded ; } else { path . pop ( ) ; } } } ; return null ; }
Find an object recursively and return the path where it was founded
Use in Threadify function to find the module and the path to the object
so we can clone it in the thread
Find an object recursively and return the path where it was founded Use in Threadify function to find the module and the path to the object so we can clone it in the thread