@codeplaydata/datasus
Version:
This application decompress the datasus micro data and serve as a gateway class.
23 lines (22 loc) • 566 B
JavaScript
// @filename: StringCriteria.ts
/**
* Criteria that matches when a record's property equals an expected string.
*/
export class StringCriteria {
str;
objProp;
name;
/**
* @param str Expected value.
* @param objProp Record property to compare.
*/
constructor(str, objProp) {
this.str = str;
this.objProp = objProp;
this.name = objProp + '_FILTER';
}
/** Returns true if item[objProp] strictly equals the expected string. */
match(item) {
return item[this.objProp] === this.str;
}
}