Skip to content

Commit 30f3cb1

Browse files
committed
docs: typeof function extension table
1 parent 8cd8a86 commit 30f3cb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/functions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ $.categories[?typeof(@.length) == 'number']
107107

108108
`type()` is and alias for `typeof()`.
109109

110+
`jsonpath.function_extensions.TypeOf` takes a `single_number_type` argument, which controls the behavior of `typeof()` when given and int or float. By default, `single_number_type` is `True` and `"number"` is returned. Register a new instance of `TypeOf` with a `JSONPathEnvironment` with `single_number_type` set to `False` and `"int"` and `"float"` will be returned when given integers and floats, respectively.
111+
112+
| instance | type string |
113+
| --------------------- | ------------------------------------------------------ |
114+
| UNDEFINED | "undefined" |
115+
| None | "null" |
116+
| str | "string" |
117+
| Sequence (array-like) | "array" |
118+
| Mapping (dict-like) | "object" |
119+
| bool | "boolean" |
120+
| int | "number" or "int" if `single_number_type` is `False` |
121+
| float | "number" or "float" if `single_number_type` is `False` |
122+
110123
## `value()`
111124

112125
```

0 commit comments

Comments
 (0)