@tscircuit/ngspice-spice-engine 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +14 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -105,11 +105,18 @@ var extractRequestedPlots = (spiceString) => {
105
105
  if (!match || !match[1]) {
106
106
  return null;
107
107
  }
108
- const tokens = match[1].toLowerCase().split(/\s+/).filter(Boolean);
108
+ const tokens = match[1].split(/\s+/).filter(Boolean);
109
109
  if (tokens.length === 0) {
110
110
  return null;
111
111
  }
112
- return new Set(tokens);
112
+ const plotMap = /* @__PURE__ */ new Map();
113
+ for (const token of tokens) {
114
+ const lowerCaseToken = token.toLowerCase();
115
+ if (!plotMap.has(lowerCaseToken)) {
116
+ plotMap.set(lowerCaseToken, token);
117
+ }
118
+ }
119
+ return plotMap;
113
120
  };
114
121
  var getNetName = (rawName) => {
115
122
  const match = rawName.match(/^v\((.*)\)$/i);
@@ -133,10 +140,13 @@ var eecircuitResultToVGraphs = (result, spiceString) => {
133
140
  if (item.type !== "voltage" || !Array.isArray(item.values)) {
134
141
  continue;
135
142
  }
136
- if (requestedPlots && !requestedPlots.has(item.name.toLowerCase())) {
143
+ const lowerCaseItemName = item.name.toLowerCase();
144
+ if (requestedPlots && !requestedPlots.has(lowerCaseItemName)) {
137
145
  continue;
138
146
  }
139
- const netName = getNetName(item.name);
147
+ const netName = getNetName(
148
+ requestedPlots ? requestedPlots.get(lowerCaseItemName) : item.name
149
+ );
140
150
  graphs.push({
141
151
  netName,
142
152
  time: timeValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/ngspice-spice-engine",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A tscircuit-compatible SPICE engine using ngspice.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",