0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/packages/api/src/utils.ts

24 lines
582 B
TypeScript
Raw Normal View History

import { Package } from '@verdaccio/types';
2020-03-03 17:59:19 -05:00
import _ from 'lodash';
/**
* Check whether the package metadta has enough data to be published
* @param pkg metadata
*/
export function isPublishablePackage(pkg: Package): boolean {
const keys: string[] = Object.keys(pkg);
2020-03-03 17:59:19 -05:00
return _.includes(keys, 'versions');
2020-03-03 17:59:19 -05:00
}
export function isRelatedToDeprecation(pkgInfo: Package): boolean {
const { versions } = pkgInfo;
for (const version in versions) {
if (Object.prototype.hasOwnProperty.call(versions[version], 'deprecated')) {
return true;
}
}
return false;
}