From 4601a45557200521ca882554e1c125409ff28f75 Mon Sep 17 00:00:00 2001 From: Chris O'Hara Date: Fri, 7 Oct 2022 13:17:48 +1000 Subject: [PATCH] Add method to get how many tokenizer bytes are remaining (#126) --- json/token.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/json/token.go b/json/token.go index 652e36d..b9f46ae 100644 --- a/json/token.go +++ b/json/token.go @@ -302,6 +302,11 @@ func (t *Tokenizer) String() []byte { return s } +// Remaining returns the number of bytes left to parse. +func (t *Tokenizer) Remaining() int { + return len(t.json) +} + // RawValue represents a raw json value, it is intended to carry null, true, // false, number, and string values only. type RawValue []byte