summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx21
1 files changed, 20 insertions, 1 deletions
diff --git a/jq.pyx b/jq.pyx
index 229faa4..f1c6a48 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -174,7 +174,7 @@ cdef class _ProgramWithInput(object):
return list(self)
def first(self):
- return next(iter(self))
+ return next(_iter(self))
cdef class _ResultIterator(object):
@@ -238,6 +238,25 @@ cdef class _ResultIterator(object):
raise StopIteration()
+def all(program, value=_NO_VALUE, text=_NO_VALUE):
+ return compile(program).input(value, text=text).all()
+
+
+def first(program, value=_NO_VALUE, text=_NO_VALUE):
+ return compile(program).input(value, text=text).first()
+
+
+_iter = iter
+
+
+def iter(program, value=_NO_VALUE, text=_NO_VALUE):
+ return _iter(compile(program).input(value, text=text))
+
+
+def text(program, value=_NO_VALUE, text=_NO_VALUE):
+ return compile(program).input(value, text=text).text()
+
+
# Support the 0.1.x API for backwards compatibility
def jq(object program):
return compile(program)