Skip to content

Commit 5a1fb34

Browse files
committed
add MustCompile
1 parent 46faf33 commit 5a1fb34

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

jsonpath.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ type step struct {
3232
args interface{}
3333
}
3434

35+
func MustCompile(jpath string) *Compiled {
36+
c, err := Compile(jpath)
37+
if err != nil {
38+
panic(err)
39+
}
40+
return c
41+
}
42+
3543
func Compile(jpath string) (*Compiled, error) {
3644
tokens, err := tokenize(jpath)
3745
if err != nil {

0 commit comments

Comments
 (0)