Skip to content

Commit 3c9c5db

Browse files
2 file edited
1 parent 348eb68 commit 3c9c5db

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

core/Probability-Manager.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,18 @@ class ProbabilityManager {
103103
}
104104
return result;
105105
}
106+
107+
toArrayForInstance(instanceName) {
108+
const result = [];
109+
const lists = this.instances[instanceName];
110+
if (!lists) {
111+
throw new Error(`Instance does not exist. Instance: ${instanceName}`);
112+
}
113+
for (const [listName, list] of Object.entries(lists)) {
114+
for (const { object, probability } of list.objects) {
115+
result.push([instanceName, listName, object, probability]);
116+
}
117+
}
118+
return result;
119+
}
106120
}

core/Probability-Manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare module "https://raw.githubusercontent.com/Croc-Prog-github/Probability-M
1212
clearInstance(instanceName: string): void;
1313
clearAll(): void;
1414
toArray(): void;
15+
toArrayForInstance(instanceName: string): void
1516
}
1617

1718
export default ProbabilityManager;

0 commit comments

Comments
 (0)