Added two examples for script operators

This commit is contained in:
Peng-YM
2020-09-20 09:56:40 +08:00
parent 32703deb2c
commit fac377735d
2 changed files with 73 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ function operator(proxies) {
const counter = {};
return proxies.map(p => {
if (!counter[p.name]) counter[p.name] = 0;
p.name = p.name + " " + (++counter[p.name]).toString();
const num = "00000" + counter[p.name];
p.name = p.name + " " + num.substr(num.length-2);
counter[p.name]++;
return p;
});
}