www.spaceplanner.app

Web client to the spaceplanner API
git clone git://jacobedwards.org/www.spaceplanner.app
Log | Files | Refs

commit 412fdeacb5a4a44cd208aea1b2d96d6ed5128ec6
parent ed0488806dcf61ffc6582df86151e63c1c6489fb
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Mon, 19 Aug 2024 09:06:52 -0700

Make a unit symbols table

This is like the systems table, but provides an easy link to a unit
from it's symbol.

Diffstat:
Mfiles/floorplans/floorplan/editor.js | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/files/floorplans/floorplan/editor.js b/files/floorplans/floorplan/editor.js @@ -44,6 +44,7 @@ class Units { constructor() { this.data = {} this.systems = {} + this.symbols = {} } add(name, factor, options) { @@ -64,6 +65,9 @@ class Units { if (options.system && this.systems[options.system]) { throw new Error("Unit system already exists") } + if (options.symbol && this.symbols[options.symbol]) { + throw new Error("Symbol already exists") + } this.data[name] = { name: name, @@ -75,6 +79,7 @@ class Units { } if (options.symbol) { this.data[name].symbol = options.symbol + this.symbols[options.symbol] = name } if (options.base) { this.data[options.base].next = name