1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-06-02 01:25:05 +07:00
verdaccio-ui/src/pages/Version/is-package-version-valid.ts
Priscila Oliveira f5c77ff43c fix: version Page - Replaces class by func. (#171)
* refactor: updated version page

* refactor: rollback context

* fix: added version provider
2019-10-17 07:36:41 +02:00

17 lines
502 B
TypeScript

import { PackageMetaInterface } from '../../../types/packageMeta';
function isPackageVersionValid(packageMeta: Partial<PackageMetaInterface>, packageVersion?: string): boolean {
if (!packageVersion || typeof packageVersion === 'undefined') {
// if is undefined, that means versions does not exist, we continue
return true;
}
if (packageMeta.versions) {
return Object.keys(packageMeta.versions).includes(packageVersion);
}
return false;
}
export default isPackageVersionValid;