{"_id":"@emdzej/ncsx-property-formulas","_rev":"6-5050284032d005509dc2c82fa3dc325f","name":"@emdzej/ncsx-property-formulas","dist-tags":{"latest":"0.9.0"},"versions":{"0.4.0":{"name":"@emdzej/ncsx-property-formulas","version":"0.4.0","_id":"@emdzej/ncsx-property-formulas@0.4.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/ncsx#readme","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"dist":{"shasum":"e1cbdee91d36c16d0eb1a49c144ebc1f4cbabf76","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.4.0.tgz","fileCount":19,"integrity":"sha512-qd7gQUSHnGJeXtOzr/74u9QeBbsFVH7lmgfoT2/KiY+9wdg30zXxFmhYUfbu/n37VN4qUchc+v9OTKjm0xSu/w==","signatures":[{"sig":"MEUCIQDaoRnCVcsO8ChP7HBmJ41UkPNtmLPCySZFJMV/wNiEuAIgW3XdxqPJvhUFBZIoaU+3Zas/nVKvRe7gT61IwXugnIU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122190},"main":"dist/index.js","type":"module","_from":"file:emdzej-ncsx-property-formulas-0.4.0.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/6d046c7902eddcbe430ee276d2a8a00d/emdzej-ncsx-property-formulas-0.4.0.tgz","_integrity":"sha512-qd7gQUSHnGJeXtOzr/74u9QeBbsFVH7lmgfoT2/KiY+9wdg30zXxFmhYUfbu/n37VN4qUchc+v9OTKjm0xSu/w==","repository":{"url":"git+https://github.com/emdzej/ncsx.git","type":"git","directory":"packages/property-formulas"},"_npmVersion":"11.14.1","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/ncsx-property-formulas_0.4.0_1779705621913_0.955402932283701","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@emdzej/ncsx-property-formulas","version":"0.5.1","_id":"@emdzej/ncsx-property-formulas@0.5.1","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/ncsx#readme","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"dist":{"shasum":"be4092b5ef36ce15e5986e8c2e6025d154424a4b","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.5.1.tgz","fileCount":19,"integrity":"sha512-sn/QNd4vEHL8EEVS3cHYrCaqz+LJeB6xyG49CpcaghvLyUbm8lRxSSHBipGy/rqSoCuLdVnt3usxA+aTKL4Pqw==","signatures":[{"sig":"MEQCIGBnZx2U5E0BSlDSDpqHP0rNT/3roUT0/VODq803yvFGAiBI//RUpaVmtk1J31ACEe5Eh3Dsgo3n1OG2/bN95VduTg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122190},"main":"dist/index.js","type":"module","_from":"file:emdzej-ncsx-property-formulas-0.5.1.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/d31bc46c133f540f177ecd8e2d311d30/emdzej-ncsx-property-formulas-0.5.1.tgz","_integrity":"sha512-sn/QNd4vEHL8EEVS3cHYrCaqz+LJeB6xyG49CpcaghvLyUbm8lRxSSHBipGy/rqSoCuLdVnt3usxA+aTKL4Pqw==","repository":{"url":"git+https://github.com/emdzej/ncsx.git","type":"git","directory":"packages/property-formulas"},"_npmVersion":"11.14.1","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/ncsx-property-formulas_0.5.1_1779876433385_0.10997197502793465","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@emdzej/ncsx-property-formulas","version":"0.6.0","_id":"@emdzej/ncsx-property-formulas@0.6.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/ncsx#readme","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"dist":{"shasum":"b09937bc126b092d49f65623c90dd3ac5a62aa50","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.6.0.tgz","fileCount":19,"integrity":"sha512-2If8z10cJrGrkx2LxpGKuGy2y41saKjVXOIAnCsVWCYGf7IoEWZTS0psUrdgOWCDrX0hwN065Jmfe69XlOQTtQ==","signatures":[{"sig":"MEUCIHpKW12ok0bdjHQlMNts2TssBAPR+bp3hK+agyj0xJUMAiEAvZv3NU/tOqo3MGoOB8cEFR0KFqjtXk+py4IYUxkTui8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122190},"main":"dist/index.js","type":"module","_from":"file:emdzej-ncsx-property-formulas-0.6.0.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/c410b3a477c2a318a4a3dfd4f4e486e6/emdzej-ncsx-property-formulas-0.6.0.tgz","_integrity":"sha512-2If8z10cJrGrkx2LxpGKuGy2y41saKjVXOIAnCsVWCYGf7IoEWZTS0psUrdgOWCDrX0hwN065Jmfe69XlOQTtQ==","repository":{"url":"git+https://github.com/emdzej/ncsx.git","type":"git","directory":"packages/property-formulas"},"_npmVersion":"11.14.1","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/ncsx-property-formulas_0.6.0_1779981237816_0.6906252293100845","host":"s3://npm-registry-packages-npm-production"}},"0.7.0":{"name":"@emdzej/ncsx-property-formulas","version":"0.7.0","_id":"@emdzej/ncsx-property-formulas@0.7.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/ncsx#readme","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"dist":{"shasum":"70c7d077ee4ea1cf2d62c38dd8384b2c457c66e8","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.7.0.tgz","fileCount":19,"integrity":"sha512-HfT517FB3hLDPC+bUdMtkd3JyuesdU+YwqpryNdgBDVAsDZVR2Q8D2a/j8sGF608Bo9h5MDg+PEo52KttcgcqA==","signatures":[{"sig":"MEYCIQC8E4PKlptt1BRdQqkVJnZ5B0m4jRNQ95Y+XjgfRlp8awIhAOEdcGb6W2jxkukj9VbBOWiByM3gT28InN05tnV8fRyI","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122190},"main":"dist/index.js","type":"module","_from":"file:emdzej-ncsx-property-formulas-0.7.0.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/003e015f82e2e48a2460442492e52745/emdzej-ncsx-property-formulas-0.7.0.tgz","_integrity":"sha512-HfT517FB3hLDPC+bUdMtkd3JyuesdU+YwqpryNdgBDVAsDZVR2Q8D2a/j8sGF608Bo9h5MDg+PEo52KttcgcqA==","repository":{"url":"git+https://github.com/emdzej/ncsx.git","type":"git","directory":"packages/property-formulas"},"_npmVersion":"11.14.1","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/ncsx-property-formulas_0.7.0_1780063003614_0.8788498279604287","host":"s3://npm-registry-packages-npm-production"}},"0.8.0":{"name":"@emdzej/ncsx-property-formulas","version":"0.8.0","_id":"@emdzej/ncsx-property-formulas@0.8.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/ncsx#readme","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"dist":{"shasum":"40d3382cc02c723a99f5a604fc0199b93427d294","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.8.0.tgz","fileCount":19,"integrity":"sha512-CB2FoDBohIpkX/bFfuvjDDdWUG3+TDVfK1wbI8e9YS4BES59OoBHDfx6Ucd5ePKyt/A1MrQqW1gL3pODLDipqQ==","signatures":[{"sig":"MEUCIAiEaFAoK/QJr4OS8GQQqyXfxuREXW+37ZLg8Fz7Pkt0AiEAriYUB37loziXZUTu/zRSIk/u1vWOwKC4IB+Dmphpius=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122190},"main":"dist/index.js","type":"module","_from":"file:emdzej-ncsx-property-formulas-0.8.0.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run --passWithNoTests","build":"tsc -p tsconfig.json","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/4396f0452c128bbae19b0d46b1aa0498/emdzej-ncsx-property-formulas-0.8.0.tgz","_integrity":"sha512-CB2FoDBohIpkX/bFfuvjDDdWUG3+TDVfK1wbI8e9YS4BES59OoBHDfx6Ucd5ePKyt/A1MrQqW1gL3pODLDipqQ==","repository":{"url":"git+https://github.com/emdzej/ncsx.git","type":"git","directory":"packages/property-formulas"},"_npmVersion":"11.16.0","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/ncsx-property-formulas_0.8.0_1780758405263_0.7252736340051638","host":"s3://npm-registry-packages-npm-production"}},"0.9.0":{"name":"@emdzej/ncsx-property-formulas","version":"0.9.0","description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","main":"dist/index.js","types":"dist/index.d.ts","type":"module","devDependencies":{"@types/node":"^22.13.1","vitest":"^2.1.8"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/emdzej/ncsx.git","directory":"packages/property-formulas"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run --passWithNoTests","test:watch":"vitest","lint":"eslint .","typecheck":"tsc --noEmit","clean":"rm -rf dist .turbo *.tsbuildinfo"},"_id":"@emdzej/ncsx-property-formulas@0.9.0","bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"homepage":"https://github.com/emdzej/ncsx#readme","_integrity":"sha512-xyQW3kg/ycCQAfxyuGPHYPCXXex+fRB+tB5bx+9D7h+eEN0E+bCPTb2EaFA8lxkqZ32rjVK7RAa4keQfTMxojw==","_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/c4243344e264d948723b73571784b702/emdzej-ncsx-property-formulas-0.9.0.tgz","_from":"file:emdzej-ncsx-property-formulas-0.9.0.tgz","_nodeVersion":"22.22.1","_npmVersion":"11.16.0","dist":{"integrity":"sha512-xyQW3kg/ycCQAfxyuGPHYPCXXex+fRB+tB5bx+9D7h+eEN0E+bCPTb2EaFA8lxkqZ32rjVK7RAa4keQfTMxojw==","shasum":"fbac37a17e25558a5b2e6e60e59bc5eeecb4988e","tarball":"https://registry.npmjs.org/@emdzej/ncsx-property-formulas/-/ncsx-property-formulas-0.9.0.tgz","fileCount":19,"unpackedSize":122190,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDrEqCnTxEIDMAXk4jeh863hqsDdQgbFy0DRZky1gCDpAiBePQmxa8AwgSfPikqmb61MHE7VAznRfBL3dLj7WiVRlQ=="}]},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"directories":{},"maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ncsx-property-formulas_0.9.0_1783336555158_0.900507174386594"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T10:40:21.757Z","modified":"2026-07-06T11:15:55.403Z","0.4.0":"2026-05-25T10:40:22.078Z","0.5.1":"2026-05-27T10:07:13.522Z","0.6.0":"2026-05-28T15:13:57.947Z","0.7.0":"2026-05-29T13:56:43.778Z","0.8.0":"2026-06-06T15:06:45.409Z","0.9.0":"2026-07-06T11:15:55.299Z"},"bugs":{"url":"https://github.com/emdzej/ncsx/issues"},"homepage":"https://github.com/emdzej/ncsx#readme","repository":{"type":"git","url":"git+https://github.com/emdzej/ncsx.git","directory":"packages/property-formulas"},"description":"Per-FSW property-value decoders, ported from NCS Dummy's Classes/Formulas/Formulas.cs. Renders raw CABD bytes as human-readable values (km/h, °C, V, percentages, …).","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"readme":"# @emdzej/ncsx-property-formulas\n\nPer-FSW **property-value decoders**, ported from NCS Dummy's\n[`Classes/Formulas/Formulas.cs`](../../../ncsx-research/ncsdummy-src/NcsDummy/Classes/Formulas/Formulas.cs)\n(1982 lines, 1055 `case` arms across 149 distinct formula bodies).\n\nThis is the layer that turns raw CABD bytes like `00100000` into the human-readable\n`\"32 km/h\"` you see in NCS Dummy's details pane. It's purely a display aid — the canonical\ndecode for coding purposes goes through `@emdzej/ncsx-cabd` (OPERATION + EINHEIT). This\npackage adds the community-curated unit/format knowledge that CABD alone doesn't carry.\n\nSee [`../../docs/ncsdummy-analysis.md` §5](../../docs/ncsdummy-analysis.md) for how it fits\ninto NCS Dummy's rendering pipeline.\n\n## Install\n\n```bash\npnpm add @emdzej/ncsx-property-formulas\n# or:\n\"@emdzej/ncsx-property-formulas\": \"workspace:*\"\n```\n\n## Quick start\n\n```ts\nimport { formatValue } from '@emdzej/ncsx-property-formulas';\n\nconst human = formatValue({\n  chassis: 'E60',\n  module: 'KMBI_E60',\n  codingIndex: 0x06,\n  keyword: 'LENK_UEBERSETZUNG',\n  mask: Uint8Array.from([0xff]),\n  data: Uint8Array.from([0x32]),  // 50\n});\n// → \"10\"   (LENK_UEBERSETZUNG = data / 5)\n```\n\nReturns `null` when the keyword has no formula or when chassis/module/data is missing.\nReturns `\"?\"` when a formula matches but the data buffer is empty.\n\n## API\n\n| Export                      | Purpose                                                  |\n|-----------------------------|----------------------------------------------------------|\n| `formatValue(ctx)`          | Top-level — keyword → human-readable value (or null)     |\n| `FORMULAS`                  | The raw `Map<keyword, Formula>` if you want to iterate   |\n| `Formula` / `FormulaContext`| Types for callers that want to register custom formulas  |\n| `getFloat` / `getFloat0_128` / `getFloatNeg128` / `getFloatNeg8` | Byte-folding helpers (faithful to NCS Dummy) |\n| `printNumber`               | C# `G4`-style formatter                                   |\n| `getString` / `reverse` / `invert` / `pow` | Other helpers                            |\n\n## How the port was made\n\nThe 1055 case arms are too many to hand-translate. `scripts/port-formulas.py` (in this\nrepo's history; the latest output lives at `src/formulas.ts`) does a brace-balanced\nextraction of the outer `switch (keyword) {…}` and emits one\n`reg([keys…], (ctx) => { … })` per group via a regex-driven rewriter:\n\n| C#                                | TS                                |\n|-----------------------------------|-----------------------------------|\n| `data` / `mask` / `chassis` / `module` | `ctx.data` / `ctx.mask` / …  |\n| `PrintNumber(x)` / `GetFloat(x)`  | `printNumber(x)` / `getFloat(x)`  |\n| `data == null \\|\\| data.Length == 0` | `ctx.data.length === 0`        |\n| `data.Length`                     | `ctx.data.length`                 |\n| `1f` / `2.5d` (numeric suffix)    | `1` / `2.5`                       |\n| `(int)x` (explicit cast)          | `x`                               |\n| `string.IsNullOrEmpty(x)`         | `!x`                              |\n| `byte.MaxValue` etc.              | `0xff` etc.                       |\n| `new byte[N] { a, b, c }` (multi-line) | `Uint8Array.from([a, b, c])` |\n\nAnything the rewriter couldn't translate cleanly would fail to compile — the package\ncurrently builds clean, so all 149 groups round-tripped.\n\n## Caveats\n\n- **Not coding-canonical.** These are display heuristics. For actual byte ↔ value coding\n  use `@emdzej/ncsx-cabd`'s `decodeField`/`encodeField`, which run OPERATION + EINHEIT.\n- **No fallback chassis logic.** When NCS Dummy's case has a nested `switch (module) {…}`\n  with a `default: return null;`, our port returns `null` for unmatched modules — same\n  behaviour, but means many formulas are intentionally chassis/module-gated.\n- **Community-curated.** Some cases have known quirks copied verbatim (e.g. magic\n  constants like `data * 18f / 4095f` for voltage divider readings).\n\n## Related\n\n- [`@emdzej/ncsx-cabd`](../cabd/) — OPERATION + EINHEIT pipeline; canonical numeric decode.\n- [`@emdzej/ncsx-function-list`](../function-list/) — the catalog whose `property` items\n  use this for display.\n- [`@emdzej/ncsx-translations`](../translations/) — keyword → English; the other half of\n  NCS Dummy's rendering.\n","readmeFilename":"README.md"}