MCPcopy Create free account
hub / github.com/atripati/ark / simplifyUser

Function simplifyUser

pkg/tools/github.go:989–1007  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

987}
988
989func simplifyUser(raw string) (string, error) {
990 var u map[string]interface{}
991 if err := json.Unmarshal([]byte(raw), &u); err != nil {
992 return raw, nil
993 }
994
995 simple := stripNulls(map[string]interface{}{
996 "login": u["login"],
997 "name": u["name"],
998 "bio": u["bio"],
999 "public_repos": u["public_repos"],
1000 "followers": u["followers"],
1001 "following": u["following"],
1002 "url": u["html_url"],
1003 })
1004
1005 out, _ := json.Marshal(simple)
1006 return string(out), nil
1007}
1008func stripNulls(m map[string]interface{}) map[string]interface{} {
1009 clean := make(map[string]interface{}, len(m))
1010 for k, v := range m {

Callers 1

getUserMethod · 0.85

Calls 1

stripNullsFunction · 0.85

Tested by

no test coverage detected