query-registry
Version:
Query the npm registry for packuments, manifests, packages and download counts
19 lines (15 loc) • 486 B
JavaScript
/**
* `getUntypedName` returns the name of the normal package
* corresponding to a DefinitelyTyped package.
*/
function getUntypedName({
name
}) {
if (!name.startsWith('@types/')) {
return undefined;
} // ['foo', undefined] or ['@bar', 'baz']
const [scopeOrName, scopedName] = name.replace('@types/', '').split('__');
return scopedName ? `@${scopeOrName}/${scopedName}` : scopeOrName;
}
export { getUntypedName };
//# sourceMappingURL=get-untyped-name.esm.js.map