function by(...keys){
const paths = keys.map(
function(element){
return element.toString().split(".");
}
);
return function compare(first, second){
let first_value;
let second_value;
const all_values_equal = paths.every(function(path){
first_value = refine(first, path);
second_value = refine(second, path);
return first_value === second_value;
});
if (all_values_equal){
return 0;
}
return(
(
typeof first_value === typeof second_value
? first_value < second_value
: typeof first_value < typeof second_value
)
? -1
: 1
);
}
}