mirror of
https://github.com/SomboChea/ui
synced 2024-11-28 00:44:30 +07:00
refactor: formatLicense to return undefined instead of null
This commit is contained in:
parent
cf1f47e86c
commit
13c7aa6d03
@ -13,9 +13,9 @@ describe('formatLicense', (): void => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should check license field for other value', (): void => {
|
test('should check license field for other value', (): void => {
|
||||||
expect(formatLicense(null)).toBeNull();
|
expect(formatLicense(null)).toBeUndefined();
|
||||||
expect(formatLicense({})).toBeNull();
|
expect(formatLicense({})).toBeUndefined();
|
||||||
expect(formatLicense([])).toBeNull();
|
expect(formatLicense([])).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
|
|||||||
*/
|
*/
|
||||||
// License should use type License defined above, but conflicts with the unit test that provide array or empty object
|
// License should use type License defined above, but conflicts with the unit test that provide array or empty object
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
export function formatLicense(license: any): string | null {
|
export function formatLicense(license: any): string | undefined {
|
||||||
if (isString(license)) {
|
if (isString(license)) {
|
||||||
return license;
|
return license;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ export function formatLicense(license: any): string | null {
|
|||||||
return license.type;
|
return license.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Repository {
|
export interface Repository {
|
||||||
|
@ -5,7 +5,7 @@ export interface PackageMetaInterface {
|
|||||||
fileCount: number;
|
fileCount: number;
|
||||||
unpackedSize: number;
|
unpackedSize: number;
|
||||||
};
|
};
|
||||||
license?: Partial<LicenseInterface> | string | null;
|
license?: Partial<LicenseInterface> | string;
|
||||||
};
|
};
|
||||||
_uplinks: {};
|
_uplinks: {};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user