Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove method does not work #16

Closed
frankieali opened this issue Mar 8, 2022 · 2 comments
Closed

Remove method does not work #16

frankieali opened this issue Mar 8, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@frankieali
Copy link
Contributor

When attempting to remove a die by passing in a die roll object I get .filter() is not a method. I understand why this is happening. Internally, all the dice rolls are cached in an object, indexed by their rollId. This is so they can be easily looked up once their roll value has been calculated after the physic simulation. However, when outputting the final results, this multidimensional object is converted into an array of objects. The rolls are not an array internally, so there is no .filter method.

This has also uncovered some other issues around data mutation in this project. I'm looking into how to better manage the data internally.

@frankieali frankieali added the bug Something isn't working label Mar 8, 2022
@clevett
Copy link
Contributor

clevett commented Mar 9, 2022

I don't know if it will help but I posted a draft PR to my library for Typescript: https://github.com/clevett/dice-box/pull/6/files

About half the work of converting the library to Typescript was fixing issues the data mutation.

@frankieali
Copy link
Contributor Author

Fixed with version 0.6. I reworked both the reroll and remove methods so they will accept similar arguments and return similar data in their promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants