Skip to content

Commit

Permalink
slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Jun 11, 2024
1 parent b166566 commit 9a96ae2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/utils/src/__tests__/getHash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ describe('getHash', () => {
});

test('length', async () => {
expect(await getHash('foo', 3)).toHaveLength(3);
expect(await getHash('foo', 2)).toHaveLength(2);
});
});
2 changes: 1 addition & 1 deletion packages/utils/src/core/getHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ async function sha256(message: string): Promise<string | undefined> {
}

export async function getHash(str: string, length?: number): Promise<string> {
return ((await sha256(str)) || '').slice(length);
return ((await sha256(str)) || '').slice(0, length);
}

0 comments on commit 9a96ae2

Please sign in to comment.