UNPKG

@nodesecure/mama

Version:
15 lines 410 B
// CONSTANTS const kPackageSpecRegex = /^(?:@([^/]+)\/)?.+?(?:@(.+))?$/; export function parseNpmSpec(spec) { const match = spec.match(kPackageSpecRegex); if (!match) { return null; } return { org: match[1] || null, name: match[2] ? spec.replace(`@${match[2]}`, "") : spec, semver: match[2] || null, spec }; } //# sourceMappingURL=parseNpmSpec.js.map