精简空内容时的url链接

This commit is contained in:
枫谷剑仙 2020-10-16 01:14:34 +08:00
parent a0607f03c9
commit 69bcf4ec22
2 changed files with 17 additions and 2 deletions

View File

@ -54,6 +54,20 @@ Number.prototype.PrefixInteger = function(length)
{
return (Array(length).join('0') + this).slice(-length);
}
//数组删除自己尾部的空元素
Array.prototype.DeleteLatter = function(item = null)
{
let index = this.length - 1;
for (; index>=0; index--)
{
if (this[index] !== item)
{
break;
}
}
this.splice(index + 1);
return this;
}
//▼ADPCM播放相关来自 https://github.com/jy4340132/aaa
const pcmMemory = new WebAssembly.Memory({initial: 256, maximum: 256});

View File

@ -129,6 +129,7 @@ var Member = function() {
};
Member.prototype.outObj = function() {
const m = this;
if (m.id == 0) return null;
let obj = [m.id];
if (m.level != undefined) obj[1] = m.level;
if (m.awoken != undefined) obj[2] = m.awoken;
@ -254,10 +255,10 @@ Formation.prototype.outObj = function() {
const teamArr = [];
teamArr[0] = t[0].map(m =>
m.outObj()
);
).DeleteLatter();
teamArr[1] = t[1].map(m =>
m.outObj()
);
).DeleteLatter();
if (t[2]) teamArr[2] = t[2];
return teamArr;
});