@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.
- package/dist/index.js +14 -4
- 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].
|
|
108
|
+
const tokens = match[1].split(/\s+/).filter(Boolean);
|
|
109
109
|
if (tokens.length === 0) {
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
|
-
|
|
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
|
-
|
|
143
|
+
const lowerCaseItemName = item.name.toLowerCase();
|
|
144
|
+
if (requestedPlots && !requestedPlots.has(lowerCaseItemName)) {
|
|
137
145
|
continue;
|
|
138
146
|
}
|
|
139
|
-
const netName = getNetName(
|
|
147
|
+
const netName = getNetName(
|
|
148
|
+
requestedPlots ? requestedPlots.get(lowerCaseItemName) : item.name
|
|
149
|
+
);
|
|
140
150
|
graphs.push({
|
|
141
151
|
netName,
|
|
142
152
|
time: timeValues,
|