Skip to content

Commit

Permalink
feat(number): adjust hex default (#1649)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 authored Dec 10, 2022
1 parent ab9fa1f commit 7b50c2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/modules/number/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ export class NumberModule {
*
* @param options Maximum value or options object. Defaults to `{}`.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `min + 16`.
* @param options.max Upper bound for generated number. Defaults to `15`.
*
* @example
* faker.number.hex() // 'b'
* faker.number.hex(16) // '9'
* faker.number.hex({ min: 0, max: 65536 }) // 'af17'
* faker.number.hex(255) // '9d'
* faker.number.hex({ min: 0, max: 65535 }) // 'af17'
*
* @since 8.0.0
*/
Expand All @@ -131,7 +131,7 @@ export class NumberModule {
options = { max: options };
}

const { min = 0, max = min + 16 } = options;
const { min = 0, max = 15 } = options;

return this.int({
max,
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/number.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`number > 42 > float > with min, max and precision 1`] = `-0.4261`;

exports[`number > 42 > float > with plain number 1`] = `1.5`;

exports[`number > 42 > hex > noArgs 1`] = `"6"`;
exports[`number > 42 > hex > noArgs 1`] = `"5"`;

exports[`number > 42 > hex > with options 1`] = `"4"`;

Expand Down Expand Up @@ -60,7 +60,7 @@ exports[`number > 1211 > float > with min, max and precision 1`] = `61.0658`;

exports[`number > 1211 > float > with plain number 1`] = `3.72`;

exports[`number > 1211 > hex > noArgs 1`] = `"f"`;
exports[`number > 1211 > hex > noArgs 1`] = `"e"`;

exports[`number > 1211 > hex > with options 1`] = `"a"`;

Expand Down

0 comments on commit 7b50c2f

Please sign in to comment.