All files / src/crud-to-cas util.ts

87.5% Statements 7/8
0% Branches 0/1
100% Functions 1/1
100% Lines 6/6

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 10    2x 74x 74x 74x 74x 74x    
import type { FsLocation } from '../fsa-to-node/types';
 
export const hashToLocation = (hash: string): FsLocation => {
  Iif (hash.length < 20) throw new TypeError('Hash is too short');
  const lastTwo = hash.slice(-2);
  const twoBeforeLastTwo = hash.slice(-4, -2);
  const folder = [lastTwo, twoBeforeLastTwo];
  return [folder, hash];
};