Skip to content

Commit

Permalink
2 file edited
Browse files Browse the repository at this point in the history
  • Loading branch information
Croc-Prog-github authored Jul 23, 2024
1 parent 604de12 commit b6ee164
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/Probability-Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,16 @@ class ProbabilityManager {
clearAll() {
this.instances = {};
}

toArray() {
const result = [];
for (const [instanceName, lists] of Object.entries(this.instances)) {
for (const [listName, list] of Object.entries(lists)) {
for (const { object, probability } of list.objects) {
result.push([instanceName, listName, object, probability]);
}
}
}
return result;
}
}
1 change: 1 addition & 0 deletions core/Probability-Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare module "https://raw.githubusercontent.com/Croc-Prog-github/Probability-M
getRandomObject(instanceName: string, listName: string): string | number;
clearInstance(instanceName: string): void;
clearAll(): void;
toArray(): void;
}

export default ProbabilityManager;
Expand Down

0 comments on commit b6ee164

Please sign in to comment.