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
Paola Morales 14159b31e1 ref: refactor utils methods (#2076)
* ref: Relocate utils functions to web pkg

* ref: Refactor utils functions

* ref: Relocate utils functions to api pkg

* ref: Relocate utils functions to config pkg

* ref: Relocate utils functions to middleware pkg

* ref: Relocate utils functions to storage pkg

* ref: relocate utils functions to proxy pkg

* ref: relocate utils functions to middleware pkg

* ref: refactor utils functions

* Fix compilation errors
2021-04-09 17:54:36 +02:00

23 lines
582 B
TypeScript

import { Package } from '@verdaccio/types';
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);
return _.includes(keys, 'versions');
}
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;
}