mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-08-10 16:05:20 +02:00
feat(new tool): phone parser and normalizer
This commit is contained in:
parent
3f6c8f0edd
commit
ce3150c65d
10 changed files with 357 additions and 140 deletions
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue