// A replacer function to be used with JSON.stringify.
// It sorts the keys of an object so that they are traversed by `JSON.stringify` in the canonical order.
function replacer(_key, value) {
    if (typeof value !== 'object' || value === null || Array.isArray(value)) {
        return value;
    }
    // `value` is an object
    const sortedObj = {};
    Object.keys(value)
        .sort()
        .forEach((key) => {
        sortedObj[key] = value[key];
    });
    return sortedObj;
}
// export so that it can be used in tests
export function stableJSONStringify_fast(value) {
    return JSON.stringify(value, replacer);
}
//# sourceMappingURL=fast.js.map