All files / src/helpers cryptoSuite.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9          56x 28x    
export function cryptoSuiteToType (cryptoSuite: string): string {
  // transform kebab-case to camelCase and capitalize first char to fall back to legacy name
  // NOTE: this might be a bit naive but works in the case of MerkleProof2019 which at this time
  // is the only implementation
  // A better approach could be to use a map, but it can be tedious
  cryptoSuite = cryptoSuite.replace(/-./g, x => x[1].toUpperCase());
  return cryptoSuite.charAt(0).toUpperCase() + cryptoSuite.slice(1);
}