function sortKeys(obj) {
    const sorted = {};
    let keys = Object.keys(obj);
    keys = keys.sort();
    for (const key of keys) {
        // typeof [] === 'object', which is maddening
        if (!Array.isArray(obj[key]) && typeof obj[key] === 'object') {
            sorted[key] = sortKeys(obj[key]);
        }
        else {
            sorted[key] = obj[key];
        }
    }
    return sorted;
}
/**
 * Given an arbitrary object, recursively sort the properties on the object
 * by the name of the key.  For example:
 * {
 *   b: 1,
 *   a: 2
 * }
 * becomes....
 * {
 *   a: 2,
 *   b: 1
 * }
 * @param obj Object to be sorted
 * @returns object with sorted keys
 */
Given an arbitrary object, recursively sort the properties on the object
by the name of the key.
Given an arbitrary object recursively sort the properties on the object by the name of the key .
function sortKeys(obj) {
    const sorted = {};
    let keys = Object.keys(obj);
    keys = keys.sort();
    for (const key of keys) {
        if (!Array.isArray(obj[key]) && typeof obj[key] === 'object') {
            sorted[key] = sortKeys(obj[key]);
        }
        else {
            sorted[key] = obj[key];
        }
    }
    return sorted;
}
function sortKeys ( obj ) { const sorted = { } ; let keys = Object . keys ( obj ) ; keys = keys . sort ( ) ; for ( const key of keys ) { if ( ! Array . isArray ( obj [ key ] ) && typeof obj [ key ] === 'object' ) { sorted [ key ] = sortKeys ( obj [ key ] ) ; } else { sorted [ key ] = obj [ key ] ; } } return sorted ; }
Given an arbitrary object, recursively sort the properties on the object
 by the name of the key.
Given an arbitrary object recursively sort the properties on the object by the name of the key .
// typeof [] === 'object', which is maddening