MCPcopy Create free account
hub / github.com/mapbox/pbf / readTypeNotString

Function readTypeNotString

test/fixtures/type_string.js:24–34  ·  view source on GitHub ↗
(pbf, end)

Source from the content-addressed store, hash-verified

22}
23
24export function readTypeNotString(pbf, end) {
25 const obj = {int: 0, long: 0, boolVal: false, float: 0};
26 let field;
27 while ((field = pbf.nextField(end))) {
28 if (field === 1) obj.int = pbf.readVarint(true);
29 else if (field === 2) obj.long = pbf.readVarint(true);
30 else if (field === 3) obj.boolVal = pbf.readBoolean();
31 else if (field === 4) obj.float = pbf.readFloat();
32 }
33 return obj;
34}
35export function writeTypeNotString(obj, pbf) {
36 if (obj.int) pbf.writeVarintField(1, obj.int);
37 if (obj.long) pbf.writeVarintField(2, obj.long);

Callers 1

compile.test.jsFile · 0.85

Calls 4

nextFieldMethod · 0.80
readVarintMethod · 0.80
readBooleanMethod · 0.80
readFloatMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…