mirror of
https://github.com/esiur/esiur-js.git
synced 2026-04-03 21:48:21 +00:00
Enum
This commit is contained in:
@@ -135,16 +135,16 @@ export default class DataSerializer {
|
||||
return new DataSerializerComposeResults(
|
||||
TransmissionTypeIdentifier.Null, new DC(0));
|
||||
|
||||
var cts = template.constants.where((x) => x.value == value);
|
||||
var cts = template.constants.filter((x) => x.value == value);
|
||||
|
||||
if (cts.isEmpty)
|
||||
if (cts.length == 0)
|
||||
return new DataSerializerComposeResults(
|
||||
TransmissionTypeIdentifier.Null, new DC(0));
|
||||
|
||||
var rt = BinaryList();
|
||||
|
||||
rt.addGuid(template.classId);
|
||||
rt.addUint8(cts.first.index);
|
||||
rt.addUint8(cts[0].index);
|
||||
|
||||
return new DataSerializerComposeResults(
|
||||
TransmissionTypeIdentifier.Enum, rt.toDC());
|
||||
|
||||
@@ -132,6 +132,13 @@ export default class KeyList
|
||||
this.removeAt(0);
|
||||
}
|
||||
|
||||
first(selector) {
|
||||
for(let v of this.values)
|
||||
if (selector(v))
|
||||
return v;
|
||||
return null;
|
||||
}
|
||||
|
||||
filter(selector)
|
||||
{
|
||||
if (selector instanceof Function){
|
||||
|
||||
Reference in New Issue
Block a user