summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx15
1 files changed, 15 insertions, 0 deletions
diff --git a/jq.pyx b/jq.pyx
index 520e21c..229faa4 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -138,6 +138,16 @@ cdef class _Program(object):
def __repr__(self):
return "jq.compile({!r})".format(self.program_string)
+ # Support the 0.1.x API for backwards compatibility
+ def transform(self, value=_NO_VALUE, text=_NO_VALUE, text_output=False, multiple_output=False):
+ program_with_input = self.input(value, text=text)
+ if text_output:
+ return program_with_input.text()
+ elif multiple_output:
+ return program_with_input.all()
+ else:
+ return program_with_input.first()
+
cdef class _ProgramWithInput(object):
cdef object _program_bytes
@@ -226,3 +236,8 @@ cdef class _ResultIterator(object):
raise ValueError(u"parse error: " + message)
else:
raise StopIteration()
+
+
+# Support the 0.1.x API for backwards compatibility
+def jq(object program):
+ return compile(program)