add check that value of field is not empty in revealBitmap.ts

This commit is contained in:
turnoffthiscomputer
2024-07-29 23:15:31 +02:00
parent d71613378d
commit c0a8805d3d

View File

@@ -1,10 +1,10 @@
import { attributeToPosition } from "../constants/constants";
export function revealBitmapFromMapping(attributeToReveal: { [key: string]: boolean }): string[] {
export function revealBitmapFromMapping(attributeToReveal: { [key: string]: string }): string[] {
const reveal_bitmap = Array(90).fill('0');
Object.entries(attributeToReveal).forEach(([attribute, reveal]) => {
if (reveal) {
if (reveal !== "") {
const [start, end] = attributeToPosition[attribute as keyof typeof attributeToPosition];
reveal_bitmap.fill('1', start, end + 1);
}