remove some useless checks from event json.

This commit is contained in:
fiatjaf
2024-08-13 22:01:27 -03:00
parent e781c1be8f
commit 894a98b98b

View File

@@ -66,15 +66,11 @@ func easyjsonF642ad3eDecodeGithubComNbdWtfGoNostr(in *jlexer.Lexer, out *Event)
v1 = nil v1 = nil
} else { } else {
in.Delim('[') in.Delim('[')
if v1 == nil {
if !in.IsDelim(']') { if !in.IsDelim(']') {
v1 = make(Tag, 0, 5) v1 = make(Tag, 0, 5)
} else { } else {
v1 = Tag{} v1 = Tag{}
} }
} else {
v1 = (v1)[:0]
}
for !in.IsDelim(']') { for !in.IsDelim(']') {
var v2 string var v2 string
v2 = string(in.String()) v2 = string(in.String())
@@ -134,17 +130,11 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
{ {
const prefix string = ",\"tags\":" const prefix string = ",\"tags\":"
out.RawString(prefix) out.RawString(prefix)
if in.Tags == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[') out.RawByte('[')
for v3, v4 := range in.Tags { for v3, v4 := range in.Tags {
if v3 > 0 { if v3 > 0 {
out.RawByte(',') out.RawByte(',')
} }
if v4 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[') out.RawByte('[')
for v5, v6 := range v4 { for v5, v6 := range v4 {
if v5 > 0 { if v5 > 0 {
@@ -154,10 +144,8 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
} }
out.RawByte(']') out.RawByte(']')
} }
}
out.RawByte(']') out.RawByte(']')
} }
}
{ {
const prefix string = ",\"content\":" const prefix string = ",\"content\":"
out.RawString(prefix) out.RawString(prefix)