lambda-live-debugger
Version:
Debug Lambda functions locally like it is running in the cloud
16 lines (15 loc) • 582 B
JavaScript
import { PRIORITY_ORDER_ALGORITHMS } from "./types";
export const getChecksumAlgorithmListForResponse = (responseAlgorithms = []) => {
const validChecksumAlgorithms = [];
let i = PRIORITY_ORDER_ALGORITHMS.length;
for (const algorithm of responseAlgorithms) {
const priority = PRIORITY_ORDER_ALGORITHMS.indexOf(algorithm);
if (priority !== -1) {
validChecksumAlgorithms[priority] = algorithm;
}
else {
validChecksumAlgorithms[i++] = algorithm;
}
}
return validChecksumAlgorithms.filter(Boolean);
};