@pretty modifier makes the json look nice.
(json, arg string)
| 2971 | |
| 2972 | // @pretty modifier makes the json look nice. |
| 2973 | func modPretty(json, arg string) string { |
| 2974 | if len(arg) > 0 { |
| 2975 | opts := *pretty.DefaultOptions |
| 2976 | Parse(arg).ForEach(func(key, value Result) bool { |
| 2977 | switch key.String() { |
| 2978 | case "sortKeys": |
| 2979 | opts.SortKeys = value.Bool() |
| 2980 | case "indent": |
| 2981 | opts.Indent = cleanWS(value.String()) |
| 2982 | case "prefix": |
| 2983 | opts.Prefix = cleanWS(value.String()) |
| 2984 | case "width": |
| 2985 | opts.Width = int(value.Int()) |
| 2986 | } |
| 2987 | return true |
| 2988 | }) |
| 2989 | return bytesString(pretty.PrettyOptions(stringBytes(json), &opts)) |
| 2990 | } |
| 2991 | return bytesString(pretty.Pretty(stringBytes(json))) |
| 2992 | } |
| 2993 | |
| 2994 | // @this returns the current element. Can be used to retrieve the root element. |
| 2995 | func modThis(json, arg string) string { |
nothing calls this directly
no test coverage detected
searching dependent graphs…