in packages/dynamodb-auto-marshaller/src/Marshaller.ts [333:352]
private marshallSet(arg: Set<any>): AttributeValue|undefined {
switch (getSetType(arg[Symbol.iterator]().next().value)) {
case 'binary':
return this.collectSet(arg, isBinaryEmpty, 'BS', 'binary');
case 'number':
return this.collectSet(arg, isNumberEmpty, 'NS', 'number', stringifyNumber);
case 'string':
return this.collectSet(arg, isStringEmpty, 'SS', 'string');
case 'unknown':
if (this.onInvalid === 'throw') {
throw new Error('Sets must be composed of strings,' +
' binary values, or numbers');
}
return undefined;
case 'undefined':
if (this.onEmpty === 'nullify') {
return {NULL: true};
}
}
}