UNPKG

486 BJavaScriptView Raw
1/**
2 * `getUntypedName` returns the name of the normal package
3 * corresponding to a DefinitelyTyped package.
4 */
5function getUntypedName({
6 name
7}) {
8 if (!name.startsWith('@types/')) {
9 return undefined;
10 } // ['foo', undefined] or ['@bar', 'baz']
11
12
13 const [scopeOrName, scopedName] = name.replace('@types/', '').split('__');
14 return scopedName ? `@${scopeOrName}/${scopedName}` : scopeOrName;
15}
16
17export { getUntypedName };
18//# sourceMappingURL=get-untyped-name.esm.js.map