Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function packer(itemTag) {
switch (contentCodes.definition(itemTag).type) {
case contentCodes.type.long:
return binary.packLong;
case contentCodes.type.int:
return binary.packInt;
case contentCodes.type.short:
return binary.packShort;
case contentCodes.type.byte:
return binary.packByte;
case contentCodes.type.version:
return binary.packVersion;
case contentCodes.type.date:
return binary.packDate;
case contentCodes.type.string:
return binary.packString;
case contentCodes.type.list:
return function(list, buffer, index) {
var ptr = index;
list.forEach(function(child) {
encode(child, buffer, ptr);
ptr += encodedLength(child);;
});
return buffer;
};
}