feat: initial commit
This commit is contained in:
commit
a161b86c9a
705 changed files with 288162 additions and 0 deletions
21
vendor/sourcery.dny.nu/pana/internal/json/json.go
vendored
Normal file
21
vendor/sourcery.dny.nu/pana/internal/json/json.go
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package json
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type RawMessage = json.RawMessage
|
||||
|
||||
func GetContextDocument(doc RawMessage) (RawMessage, error) {
|
||||
var check struct {
|
||||
Context RawMessage `json:"@context,omitempty"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(doc, &check); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if check.Context != nil {
|
||||
return check.Context, nil
|
||||
}
|
||||
|
||||
return doc, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue