Skip to content

Fix to undefined fraction denominator: Improved testing and better edge case handling - #6

Open
undermark5 wants to merge 10 commits into
nsafai:masterfrom
undermark5:master
Open

Fix to undefined fraction denominator: Improved testing and better edge case handling#6
undermark5 wants to merge 10 commits into
nsafai:masterfrom
undermark5:master

Conversation

@undermark5

@undermark5 undermark5 commented Feb 28, 2021

Copy link
Copy Markdown

This PR is a combination of #3 plus the changes that I reference in my comment.

The biggest changes are an increase in the number of test cases (I'm not sure if they are in the proper place code wise or implemented properly) and the ability to handle more complex inputs including fractions (e.g. "1-2 1/2 14.5 oz can tomato paste" -> {quantity: '1-2.5', unit: '14.5 ounce', ingredient: 'can tomato paste', minQty: '1', maxQty: '2.5'})

The multiplication is definitely an option, and maybe that could be a configuration option (or optional parameter), but I feel like people have an easier time doing multiplication than division.

@nsafai nsafai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @undermark5 thanks for raising the PR. I do have some concerns with making this change because it can limit usability of the combine() feature and the future possibility of being able to convert units. Would love to get your thoughts

Comment thread test/index.test.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants