MCPcopy
hub / github.com/faker-js/faker / hex

Method hex

src/modules/number/index.ts:356–384  ·  view source on GitHub ↗

* Returns a lowercase [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number. * The bounds are inclusive. * * @param options Maximum value or options object. * @param options.min Lower bound for generated number. Defaults to `0`. * @param options.max Upper bound for generated

(
    options:
      | number
      | {
          /**
           * Lower bound for generated number.
           *
           * @default 0
           */
          min?: number;
          /**
           * Upper bound for generated number.
           *
           * @default 15
           */
          max?: number;
        } = {}
  )

Source from the content-addressed store, hash-verified

354 * @since 8.0.0
355 */
356 hex(
357 options:
358 | number
359 | {
360 /**
361 * Lower bound for generated number.
362 *
363 * @default 0
364 */
365 min?: number;
366 /**
367 * Upper bound for generated number.
368 *
369 * @default 15
370 */
371 max?: number;
372 } = {}
373 ): string {
374 if (typeof options === 'number') {
375 options = { max: options };
376 }
377
378 const { min = 0, max = 15 } = options;
379
380 return this.int({
381 max,
382 min,
383 }).toString(16);
384 }
385
386 /**
387 * Returns a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type) number.

Callers 4

number.spec.tsFile · 0.80
uuidV4Function · 0.80
uuidV7Function · 0.80
macMethod · 0.80

Calls 1

intMethod · 0.95

Tested by

no test coverage detected