From 826e8967a280af64e0bcabe5d178243a28a6ce9c Mon Sep 17 00:00:00 2001 From: David Allemang Date: Thu, 9 Jul 2026 21:13:18 -0400 Subject: [PATCH] multipart resolver type coercion --- src/blockstate.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/blockstate.js b/src/blockstate.js index 7cb091e6..627e6296 100644 --- a/src/blockstate.js +++ b/src/blockstate.js @@ -26,16 +26,18 @@ function evaluateWhen(properties, condition) { for (const [key, val] of Object.entries(condition)) { if (key === 'OR' || key === 'AND') continue; - const prop = properties[key]; - if (typeof val === 'string' && val.includes('|')) { - if (!val.split('|').includes(prop)) return false; - } else if (prop !== val.toString()) { + + const prop = properties[key] !== undefined ? String(properties[key]) : undefined; + const strVal = String(val); + + if (strVal.includes('|')) { + if (!strVal.split('|').includes(prop)) return false; + } else if (prop !== strVal) { return false; } } return true; } - export class Blockstate { constructor(json) { this.variants = json.variants;