ssbc / bipf

Binary json codec optimized for in-place access
MIT License
48 stars 9 forks source link

add isIdempotent() and markIdempotent() #41

Closed staltz closed 2 years ago

staltz commented 2 years ago

We shouldn't use _IS_BIPF_ENCODED, that's an internal implementation detail. Instead, here's isIdempotent(), and another nice util markIdempotent() which takes a ready-encoded bipf buffer and tags it.

I also fixed the return value of encodeIdempotent(). It was wrong (compare e.g. with what the readme promised), it should return a length just like encode() returns.