This commit is contained in:
parent
255d56d167
commit
0147c599a8
|
@ -209,7 +209,7 @@ func simplifyCardFromString(card microsub.Card, value string) (microsub.Card, bo
|
|||
return card, false
|
||||
}
|
||||
|
||||
func simplifyCardFromProperties(card microsub.Card, properties map[string]interface{}) (microsub.Card, bool) {
|
||||
func simplifyCardFromProperties2(card *microsub.Card, properties map[string]interface{}) {
|
||||
for ik, vk := range properties {
|
||||
if arr, ok := vk.([]interface{}); ok {
|
||||
if p, ok := arr[0].(string); ok {
|
||||
|
@ -236,6 +236,25 @@ func simplifyCardFromProperties(card microsub.Card, properties map[string]interf
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func simplifyCardFromProperties(card microsub.Card, hcard map[string]interface{}) (microsub.Card, bool) {
|
||||
for ik, vk := range hcard {
|
||||
if arr, ok := vk.([]interface{}); ok {
|
||||
switch ik {
|
||||
case "type":
|
||||
if p, ok := arr[0].(string); ok {
|
||||
card.Type = p[2:]
|
||||
}
|
||||
case "properties":
|
||||
if p, ok := arr[0].(map[string]interface{}); ok {
|
||||
simplifyCardFromProperties2(&card, p)
|
||||
}
|
||||
default:
|
||||
log.Printf("In simplifyCardFromProperties: unknown property %q with value %q\n", ik, arr[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return card, true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user