Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/tailscale/hujson
/ functions
Functions
134 in github.com/tailscale/hujson
⨍
Functions
134
◇
Types & classes
14
↓ 16 callers
Method
beforeExtraAt
(int)
types.go:516
↓ 14 callers
Function
Parse
Parse parses a HuJSON value as a Value. Extra and Literal values in v will alias the provided input buffer.
parse.go:24
↓ 14 callers
Function
consumeWhitespace
(b []byte)
parse.go:241
↓ 14 callers
Method
hasNewline
(checkTopLevelExtra bool)
format.go:579
↓ 12 callers
Method
afterExtra
()
types.go:517
↓ 11 callers
Method
Pack
Pack serializes the value as HuJSON. The output is valid so long as every Extra and Literal in the Value is valid. The output does not alias the memor
pack.go:51
↓ 10 callers
Method
format
(depth int, opts formatOptions)
format.go:358
↓ 9 callers
Method
IsStandard
IsStandard reports whether this is standard JSON by checking that there are no comments and no trailing commas.
standard.go:9
↓ 9 callers
Method
length
()
types.go:505
↓ 8 callers
Method
Clone
Clone returns a deep copy of the value.
types.go:141
↓ 8 callers
Method
String
String is a string representation of v.
pack.go:56
↓ 8 callers
Method
allValues
()
types.go:508
↓ 8 callers
Function
copyBytes
(b []byte)
types.go:556
↓ 7 callers
Method
lineStats
()
format.go:223
↓ 6 callers
Method
hasComment
()
standard.go:36
↓ 6 callers
Method
lastValue
()
types.go:509
↓ 6 callers
Function
newInvalidCharacterError
(prefix []byte, where string)
parse.go:268
↓ 5 callers
Method
Bool
Bool returns the value for a JSON boolean. It returns false if the literal is not a JSON boolean.
types.go:305
↓ 5 callers
Method
Kind
Kind represents each possible JSON literal kind with a single byte, which is conveniently the first byte of that kind's grammar with the restriction t
types.go:281
↓ 5 callers
Method
Kind
()
types.go:504
↓ 5 callers
Function
consumeComment
consumeComment consumes a line or block comment start in b. It returns the length of the comment if valid, otherwise it returns 0 if it is not a comme
parse.go:251
↓ 5 callers
Method
find
(s findState)
find.go:39
↓ 5 callers
Function
hasTrailingComma
(comp composite)
types.go:520
↓ 5 callers
Function
setTrailingComma
(comp composite, v bool)
types.go:526
↓ 4 callers
Method
Format
Format formats the value according to some opinionated heuristics for how HuJSON should look. The exact output may change over time. It is the equival
format.go:73
↓ 4 callers
Method
Standardize
Standardize strips any features specific to HuJSON from v, making it compliant with standard JSON per RFC 8259. All comments and trailing commas are r
standard.go:62
↓ 4 callers
Method
classifyComments
classifyComments classifies comments as belonging to the previous element or belonging to the current element such that: - b[:prevEnd] belongs to the
patch.go:424
↓ 4 callers
Method
extractTrailingcomments
extractTrailingcomments extracts trailing comments from the top of b. If readonly, then the source is not mutated.
patch.go:406
↓ 4 callers
Function
parseNext
parseNext parses the next value with surrounding whitespace and comments.
parse.go:38
↓ 3 callers
Method
Minimize
Minimize removes all whitespace, comments, and trailing commas from v, making it compliant with standard JSON per RFC 8259.
standard.go:42
↓ 3 callers
Method
UpdateOffsets
UpdateOffsets iterates through v and updates all Value.StartOffset and Value.EndOffset fields so that they are accurate.
pack.go:9
↓ 3 callers
Function
appendIndent
(b []byte, n int)
format.go:597
↓ 3 callers
Function
consumeExtra
consumeExtra consumes leading whitespace and comments.
parse.go:216
↓ 3 callers
Method
extractLeadingComments
extractLeadingComments extracts leading comments from the bottom of b. If readonly, then the source is not mutated.
patch.go:377
↓ 3 callers
Method
injectTrailingComments
injectTrailingComments injects trailing comments into the top of b.
patch.go:388
↓ 3 callers
Function
processFile
(info fs.FileInfo, filename string, in io.Reader)
cmd/hujsonfmt/hujsonfmt.go:101
↓ 2 callers
Method
All
All returns an iterator over all values in depth-first order, starting with v itself.
types.go:164
↓ 2 callers
Method
IsValid
IsValid reports whether the whitespace and comments are valid according to the HuJSON grammar.
types.go:551
↓ 2 callers
Method
Patch
TODO(dsnet): Insert/remove operations on an array has O(n) complexity where n is the length of the array. We could improve this with more clever data
patch.go:46
↓ 2 callers
Function
String
String constructs a JSON literal for string. Invalid UTF-8 is mangled with the Unicode replacement character.
types.go:213
↓ 2 callers
Method
append
(b []byte)
pack.go:60
↓ 2 callers
Method
clone
clone returns a deep copy of the value.
types.go:187
↓ 2 callers
Method
injectLeadingComments
injectLeadingComments injects leading comments into the bottom of b.
patch.go:360
↓ 2 callers
Function
insertAt
(comp composite, i int, v Value)
patch.go:340
↓ 2 callers
Method
patchAdd
(i int, op patchOperation)
patch.go:142
↓ 2 callers
Function
removeAt
(comp composite, i int)
patch.go:347
↓ 2 callers
Function
replaceAt
(comp composite, i int, v Value)
patch.go:335
↓ 1 callers
Method
Find
Find locates the value specified by the JSON pointer (see RFC 6901). It returns nil if the value does not exist or the pointer is invalid. If a JSON o
find.go:22
↓ 1 callers
Function
Format
Format formats b according to some opinionated heuristics for how HuJSON should look. The exact output may change over time. It is the equivalent of `
format.go:46
↓ 1 callers
Function
Minimize
Minimize removes all whitespace, comments, and trailing commas from b, making it compliant with standard JSON per RFC 8259. If an error is encountered
format.go:29
↓ 1 callers
Function
Standardize
Standardize strips any features specific to HuJSON from b, making it compliant with standard JSON per RFC 8259. All comments and trailing commas are r
format.go:17
↓ 1 callers
Method
String
String returns the unescaped string value for a JSON string. For other JSON kinds, this returns the raw JSON represention.
types.go:311
↓ 1 callers
Method
alignObjectValues
alignObjectValues aligns object values by inserting spaces after the name so that the values are aligned to the same column. It always returns true t
format.go:509
↓ 1 callers
Function
backupFile
( filename string, data []byte, perms fs.FileMode, )
cmd/hujsonfmt/hujsonfmt.go:220
↓ 1 callers
Function
copyAt
Preserving and moving comments is impossible to perform reasonably in all conceivable situations given that the placement of comments is more a matter
patch.go:329
↓ 1 callers
Method
equalString
(s string)
find.go:97
↓ 1 callers
Function
equalValue
(x, y Value)
patch.go:222
↓ 1 callers
Method
expandComposites
expandComposites populates needExpand with the set of composite values that need to be expanded (i.e., print each member/element on a new line). This
format.go:141
↓ 1 callers
Method
formatWhitespace
formatWhitespace mutates the AST and formats whitespace to ensure consistent indentation and expansion of objects and arrays.
format.go:259
↓ 1 callers
Method
getAt
(int)
types.go:511
↓ 1 callers
Function
hasPathPrefix
hasPathPrefix is a stricter version of strings.HasPrefix where the prefix must end on a path segment boundary.
patch.go:215
↓ 1 callers
Method
insertAt
(int, ValueTrimmed)
types.go:513
↓ 1 callers
Function
isHuJSONFile
(f fs.DirEntry)
cmd/hujsonfmt/hujsonfmt.go:97
↓ 1 callers
Method
isStandard
()
standard.go:12
↓ 1 callers
Method
length
()
types.go:374
↓ 1 callers
Method
length
()
types.go:447
↓ 1 callers
Function
lineColumn
(b []byte, n int)
parse.go:16
↓ 1 callers
Function
mainE
()
cmd/hujsonfmt/hujsonfmt.go:49
↓ 1 callers
Method
minimize
()
standard.go:46
↓ 1 callers
Method
normalize
normalize performs simple normalization changes. In particular, it: - normalizes strings, - normalizes empty objects and arrays as simply {} or [], -
format.go:98
↓ 1 callers
Function
parseNextTrimmed
parseNextTrimmed parses the next value without surrounding whitespace and comments.
parse.go:73
↓ 1 callers
Function
parsePatch
(patch []byte)
patch.go:77
↓ 1 callers
Method
patchMoveOrCopy
(i int, op patchOperation)
patch.go:182
↓ 1 callers
Method
patchRemoveOrReplace
(i int, op patchOperation)
patch.go:165
↓ 1 callers
Method
patchTest
(i int, op patchOperation)
patch.go:201
↓ 1 callers
Function
printDiff
(filename string, src, modified []byte)
cmd/hujsonfmt/hujsonfmt.go:173
↓ 1 callers
Function
processSrc
(src []byte)
cmd/hujsonfmt/hujsonfmt.go:155
↓ 1 callers
Function
readFile
(path string, in io.Reader)
cmd/hujsonfmt/hujsonfmt.go:137
↓ 1 callers
Method
removeAt
(int)
types.go:514
↓ 1 callers
Method
setAt
(int, ValueTrimmed)
types.go:512
↓ 1 callers
Method
standardize
()
standard.go:66
↓ 1 callers
Method
updateOffsets
(n int)
pack.go:12
↓ 1 callers
Function
usage
()
cmd/hujsonfmt/hujsonfmt.go:35
↓ 1 callers
Function
writeFile
(info fs.FileInfo, filename string, src, data []byte)
cmd/hujsonfmt/hujsonfmt.go:192
Function
Bool
e.g., null, false, true, "string", or 3.14159 Bool constructs a JSON literal for a boolean.
types.go:203
Function
Float
Float construct a JSON literal for a floating-point number. The values NaN, +Inf, and -Inf will be represented as a JSON string with the values "NaN",
types.go:260
Method
Float
Float returns the floating-point value for a JSON number. It returns a NaN, +Inf, or -Inf value for any JSON string with the values "NaN", "Infinity",
types.go:340
Function
Fuzz
(f *testing.F)
fuzz_test.go:15
Function
FuzzPatch
(f *testing.F)
fuzz_test.go:69
Function
Int
Int construct a JSON literal for a signed integer.
types.go:248
Method
Int
Int returns the signed integer value for a JSON number. It returns 0 if the literal is not a signed integer.
types.go:320
Method
IsStandard
IsStandard reports whether this is standard JSON whitespace.
standard.go:33
Method
IsValid
IsValid reports whether b is a valid JSON null, boolean, string, or number. The literal must not have surrounding whitespace.
types.go:297
Method
Kind
Kind reports the kind of the JSON value.
types.go:185
Method
Kind
()
types.go:430
Method
Kind
()
types.go:498
Method
Range
Range iterates through a Value in depth-first order and calls f for each value (including the root value). It stops iteration when f returns false. D
types.go:153
Function
Test
(t *testing.T)
json_test.go:280
Function
TestAll
(t *testing.T)
types_test.go:9
Function
TestFind
(t *testing.T)
find_test.go:13
next →
1–100 of 134, ranked by callers