Js regular, matching the second @ character of'@ group/package@version''

find a rule, the requirement is like this

const str = "@group/package@version";
const reg = /____/; // 
const arr = str.split(reg); //  ["@group/package", "version"]
Nov.29,2021


<h3></h3>
/**
 * 
 * @param {String} _package 4
 */
function _split(_package) {
    // 4
    // 1'smash-cli'              => arr = [ 'smash-cli' ]
    // 2'smash-cli@1.0.0'        => arr = [ 'smash-cli', '1.0.0' ]
    // 3'@erye/smash-cli'        => arr = [ '', 'erye/smash-cli' ]
    // 4'@erye/smash-cli@1.0.0'  => arr = [ '', 'erye/smash-cli', '1.0.0' ]
    const arr = _package.split('@');
    if (arr[0] == '') {        //  34
        arr[1] = '@' + arr[1]; //  @ 
        arr.shift();           // 
    }

    return { name: arr[0], version: arr[1] };
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47d0a-44c62.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47d0a-44c62.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?