This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/cronjob/node_modules/@smithy/protocol-http/dist-es/Fields.js

20 lines
546 B
JavaScript
Raw Permalink Normal View History

2024-05-26 22:54:55 +02:00
export class Fields {
constructor({ fields = [], encoding = "utf-8" }) {
this.entries = {};
fields.forEach(this.setField.bind(this));
this.encoding = encoding;
}
setField(field) {
this.entries[field.name.toLowerCase()] = field;
}
getField(name) {
return this.entries[name.toLowerCase()];
}
removeField(name) {
delete this.entries[name.toLowerCase()];
}
getByType(kind) {
return Object.values(this.entries).filter((field) => field.kind === kind);
}
}