MCPcopy Create free account
hub / github.com/chain/Core / Array

Function Array

net/http/httpjson/io.go:52–57  ·  view source on GitHub ↗

Array returns an empty JSON array if v is a nil slice, so that it renders as "[]" rather than "null". Otherwise, it returns v.

(v interface{})

Source from the content-addressed store, hash-verified

50// so that it renders as "[]" rather than "null".
51// Otherwise, it returns v.
52func Array(v interface{}) interface{} {
53 if rv := reflect.ValueOf(v); rv.Kind() == reflect.Slice && rv.IsNil() {
54 v = []struct{}{}
55 }
56 return v
57}

Callers 3

signBatchMethod · 0.85
WriteFunction · 0.85
jquery.min.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected