/**
 * Remove `prefix` from `text`.
 */ const removePrefixFromPackageName = ( prefixList , packageName ) => { for ( let i = 0 ; i < prefixList . length ; i ++ ) { const prefix = prefixList [ i ] ; if ( packageName . charAt ( 0 ) === "@" ) { const [ namespace , name ] = packageName . split ( "/" ) ; if ( name . startsWith ( prefix ) ) { return `${ namespace }/${ name . slice ( prefix . length ) }` ; } } else if ( packageName . startsWith ( prefix ) ) { return packageName . slice ( prefix . length ) ; } } return packageName ; } ; param { string } prefix param { string } name returns { string } const createFullPackageName = ( prefix , name ) => { if ( name . charAt ( 0 ) === "@" ) { const scopedPackageNameRegex = new RegExp ( `^${ prefix }(-|$)` ) ; if ( ! scopedPackageNameRegex . test ( name . split ( "/" ) [ 1 ] ) ) { return name . replace ( /^@([^/]+)\/(.*)$/ , `@$1/${ prefix }$2` ) ; } } return `${ prefix }${ name }` ; } ; export { createFullPackageName , removePrefixFromPackageName } ;