trim-and-sort-shrinkwrap.js
function sortedKeys(obj, orderedKeys) {
    var keys = Object.keys(obj).sort();
    var fresh = {};

    orderedKeys.forEach(function (key) {
        if (keys.indexOf(key) === -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    keys.forEach(function (key) {
        if (orderedKeys.indexOf(key) !== -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    return fresh;
}
function sortedKeys(obj, orderedKeys) {
    var keys = Object.keys(obj).sort();
    var fresh = {};

    orderedKeys.forEach(function (key) {
        if (keys.indexOf(key) === -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    keys.forEach(function (key) {
        if (orderedKeys.indexOf(key) !== -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    return fresh;
}
function sortedKeys ( obj , orderedKeys ) { var keys = Object . keys ( obj ) . sort ( ) ; var fresh = { } ; orderedKeys . forEach ( function ( key ) { if ( keys . indexOf ( key ) === - 1 ) { return ; } fresh [ key ] = obj [ key ] ; } ) ; keys . forEach ( function ( key ) { if ( orderedKeys . indexOf ( key ) !== - 1 ) { return ; } fresh [ key ] = obj [ key ] ; } ) ; return fresh ; }
set keys in an order
set keys in an order