There's nothing wrong with if statements. If you can't even understand the code yourself it's a sign that it needs to be rewritten.
function x(result, Skip, obj, traverseObject, treverseArray) {
if(! result instanceof Skip) return result;
if(typeof obj === "object") return traverseObject(Object.keys(obj));
if(Array.isArray(obj)) return traverseArray(obj);
return new Skip("Not found.");
}