mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
17 lines
477 B
JavaScript
17 lines
477 B
JavaScript
function operator(proxies) {
|
|
const counter = {};
|
|
const increment = {};
|
|
proxies.forEach((p) => {
|
|
if (typeof counter[p.name] === 'undefined') counter[p.name] = 1;
|
|
else counter[p.name]++;
|
|
});
|
|
return proxies.map((p) => {
|
|
if (counter[p.name] > 1) {
|
|
if (typeof increment[p.name] === "undefined") increment[p.name] = 1;
|
|
const num = "00000" + increment[p.name]++;
|
|
p.name = p.name + " " + num.substr(num.length - 2);
|
|
}
|
|
return p;
|
|
});
|
|
}
|