MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / isJSONObject

Function isJSONObject

base/util.go:1396–1404  ·  view source on GitHub ↗

isJSONObject checks if the given bytes are a JSON object, and also whether it's an empty object or not.

(b []byte)

Source from the content-addressed store, hash-verified

1394// isJSONObject checks if the given bytes are a JSON object,
1395// and also whether it's an empty object or not.
1396func isJSONObject(b []byte) (isJSONObject, isEmpty bool) {
1397
1398 // Check if the byte slice starts with { and ends with }
1399 if len(b) < 2 || b[0] != 0x7b || b[len(b)-1] != 0x7d {
1400 return false, false
1401 }
1402
1403 return true, len(b) == 2
1404}
1405
1406// injectJSONPropertyFromBytes injects val under the given key into b.
1407func injectJSONPropertyFromBytes(b []byte, bIsEmpty bool, kvPairs []KVPairBytes) (newJSON []byte) {

Callers 2

InjectJSONPropertiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected