diff options
| author | Eric Cheng <[email protected]> | 2022-08-28 09:59:51 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-28 15:59:51 +0200 |
| commit | 379ba79ba3b9735ed039d87f32fc14fa9920d4ed (patch) | |
| tree | e2ab2bf145231bafc6aaa73ccfdd0124ee3e3c03 /src/modules/datatype | |
| parent | f78843edb05913c44ebd86535b0d50d22e99fc5e (diff) | |
| download | faker-379ba79ba3b9735ed039d87f32fc14fa9920d4ed.tar.xz faker-379ba79ba3b9735ed039d87f32fc14fa9920d4ed.zip | |
fix(datatype): unintentional hex breaking change (#1306)
Co-authored-by: Leyla Jähnig <[email protected]>
Diffstat (limited to 'src/modules/datatype')
| -rw-r--r-- | src/modules/datatype/index.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/datatype/index.ts b/src/modules/datatype/index.ts index 671e8c6c..57399450 100644 --- a/src/modules/datatype/index.ts +++ b/src/modules/datatype/index.ts @@ -190,17 +190,17 @@ export class Datatype { * * @param options The optional options object. * @param options.length Length of the generated number. Defaults to `1`. - * @param options.prefix Prefix for the generated number. Defaults to `''`. + * @param options.prefix Prefix for the generated number. Defaults to `'0x'`. * @param options.case Case of the generated number. Defaults to `'mixed'`. * * @example - * faker.datatype.hexadecimal() // 'B' - * faker.datatype.hexadecimal({ length: 10 }) // 'aE13d044cB' + * faker.datatype.hexadecimal() // '0xB' + * faker.datatype.hexadecimal({ length: 10 }) // '0xaE13d044cB' * faker.datatype.hexadecimal({ prefix: '0x' }) // '0xE' * faker.datatype.hexadecimal({ case: 'lower' }) // 'f' - * faker.datatype.hexadecimal({ length: 10, prefix: '0x' }) // '0xf12a974eB1' - * faker.datatype.hexadecimal({ length: 10, case: 'upper' }) // 'E3F38014FB' - * faker.datatype.hexadecimal({ prefix: '0x', case: 'lower' }) // '0xd' + * faker.datatype.hexadecimal({ length: 10, prefix: '#' }) // '#f12a974eB1' + * faker.datatype.hexadecimal({ length: 10, case: 'upper' }) // '0xE3F38014FB' + * faker.datatype.hexadecimal({ prefix: '', case: 'lower' }) // 'd' * faker.datatype.hexadecimal({ length: 10, prefix: '0x', case: 'mixed' }) // '0xAdE330a4D1' */ hexadecimal( @@ -220,7 +220,7 @@ export class Datatype { }; } - const { length = 1, prefix = '', case: letterCase = 'mixed' } = options; + const { length = 1, prefix = '0x', case: letterCase = 'mixed' } = options; let wholeString = ''; |
