Files
pnpm/src/encodePkgId.ts
Zoltan Kochan 715c82706e fix: node id should always be reliably splittable to package IDs
The > symbol is used to delimit package IDs in the Node ID.

The % and > symbols are encoded in package IDs.

ref https://github.com/pnpm/pnpm/issues/986
2018-01-11 09:41:34 +02:00

9 lines
382 B
TypeScript

import replaceString = require('replace-string')
// The only reason package IDs are encoded is to avoid '>' signs.
// Otherwise, it would be impossible to split the node ID back to package IDs reliably.
// See issue https://github.com/pnpm/pnpm/issues/986
export default function encodePkgId (pkgId: string) {
return replaceString(replaceString(pkgId, '%', '%25'), '>', '%3E')
}