The current version of binary-parser has a type-coercion problem where an offset of 0 will incorrectly be rejected by .pointer. It's caused by this block which coerces offset=0 into false.
if (!options.offset) {
throw new Error("offset is required for pointer.");
}
This PR simply replaces that check with one that accepts 0 but rejects both undefined and null (undefined == null = true)
The current version of
binary-parser
has a type-coercion problem where an offset of 0 will incorrectly be rejected by.pointer
. It's caused by this block which coercesoffset=0
into false.This PR simply replaces that check with one that accepts 0 but rejects both
undefined
andnull
(undefined == null
=true
)