Skip to content

Commit bb7433c

Browse files
committed
feat(to/from): skip struct values if wasm tag is "-"
1 parent 72a2a03 commit bb7433c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

wasm/reflect_from.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ func decodeObjectIntoStruct(x js.Value, v reflect.Value) error {
224224
tagName, tagOK := fieldType.Tag.Lookup("wasm")
225225

226226
if tagOK {
227+
if tagName == "-" {
228+
continue
229+
}
227230
name = tagName
228231
}
229232

wasm/reflect_to.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ func structToJSObject(x reflect.Value) js.Value {
154154

155155
name := field.Name
156156
if tagName, ok := field.Tag.Lookup("wasm"); ok {
157+
if tagName == "-" {
158+
continue
159+
}
157160
name = tagName
158161
}
159162

0 commit comments

Comments
 (0)