-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
breaking changeCannot be merged when next version is not a major releaseCannot be merged when next version is not a major releasec: bugSomething isn't workingSomething isn't workingc: refactorPR that affects the runtime behavior, but doesn't add new features or fixes bugsPR that affects the runtime behavior, but doesn't add new features or fixes bugsm: commerceSomething is referring to the commerce moduleSomething is referring to the commerce modulep: 1-normalNothing urgentNothing urgent
Milestone
Description
Currently the price method generates prices like this "$5.39". This has several drawbacks, as some currency symbols are written behind the price instead of in front. Some might want an extra space...
There is also the thing about the prices, that require fine tuning of the dec parameter depending on the generated value.
e.g.
// v8.3.1
faker.commerce.price({ min: 0.001, max: 0.009 }) // [Error]: No integer value between 0.001 and 0.009 found.
// #2458
faker.commerce.price({ min: 0.001, max: 0.009 }) // [Error]: No integer value between 0.01 and 0.09 found.
faker.commerce.price({ min: 0.001, max: 0.009, dec: 4 }) // 0.0029
// general
faker.commerce.price({ min: 1_000_000, max: 99_000_000 }) // 3071675.85 (prices like these usually don't have decimal places)Prices are also very often used as numbers e.g. if they are combined with quantities:
| Unit Price | Units | Total Price |
|---|---|---|
| 0.29 | 5 | 1.45 |
So commerce.price() should return number.
Summary
commerce.price()should returnnumber.- the
decparameter should be determined automatically (unless set specifically) - the
symbolparameter should be removed
#See also
jsardev
Metadata
Metadata
Assignees
Labels
breaking changeCannot be merged when next version is not a major releaseCannot be merged when next version is not a major releasec: bugSomething isn't workingSomething isn't workingc: refactorPR that affects the runtime behavior, but doesn't add new features or fixes bugsPR that affects the runtime behavior, but doesn't add new features or fixes bugsm: commerceSomething is referring to the commerce moduleSomething is referring to the commerce modulep: 1-normalNothing urgentNothing urgent