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

Function getDefaultWriteTest

compile.js:298–307  ·  view source on GitHub ↗
(ctx, field)

Source from the content-addressed store, hash-verified

296}
297
298function getDefaultWriteTest(ctx, field) {
299 const def = ctx._defaults[field.name];
300 let code = ` if (obj.${field.name}`;
301
302 if (!field.repeated && !getSubMessage(ctx, field)) {
303 if (def === undefined || def || field.oneof) code += ' != null';
304 if (def) code += ` && obj.${field.name} !== ${JSON.stringify(def)}`;
305 }
306 return `${code}) `;
307}
308
309function isPacked(field) {
310 return field.options.packed === 'true';

Callers 1

compileFieldWriteLineFunction · 0.85

Calls 1

getSubMessageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…