feat(new tool): phone parser and normalizer

This commit is contained in:
Corentin Thomasset authored and Corentin THOMASSET committed 2023-05-02 13:57:39 +02:00
1 parent 3f6c8f0edd
commit ce3150c65d
10 files changed
+357 -140

No files matched your search

+8 -1
View File
@@ -1,6 +1,6 @@
import _ from 'lodash';
import { describe, expect, it } from 'vitest';
import { isNotThrowing } from './boolean';
import { booleanToHumanReadable, isNotThrowing } from './boolean';
describe('boolean utils', () => {
describe('isNotThrowing', () => {
@@ -13,4 +13,11 @@ describe('boolean utils', () => {
).to.eql(false);
});
});
describe('booleanToHumanReadable', () => {
it('should return "Yes" if the value is true and "No" otherwise', () => {
expect(booleanToHumanReadable(true)).to.eql('Yes');
expect(booleanToHumanReadable(false)).to.eql('No');
});
});
});
+5 -1
View File
@@ -1,4 +1,4 @@
export { isNotThrowing };
export { isNotThrowing, booleanToHumanReadable };
function isNotThrowing(cb: () => unknown): boolean {
try {
@@ -8,3 +8,7 @@ function isNotThrowing(cb: () => unknown): boolean {
return false;
}
}
function booleanToHumanReadable(value: boolean): string {
return value ? 'Yes' : 'No';
}