You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/modules/commerce/index.ts
+76-17Lines changed: 76 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -116,16 +116,23 @@ export class CommerceModule extends ModuleBase {
116
116
/**
117
117
* Generates a price between min and max (inclusive).
118
118
*
119
+
* To better represent real-world prices, when `options.dec` is greater than `0`, the final decimal digit in the returned string will be generated as follows:
120
+
*
121
+
* - 50% of the time: `9`
122
+
* - 30% of the time: `5`
123
+
* - 10% of the time: `0`
124
+
* - 10% of the time: a random digit from `0` to `9`
125
+
*
119
126
* @param options An options object.
120
127
* @param options.min The minimum price. Defaults to `1`.
121
128
* @param options.max The maximum price. Defaults to `1000`.
122
129
* @param options.dec The number of decimal places. Defaults to `2`.
123
130
* @param options.symbol The currency value to use. Defaults to `''`.
@@ -160,15 +167,22 @@ export class CommerceModule extends ModuleBase {
160
167
/**
161
168
* Generates a price between min and max (inclusive).
162
169
*
170
+
* To better represent real-world prices, when `options.dec` is greater than `0`, the final decimal digit in the returned string will be generated as follows:
171
+
*
172
+
* - 50% of the time: `9`
173
+
* - 30% of the time: `5`
174
+
* - 10% of the time: `0`
175
+
* - 10% of the time: a random digit from `0` to `9`
176
+
*
163
177
* @param min The minimum price. Defaults to `1`.
164
178
* @param max The maximum price. Defaults to `1000`.
165
179
* @param dec The number of decimal places. Defaults to `2`.
166
180
* @param symbol The currency value to use. Defaults to `''`.
167
181
*
168
182
* @example
169
-
* faker.commerce.price() // 828.00
170
-
* faker.commerce.price(100) // 904.00
171
-
* faker.commerce.price(100, 200) // 154.00
183
+
* faker.commerce.price() // 828.07
184
+
* faker.commerce.price(100) // 904.19
185
+
* faker.commerce.price(100, 200) // 154.55
172
186
* faker.commerce.price(100, 200, 0) // 133
173
187
* faker.commerce.price(100, 200, 0, '$') // $114
174
188
*
@@ -180,7 +194,14 @@ export class CommerceModule extends ModuleBase {
180
194
/**
181
195
* Generates a price between min and max (inclusive).
182
196
*
183
-
* @param options The minimum price or on options object.
197
+
* To better represent real-world prices, when `options.dec` is greater than `0`, the final decimal digit in the returned string will be generated as follows:
198
+
*
199
+
* - 50% of the time: `9`
200
+
* - 30% of the time: `5`
201
+
* - 10% of the time: `0`
202
+
* - 10% of the time: a random digit from `0` to `9`
203
+
*
204
+
* @param options The minimum price or an options object.
184
205
* @param options.min The minimum price. Defaults to `1`.
185
206
* @param options.max The maximum price. Defaults to `1000`.
186
207
* @param options.dec The number of decimal places. Defaults to `2`.
@@ -190,9 +211,9 @@ export class CommerceModule extends ModuleBase {
190
211
* @param legacySymbol The currency value to use. This argument is deprecated. Defaults to `''`.
@@ -234,7 +255,14 @@ export class CommerceModule extends ModuleBase {
234
255
/**
235
256
* Generates a price between min and max (inclusive).
236
257
*
237
-
* @param options The minimum price or on options object.
258
+
* To better represent real-world prices, when `options.dec` is greater than `0`, the final decimal digit in the returned string will be generated as follows:
259
+
*
260
+
* - 50% of the time: `9`
261
+
* - 30% of the time: `5`
262
+
* - 10% of the time: `0`
263
+
* - 10% of the time: a random digit from `0` to `9`
264
+
*
265
+
* @param options The minimum price or an options object.
238
266
* @param options.min The minimum price. Defaults to `1`.
239
267
* @param options.max The maximum price. Defaults to `1000`.
240
268
* @param options.dec The number of decimal places. Defaults to `2`.
@@ -244,9 +272,9 @@ export class CommerceModule extends ModuleBase {
244
272
* @param legacySymbol The currency value to use. This argument is deprecated. Defaults to `''`.
0 commit comments