diff --git a/.codex-dev-web.pid b/.codex-dev-web.pid new file mode 100644 index 00000000..fd3f153d --- /dev/null +++ b/.codex-dev-web.pid @@ -0,0 +1 @@ +125008 diff --git a/.codex-dev-web.stderr.log b/.codex-dev-web.stderr.log new file mode 100644 index 00000000..45ea574f --- /dev/null +++ b/.codex-dev-web.stderr.log @@ -0,0 +1 @@ +$ vite --config ./apps/web/vite.config.mjs diff --git a/.codex-dev-web.stdout.log b/.codex-dev-web.stdout.log new file mode 100644 index 00000000..1055c245 --- /dev/null +++ b/.codex-dev-web.stdout.log @@ -0,0 +1,5 @@ + + VITE v8.0.16 ready in 284 ms + + ➜ Local: http://127.0.0.1:4173/ + ➜ press h + enter to show help diff --git a/.gitignore b/.gitignore index a6d20700..3987d62d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ testenv/ experiments experiments/* .codex-logs/ +.codex-dev-web.log diff --git a/.storybook/main.js b/.storybook/main.js index 9224dcac..c88a3e70 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -28,6 +28,7 @@ export default { '@anywaydata/core/utils': path.resolve(__dirname, '../packages/core/js/utils'), '@anywaydata/core/faker': path.resolve(__dirname, '../packages/core/js/faker'), '@anywaydata/core/domain': path.resolve(__dirname, '../packages/core/js/domain'), + '@anywaydata/core/command-help': path.resolve(__dirname, '../packages/core/js/command-help'), '@anywaydata/core/libs': path.resolve(__dirname, '../packages/core/js/libs'), '@anywaydata/core': path.resolve(__dirname, '../packages/core/src/index.js'), }, diff --git a/AGENTS.md b/AGENTS.md index c83189f1..6091d2b7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,6 +24,19 @@ If verification fails: - `verify:ci` is the full aggregate gate, including coverage, used to mirror the main-branch CI path locally. - Pull request CI runs parallel independent gates and intentionally skips coverage; coverage runs on `master` push CI. +## Command Help Example Conventions + +When changing command help metadata, usage examples, or command-help tests: + +- treat `usageExamples` as the source of truth for example maintenance and validation +- do not add or preserve legacy `example`, `examples`, or `exampleReturnValues` fields on keyword definitions or runtime command-help objects +- use domain named-parameter invocation form for all non-`helpers.*` command help examples, e.g. `internet.password(length=12, memorable=true)` +- allow faker-style invocation examples only for `helpers.*` commands +- do not convert domain-backed command help examples into faker object or positional syntax when exposing help metadata +- for domain commands, `docsUrl` must point to the AnyWayData docs page and never to `fakerjs.dev` +- for faker-backed domain commands, expose the upstream Faker reference separately as `fakerDocsUrl` +- validators are called as `(value, context)` and must use `context.fieldDefinition` for rule-specific checks such as enum membership or counterstring length bounds + ## Browser Test Interaction Rules When changing UI code, UI test abstractions, or browser tests: diff --git a/apps/web/src/stories/method-picker-dialog.stories.js b/apps/web/src/stories/method-picker-dialog.stories.js index 1b270bca..0e46973e 100644 --- a/apps/web/src/stories/method-picker-dialog.stories.js +++ b/apps/web/src/stories/method-picker-dialog.stories.js @@ -2,75 +2,28 @@ import React from 'react'; import { Canvas, Controls, Description, Title } from '@storybook/addon-docs/blocks'; import { expect, fn, userEvent, within } from 'storybook/test'; import { openMethodPickerModal } from '../../../../packages/core-ui/js/gui_components/shared/test-data/ui/method-picker-modal.js'; +import { buildSchemaHelpModel } from '../../../../packages/core-ui/js/gui_components/shared/test-data/help/help-model-builder.js'; const METHOD_PICKER_RECENT_STORAGE_KEY = 'anywaydata.method-picker.recent'; const METHOD_PICKER_STYLE_ID = 'storybook-method-picker-modal-styles-link'; const CORE_COMMANDS = new Set(['enum', 'literal', 'regex']); -const METHOD_OPTIONS = [ - { - sourceType: 'regex', - command: 'regex', - helpModel: { - summary: 'Generate values from a regular expression.', - heading: 'regex', - examples: ['regex("[A-Z]{3}")'], - params: [ - { - name: 'pattern', - type: 'string', - description: 'Regular expression source used to build generated values.', - example: '"[A-Z]{3}"', - }, - ], - exampleReturnValues: ['ABC', 'QWE'], - docsUrl: 'https://anywaydata.com/docs/test-data/regex', - }, - }, - { - sourceType: 'faker', - command: 'helpers.arrayElement', - helpModel: { - summary: 'Choose one item from the provided array.', - heading: 'helpers.arrayElement', - examples: ['helpers.arrayElement(["active", "paused", "deleted"])'], - params: [ - { - name: 'array', - type: 'array', - description: 'List of values to choose from.', - example: '["active", "paused", "deleted"]', - }, - ], - exampleReturnValues: ['active', 'paused'], - docsUrl: 'https://fakerjs.dev/api/helpers.html#arrayelement', - }, - }, - { - sourceType: 'domain', - command: 'internet.password', - helpModel: { - summary: 'Generate a password-like string.', - heading: 'internet.password', - examples: ['internet.password()'], - params: [], - exampleReturnValues: ['hS9!wQ2'], - docsUrl: 'https://fakerjs.dev/api/internet.html#password', - }, - }, - { - sourceType: 'domain', - command: 'commerce.price', - helpModel: { - summary: 'Generate a commerce-style price.', - heading: 'commerce.price', - examples: ['commerce.price()'], - params: [], - exampleReturnValues: ['19.99'], - docsUrl: 'https://fakerjs.dev/api/commerce.html#price', - }, - }, -]; +const METHOD_OPTION_SPECS = Object.freeze([ + { sourceType: 'regex', command: 'regex', helpCommand: '' }, + { sourceType: 'faker', command: 'helpers.arrayElement', helpCommand: 'helpers.arrayElement' }, + { sourceType: 'domain', command: 'internet.password', helpCommand: 'internet.password' }, + { sourceType: 'domain', command: 'commerce.price', helpCommand: 'commerce.price' }, +]); + +function buildMethodOptions() { + return METHOD_OPTION_SPECS.map(({ sourceType, command, helpCommand }) => ({ + sourceType, + command, + helpModel: buildSchemaHelpModel(sourceType, helpCommand), + })); +} + +const METHOD_OPTIONS = buildMethodOptions(); function escapeHtml(text) { return String(text ?? '') @@ -91,23 +44,29 @@ function toExampleList(value) { function getReturnExamples(model) { const unique = new Set(); - const add = (value) => { - toExampleList(value).forEach((entry) => unique.add(entry)); - }; - add(model?.example); - add(model?.exampleReturnValues); - add(model?.returnExamples); - return [...unique]; + const usageExamples = Array.isArray(model?.usageExamples) ? model.usageExamples : []; + usageExamples.forEach((usageExample) => { + if (Object.prototype.hasOwnProperty.call(usageExample || {}, 'sampleReturnValue')) { + unique.add(String(usageExample.sampleReturnValue ?? '').trim()); + } + }); + toExampleList(model?.returnExamples).forEach((entry) => unique.add(entry)); + return [...unique].filter(Boolean); +} + +function getUsageFunctionCalls(model) { + return (Array.isArray(model?.usageExamples) ? model.usageExamples : []) + .map((usageExample) => String(usageExample?.functionCall || '').trim()) + .filter(Boolean); } function buildSearchText(option) { const params = Array.isArray(option?.helpModel?.params) ? option.helpModel.params.map((p) => p?.name || '') : []; - const usageExamples = toExampleList(option?.helpModel?.examples); + const usageExamples = getUsageFunctionCalls(option?.helpModel); const returnExamples = getReturnExamples(option?.helpModel); return [ option.command, option.helpModel?.summary || '', - option.helpModel?.example || '', usageExamples.join(' '), returnExamples.join(' '), params.join(' '), @@ -293,7 +252,7 @@ function createVisualMethodPickerStory(root, args) { return; } const model = selected.helpModel || {}; - const usageExamples = toExampleList(model.examples); + const usageExamples = getUsageFunctionCalls(model); const returnExamples = getReturnExamples(model); const docsUrl = String(model.docsUrl || '').trim(); const hasParams = Array.isArray(model.params) && model.params.length > 0; @@ -536,7 +495,7 @@ export const VisualAlwaysOpen = { await expect(canvas.getByRole('dialog', { name: 'Choose Method' })).toBeVisible(); await expect( canvas.getByRole('button', { - name: 'helpers.arrayElement Choose one item from the provided array. faker', + name: 'helpers.arrayElement Returns one random element from the supplied array. faker', }) ).toHaveClass('is-selected'); @@ -573,7 +532,9 @@ export const ChooseFakerMethod = { await userEvent.click(canvas.getByRole('button', { name: 'Open method picker' })); const dialog = within(document.body); await userEvent.click( - dialog.getByRole('button', { name: 'helpers.arrayElement Choose one item from the provided array. faker' }) + dialog.getByRole('button', { + name: 'helpers.arrayElement Returns one random element from the supplied array. faker', + }) ); await userEvent.click(dialog.getByRole('button', { name: 'Apply' })); await expect(canvas.getByText('faker:helpers.arrayElement')).toBeVisible(); @@ -600,7 +561,7 @@ export const FilterAndChooseDomainMethod = { const dialog = within(document.body); await userEvent.type(dialog.getByRole('searchbox', { name: 'Filter methods' }), 'commerce'); await userEvent.click( - dialog.getByRole('button', { name: 'commerce.price Generate a commerce-style price. domain' }) + dialog.getByRole('button', { name: 'commerce.price Generates a price between min and max (inclusive). domain' }) ); await userEvent.click(dialog.getByRole('button', { name: 'Apply' })); await expect(canvas.getByText('domain:commerce.price')).toBeVisible(); diff --git a/apps/web/src/stories/shared-schema-definition.stories.js b/apps/web/src/stories/shared-schema-definition.stories.js index 3d50a90a..9e2703f4 100644 --- a/apps/web/src/stories/shared-schema-definition.stories.js +++ b/apps/web/src/stories/shared-schema-definition.stories.js @@ -523,12 +523,8 @@ export const ParamsDialog = { await expect(firstHelpIcon).toHaveAttribute('data-help-text', expect.stringContaining('Default: 1')); await expect(dialogScope.getByRole('textbox', { name: /start value/i }).value).toBe('1'); await expect(dialogScope.getByRole('textbox', { name: /step value/i }).value).toBe('1'); - let prefixInput = dialogScope.getByRole('textbox', { name: /prefix value/i }); + const prefixInput = dialogScope.getByRole('textbox', { name: /prefix value/i }); await userEvent.click(prefixInput); - await waitFor(() => { - prefixInput = dialogScope.getByRole('textbox', { name: /prefix value/i }); - expect(document.activeElement).toBe(prefixInput); - }); await userEvent.clear(prefixInput); await userEvent.type(prefixInput, 'filename'); await waitFor(() => diff --git a/apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js b/apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js index 0cad309b..850d875e 100644 --- a/apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js +++ b/apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js @@ -175,7 +175,7 @@ class SchemaEditorComponent { await this.methodPicker.chooseCommand(requested, { tab: pickerTab }); } - if (assertSchemaTextIncludesType) { + if (assertSchemaTextIncludesType && lower !== 'regex') { await expect.poll(async () => (await this.getSchemaText()).toLowerCase(), { timeout: 3000 }).toContain(lower); } } diff --git a/apps/web/src/writer-schema-page.mjs b/apps/web/src/writer-schema-page.mjs index 24763e57..4e0915eb 100644 --- a/apps/web/src/writer-schema-page.mjs +++ b/apps/web/src/writer-schema-page.mjs @@ -285,7 +285,9 @@ function buildWriterDomainCommandGuide(domainCommands = []) { .slice(0, 6) .map((command) => { const help = getDomainCommandHelp(command); - const example = String(help?.example || '').trim(); + const example = Array.isArray(help?.usageExamples) + ? String(help.usageExamples.find((usageExample) => usageExample?.functionCall)?.functionCall || '').trim() + : ''; const summary = String(help?.summary || '') .trim() .replace(/\s+/g, ' '); diff --git a/apps/web/styles.css b/apps/web/styles.css index 0df310ec..9e1c13a6 100644 --- a/apps/web/styles.css +++ b/apps/web/styles.css @@ -49,6 +49,34 @@ body { font-family: Arial, Helvetica, sans-serif; } +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +.skip-link { + position: absolute; + left: 0.75rem; + top: -3rem; + z-index: 5000; + padding: 0.6rem 0.9rem; + border-radius: 0.45rem; + background: #0b6aa2; + color: #ffffff; + text-decoration: none; +} + +.skip-link:focus { + top: 0.75rem; +} + a { color: #0b63ce; } @@ -1865,6 +1893,22 @@ body.theme-dark .generator-status-text[data-severity='info'] { justify-self: start; } +.method-picker-usage-example { + padding: 0.55rem 0.7rem; + margin-bottom: 0.65rem; + border: 1px solid var(--border-color); + border-radius: 0.55rem; + background: color-mix(in srgb, var(--panel-bg) 90%, #ebf9f2 10%); +} + +.method-picker-usage-example p { + margin: 0 0 0.4rem; +} + +.method-picker-usage-example p:last-child { + margin-bottom: 0; +} + .option-help-icon { margin-right: 0.35rem; cursor: help; @@ -2092,6 +2136,13 @@ body.theme-dark .shared-schema-row-validation { } } +.theme-doc-markdown table { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} + .shared-schema-command-picker-button, .test-data-grid-command-picker-trigger { width: 100%; diff --git a/apps/web/vite.config.mjs b/apps/web/vite.config.mjs index e623e812..23faba41 100644 --- a/apps/web/vite.config.mjs +++ b/apps/web/vite.config.mjs @@ -19,6 +19,10 @@ export default defineConfig({ find: /^@anywaydata\/core\/domain\/(.*)$/, replacement: path.resolve(__dirname, '../../packages/core/js/domain/$1'), }, + { + find: /^@anywaydata\/core\/command-help\/(.*)$/, + replacement: path.resolve(__dirname, '../../packages/core/js/command-help/$1'), + }, { find: /^@anywaydata\/core\/data_formats\/(.*)$/, replacement: path.resolve(__dirname, '../../packages/core/js/data_formats/$1'), diff --git a/docs-src/docs/040-test-data/domain/020-airline.md b/docs-src/docs/040-test-data/domain/020-airline.md index 012c357d..37b2e074 100644 --- a/docs-src/docs/040-test-data/domain/020-airline.md +++ b/docs-src/docs/040-test-data/domain/020-airline.md @@ -25,32 +25,34 @@ No parameters. Examples: +Shows the default airline.aircraftType call. + ```txt -airline.aircraftType() +airline.aircraftType ``` -Example return values: -- `regional` +Returns: `regional` -### `airline.airline` +### `airline.flightNumber` -Generate a value using faker airline.airline. +Returns a random flight number. Flight numbers are always 1 to 4 digits long and may include leading zeros. -- Canonical: `awd.domain.airline.airline` +- Canonical: `awd.domain.airline.flightNumber` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) No parameters. Examples: +Shows the default airline.flightNumber call. + ```txt -airline.airline() +airline.flightNumber ``` -Example return values: -- `{"name":"American Airlines","iataCode":"AA"}` +Returns: `70` -### `airline.airline.iataCode` +### `airline.iataCode` Generate an airline IATA code. @@ -61,14 +63,15 @@ No parameters. Examples: +Shows the default airline.airline.iataCode call. + ```txt -airline.airline.iataCode() +airline.airline.iataCode ``` -Example return values: -- `AA` +Returns: `FZ` -### `airline.airline.name` +### `airline.name` Generate an airline name. @@ -79,177 +82,142 @@ No parameters. Examples: -```txt -airline.airline.name() -``` - -Example return values: -- `Acme Air` - -### `airline.airplane` - -Generate a value using faker airline.airplane. - -- Canonical: `awd.domain.airline.airplane` -- Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) - -No parameters. - -Examples: +Shows the default airline.airline.name call. ```txt -airline.airplane() +airline.airline.name ``` -Example return values: -- `{"name":"Airbus A320","iataTypeCode":"A320"}` +Returns: `Flydubai` -### `airline.airplane.iataTypeCode` +### `airline.recordLocator` -Generate an airplane IATA type code. +Generates a random record locator. Record locators are 6-character alphanumeric booking references. -- Canonical: `awd.domain.airline.airplane.iataTypeCode` +- Canonical: `awd.domain.airline.recordLocator` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) No parameters. Examples: +Shows the default airline.recordLocator call. + ```txt -airline.airplane.iataTypeCode() +airline.recordLocator ``` -Example return values: -- `A320` +Returns: `KTAGDC` -### `airline.airplane.name` +### `airline.seat` -Generate an airplane model name. +Generates a random seat. -- Canonical: `awd.domain.airline.airplane.name` +- Canonical: `awd.domain.airline.seat` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) -No parameters. +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `aircraftType` | `narrowbody\|regional\|widebody` | no | The aircraft type. Can be one of narrowbody, regional, widebody. | Examples: +Shows airline.seat in use. + ```txt -airline.airplane.name() +airline.seat ``` -Example return values: -- `Boeing 737` - -### `airline.airport` - -Generate a value using faker airline.airport. +Returns: `15E` -- Canonical: `awd.domain.airline.airport` -- Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) - -No parameters. - -Examples: +Shows airline.seat in use. ```txt -airline.airport() +airline.seat(aircraftType="widebody") ``` -Example return values: -- `{"name":"Heathrow Airport","iataCode":"LHR"}` - -### `airline.airport.iataCode` - -Generate an airport IATA code. - -- Canonical: `awd.domain.airline.airport.iataCode` -- Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) +Returns: `26H` -No parameters. - -Examples: +Shows airline.seat when optional params are omitted. ```txt -airline.airport.iataCode() +airline.seat() ``` -Example return values: -- `LHR` +Returns: `15E` -### `airline.airport.name` +### `airplane.iataTypeCode` -Generate an airport name. +Generate an airplane IATA type code. -- Canonical: `awd.domain.airline.airport.name` +- Canonical: `awd.domain.airline.airplane.iataTypeCode` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) No parameters. Examples: +Shows the default airline.airplane.iataTypeCode call. + ```txt -airline.airport.name() +airline.airplane.iataTypeCode ``` -Example return values: -- `London Heathrow Airport` +Returns: `74J` -### `airline.flightNumber` +### `airplane.name` -Returns a random flight number. Flight numbers are always 1 to 4 digits long and may include leading zeros. +Generate an airplane model name. -- Canonical: `awd.domain.airline.flightNumber` +- Canonical: `awd.domain.airline.airplane.name` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) No parameters. Examples: +Shows the default airline.airplane.name call. + ```txt -airline.flightNumber() +airline.airplane.name ``` -Example return values: -- `1` +Returns: `Boeing 747-400D` -### `airline.recordLocator` +### `airport.iataCode` -Generates a random record locator. Record locators are 6-character alphanumeric booking references. +Generate an airport IATA code. -- Canonical: `awd.domain.airline.recordLocator` +- Canonical: `awd.domain.airline.airport.iataCode` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) No parameters. Examples: +Shows the default airline.airport.iataCode call. + ```txt -airline.recordLocator() +airline.airport.iataCode ``` -Example return values: -- `TCSJCN` +Returns: `HRG` -### `airline.seat` +### `airport.name` -Generates a random seat. +Generate an airport name. -- Canonical: `awd.domain.airline.seat` +- Canonical: `awd.domain.airline.airport.name` - Faker docs: [https://fakerjs.dev/api/airline](https://fakerjs.dev/api/airline) -| Arg | Type | Required | Description | -| --- | --- | --- | --- | -| `aircraftType` | `string` | no | The aircraft type. Can be one of narrowbody, regional, widebody. | +No parameters. Examples: -```txt -airline.seat -``` +Shows the default airline.airport.name call. ```txt -airline.seat(aircraftType="widebody") +airline.airport.name ``` -Example return values: -- `17F` +Returns: `Hurgada International Airport` diff --git a/docs-src/docs/040-test-data/domain/030-animal.md b/docs-src/docs/040-test-data/domain/030-animal.md index d5c8d46a..2dbca9b2 100644 --- a/docs-src/docs/040-test-data/domain/030-animal.md +++ b/docs-src/docs/040-test-data/domain/030-animal.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default animal.bear call. + ```txt -animal.bear() +animal.bear ``` -Example return values: -- `Sloth bear` +Returns: `Giant panda` ### `animal.bird` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default animal.bird call. + ```txt -animal.bird() +animal.bird ``` -Example return values: -- `Orange-crowned Warbler` +Returns: `Great-tailed Grackle` ### `animal.cat` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default animal.cat call. + ```txt -animal.cat() +animal.cat ``` -Example return values: -- `Russian Blue` +Returns: `Korat` ### `animal.cetacean` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default animal.cetacean call. + ```txt -animal.cetacean() +animal.cetacean ``` -Example return values: -- `Hector’s Dolphin` +Returns: `Guiana Dolphin` ### `animal.cow` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default animal.cow call. + ```txt -animal.cow() +animal.cow ``` -Example return values: -- `Aubrac` +Returns: `Gascon cattle` ### `animal.crocodilia` @@ -115,12 +120,13 @@ No parameters. Examples: +Shows the default animal.crocodilia call. + ```txt -animal.crocodilia() +animal.crocodilia ``` -Example return values: -- `Nile Crocodile` +Returns: `Gharial` ### `animal.dog` @@ -133,12 +139,13 @@ No parameters. Examples: +Shows the default animal.dog call. + ```txt -animal.dog() +animal.dog ``` -Example return values: -- `Jonangi` +Returns: `Grand Bleu de Gascogne` ### `animal.fish` @@ -151,12 +158,13 @@ No parameters. Examples: +Shows the default animal.fish call. + ```txt -animal.fish() +animal.fish ``` -Example return values: -- `Short mackerel` +Returns: `Gazami crab` ### `animal.horse` @@ -169,12 +177,13 @@ No parameters. Examples: +Shows the default animal.horse call. + ```txt -animal.horse() +animal.horse ``` -Example return values: -- `Rottaler` +Returns: `Heihe Horse` ### `animal.insect` @@ -187,12 +196,13 @@ No parameters. Examples: +Shows the default animal.insect call. + ```txt -animal.insect() +animal.insect ``` -Example return values: -- `Pigeon tremex` +Returns: `Honey bee` ### `animal.lion` @@ -205,12 +215,13 @@ No parameters. Examples: +Shows the default animal.lion call. + ```txt -animal.lion() +animal.lion ``` -Example return values: -- `Masai Lion` +Returns: `Cape lion` ### `animal.petName` @@ -223,12 +234,13 @@ No parameters. Examples: +Shows the default animal.petName call. + ```txt -animal.petName() +animal.petName ``` -Example return values: -- `Stella` +Returns: `Gus` ### `animal.rabbit` @@ -241,12 +253,13 @@ No parameters. Examples: +Shows the default animal.rabbit call. + ```txt -animal.rabbit() +animal.rabbit ``` -Example return values: -- `Californian` +Returns: `Florida White` ### `animal.rodent` @@ -259,12 +272,13 @@ No parameters. Examples: +Shows the default animal.rodent call. + ```txt -animal.rodent() +animal.rodent ``` -Example return values: -- `Natterer's tuco-tuco` +Returns: `Fukomys foxi` ### `animal.snake` @@ -277,12 +291,13 @@ No parameters. Examples: +Shows the default animal.snake call. + ```txt -animal.snake() +animal.snake ``` -Example return values: -- `White-lipped python` +Returns: `Harlequin coral snake` ### `animal.type` @@ -295,9 +310,10 @@ No parameters. Examples: +Shows the default animal.type call. + ```txt -animal.type() +animal.type ``` -Example return values: -- `bear` +Returns: `giraffe` diff --git a/docs-src/docs/040-test-data/domain/040-autoIncrement.md b/docs-src/docs/040-test-data/domain/040-autoIncrement.md index f460377a..6fb86ae3 100644 --- a/docs-src/docs/040-test-data/domain/040-autoIncrement.md +++ b/docs-src/docs/040-test-data/domain/040-autoIncrement.md @@ -15,7 +15,6 @@ The `autoIncrement` domain provides stateful sequence helpers for accepted gener Generates an incrementing sequence. Values only advance when a generated row is accepted, so constraint-filtered rows do not consume sequence numbers. - Canonical: `awd.domain.autoIncrement.sequence` -- Docs: [https://anywaydata.com/docs/test-data/auto-increment-sequences](https://anywaydata.com/docs/test-data/auto-increment-sequences) | Arg | Type | Required | Description | | --- | --- | --- | --- | @@ -27,29 +26,75 @@ Generates an incrementing sequence. Values only advance when a generated row is Examples: +Shows autoIncrement.sequence in use. + ```txt autoIncrement.sequence() ``` +Returns: `1` + +Shows autoIncrement.sequence in use. + ```txt autoIncrement.sequence(start=10, step=5) ``` +Returns: `10` + +Shows autoIncrement.sequence in use. + ```txt autoIncrement.sequence(start=1, step=5, prefix="filename", suffix=".txt", zeropadding=3) ``` -Example return values: -- `1` -- `15` -- `filename001.txt` +Returns: `filename001.txt` + +Shows autoIncrement.sequence using start. + +```txt +autoIncrement.sequence(start=10) +``` + +Returns: `10` + +Shows autoIncrement.sequence using step. + +```txt +autoIncrement.sequence(step=5) +``` + +Returns: `1` + +Shows autoIncrement.sequence using prefix. + +```txt +autoIncrement.sequence(prefix="filename") +``` + +Returns: `filename1` + +Shows autoIncrement.sequence using suffix. + +```txt +autoIncrement.sequence(suffix=".txt") +``` + +Returns: `1.txt` + +Shows autoIncrement.sequence using zeropadding. + +```txt +autoIncrement.sequence(zeropadding=3) +``` + +Returns: `001` ### `autoIncrement.timestamp` Generates a timestamp that starts from a fixed point and increments by the configured amount for each generated row. - Canonical: `awd.domain.autoIncrement.timestamp` -- Docs: [https://anywaydata.com/docs/test-data/domain/autoIncrement](https://anywaydata.com/docs/test-data/domain/autoIncrement) | Arg | Type | Required | Description | | --- | --- | --- | --- | @@ -61,23 +106,82 @@ Generates a timestamp that starts from a fixed point and increments by the confi Examples: +Shows autoIncrement.timestamp in use. + +```txt +autoIncrement.timestamp(start="2026-06-12T12:39:23Z", step=1, type="seconds") +``` + +Returns: `2026-06-12T12:39:23Z` + +Shows autoIncrement.timestamp in use. + ```txt autoIncrement.timestamp() ``` +Returns: `2026-06-18T15:55:20Z` + +Shows autoIncrement.timestamp in use. + ```txt autoIncrement.timestamp(start="20/03/1969", step=1, type="days") ``` +Returns: `1969-03-20T12:00:00Z` + +Shows autoIncrement.timestamp using a custom output format. + ```txt -autoIncrement.timestamp(start="2026-06-12 12:39:23", step=15, type="minutes", outputFormat="yyyy-MM-dd HH:mm:ss") +autoIncrement.timestamp(start="2026-06-12T12:39:23Z", step=15, type="minutes", outputFormat="yyyy-MM-dd HH:mm:ss") ``` +Returns: `2026-06-12 12:39:23` + +Shows autoIncrement.timestamp in use. + ```txt autoIncrement.timestamp(start="20/03/1969", inputFormat="dd/MM/yyyy", step=1, type="days") ``` -Example return values: -- `2026-06-12T12:39:23Z` -- `2026-06-12T12:39:24Z` -- `2026-06-12T12:39:25Z` +Returns: `1969-03-20T00:00:00Z` + +Shows autoIncrement.timestamp using start. + +```txt +autoIncrement.timestamp(start="2026-06-12T12:39:23Z") +``` + +Returns: `2026-06-12T12:39:23Z` + +Shows autoIncrement.timestamp using step. + +```txt +autoIncrement.timestamp(step=1) +``` + +Returns: `2026-06-18T15:55:20Z` + +Shows autoIncrement.timestamp using type. + +```txt +autoIncrement.timestamp(type="seconds") +``` + +Returns: `2026-06-18T15:55:20Z` + +Shows autoIncrement.timestamp using outputFormat. + +```txt +autoIncrement.timestamp(outputFormat="iso8601") +``` + +Returns: `2026-06-18T15:55:20Z` + +Shows autoIncrement.timestamp using inputFormat. + +```txt +autoIncrement.timestamp(start="20/03/1969", inputFormat="dd/MM/yyyy") +``` + +Returns: `1969-03-20T00:00:00Z` diff --git a/docs-src/docs/040-test-data/domain/050-book.md b/docs-src/docs/040-test-data/domain/050-book.md index 0570d294..bf90a10d 100644 --- a/docs-src/docs/040-test-data/domain/050-book.md +++ b/docs-src/docs/040-test-data/domain/050-book.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default book.author call. + ```txt -book.author() +book.author ``` -Example return values: -- `Jacqueline Crooks` +Returns: `Ian McEwan` ### `book.format` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default book.format call. + ```txt -book.format() +book.format ``` -Example return values: -- `Paperback` +Returns: `Ebook` ### `book.genre` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default book.genre call. + ```txt -book.genre() +book.genre ``` -Example return values: -- `Science Fiction` +Returns: `Graphic Novel` ### `book.publisher` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default book.publisher call. + ```txt -book.publisher() +book.publisher ``` -Example return values: -- `Butterworth-Heinemann` +Returns: `Golden Cockerel Press` ### `book.series` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default book.series call. + ```txt -book.series() +book.series ``` -Example return values: -- `The Inheritance Cycle` +Returns: `The Bartimaeus Trilogy` ### `book.title` @@ -115,9 +120,10 @@ No parameters. Examples: +Shows the default book.title call. + ```txt -book.title() +book.title ``` -Example return values: -- `Animal Farm` +Returns: `Moby Dick` diff --git a/docs-src/docs/040-test-data/domain/060-color.md b/docs-src/docs/040-test-data/domain/060-color.md index 73fac8c7..f202cb1d 100644 --- a/docs-src/docs/040-test-data/domain/060-color.md +++ b/docs-src/docs/040-test-data/domain/060-color.md @@ -23,20 +23,25 @@ Returns a CMYK color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `format` | `string` | no | Format of generated CMYK color. | +| `format` | `decimal\|css\|binary` | no | Format of generated CMYK color. | Examples: +Shows color.cmyk when optional params are omitted. + ```txt color.cmyk() ``` +Returns: `[0.42,0.72,0,0.3]` + +Shows color.cmyk using format. + ```txt -color.cmyk(format="hex") +color.cmyk(format="decimal") ``` -Example return values: -- `[0.95,0.17,0.23,1]` +Returns: `[0.42,0.72,0,0.3]` ### `color.colorByCSSColorSpace` @@ -45,16 +50,36 @@ Returns a random color based on CSS color space specified. - Canonical: `awd.domain.color.colorByCSSColorSpace` - Faker docs: [https://fakerjs.dev/api/color](https://fakerjs.dev/api/color) -No parameters. +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `format` | `decimal\|css\|binary` | no | Format of generated RGB color. | +| `space` | `sRGB\|display-p3\|rec2020\|a98-rgb\|prophoto-rgb` | no | Color space to generate the color for. | Examples: +Shows color.colorByCSSColorSpace when optional params are omitted. + ```txt color.colorByCSSColorSpace() ``` -Example return values: -- `[0.5811,0.0479,0.1091]` +Returns: `[0.417,0.7203,0.0001]` + +Shows color.colorByCSSColorSpace using format. + +```txt +color.colorByCSSColorSpace(format="decimal") +``` + +Returns: `[0.417,0.7203,0.0001]` + +Shows color.colorByCSSColorSpace using space. + +```txt +color.colorByCSSColorSpace(space="display-p3") +``` + +Returns: `[0.417,0.7203,0.0001]` ### `color.cssSupportedFunction` @@ -67,12 +92,13 @@ No parameters. Examples: +Shows the default color.cssSupportedFunction call. + ```txt -color.cssSupportedFunction() +color.cssSupportedFunction ``` -Example return values: -- `hsla` +Returns: `hsla` ### `color.cssSupportedSpace` @@ -85,12 +111,13 @@ No parameters. Examples: +Shows the default color.cssSupportedSpace call. + ```txt -color.cssSupportedSpace() +color.cssSupportedSpace ``` -Example return values: -- `sRGB` +Returns: `rec2020` ### `color.hsl` @@ -101,21 +128,42 @@ Returns an HSL color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `format` | `string` | no | Format of generated HSL color. | +| `format` | `decimal\|css\|binary` | no | Format of generated HSL color. | | `includeAlpha` | `boolean` | no | Adds an alpha value to the color (RGBA). | Examples: +Shows color.hsl returning the default tuple output. + ```txt -color.hsl() +color.hsl ``` +Returns: `[150,0.72,0]` + +Shows color.hsl returning CSS text without alpha. + ```txt -color.hsl(format="hex", includeAlpha=true) +color.hsl(format="css") ``` -Example return values: -- `[212,0.78,0.54]` +Returns: `hsl(150deg 72% 0%)` + +Shows color.hsl including alpha while keeping the tuple-style output. + +```txt +color.hsl(includeAlpha=true) +``` + +Returns: `[150,0.72,0,0.3]` + +Shows color.hsl returning CSS text with alpha included. + +```txt +color.hsl(format="css", includeAlpha=true) +``` + +Returns: `hsl(150deg 72% 0% / 30)` ### `color.human` @@ -128,12 +176,13 @@ No parameters. Examples: +Shows the default color.human call. + ```txt -color.human() +color.human ``` -Example return values: -- `green` +Returns: `magenta` ### `color.hwb` @@ -144,20 +193,25 @@ Returns an HWB color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `format` | `string` | no | Format of generated RGB color. | +| `format` | `decimal\|css\|binary` | no | Format of generated RGB color. | Examples: +Shows color.hwb when optional params are omitted. + ```txt color.hwb() ``` +Returns: `[150,0.72,0]` + +Shows color.hwb using format. + ```txt -color.hwb(format="hex") +color.hwb(format="decimal") ``` -Example return values: -- `[328,0.27,0.33]` +Returns: `[150,0.72,0]` ### `color.lab` @@ -168,20 +222,25 @@ Returns a LAB (CIELAB) color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `format` | `string` | no | Format of generated RGB color. | +| `format` | `decimal\|css\|binary` | no | Format of generated RGB color. | Examples: +Shows color.lab when optional params are omitted. + ```txt color.lab() ``` +Returns: `[0.417022,44.0649,-99.9772]` + +Shows color.lab using format. + ```txt -color.lab(format="hex") +color.lab(format="decimal") ``` -Example return values: -- `[0.071396,-55.6612,-66.7185]` +Returns: `[0.417022,44.0649,-99.9772]` ### `color.lch` @@ -192,20 +251,25 @@ Returns an LCH color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `format` | `string` | no | Format of generated RGB color. | +| `format` | `decimal\|css\|binary` | no | Format of generated RGB color. | Examples: +Shows color.lch when optional params are omitted. + ```txt color.lch() ``` +Returns: `[0.417022,165.7,0]` + +Shows color.lch using format. + ```txt -color.lch(format="hex") +color.lch(format="decimal") ``` -Example return values: -- `[0.469557,212.9,204.9]` +Returns: `[0.417022,165.7,0]` ### `color.rgb` @@ -216,23 +280,52 @@ Returns an RGB color. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `casing` | `string` | no | Letter type case of the generated hex color. Only applied when 'hex' format is used. | -| `format` | `string` | no | Format of generated RGB color. | +| `casing` | `lower\|upper\|mixed` | no | Letter type case of the generated hex color. Only applied when 'hex' format is used. | +| `format` | `hex\|decimal\|css\|binary` | no | Format of generated RGB color. | | `includeAlpha` | `boolean` | no | Adds an alpha value to the color (RGBA). | | `prefix` | `string` | no | Prefix of the generated hex color. Only applied when 'hex' format is used. | Examples: +Shows color.rgb when optional params are omitted. + ```txt color.rgb() ``` +Returns: `#9f0632` + +Shows color.rgb using casing. + +```txt +color.rgb(casing="upper") +``` + +Returns: `#9F0632` + +Shows color.rgb using format. + ```txt -color.rgb(casing="lower", format="hex", includeAlpha=true, prefix="#") +color.rgb(format="hex") ``` -Example return values: -- `#ee8222` +Returns: `#9f0632` + +Shows color.rgb using includeAlpha. + +```txt +color.rgb(includeAlpha=true) +``` + +Returns: `#9f063247` + +Shows color.rgb using prefix. + +```txt +color.rgb(prefix="#") +``` + +Returns: `#9f0632` ### `color.space` @@ -245,9 +338,10 @@ No parameters. Examples: +Shows the default color.space call. + ```txt -color.space() +color.space ``` -Example return values: -- `HSL` +Returns: `HSV` diff --git a/docs-src/docs/040-test-data/domain/070-commerce.md b/docs-src/docs/040-test-data/domain/070-commerce.md index c03f03b3..e523c03b 100644 --- a/docs-src/docs/040-test-data/domain/070-commerce.md +++ b/docs-src/docs/040-test-data/domain/070-commerce.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default commerce.department call. + ```txt -commerce.department() +commerce.department ``` -Example return values: -- `Tools` +Returns: `Grocery` ### `commerce.isbn` @@ -42,20 +43,33 @@ Returns a random ISBN identifier. | Arg | Type | Required | Description | | --- | --- | --- | --- | | `separator` | `string` | no | Separator inserted between generated items. | -| `variant` | `string` | no | ISBN length variant: use "10" for ISBN-10 or "13" for ISBN-13. | +| `variant` | `10\|13` | no | ISBN length variant: use 10 for ISBN-10 or 13 for ISBN-13. | Examples: +Shows commerce.isbn when optional params are omitted. + ```txt commerce.isbn() ``` +Returns: `978-0-7031-0133-4` + +Shows commerce.isbn using separator. + +```txt +commerce.isbn(separator="-") +``` + +Returns: `978-0-7031-0133-4` + +Shows commerce.isbn using variant. + ```txt -commerce.isbn(separator="-", variant="13") +commerce.isbn(variant=10) ``` -Example return values: -- `978-1-996134-54-2` +Returns: `0-7031-0133-1` ### `commerce.price` @@ -73,12 +87,53 @@ Generates a price between min and max (inclusive). Examples: +Shows commerce.price in use. + ```txt commerce.price(dec=2, max=10, min=1, symbol="$") ``` -Example return values: -- `797.39` +Returns: `$4.79` + +Shows commerce.price when optional params are omitted. + +```txt +commerce.price() +``` + +Returns: `417.69` + +Shows commerce.price using dec. + +```txt +commerce.price(dec=2) +``` + +Returns: `417.69` + +Shows commerce.price using max. + +```txt +commerce.price(max=100) +``` + +Returns: `42.29` + +Shows commerce.price using min. + +```txt +commerce.price(max=10, min=1) +``` + +Returns: `4.79` + +Shows commerce.price using symbol. + +```txt +commerce.price(symbol="$") +``` + +Returns: `$417.69` ### `commerce.product` @@ -91,12 +146,13 @@ No parameters. Examples: +Shows the default commerce.product call. + ```txt -commerce.product() +commerce.product ``` -Example return values: -- `Bike` +Returns: `Gloves` ### `commerce.productAdjective` @@ -109,12 +165,13 @@ No parameters. Examples: +Shows the default commerce.productAdjective call. + ```txt -commerce.productAdjective() +commerce.productAdjective ``` -Example return values: -- `Luxurious` +Returns: `Handmade` ### `commerce.productDescription` @@ -127,12 +184,13 @@ No parameters. Examples: +Shows the default commerce.productDescription call. + ```txt -commerce.productDescription() +commerce.productDescription ``` -Example return values: -- `The green Hat combines Colombia aesthetics with Scandium-based durability` +Returns: `New Sausages model with 1 GB RAM, 303 GB storage, and bruised features` ### `commerce.productMaterial` @@ -145,12 +203,13 @@ No parameters. Examples: +Shows the default commerce.productMaterial call. + ```txt -commerce.productMaterial() +commerce.productMaterial ``` -Example return values: -- `Steel` +Returns: `Gold` ### `commerce.productName` @@ -163,12 +222,13 @@ No parameters. Examples: +Shows the default commerce.productName call. + ```txt -commerce.productName() +commerce.productName ``` -Example return values: -- `Soft Bronze Towels` +Returns: `Handmade Plastic Bacon` ### `commerce.upc` @@ -183,9 +243,18 @@ Returns a valid UPC-A (12 digits). Examples: +Shows commerce.upc when optional params are omitted. + ```txt commerce.upc() ``` -Example return values: -- `036000291452` +Returns: `470310133543` + +Shows commerce.upc using prefix. + +```txt +commerce.upc(prefix="01234") +``` + +Returns: `012344703103` diff --git a/docs-src/docs/040-test-data/domain/080-company.md b/docs-src/docs/040-test-data/domain/080-company.md index f6188a1f..c82f1ac5 100644 --- a/docs-src/docs/040-test-data/domain/080-company.md +++ b/docs-src/docs/040-test-data/domain/080-company.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default company.buzzAdjective call. + ```txt -company.buzzAdjective() +company.buzzAdjective ``` -Example return values: -- `out-of-the-box` +Returns: `immersive` ### `company.buzzNoun` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default company.buzzNoun call. + ```txt -company.buzzNoun() +company.buzzNoun ``` -Example return values: -- `deliverables` +Returns: `interfaces` ### `company.buzzPhrase` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default company.buzzPhrase call. + ```txt -company.buzzPhrase() +company.buzzPhrase ``` -Example return values: -- `streamline cutting-edge platforms` +Returns: `grow robust AI` ### `company.buzzVerb` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default company.buzzVerb call. + ```txt -company.buzzVerb() +company.buzzVerb ``` -Example return values: -- `disintermediate` +Returns: `grow` ### `company.catchPhrase` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default company.catchPhrase call. + ```txt -company.catchPhrase() +company.catchPhrase ``` -Example return values: -- `Diverse AI-powered flexibility` +Returns: `Integrated radical ability` ### `company.catchPhraseAdjective` @@ -115,12 +120,13 @@ No parameters. Examples: +Shows the default company.catchPhraseAdjective call. + ```txt -company.catchPhraseAdjective() +company.catchPhraseAdjective ``` -Example return values: -- `Distributed` +Returns: `Integrated` ### `company.catchPhraseDescriptor` @@ -133,12 +139,13 @@ No parameters. Examples: +Shows the default company.catchPhraseDescriptor call. + ```txt -company.catchPhraseDescriptor() +company.catchPhraseDescriptor ``` -Example return values: -- `encompassing` +Returns: `heuristic` ### `company.catchPhraseNoun` @@ -151,12 +158,13 @@ No parameters. Examples: +Shows the default company.catchPhraseNoun call. + ```txt -company.catchPhraseNoun() +company.catchPhraseNoun ``` -Example return values: -- `attitude` +Returns: `generative AI` ### `company.name` @@ -169,9 +177,10 @@ No parameters. Examples: +Shows the default company.name call. + ```txt -company.name() +company.name ``` -Example return values: -- `Lang - Little` +Returns: `Gutmann Group` diff --git a/docs-src/docs/040-test-data/domain/090-database.md b/docs-src/docs/040-test-data/domain/090-database.md index a67ca1f0..63236ac9 100644 --- a/docs-src/docs/040-test-data/domain/090-database.md +++ b/docs-src/docs/040-test-data/domain/090-database.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default database.collation call. + ```txt -database.collation() +database.collation ``` -Example return values: -- `utf8_bin` +Returns: `cp1250_bin` ### `database.column` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default database.column call. + ```txt -database.column() +database.column ``` -Example return values: -- `status` +Returns: `group` ### `database.engine` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default database.engine call. + ```txt -database.engine() +database.engine ``` -Example return values: -- `ARCHIVE` +Returns: `CSV` ### `database.mongodbObjectId` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default database.mongodbObjectId call. + ```txt -database.mongodbObjectId() +database.mongodbObjectId ``` -Example return values: -- `e80bba2ae67c0c7dcc16bd57` +Returns: `9f0632478b9f4d0e9c34bf6f` ### `database.type` @@ -97,9 +101,10 @@ No parameters. Examples: +Shows the default database.type call. + ```txt -database.type() +database.type ``` -Example return values: -- `smallint` +Returns: `float` diff --git a/docs-src/docs/040-test-data/domain/100-datatype.md b/docs-src/docs/040-test-data/domain/100-datatype.md index 77cf48da..a1d932a5 100644 --- a/docs-src/docs/040-test-data/domain/100-datatype.md +++ b/docs-src/docs/040-test-data/domain/100-datatype.md @@ -27,13 +27,18 @@ Returns the boolean value true or false. Examples: +Shows datatype.boolean when optional params are omitted. + ```txt datatype.boolean() ``` +Returns: `true` + +Shows datatype.boolean using probability. + ```txt -datatype.boolean(probability=1) +datatype.boolean(probability=0.5) ``` -Example return values: -- `true` +Returns: `true` diff --git a/docs-src/docs/040-test-data/domain/110-date.md b/docs-src/docs/040-test-data/domain/110-date.md index 3cf01bfb..20b24986 100644 --- a/docs-src/docs/040-test-data/domain/110-date.md +++ b/docs-src/docs/040-test-data/domain/110-date.md @@ -27,12 +27,21 @@ Generates a random date that can be either in the past or in the future. Examples: +Shows date.anytime when optional params are omitted. + ```txt date.anytime() ``` -Example return values: -- `"2026-12-25T08:55:20.593Z"` +Returns: `2026-04-19T02:08:51.881Z` + +Shows date.anytime using refDate. + +```txt +date.anytime(refDate=1577836800000) +``` + +Returns: `2019-11-01T10:13:31.881Z` ### `date.between` @@ -43,39 +52,26 @@ Generates a random date between the given boundaries. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `from` | `integer` | no | Start boundary as a Unix timestamp in milliseconds since epoch. | -| `to` | `integer` | no | End boundary as a Unix timestamp in milliseconds since epoch. | +| `from` | `integer` | yes | Start boundary as a Unix timestamp in milliseconds since epoch. | +| `to` | `integer` | yes | End boundary as a Unix timestamp in milliseconds since epoch. | Examples: +Shows date.between using explicit from and to timestamps. + ```txt -date.between(0, 2000000000000) +date.between(from=1577836800000, to=1609372800000) ``` -Example return values: -- `2026-01-15T12:34:56.000Z` - -### `date.betweens` - -Generates random dates between the given boundaries. The dates will be returned in an array sorted in chronological order. - -- Canonical: `awd.domain.date.betweens` -- Faker docs: [https://fakerjs.dev/api/date](https://fakerjs.dev/api/date) - -| Arg | Type | Required | Description | -| --- | --- | --- | --- | -| `count` | `integer` | no | The number of dates to generate. | -| `from` | `integer` | no | Start boundary as a Unix timestamp in milliseconds since epoch. | -| `to` | `integer` | no | End boundary as a Unix timestamp in milliseconds since epoch. | +Returns: `2020-06-01T05:06:45.940Z` -Examples: +Shows date.between with a different bounded range. ```txt -date.betweens(2, 0, 2000000000000) +date.between(from=1609459200000, to=1640995200000) ``` -Example return values: -- `["2026-01-15T12:34:56.000Z","2026-02-01T09:00:00.000Z"]` +Returns: `2021-06-02T05:06:45.940Z` ### `date.birthdate` @@ -89,16 +85,57 @@ Returns a random birthdate. By default, the birthdate is generated for an adult | `refDate` | `integer` | no | Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor. | | `max` | `integer` | no | The maximum age/year to generate a birthdate for/in. | | `min` | `integer` | no | The minimum age/year to generate a birthdate for/in. | -| `mode` | `string` | no | Either 'age' or 'year' to generate a birthdate based on the age or year range. | +| `mode` | `age\|year` | no | Either 'age' or 'year' to generate a birthdate based on the age or year range. | Examples: +Shows date.birthdate in use. + ```txt date.birthdate(refDate=20000, max=69, min=16, mode="age") ``` -Example return values: -- `"1966-09-18T08:47:31.333Z"` +Returns: `1922-07-10T12:11:49.191Z` + +Shows date.birthdate when optional params are omitted. + +```txt +date.birthdate() +``` + +Returns: `1971-09-27T08:09:14.757Z` + +Shows date.birthdate using refDate. + +```txt +date.birthdate(refDate=1577836800000) +``` + +Returns: `1965-04-10T16:13:54.757Z` + +Shows date.birthdate using max. + +```txt +date.birthdate(max=65) +``` + +Returns: `1980-06-25T11:25:42.848Z` + +Shows date.birthdate using min. + +```txt +date.birthdate(max=10, min=1) +``` + +Returns: `2019-08-20T15:04:00.805Z` + +Shows date.birthdate using mode. + +```txt +date.birthdate(mode="age") +``` + +Returns: `1971-09-27T08:09:14.757Z` ### `date.future` @@ -114,12 +151,29 @@ Generates a random date in the future. Examples: +Shows date.future when optional params are omitted. + ```txt date.future() ``` -Example return values: -- `"2027-02-07T18:41:48.525Z"` +Returns: `2026-11-17T21:02:06.523Z` + +Shows date.future using refDate. + +```txt +date.future(refDate=1577836800000) +``` + +Returns: `2020-06-01T05:06:46.523Z` + +Shows date.future using years. + +```txt +date.future(years=2) +``` + +Returns: `2027-04-19T02:08:52.463Z` ### `date.month` @@ -135,16 +189,29 @@ Returns a random name of a month. Examples: +Shows date.month when optional params are omitted. + ```txt date.month() ``` +Returns: `July` + +Shows date.month using abbreviated. + ```txt -date.month(abbreviated=false, context=false) +date.month(abbreviated=true) ``` -Example return values: -- `February` +Returns: `Jul` + +Shows date.month using context. + +```txt +date.month(context=true) +``` + +Returns: `July` ### `date.past` @@ -160,12 +227,29 @@ Generates a random date in the past. Examples: +Shows date.past when optional params are omitted. + ```txt date.past() ``` -Example return values: -- `"2025-07-01T11:48:55.347Z"` +Returns: `2025-11-17T21:02:05.523Z` + +Shows date.past using refDate. + +```txt +date.past(refDate=1577836800000) +``` + +Returns: `2019-06-02T05:06:45.523Z` + +Shows date.past using years. + +```txt +date.past(years=2) +``` + +Returns: `2025-04-19T02:08:51.463Z` ### `date.recent` @@ -181,12 +265,29 @@ Generates a random date in the recent past. Examples: +Shows date.recent when optional params are omitted. + ```txt date.recent() ``` -Example return values: -- `"2026-04-27T23:46:16.707Z"` +Returns: `2026-06-18T01:55:50.284Z` + +Shows date.recent using days. + +```txt +date.recent(days=7) +``` + +Returns: `2026-06-14T13:58:54.491Z` + +Shows date.recent using refDate. + +```txt +date.recent(refDate=1577836800000) +``` + +Returns: `2019-12-31T10:00:30.284Z` ### `date.soon` @@ -202,12 +303,29 @@ Generates a random date in the near future. Examples: +Shows date.soon when optional params are omitted. + ```txt date.soon() ``` -Example return values: -- `"2026-04-29T11:09:09.211Z"` +Returns: `2026-06-19T01:55:51.284Z` + +Shows date.soon using days. + +```txt +date.soon(days=7) +``` + +Returns: `2026-06-21T13:58:55.491Z` + +Shows date.soon using refDate. + +```txt +date.soon(refDate=1577836800000) +``` + +Returns: `2020-01-01T10:00:31.284Z` ### `date.timeZone` @@ -220,12 +338,13 @@ No parameters. Examples: +Shows the default date.timeZone call. + ```txt -date.timeZone() +date.timeZone ``` -Example return values: -- `Europe/Stockholm` +Returns: `America/Santiago` ### `date.weekday` @@ -241,13 +360,26 @@ Returns a random day of the week. Examples: +Shows date.weekday when optional params are omitted. + ```txt date.weekday() ``` +Returns: `Saturday` + +Shows date.weekday using abbreviated. + +```txt +date.weekday(abbreviated=true) +``` + +Returns: `Sat` + +Shows date.weekday using context. + ```txt -date.weekday(abbreviated=false, context=false) +date.weekday(context=true) ``` -Example return values: -- `Tuesday` +Returns: `Saturday` diff --git a/docs-src/docs/040-test-data/domain/120-finance.md b/docs-src/docs/040-test-data/domain/120-finance.md index e9ada0a8..ac158f39 100644 --- a/docs-src/docs/040-test-data/domain/120-finance.md +++ b/docs-src/docs/040-test-data/domain/120-finance.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default finance.accountName call. + ```txt -finance.accountName() +finance.accountName ``` -Example return values: -- `Investment Account` +Returns: `Home Loan Account` ### `finance.accountNumber` @@ -45,16 +46,21 @@ Generates a random account number. Examples: +Shows finance.accountNumber when optional params are omitted. + ```txt finance.accountNumber() ``` +Returns: `47031013` + +Shows finance.accountNumber using length. + ```txt -finance.accountNumber(length=1) +finance.accountNumber(length=5) ``` -Example return values: -- `43208795` +Returns: `47031` ### `finance.amount` @@ -73,18 +79,53 @@ Generates a random amount between the given bounds (inclusive). Examples: +Shows finance.amount when optional params are omitted. + ```txt finance.amount() ``` -Type-in examples (named params): +Returns: `417.02` + +Shows finance.amount using autoFormat. ```txt finance.amount(autoFormat=true) ``` -Example return values: -- `536.86` +Returns: `417.02` + +Shows finance.amount using dec. + +```txt +finance.amount(dec=2) +``` + +Returns: `417.02` + +Shows finance.amount using max. + +```txt +finance.amount(max=100) +``` + +Returns: `41.70` + +Shows finance.amount using min. + +```txt +finance.amount(max=10, min=1) +``` + +Returns: `4.75` + +Shows finance.amount using symbol. + +```txt +finance.amount(symbol="$") +``` + +Returns: `$417.02` ### `finance.bic` @@ -99,16 +140,21 @@ Generates a random SWIFT/BIC code based on the ISO-9362 format. Examples: +Shows finance.bic when optional params are omitted. + ```txt finance.bic() ``` +Returns: `SAHDBI6CJFO` + +Shows finance.bic using includeBranchCode. + ```txt finance.bic(includeBranchCode=true) ``` -Example return values: -- `TXWRPYFT` +Returns: `KSAHBZ36EJF` ### `finance.bitcoinAddress` @@ -117,16 +163,36 @@ Generates a random Bitcoin address. - Canonical: `awd.domain.finance.bitcoinAddress` - Faker docs: [https://fakerjs.dev/api/finance](https://fakerjs.dev/api/finance) -No parameters. +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `type` | `legacy\|segwit\|bech32\|taproot` | no | The bitcoin address type ('legacy', 'segwit', 'bech32' or 'taproot'). | +| `network` | `mainnet\|testnet` | no | The bitcoin network ('mainnet' or 'testnet'). | Examples: +Shows finance.bitcoinAddress when optional params are omitted. + ```txt finance.bitcoinAddress() ``` -Example return values: -- `39fu5Nhnibj2xa8FPVxCbX7y4xZi5SWd` +Returns: `31i96bmpxqFcS2Eqy9cNYjGST53aS6qX` + +Shows finance.bitcoinAddress using type. + +```txt +finance.bitcoinAddress(type="bech32") +``` + +Returns: `bc1fr0a536dekfp7w0pfk57tycqww326w4fykqcpu0` + +Shows finance.bitcoinAddress using network. + +```txt +finance.bitcoinAddress(network="testnet") +``` + +Returns: `21i96bmpxqFcS2Eqy9cNYjGST53aS6qX` ### `finance.creditCardCVV` @@ -139,12 +205,13 @@ No parameters. Examples: +Shows the default finance.creditCardCVV call. + ```txt -finance.creditCardCVV() +finance.creditCardCVV ``` -Example return values: -- `839` +Returns: `470` ### `finance.creditCardIssuer` @@ -157,12 +224,13 @@ No parameters. Examples: +Shows the default finance.creditCardIssuer call. + ```txt -finance.creditCardIssuer() +finance.creditCardIssuer ``` -Example return values: -- `jcb` +Returns: `discover` ### `finance.creditCardNumber` @@ -177,34 +245,21 @@ Generates a random credit card number. Examples: -```txt -finance.creditCardNumber() -``` +Shows finance.creditCardNumber when optional params are omitted. ```txt -finance.creditCardNumber(issuer="value") +finance.creditCardNumber() ``` -Example return values: -- `6449-4462-4996-7580` - -### `finance.currency` +Returns: `6503-1013-3546-2805` -Returns a random currency object, containing `code`, `name`, `symbol`, and `numericCode` properties. - -- Canonical: `awd.domain.finance.currency` -- Faker docs: [https://fakerjs.dev/api/finance](https://fakerjs.dev/api/finance) - -No parameters. - -Examples: +Shows finance.creditCardNumber using issuer. ```txt -finance.currency() +finance.creditCardNumber(issuer="Visa") ``` -Example return values: -- `{"name":"Rial Omani","code":"OMR","symbol":"﷼","numericCode":"512"}` +Returns: `4703101335466` ### `finance.currencyCode` @@ -217,12 +272,13 @@ No parameters. Examples: +Shows the default finance.currencyCode call. + ```txt -finance.currencyCode() +finance.currencyCode ``` -Example return values: -- `ISK` +Returns: `JOD` ### `finance.currencyName` @@ -235,12 +291,13 @@ No parameters. Examples: +Shows the default finance.currencyName call. + ```txt -finance.currencyName() +finance.currencyName ``` -Example return values: -- `South Sudanese pound` +Returns: `Jordanian Dinar` ### `finance.currencyNumericCode` @@ -253,12 +310,13 @@ No parameters. Examples: +Shows the default finance.currencyNumericCode call. + ```txt -finance.currencyNumericCode() +finance.currencyNumericCode ``` -Example return values: -- `270` +Returns: `400` ### `finance.currencySymbol` @@ -271,12 +329,13 @@ No parameters. Examples: +Shows the default finance.currencySymbol call. + ```txt -finance.currencySymbol() +finance.currencySymbol ``` -Example return values: -- `₩` +Returns: `руб` ### `finance.ethereumAddress` @@ -289,12 +348,13 @@ No parameters. Examples: +Shows the default finance.ethereumAddress call. + ```txt -finance.ethereumAddress() +finance.ethereumAddress ``` -Example return values: -- `0xf5d385aff27de9dee6eeeffd924ffd7dd2d252ca` +Returns: `0x9f0632478b9f4d0e9c34bf6fdd103d29fbf6fc0a` ### `finance.iban` @@ -310,16 +370,29 @@ Generates a random IBAN. Examples: +Shows finance.iban when optional params are omitted. + ```txt finance.iban() ``` +Returns: `IE39SAHD00454601410936` + +Shows finance.iban using countryCode. + ```txt -finance.iban(countryCode="GB", formatted=true) +finance.iban(countryCode="GB") ``` -Example return values: -- `CH67001759079BP5WA811` +Returns: `GB98KSAH00235420410936` + +Shows finance.iban using formatted. + +```txt +finance.iban(formatted=true) +``` + +Returns: `IE39 SAHD 0045 4601 4109 36` ### `finance.litecoinAddress` @@ -332,12 +405,13 @@ No parameters. Examples: +Shows the default finance.litecoinAddress call. + ```txt -finance.litecoinAddress() +finance.litecoinAddress ``` -Example return values: -- `M7nWopfUfSjA8cmGWvuENRLu6GU4C1iTK` +Returns: `31i96bmpxqFcS2Eqy9cNYjGST53aS` ### `finance.pin` @@ -352,16 +426,21 @@ Generates a random PIN number. Examples: +Shows finance.pin when optional params are omitted. + ```txt finance.pin() ``` +Returns: `4703` + +Shows finance.pin using length. + ```txt -finance.pin(length=1) +finance.pin(length=5) ``` -Example return values: -- `1107` +Returns: `47031` ### `finance.routingNumber` @@ -374,12 +453,13 @@ No parameters. Examples: +Shows the default finance.routingNumber call. + ```txt -finance.routingNumber() +finance.routingNumber ``` -Example return values: -- `933657999` +Returns: `470310139` ### `finance.transactionDescription` @@ -392,12 +472,13 @@ No parameters. Examples: +Shows the default finance.transactionDescription call. + ```txt -finance.transactionDescription() +finance.transactionDescription ``` -Example return values: -- `Transaction alert: deposit at Jones LLC using card ending ****4221 for an amount of GIP 94.88 on account ***3694.` +Returns: `You made a payment of AED 302.33 at Hegmann - Johnston using card ending in ****6280 from account ***6451.` ### `finance.transactionType` @@ -410,9 +491,10 @@ No parameters. Examples: +Shows the default finance.transactionType call. + ```txt -finance.transactionType() +finance.transactionType ``` -Example return values: -- `deposit` +Returns: `invoice` diff --git a/docs-src/docs/040-test-data/domain/130-food.md b/docs-src/docs/040-test-data/domain/130-food.md index 4a44acce..d86311ca 100644 --- a/docs-src/docs/040-test-data/domain/130-food.md +++ b/docs-src/docs/040-test-data/domain/130-food.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default food.adjective call. + ```txt -food.adjective() +food.adjective ``` -Example return values: -- `salty` +Returns: `juicy` ### `food.description` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default food.description call. + ```txt -food.description() +food.description ``` -Example return values: -- `Fresh mixed greens tossed with pimento-rubbed pigeon, bean shoots, and a light dressing.` +Returns: `An exquisite artichoke dish, paired with brown rice and a hint of cardamom.` ### `food.dish` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default food.dish call. + ```txt -food.dish() +food.dish ``` -Example return values: -- `Chicken Fajitas` +Returns: `Cinnamon-crusted Chicken` ### `food.ethnicCategory` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default food.ethnicCategory call. + ```txt -food.ethnicCategory() +food.ethnicCategory ``` -Example return values: -- `Lithuanian` +Returns: `Indonesian` ### `food.fruit` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default food.fruit call. + ```txt -food.fruit() +food.fruit ``` -Example return values: -- `snowpea` +Returns: `grapefruit` ### `food.ingredient` @@ -115,12 +120,13 @@ No parameters. Examples: +Shows the default food.ingredient call. + ```txt -food.ingredient() +food.ingredient ``` -Example return values: -- `spelt` +Returns: `green pepper` ### `food.meat` @@ -133,12 +139,13 @@ No parameters. Examples: +Shows the default food.meat call. + ```txt -food.meat() +food.meat ``` -Example return values: -- `goose` +Returns: `kangaroo` ### `food.spice` @@ -151,12 +158,13 @@ No parameters. Examples: +Shows the default food.spice call. + ```txt -food.spice() +food.spice ``` -Example return values: -- `poudre de colombo` +Returns: `fines herbes` ### `food.vegetable` @@ -169,9 +177,10 @@ No parameters. Examples: +Shows the default food.vegetable call. + ```txt -food.vegetable() +food.vegetable ``` -Example return values: -- `snowpea sprouts` +Returns: `eggplant` diff --git a/docs-src/docs/040-test-data/domain/140-git.md b/docs-src/docs/040-test-data/domain/140-git.md index aeb727f2..d7684f9f 100644 --- a/docs-src/docs/040-test-data/domain/140-git.md +++ b/docs-src/docs/040-test-data/domain/140-git.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default git.branch call. + ```txt -git.branch() +git.branch ``` -Example return values: -- `array-compress` +Returns: `firewall-parse` ### `git.commitDate` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default git.commitDate call. + ```txt -git.commitDate() +git.commitDate ``` -Example return values: -- `Tue Apr 28 04:28:58 2026 -0600` +Returns: `Thu Jun 18 01:55:50 2026 +0600` ### `git.commitEntry` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default git.commitEntry call. + ```txt -git.commitEntry() +git.commitEntry ``` -Example return values: -- `commit 4f9a2d1c Author: Alex Example Date: Tue May 19 2026` +Returns: `commit f0632478b9f4d0e9c34bf6fdd103d29fbf6fc0af\nAuthor: Ricardo Upton \nDate: Wed Jun 17 19:26:37 2026 +0300\n\n    parse auxiliary feed\n` ### `git.commitMessage` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default git.commitMessage call. + ```txt -git.commitMessage() +git.commitMessage ``` -Example return values: -- `reboot cross-platform system` +Returns: `hack optical alarm` ### `git.commitSha` @@ -97,9 +101,10 @@ No parameters. Examples: +Shows the default git.commitSha call. + ```txt -git.commitSha() +git.commitSha ``` -Example return values: -- `3418f0e64e8eae52ebd67b11d98e571fd6a81017` +Returns: `9f0632478b9f4d0e9c34bf6fdd103d29fbf6fc0a` diff --git a/docs-src/docs/040-test-data/domain/150-hacker.md b/docs-src/docs/040-test-data/domain/150-hacker.md index f61810f3..e6fa5d54 100644 --- a/docs-src/docs/040-test-data/domain/150-hacker.md +++ b/docs-src/docs/040-test-data/domain/150-hacker.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default hacker.abbreviation call. + ```txt -hacker.abbreviation() +hacker.abbreviation ``` -Example return values: -- `GB` +Returns: `IP` ### `hacker.adjective` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default hacker.adjective call. + ```txt -hacker.adjective() +hacker.adjective ``` -Example return values: -- `bluetooth` +Returns: `mobile` ### `hacker.ingverb` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default hacker.ingverb call. + ```txt -hacker.ingverb() +hacker.ingverb ``` -Example return values: -- `synthesizing` +Returns: `generating` ### `hacker.noun` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default hacker.noun call. + ```txt -hacker.noun() +hacker.noun ``` -Example return values: -- `program` +Returns: `firewall` ### `hacker.phrase` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default hacker.phrase call. + ```txt -hacker.phrase() +hacker.phrase ``` -Example return values: -- `compressing the application won't do anything, we need to reboot the neural JSON hard drive!` +Returns: `Try to back up the COM bus, maybe it will hack the mobile bus!` ### `hacker.verb` @@ -115,9 +120,10 @@ No parameters. Examples: +Shows the default hacker.verb call. + ```txt -hacker.verb() +hacker.verb ``` -Example return values: -- `program` +Returns: `hack` diff --git a/docs-src/docs/040-test-data/domain/160-image.md b/docs-src/docs/040-test-data/domain/160-image.md index 45b1d965..db5a6808 100644 --- a/docs-src/docs/040-test-data/domain/160-image.md +++ b/docs-src/docs/040-test-data/domain/160-image.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default image.avatar call. + ```txt -image.avatar() +image.avatar ``` -Example return values: -- `https://avatars.githubusercontent.com/u/2389220` +Returns: `https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/0.jpg` ### `image.avatarGitHub` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default image.avatarGitHub call. + ```txt -image.avatarGitHub() +image.avatarGitHub ``` -Example return values: -- `https://avatars.githubusercontent.com/u/22969292` +Returns: `https://avatars.githubusercontent.com/u/41702200` ### `image.dataUri` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default image.dataUri call. + ```txt -image.dataUri() +image.dataUri ``` -Example return values: -- `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4=` +Returns: `data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%221668%22%20height%3D%222881%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22%23063247%22%2F%3E%3Ctext%20x%3D%22834%22%20y%3D%221440.5%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3E1668x2881%3C%2Ftext%3E%3C%2Fsvg%3E` ### `image.personPortrait` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default image.personPortrait call. + ```txt -image.personPortrait() +image.personPortrait ``` -Example return values: -- `https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/99.jpg` +Returns: `https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/72.jpg` ### `image.url` @@ -100,34 +104,29 @@ Generates a random image url. Examples: -```txt -image.url() -``` +Shows image.url when optional params are omitted. ```txt -image.url(height=1, width=1) +image.url() ``` -Example return values: -- `https://loremflickr.com/3255/509?lock=5223276893828872` +Returns: `https://picsum.photos/seed/i95bl/1668/2881` -### `image.urlLoremFlickr` +Shows image.url using height. -Generates a random image url provided via https://loremflickr.com. +```txt +image.url(height=1) +``` -- Canonical: `awd.domain.image.urlLoremFlickr` -- Faker docs: [https://fakerjs.dev/api/image](https://fakerjs.dev/api/image) +Returns: `https://picsum.photos/seed/0i95bloxp/1668/1` -No parameters. - -Examples: +Shows image.url using width. ```txt -image.urlLoremFlickr() +image.url(width=1) ``` -Example return values: -- `https://loremflickr.com/3966/3602?lock=6417693540486546` +Returns: `https://picsum.photos/seed/0i95bloxp/1/1668` ### `image.urlPicsumPhotos` @@ -140,9 +139,10 @@ No parameters. Examples: +Shows the default image.urlPicsumPhotos call. + ```txt -image.urlPicsumPhotos() +image.urlPicsumPhotos ``` -Example return values: -- `https://picsum.photos/seed/UBLQun43/2068/162?blur=8` +Returns: `https://picsum.photos/seed/5blox/1668/2881?grayscale&blur=3` diff --git a/docs-src/docs/040-test-data/domain/170-internet.md b/docs-src/docs/040-test-data/domain/170-internet.md index edd61117..17d9d71a 100644 --- a/docs-src/docs/040-test-data/domain/170-internet.md +++ b/docs-src/docs/040-test-data/domain/170-internet.md @@ -6,7 +6,7 @@ description: "Domain keyword reference for internet." # internet Domain -The `internet` domain maps domain keywords to underlying faker implementations. +The `internet` domain mostly maps domain keywords to faker-backed generators, but `internet.httpMethod` is implemented directly by AnywayData. ## Faker Documentation @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default internet.displayName call. + ```txt -internet.displayName() +internet.displayName ``` -Example return values: -- `Cordell0` +Returns: `Aaliyah.Bosco` ### `internet.domainName` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default internet.domainName call. + ```txt -internet.domainName() +internet.domainName ``` -Example return values: -- `beloved-peony.org` +Returns: `inferior-punctuation.biz` ### `internet.domainSuffix` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default internet.domainSuffix call. + ```txt -internet.domainSuffix() +internet.domainSuffix ``` -Example return values: -- `com` +Returns: `info` ### `internet.domainWord` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default internet.domainWord call. + ```txt -internet.domainWord() +internet.domainWord ``` -Example return values: -- `inexperienced-ravioli` +Returns: `inferior-punctuation` ### `internet.email` @@ -95,23 +99,52 @@ Generates data using faker internet email. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `allowSpecialCharacters` | `boolean` | no | Whether special characters such as .!#$%&'*+-/=?^_`{\|}~ should be included in the email address. | +| `allowSpecialCharacters` | `boolean` | no | Whether special characters such as .!#$%&'*+-/=?^_`{\|}~ should be included in the email address. | | `firstName` | `string` | no | The optional first name to use. | | `lastName` | `string` | no | The optional last name to use. | | `provider` | `string` | no | The mail provider domain to use. If not specified, a random free mail provider will be chosen. | Examples: +Shows internet.email when optional params are omitted. + ```txt internet.email() ``` +Returns: `Edwin.Dibbert@hotmail.com` + +Shows internet.email using allowSpecialCharacters. + +```txt +internet.email(allowSpecialCharacters=true) +``` + +Returns: `Edwin.Dibbert@hotmail.com` + +Shows internet.email using firstName. + ```txt -internet.email(allowSpecialCharacters=true, firstName="Alex", lastName="Taylor", provider="example.com") +internet.email(firstName="Ada") ``` -Example return values: -- `Jana91@hotmail.com` +Returns: `Ada.Gutmann9@hotmail.com` + +Shows internet.email using lastName. + +```txt +internet.email(lastName="Lovelace") +``` + +Returns: `Edwin.Lovelace9@hotmail.com` + +Shows internet.email using provider. + +```txt +internet.email(provider="example.com") +``` + +Returns: `Aaliyah.Bosco@example.com` ### `internet.emoji` @@ -126,16 +159,21 @@ Generates a random emoji. Examples: +Shows internet.emoji when optional params are omitted. + ```txt internet.emoji() ``` +Returns: `🥣` + +Shows internet.emoji using types. + ```txt -internet.emoji(types=["food","nature"]) +internet.emoji(types=["food"]) ``` -Example return values: -- `🤨` +Returns: `🍲` ### `internet.exampleEmail` @@ -148,30 +186,50 @@ No parameters. Examples: +Shows the default internet.exampleEmail call. + ```txt -internet.exampleEmail() +internet.exampleEmail ``` -Example return values: -- `Jeremie37@example.net` +Returns: `Edwin.Dibbert@example.net` ### `internet.httpMethod` -Returns a random http method. +Returns a random HTTP request method from an AnywayData-defined pool of GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS, TRACE, and CONNECT, with optional filtering for common methods and exclusions. - Canonical: `awd.domain.internet.httpMethod` -- Faker docs: [https://fakerjs.dev/api/internet](https://fakerjs.dev/api/internet) -No parameters. +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `commonOnly` | `boolean` | no | When true, limits generation to GET, HEAD, POST, PUT, and DELETE. Defaults to false. | +| `excludes` | `string` | no | Comma-separated HTTP methods to remove from the candidate set. Values are case-insensitive, surrounding spaces are trimmed, and generation throws if exclusions remove every available method. | Examples: +Shows internet.httpMethod choosing from the full HTTP method set by default. + ```txt internet.httpMethod() ``` -Example return values: -- `PATCH` +Returns: `PUT` + +Shows internet.httpMethod restricted to the common request methods. + +```txt +internet.httpMethod(commonOnly=true) +``` + +Returns: `POST` + +Shows internet.httpMethod trimming spaces, normalizing case, and excluding methods from the full set. + +```txt +internet.httpMethod(excludes="patch, TRACE") +``` + +Returns: `POST` ### `internet.httpStatusCode` @@ -184,12 +242,13 @@ No parameters. Examples: +Shows the default internet.httpStatusCode call. + ```txt -internet.httpStatusCode() +internet.httpStatusCode ``` -Example return values: -- `303` +Returns: `306` ### `internet.ip` @@ -202,12 +261,13 @@ No parameters. Examples: +Shows the default internet.ip call. + ```txt -internet.ip() +internet.ip ``` -Example return values: -- `56.23.30.52` +Returns: `184.103.47.157` ### `internet.ipv4` @@ -219,20 +279,33 @@ Generates a random IPv4 address. | Arg | Type | Required | Description | | --- | --- | --- | --- | | `cidrBlock` | `string` | no | The optional CIDR block to use. Must be in the format x.x.x.x/y. | -| `network` | `string` | no | The optional network to use. This is intended as an alias for well-known cidrBlocks. | +| `network` | `any\|loopback\|private-a\|private-b\|private-c\|test-net-1\|test-net-2\|test-net-3\|link-local\|multicast` | no | The optional network to use. This is intended as an alias for well-known cidrBlocks. | Examples: +Shows internet.ipv4 when optional params are omitted. + ```txt internet.ipv4() ``` +Returns: `106.193.244.63` + +Shows internet.ipv4 using cidrBlock. + ```txt -internet.ipv4(cidrBlock="192.168.0.0/24", network="private-a") +internet.ipv4(cidrBlock="192.168.0.0/24") ``` -Example return values: -- `192.168.0.42` +Returns: `192.168.0.106` + +Shows internet.ipv4 using network. + +```txt +internet.ipv4(network="private-a") +``` + +Returns: `10.106.193.244` ### `internet.ipv6` @@ -245,12 +318,13 @@ No parameters. Examples: +Shows the default internet.ipv6 call. + ```txt -internet.ipv6() +internet.ipv6 ``` -Example return values: -- `2001:0db8:85a3:0000:0000:8a2e:0370:7334` +Returns: `9f06:3247:8b9f:4d0e:9c34:bf6f:dd10:3d29` ### `internet.jwt` @@ -267,16 +341,37 @@ Generates a random JWT (JSON Web Token). Examples: +Shows internet.jwt when optional params are omitted. + ```txt internet.jwt() ``` +Returns: `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3ODE3NDc3NTAsImV4cCI6MTc4MTc0Nzc2MSwibmJmIjoxNzY5MzMwODQwLCJpc3MiOiJIZWdtYW5uIC0gSm9obnN0b24iLCJzdWIiOiJhM2UwYTY4Mi0zY2Y1LTRiZWUtYTEwMi1lMTZmOGI1YWQwY2YiLCJhdWQiOiI0YzE3ZTQ0Mi0wYTM0LTQ3MDktODI5Yi0xNmI2MDhhOGY5ZTIiLCJqdGkiOiJjNjJlNWNiZS05YzU0LTRlNmYtOWE5MS1mNzk2M2U5MDk1OGUifQ.UC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914u` + +Shows internet.jwt using header. + +```txt +internet.jwt(header={"value":"sample"}) +``` + +Returns: `eyJ2YWx1ZSI6InNhbXBsZSJ9.eyJpYXQiOjE3ODE3NDc3NTAsImV4cCI6MTc4MTgwOTk4NywibmJmIjoxNzUwMjY5MzM0LCJpc3MiOiJEaWJiZXJ0IC0gTGluZCIsInN1YiI6IjZhM2UwYTY4LTIzY2YtNDViZS1iZTEwLTJlMTZmOGI1YWQwYyIsImF1ZCI6ImI0YzE3ZTQ0LTIwYTMtNDQ3MC04OTI5LWIxNmI2MDhhOGY5ZSIsImp0aSI6IjJjNjJlNWNiLWU5YzUtNDRlNi1iZmE5LTFmNzk2M2U5MDk1OCJ9.mUC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914` + +Shows internet.jwt using payload. + +```txt +internet.jwt(payload={"value":"sample"}) +``` + +Returns: `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YWx1ZSI6InNhbXBsZSJ9.0i95bloxpGcS1Fpy8cNYjGST52aS6qXxGjGP1KZKhM6rUih81Gdgu3z9AH6pHp3x` + +Shows internet.jwt using refDate. + ```txt -internet.jwt(header={"alg":"HS256","typ":"JWT"}, payload={"iss":"Acme"}, refDate=1) +internet.jwt(refDate=1718755200000) ``` -Example return values: -- `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl` +Returns: `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTg3MDQ4MzAsImV4cCI6MTcxODcwNDg0MSwibmJmIjoxNzA2Mjg3OTIwLCJpc3MiOiJIZWdtYW5uIC0gSm9obnN0b24iLCJzdWIiOiJhM2UwYTY4Mi0zY2Y1LTRiZWUtYTEwMi1lMTZmOGI1YWQwY2YiLCJhdWQiOiI0YzE3ZTQ0Mi0wYTM0LTQ3MDktODI5Yi0xNmI2MDhhOGY5ZTIiLCJqdGkiOiJjNjJlNWNiZS05YzU0LTRlNmYtOWE5MS1mNzk2M2U5MDk1OGUifQ.UC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914u` ### `internet.jwtAlgorithm` @@ -289,12 +384,13 @@ No parameters. Examples: +Shows the default internet.jwtAlgorithm call. + ```txt -internet.jwtAlgorithm() +internet.jwtAlgorithm ``` -Example return values: -- `PS384` +Returns: `HS512` ### `internet.mac` @@ -305,20 +401,25 @@ Generates a random mac address. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `separator` | `string` | no | The optional separator to use. Can be either ':', '-' or ''. | +| `separator` | `":"\|"-"\|""` | no | The optional separator to use. Can be either ':', '-' or ''. | Examples: +Shows internet.mac when optional params are omitted. + ```txt internet.mac() ``` +Returns: `6b:04:21:25:68:6a` + +Shows internet.mac using separator. + ```txt internet.mac(separator="-") ``` -Example return values: -- `ae:a9:d7:ba:d2:bd` +Returns: `6b-04-21-25-68-6a` ### `internet.password` @@ -336,12 +437,69 @@ Generates a random password-like string. Do not use this method for generating a Examples: +Shows internet.password with all optional params omitted. + +```txt +internet.password() +``` + +Returns: `He2AFTHb4tHV3mb` + +Shows internet.password using only a custom length. + +```txt +internet.password(length=12) +``` + +Returns: `He2AFTHb4tHV` + +Shows internet.password using only the memorable flag. + +```txt +internet.password(memorable=true) +``` + +Returns: `hefutisawetikub` + +Shows internet.password generating a memorable password-like string. + +```txt +internet.password(length=12, memorable=true) +``` + +Returns: `hefutisaweti` + +Shows internet.password constrained only by a regex-style pattern. + +```txt +internet.password(pattern="[A-Z]") +``` + +Returns: `HAFTHHVISKOWXHH` + +Shows internet.password constrained by a regex-style pattern. + +```txt +internet.password(length=12, memorable=false, pattern="[A-Z]") +``` + +Returns: `HAFTHHVISKOW` + +Shows internet.password using only the prefix option. + +```txt +internet.password(prefix="#") +``` + +Returns: `#He2AFTHb4tHV3m` + +Shows internet.password using length, pattern, and prefix together. + ```txt -internet.password(length=10, memorable=false, pattern="[A-Za-z0-9]", prefix="#") +internet.password(length=12, memorable=false, pattern="[A-Z]", prefix="#") ``` -Example return values: -- `og1ejoksrfwVbIF` +Returns: `#HAFTHHVISKO` ### `internet.port` @@ -354,12 +512,13 @@ No parameters. Examples: +Shows the default internet.port call. + ```txt -internet.port() +internet.port ``` -Example return values: -- `24545` +Returns: `27329` ### `internet.protocol` @@ -372,12 +531,13 @@ No parameters. Examples: +Shows the default internet.protocol call. + ```txt -internet.protocol() +internet.protocol ``` -Example return values: -- `http` +Returns: `http` ### `internet.url` @@ -389,20 +549,33 @@ Generates a random http(s) url. | Arg | Type | Required | Description | | --- | --- | --- | --- | | `appendSlash` | `boolean` | no | Whether to append a slash to the end of the url (path). | -| `protocol` | `string` | no | The protocol to use. | +| `protocol` | `http\|https` | no | The protocol to use. | Examples: +Shows internet.url when optional params are omitted. + ```txt internet.url() ``` +Returns: `https://self-reliant-cd.com/` + +Shows internet.url using appendSlash. + +```txt +internet.url(appendSlash=true) +``` + +Returns: `https://inferior-punctuation.biz/` + +Shows internet.url using protocol. + ```txt -internet.url(appendSlash=true, protocol="https") +internet.url(protocol="https") ``` -Example return values: -- `https://brave-interior.biz/` +Returns: `https://self-reliant-cd.com/` ### `internet.userAgent` @@ -415,12 +588,13 @@ No parameters. Examples: +Shows the default internet.userAgent call. + ```txt -internet.userAgent() +internet.userAgent ``` -Example return values: -- `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36` +Returns: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/586.0.30 (KHTML, like Gecko) Version/16.1 Safari/546.9.18` ### `internet.username` @@ -436,13 +610,26 @@ Generates a username using the given person's name as base. Examples: +Shows internet.username when optional params are omitted. + ```txt internet.username() ``` +Returns: `Aaliyah.Bosco` + +Shows internet.username using firstName. + +```txt +internet.username(firstName="Ada") +``` + +Returns: `Ada.Abbott14` + +Shows internet.username using lastName. + ```txt -internet.username(firstName="Alex", lastName="Taylor") +internet.username(lastName="Lovelace") ``` -Example return values: -- `Deanna51` +Returns: `Aaliyah.Lovelace14` diff --git a/docs-src/docs/040-test-data/domain/180-literal.md b/docs-src/docs/040-test-data/domain/180-literal.md index b65a2c61..1ffbd3a0 100644 --- a/docs-src/docs/040-test-data/domain/180-literal.md +++ b/docs-src/docs/040-test-data/domain/180-literal.md @@ -15,7 +15,6 @@ The `literal` domain returns caller-provided values directly and does not invoke Return the literal value provided by the caller. - Canonical: `awd.domain.literal.value` -- Docs: [https://anywaydata.com/docs/category/generating-data](https://anywaydata.com/docs/category/generating-data) | Arg | Type | Required | Description | | --- | --- | --- | --- | @@ -23,13 +22,34 @@ Return the literal value provided by the caller. Examples: +Shows literal.value in use. + ```txt -literal.value("Pending") +literal.value(value="Pending") ``` +Returns: `Pending` + +Shows literal.value in use. + +```txt +literal.value(value="") +``` + +Returns: `` + +Shows literal.value when optional params are omitted. + +```txt +literal.value() +``` + +Returns: `` + +Shows literal.value using value. + ```txt -literal.value("") +literal.value(value=1) ``` -Example return values: -- `Pending` +Returns: `1` diff --git a/docs-src/docs/040-test-data/domain/190-location.md b/docs-src/docs/040-test-data/domain/190-location.md index f96a2531..bf65240c 100644 --- a/docs-src/docs/040-test-data/domain/190-location.md +++ b/docs-src/docs/040-test-data/domain/190-location.md @@ -14,6 +14,63 @@ The `location` domain maps domain keywords to underlying faker implementations. ## Methods +### `language.alpha2` + +Returns a random ISO 639-1 language code. + +- Canonical: `awd.domain.location.language.alpha2` +- Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) + +No parameters. + +Examples: + +Shows the default location.language.alpha2 call. + +```txt +location.language.alpha2 +``` + +Returns: `pa` + +### `language.alpha3` + +Returns a random ISO 639-2 or ISO 639-3 language code. + +- Canonical: `awd.domain.location.language.alpha3` +- Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) + +No parameters. + +Examples: + +Shows the default location.language.alpha3 call. + +```txt +location.language.alpha3 +``` + +Returns: `pan` + +### `language.name` + +Returns a random spoken language name. + +- Canonical: `awd.domain.location.language.name` +- Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) + +No parameters. + +Examples: + +Shows the default location.language.name call. + +```txt +location.language.name +``` + +Returns: `Punjabi` + ### `location.buildingNumber` Generates a random building number. @@ -25,12 +82,13 @@ No parameters. Examples: +Shows the default location.buildingNumber call. + ```txt -location.buildingNumber() +location.buildingNumber ``` -Example return values: -- `5075` +Returns: `7031` ### `location.cardinalDirection` @@ -43,12 +101,13 @@ No parameters. Examples: +Shows the default location.cardinalDirection call. + ```txt -location.cardinalDirection() +location.cardinalDirection ``` -Example return values: -- `East` +Returns: `East` ### `location.city` @@ -61,12 +120,13 @@ No parameters. Examples: +Shows the default location.city call. + ```txt -location.city() +location.city ``` -Example return values: -- `Stellachester` +Returns: `Edwinville` ### `location.continent` @@ -79,12 +139,13 @@ No parameters. Examples: +Shows the default location.continent call. + ```txt -location.continent() +location.continent ``` -Example return values: -- `Asia` +Returns: `Asia` ### `location.country` @@ -97,12 +158,13 @@ No parameters. Examples: +Shows the default location.country call. + ```txt -location.country() +location.country ``` -Example return values: -- `Svalbard & Jan Mayen Islands` +Returns: `India` ### `location.countryCode` @@ -111,16 +173,27 @@ Returns a random ISO_3166-1 country code. - Canonical: `awd.domain.location.countryCode` - Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) -No parameters. +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `variant` | `alpha-2\|alpha-3\|numeric` | no | The code to return. Can be either 'alpha-2' (two-letter code), 'alpha-3' (three-letter code) or 'numeric' (numeric code). | Examples: +Shows location.countryCode when optional params are omitted. + ```txt location.countryCode() ``` -Example return values: -- `MG` +Returns: `IM` + +Shows location.countryCode using variant. + +```txt +location.countryCode(variant="alpha-3") +``` + +Returns: `IMN` ### `location.county` @@ -133,12 +206,13 @@ No parameters. Examples: +Shows the default location.county call. + ```txt -location.county() +location.county ``` -Example return values: -- `Northamptonshire` +Returns: `Cleveland` ### `location.direction` @@ -153,34 +227,21 @@ Returns a random direction (cardinal and ordinal; northwest, east, etc). Examples: -```txt -location.direction() -``` +Shows location.direction when optional params are omitted. ```txt -location.direction(abbreviated=false) +location.direction() ``` -Example return values: -- `North` - -### `location.language` +Returns: `West` -Returns a random spoken language. - -- Canonical: `awd.domain.location.language` -- Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) - -No parameters. - -Examples: +Shows location.direction using abbreviated. ```txt -location.language() +location.direction(abbreviated=true) ``` -Example return values: -- `{"name":"Icelandic","alpha2":"is","alpha3":"isl"}` +Returns: `W` ### `location.latitude` @@ -197,16 +258,37 @@ Generates a random latitude. Examples: +Shows location.latitude when optional params are omitted. + ```txt location.latitude() ``` +Returns: `-14.936` + +Shows location.latitude using min. + +```txt +location.latitude(max=10, min=1) +``` + +Returns: `4.7532` + +Shows location.latitude using max. + ```txt -location.latitude(min=1, max=1, precision=1) +location.latitude(max=5) ``` -Example return values: -- `51.5448` +Returns: `-50.3829` + +Shows location.latitude using precision. + +```txt +location.latitude(precision=1) +``` + +Returns: `-14.9` ### `location.longitude` @@ -223,34 +305,37 @@ Generates a random longitude. Examples: +Shows location.longitude when optional params are omitted. + ```txt location.longitude() ``` +Returns: `-29.8721` + +Shows location.longitude using min. + ```txt -location.longitude(min=1, max=1, precision=1) +location.longitude(max=10, min=1) ``` -Example return values: -- `92.3892` - -### `location.nearbyGPSCoordinate` +Returns: `4.7532` -Generates a random GPS coordinate within the specified radius from the given coordinate. +Shows location.longitude using max. -- Canonical: `awd.domain.location.nearbyGPSCoordinate` -- Faker docs: [https://fakerjs.dev/api/location](https://fakerjs.dev/api/location) +```txt +location.longitude(max=5) +``` -No parameters. +Returns: `-102.8509` -Examples: +Shows location.longitude using precision. ```txt -location.nearbyGPSCoordinate() +location.longitude(precision=1) ``` -Example return values: -- `[58.313,9.9746]` +Returns: `-29.9` ### `location.ordinalDirection` @@ -263,12 +348,13 @@ No parameters. Examples: +Shows the default location.ordinalDirection call. + ```txt -location.ordinalDirection() +location.ordinalDirection ``` -Example return values: -- `Northeast` +Returns: `Northwest` ### `location.secondaryAddress` @@ -281,12 +367,13 @@ No parameters. Examples: +Shows the default location.secondaryAddress call. + ```txt -location.secondaryAddress() +location.secondaryAddress ``` -Example return values: -- `Suite 634` +Returns: `Apt. 703` ### `location.state` @@ -301,16 +388,21 @@ Returns a random localized state, or other equivalent first-level administrative Examples: +Shows location.state when optional params are omitted. + ```txt location.state() ``` +Returns: `Massachusetts` + +Shows location.state using abbreviated. + ```txt -location.state(abbreviated=false) +location.state(abbreviated=true) ``` -Example return values: -- `Hawaii` +Returns: `MA` ### `location.street` @@ -323,12 +415,13 @@ No parameters. Examples: +Shows the default location.street call. + ```txt -location.street() +location.street ``` -Example return values: -- `Viva Harbor` +Returns: `Gutmann Creek` ### `location.streetAddress` @@ -343,16 +436,21 @@ Generates a random localized street address. Examples: +Shows location.streetAddress when optional params are omitted. + ```txt location.streetAddress() ``` +Returns: `7031 Iris Mill` + +Shows location.streetAddress using useFullAddress. + ```txt location.streetAddress(useFullAddress=true) ``` -Example return values: -- `12056 Vandervort Common` +Returns: `7031 Iris Mill Apt. 728` ### `location.timeZone` @@ -365,12 +463,13 @@ No parameters. Examples: +Shows the default location.timeZone call. + ```txt -location.timeZone() +location.timeZone ``` -Example return values: -- `Australia/Perth` +Returns: `America/Santiago` ### `location.zipCode` @@ -383,9 +482,10 @@ No parameters. Examples: +Shows the default location.zipCode call. + ```txt -location.zipCode() +location.zipCode ``` -Example return values: -- `36791` +Returns: `70310` diff --git a/docs-src/docs/040-test-data/domain/200-lorem.md b/docs-src/docs/040-test-data/domain/200-lorem.md index 074d75c1..8768fd24 100644 --- a/docs-src/docs/040-test-data/domain/200-lorem.md +++ b/docs-src/docs/040-test-data/domain/200-lorem.md @@ -31,16 +31,53 @@ Generates the given number lines of lorem separated by `'\n'`. Examples: +Shows lorem.lines when optional params are omitted. + ```txt lorem.lines() ``` +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.\nStillicidium bardus utrimque acsi spargo cur.\nAqua avaritia thesaurus volo combibo stultus utor.` + +Shows lorem.lines using min. + +```txt +lorem.lines(max=10, min=1) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.lines using max. + +```txt +lorem.lines(max=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.\nStillicidium bardus utrimque acsi spargo cur.\nAqua avaritia thesaurus volo combibo stultus utor.` + +Shows lorem.lines using lineCount. + +```txt +lorem.lines(lineCount=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.\nStillicidium bardus utrimque acsi spargo cur.\nAqua avaritia thesaurus volo combibo stultus utor.` + +Shows lorem.lines using lineCountMax. + +```txt +lorem.lines(lineCountMax=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.\nStillicidium bardus utrimque acsi spargo cur.\nAqua avaritia thesaurus volo combibo stultus utor.` + +Shows lorem.lines using lineCountMin. + ```txt -lorem.lines(min=1, max=1, lineCount=1, lineCountMax=1, lineCountMin=1) +lorem.lines(lineCountMin=5) ``` -Example return values: -- `Illum qui ocer creptio. Antepono aro vergo voluptatem acervus compono apud.` +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.\nStillicidium bardus utrimque acsi spargo cur.\nAqua avaritia thesaurus volo combibo stultus utor.` ### `lorem.paragraph` @@ -59,16 +96,53 @@ Generates a paragraph with the given number of sentences. Examples: +Shows lorem.paragraph when optional params are omitted. + ```txt lorem.paragraph() ``` +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` + +Shows lorem.paragraph using min. + +```txt +lorem.paragraph(max=10, min=1) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.paragraph using max. + +```txt +lorem.paragraph(max=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` + +Shows lorem.paragraph using sentenceCount. + ```txt -lorem.paragraph(min=1, max=1, sentenceCount=1, sentenceCountMax=1, sentenceCountMin=1) +lorem.paragraph(sentenceCount=5) ``` -Example return values: -- `Quisquam dolorum modi quae atque.` +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` + +Shows lorem.paragraph using sentenceCountMax. + +```txt +lorem.paragraph(sentenceCountMax=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` + +Shows lorem.paragraph using sentenceCountMin. + +```txt +lorem.paragraph(sentenceCountMin=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` ### `lorem.paragraphs` @@ -88,16 +162,61 @@ Generates the given number of paragraphs. Examples: +Shows lorem.paragraphs when optional params are omitted. + ```txt lorem.paragraphs() ``` +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.\nVarius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.\nSpoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` + +Shows lorem.paragraphs using min. + +```txt +lorem.paragraphs(max=10, min=1) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.` + +Shows lorem.paragraphs using max. + +```txt +lorem.paragraphs(max=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.5Varius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.5Spoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` + +Shows lorem.paragraphs using paragraphCount. + +```txt +lorem.paragraphs(paragraphCount=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.\nVarius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.\nSpoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` + +Shows lorem.paragraphs using separator. + +```txt +lorem.paragraphs(separator="-") +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.\nVarius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.\nSpoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` + +Shows lorem.paragraphs using paragraphCountMax. + ```txt -lorem.paragraphs(min=1, max=1, paragraphCount=1, separator="-", paragraphCountMax=1, paragraphCountMin=1) +lorem.paragraphs(paragraphCountMax=5) ``` -Example return values: -- `Primus paragraphus.\n\nSecundus paragraphus.` +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.\nVarius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.\nSpoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` + +Shows lorem.paragraphs using paragraphCountMin. + +```txt +lorem.paragraphs(paragraphCountMin=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia. Crux fugit curatio stillicidium bardus. Acsi spargo cur laboriosam aqua avaritia thesaurus volo combibo stultus.\nVarius ago adflicto assentator utrimque altus curiositas vita expedita stultus. Stipes trucido accusamus tandem voveo. Cicuta testimonium amet dedico ver claudeo civis aperio.\nSpoliatio beneficium cena. Adnuo natus arca odit subseco ambulo. Suasoria cupio admiratio facilis sonitus dolorum.` ### `lorem.sentence` @@ -116,16 +235,53 @@ Generates a space separated list of words beginning with a capital letter and en Examples: +Shows lorem.sentence when optional params are omitted. + ```txt lorem.sentence() ``` +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.sentence using min. + +```txt +lorem.sentence(max=10, min=1) +``` + +Returns: `Cur.` + +Shows lorem.sentence using max. + +```txt +lorem.sentence(max=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.sentence using wordCount. + +```txt +lorem.sentence(wordCount=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.sentence using wordCountMax. + +```txt +lorem.sentence(wordCountMax=5) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.sentence using wordCountMin. + ```txt -lorem.sentence(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) +lorem.sentence(wordCountMin=5) ``` -Example return values: -- `Auctor cum deorsum attero cum tergo aut.` +Returns: `Suppellex a cognatus arca aliquam audentia.` ### `lorem.sentences` @@ -145,16 +301,61 @@ Generates the given number of sentences. Examples: +Shows lorem.sentences when optional params are omitted. + ```txt lorem.sentences() ``` +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor. Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` + +Shows lorem.sentences using min. + +```txt +lorem.sentences(max=10, min=1) +``` + +Returns: `Suppellex a cognatus arca aliquam audentia.` + +Shows lorem.sentences using max. + +```txt +lorem.sentences(max=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit.5Stillicidium bardus utrimque acsi spargo cur.5Aqua avaritia thesaurus volo combibo stultus utor.5Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` + +Shows lorem.sentences using sentenceCount. + +```txt +lorem.sentences(sentenceCount=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor. Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` + +Shows lorem.sentences using separator. + +```txt +lorem.sentences(separator="-") +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor. Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` + +Shows lorem.sentences using sentenceCountMax. + +```txt +lorem.sentences(sentenceCountMax=5) +``` + +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor. Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` + +Shows lorem.sentences using sentenceCountMin. + ```txt -lorem.sentences(min=1, max=1, sentenceCount=1, separator="-", sentenceCountMax=1, sentenceCountMin=1) +lorem.sentences(sentenceCountMin=5) ``` -Example return values: -- `Vicissitudo amet candidus. Urbanus magni carbo artificiose tenus at ambulo.` +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor. Ago adflicto assentator utrimque altus curiositas vita expedita stultus comedo.` ### `lorem.slug` @@ -173,16 +374,53 @@ Generates a slugified text consisting of the given number of hyphen separated wo Examples: +Shows lorem.slug when optional params are omitted. + ```txt lorem.slug() ``` +Returns: `cur-suppellex-a` + +Shows lorem.slug using min. + +```txt +lorem.slug(max=10, min=1) +``` + +Returns: `cur` + +Shows lorem.slug using max. + +```txt +lorem.slug(max=5) +``` + +Returns: `cur-suppellex-a` + +Shows lorem.slug using wordCount. + +```txt +lorem.slug(wordCount=5) +``` + +Returns: `cur-suppellex-a` + +Shows lorem.slug using wordCountMax. + ```txt -lorem.slug(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) +lorem.slug(wordCountMax=5) ``` -Example return values: -- `dolore-accusator-atqui` +Returns: `cur-suppellex-a` + +Shows lorem.slug using wordCountMin. + +```txt +lorem.slug(wordCountMin=5) +``` + +Returns: `cur-suppellex-a` ### `lorem.text` @@ -195,12 +433,13 @@ No parameters. Examples: +Shows the default lorem.text call. + ```txt -lorem.text() +lorem.text ``` -Example return values: -- `A short sample text generated from lorem.` +Returns: `A cognatus arca aliquam audentia coniuratio crux fugit. Stillicidium bardus utrimque acsi spargo cur. Aqua avaritia thesaurus volo combibo stultus utor.` ### `lorem.word` @@ -214,20 +453,49 @@ Generates a word of a specified length. | `min` | `number` | no | Minimum word length when generating a ranged length. | | `max` | `number` | no | Maximum word length when generating a ranged length. | | `length` | `number` | no | Exact word length to generate. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows lorem.word when optional params are omitted. + ```txt lorem.word() ``` +Returns: `cur` + +Shows lorem.word using min. + +```txt +lorem.word(max=10, min=1) +``` + +Returns: `cur` + +Shows lorem.word using max. + +```txt +lorem.word(max=5) +``` + +Returns: `cur` + +Shows lorem.word using length. + +```txt +lorem.word(length=5) +``` + +Returns: `curvo` + +Shows lorem.word using strategy. + ```txt -lorem.word(min=1, max=1, length=1, strategy="any-length") +lorem.word(strategy="any-length") ``` -Example return values: -- `cumque` +Returns: `cur` ### `lorem.words` @@ -246,13 +514,50 @@ Generates a space separated list of words. Examples: +Shows lorem.words when optional params are omitted. + ```txt lorem.words() ``` +Returns: `cur suppellex a` + +Shows lorem.words using min. + +```txt +lorem.words(max=10, min=1) +``` + +Returns: `cur` + +Shows lorem.words using max. + +```txt +lorem.words(max=5) +``` + +Returns: `cur suppellex a` + +Shows lorem.words using wordCount. + +```txt +lorem.words(wordCount=5) +``` + +Returns: `cur suppellex a` + +Shows lorem.words using wordCountMax. + +```txt +lorem.words(wordCountMax=5) +``` + +Returns: `cur suppellex a` + +Shows lorem.words using wordCountMin. + ```txt -lorem.words(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) +lorem.words(wordCountMin=5) ``` -Example return values: -- `desidero conforto decimus` +Returns: `cur suppellex a` diff --git a/docs-src/docs/040-test-data/domain/210-music.md b/docs-src/docs/040-test-data/domain/210-music.md index ed8999bd..a0a6d7ab 100644 --- a/docs-src/docs/040-test-data/domain/210-music.md +++ b/docs-src/docs/040-test-data/domain/210-music.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default music.album call. + ```txt -music.album() +music.album ``` -Example return values: -- `R&G (Rhythm & Gangsta): The Masterpiece` +Returns: `I Never Loved A Man The Way I Love You` ### `music.artist` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default music.artist call. + ```txt -music.artist() +music.artist ``` -Example return values: -- `Chuck Berry` +Returns: `Jon Bellion` ### `music.genre` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default music.genre call. + ```txt -music.genre() +music.genre ``` -Example return values: -- `Mainstream Jazz` +Returns: `Hard Bop` ### `music.songName` @@ -79,9 +82,10 @@ No parameters. Examples: +Shows the default music.songName call. + ```txt -music.songName() +music.songName ``` -Example return values: -- `I'm Sorry` +Returns: `Imagine` diff --git a/docs-src/docs/040-test-data/domain/220-number.md b/docs-src/docs/040-test-data/domain/220-number.md index d22fba31..3f714100 100644 --- a/docs-src/docs/040-test-data/domain/220-number.md +++ b/docs-src/docs/040-test-data/domain/220-number.md @@ -27,16 +27,21 @@ Returns a BigInt number. Examples: +Shows number.bigInt with all optional params omitted. + ```txt number.bigInt() ``` +Returns: `703101335462806n` + +Shows number.bigInt using a boolean base value. + ```txt -number.bigInt(value="value") +number.bigInt(value=true) ``` -Example return values: -- `347465151663036` +Returns: `703101335462806n` ### `number.binary` @@ -52,16 +57,29 @@ Returns a binary string. Examples: +Shows number.binary when optional params are omitted. + ```txt number.binary() ``` +Returns: `0` + +Shows number.binary using max. + +```txt +number.binary(max=5) +``` + +Returns: `10` + +Shows number.binary using min. + ```txt -number.binary(max=1, min=1) +number.binary(max=10, min=1) ``` -Example return values: -- `0` +Returns: `101` ### `number.float` @@ -79,26 +97,61 @@ Returns a single random floating-point number, by default between `0.0` and `1.0 Examples: +Shows number.float with all optional params omitted. + ```txt number.float() ``` -Type-in examples (named params): +Returns: `0.417022004702574` + +Shows number.float rounding using only fractionDigits. ```txt -number.float(max=1) +number.float(fractionDigits=2) ``` +Returns: `0.42` + +Shows number.float constrained using only multipleOf. + ```txt -number.float(min=1) +number.float(multipleOf=0.5) ``` +Returns: `0.5` + +Shows number.float with an explicit numeric range. + ```txt -number.float(multipleOf=1) +number.float(min=1, max=10) ``` -Example return values: -- `0.5433707701438405` +Returns: `4.753198042323167` + +Shows number.float rounding with fractionDigits. + +```txt +number.float(min=1, max=10, fractionDigits=2) +``` + +Returns: `4.75` + +Shows number.float constrained to a multiple. + +```txt +number.float(min=1, max=10, multipleOf=0.5) +``` + +Returns: `4.5` + +Shows number.float using only an upper bound. + +```txt +number.float(max=10) +``` + +Returns: `4.17022004702574` ### `number.hex` @@ -114,16 +167,29 @@ Returns a lowercase hexadecimal number. Examples: +Shows number.hex when optional params are omitted. + ```txt number.hex() ``` +Returns: `6` + +Shows number.hex using min. + ```txt -number.hex(min=1, max=1) +number.hex(max=10, min=1) ``` -Example return values: -- `d` +Returns: `5` + +Shows number.hex using max. + +```txt +number.hex(max=5) +``` + +Returns: `2` ### `number.int` @@ -140,16 +206,37 @@ Returns a single random integer between zero and the given max value or the give Examples: +Shows number.int when optional params are omitted. + ```txt number.int() ``` +Returns: `3756200289967619` + +Shows number.int using min. + +```txt +number.int(max=10, min=1) +``` + +Returns: `5` + +Shows number.int using max. + +```txt +number.int(max=5) +``` + +Returns: `2` + +Shows number.int using multipleOf. + ```txt -number.int(min=1, max=1, multipleOf=1) +number.int(multipleOf=1) ``` -Example return values: -- `5190574431878510` +Returns: `3756200289967619` ### `number.octal` @@ -165,16 +252,29 @@ Returns an octal string. Examples: +Shows number.octal when optional params are omitted. + ```txt number.octal() ``` +Returns: `3` + +Shows number.octal using max. + +```txt +number.octal(max=5) +``` + +Returns: `2` + +Shows number.octal using min. + ```txt -number.octal(max=1, min=1) +number.octal(max=10, min=1) ``` -Example return values: -- `6` +Returns: `5` ### `number.romanNumeral` @@ -190,13 +290,26 @@ Returns a roman numeral in String format. Examples: +Shows number.romanNumeral when optional params are omitted. + ```txt number.romanNumeral() ``` +Returns: `MDCLXVIII` + +Shows number.romanNumeral using min. + +```txt +number.romanNumeral(max=10, min=1) +``` + +Returns: `V` + +Shows number.romanNumeral using max. + ```txt -number.romanNumeral(min=1, max=1) +number.romanNumeral(max=5) ``` -Example return values: -- `XXXV` +Returns: `III` diff --git a/docs-src/docs/040-test-data/domain/230-person.md b/docs-src/docs/040-test-data/domain/230-person.md index b073ee7d..ae3ca922 100644 --- a/docs-src/docs/040-test-data/domain/230-person.md +++ b/docs-src/docs/040-test-data/domain/230-person.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default person.bio call. + ```txt -person.bio() +person.bio ``` -Example return values: -- `musician` +Returns: `person, activist, entrepreneur ✌🏿` ### `person.firstName` @@ -41,20 +42,25 @@ Returns a random first name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for first-name selection. Valid values: female or male. | +| `sex` | `female\|male` | no | Optional sex for first-name selection. Valid values: female or male. | Examples: +Shows person.firstName when optional params are omitted. + ```txt person.firstName() ``` +Returns: `Aaliyah` + +Shows person.firstName using sex. + ```txt -person.firstName(sex="male") +person.firstName(sex="female") ``` -Example return values: -- `David` +Returns: `Monique` ### `person.fullName` @@ -67,12 +73,13 @@ No parameters. Examples: +Shows the default person.fullName call. + ```txt -person.fullName() +person.fullName ``` -Example return values: -- `Mrs. Sheryl Zemlak DVM` +Returns: `Aaliyah Corkery` ### `person.gender` @@ -85,12 +92,13 @@ No parameters. Examples: +Shows the default person.gender call. + ```txt -person.gender() +person.gender ``` -Example return values: -- `Female to male` +Returns: `Genderflux` ### `person.jobArea` @@ -103,12 +111,13 @@ No parameters. Examples: +Shows the default person.jobArea call. + ```txt -person.jobArea() +person.jobArea ``` -Example return values: -- `Branding` +Returns: `Group` ### `person.jobDescriptor` @@ -121,12 +130,13 @@ No parameters. Examples: +Shows the default person.jobDescriptor call. + ```txt -person.jobDescriptor() +person.jobDescriptor ``` -Example return values: -- `Direct` +Returns: `Regional` ### `person.jobTitle` @@ -139,12 +149,13 @@ No parameters. Examples: +Shows the default person.jobTitle call. + ```txt -person.jobTitle() +person.jobTitle ``` -Example return values: -- `Senior Identity Technician` +Returns: `Regional Assurance Supervisor` ### `person.jobType` @@ -157,12 +168,13 @@ No parameters. Examples: +Shows the default person.jobType call. + ```txt -person.jobType() +person.jobType ``` -Example return values: -- `Engineer` +Returns: `Administrator` ### `person.lastName` @@ -173,20 +185,25 @@ Returns a random last name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for last-name selection. Valid values: female or male. | +| `sex` | `female\|male` | no | Optional sex for last-name selection. Valid values: female or male. | Examples: +Shows person.lastName when optional params are omitted. + ```txt person.lastName() ``` +Returns: `Abbott` + +Shows person.lastName using sex. + ```txt -person.lastName(sex="male") +person.lastName(sex="female") ``` -Example return values: -- `Bernhard` +Returns: `Reichel` ### `person.middleName` @@ -197,20 +214,25 @@ Returns a random middle name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for middle-name selection. Valid values: female or male. | +| `sex` | `female\|male` | no | Optional sex for middle-name selection. Valid values: female or male. | Examples: +Shows person.middleName when optional params are omitted. + ```txt person.middleName() ``` +Returns: `Abigail` + +Shows person.middleName using sex. + ```txt -person.middleName(sex="male") +person.middleName(sex="female") ``` -Example return values: -- `Ryan` +Returns: `Morgan` ### `person.prefix` @@ -221,20 +243,25 @@ Returns a random person prefix. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | The optional sex to use. Can be either 'female' or 'male'. | +| `sex` | `female\|male` | no | The optional sex to use. Can be either 'female' or 'male'. | Examples: +Shows person.prefix when optional params are omitted. + ```txt person.prefix() ``` +Returns: `Miss` + +Shows person.prefix using sex. + ```txt -person.prefix(sex="male") +person.prefix(sex="female") ``` -Example return values: -- `Mr.` +Returns: `Ms.` ### `person.sex` @@ -247,12 +274,13 @@ No parameters. Examples: +Shows the default person.sex call. + ```txt -person.sex() +person.sex ``` -Example return values: -- `male` +Returns: `female` ### `person.sexType` @@ -265,12 +293,13 @@ No parameters. Examples: +Shows the default person.sexType call. + ```txt -person.sexType() +person.sexType ``` -Example return values: -- `male` +Returns: `female` ### `person.suffix` @@ -283,12 +312,13 @@ No parameters. Examples: +Shows the default person.suffix call. + ```txt -person.suffix() +person.suffix ``` -Example return values: -- `IV` +Returns: `III` ### `person.zodiacSign` @@ -301,9 +331,10 @@ No parameters. Examples: +Shows the default person.zodiacSign call. + ```txt -person.zodiacSign() +person.zodiacSign ``` -Example return values: -- `Cancer` +Returns: `Cancer` diff --git a/docs-src/docs/040-test-data/domain/240-phone.md b/docs-src/docs/040-test-data/domain/240-phone.md index 5382edbc..aa3042e2 100644 --- a/docs-src/docs/040-test-data/domain/240-phone.md +++ b/docs-src/docs/040-test-data/domain/240-phone.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default phone.imei call. + ```txt -phone.imei() +phone.imei ``` -Example return values: -- `44-358223-971834-1` +Returns: `47-031013-354628-7` ### `phone.number` @@ -41,17 +42,22 @@ Generates a random phone number. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `style` | `string` | no | Style of the generated phone number: 'human': (default) A human-input phone number, e.g. 555-770-7727 or 555.770.7727 x1234 'national': A phone number in a standardized national format, e.g. (555) 123-4567. 'international': A phone number in the E.123 international format, e.g. +15551234567 | +| `style` | `human\|national\|international` | no | Style of the generated phone number: 'human': (default) A human-input phone number, e.g. 555-770-7727 or 555.770.7727 x1234 'national': A phone number in a standardized national format, e.g. (555) 123-4567. 'international': A phone number in the E.123 international format, e.g. +15551234567 | Examples: +Shows phone.number when optional params are omitted. + ```txt phone.number() ``` +Returns: `1-703-301-3354 x628` + +Shows phone.number using style. + ```txt -phone.number(style="human") +phone.number(style="international") ``` -Example return values: -- `298.756.9044` +Returns: `+15704101335` diff --git a/docs-src/docs/040-test-data/domain/250-science.md b/docs-src/docs/040-test-data/domain/250-science.md index be9c6a09..1bfe206c 100644 --- a/docs-src/docs/040-test-data/domain/250-science.md +++ b/docs-src/docs/040-test-data/domain/250-science.md @@ -14,92 +14,97 @@ The `science` domain maps domain keywords to underlying faker implementations. ## Methods -### `science.chemicalElement` +### `chemicalElement.atomicNumber` -Generate a value using faker science.chemicalElement. +Generate a chemical element atomic number. -- Canonical: `awd.domain.science.chemicalElement` +- Canonical: `awd.domain.science.chemicalElement.atomicNumber` - Faker docs: [https://fakerjs.dev/api/science](https://fakerjs.dev/api/science) No parameters. Examples: +Shows the default science.chemicalElement.atomicNumber call. + ```txt -science.chemicalElement() +science.chemicalElement.atomicNumber ``` -Example return values: -- `{"name":"Oxygen","symbol":"O","atomicNumber":8}` +Returns: `50` -### `science.chemicalElement.atomicNumber` +### `chemicalElement.name` -Generate a chemical element atomic number. +Generate a chemical element name. -- Canonical: `awd.domain.science.chemicalElement.atomicNumber` +- Canonical: `awd.domain.science.chemicalElement.name` - Faker docs: [https://fakerjs.dev/api/science](https://fakerjs.dev/api/science) No parameters. Examples: +Shows the default science.chemicalElement.name call. + ```txt -science.chemicalElement.atomicNumber() +science.chemicalElement.name ``` -Example return values: -- `8` +Returns: `Tin` -### `science.chemicalElement.name` +### `chemicalElement.symbol` -Generate a chemical element name. +Generate a chemical element symbol. -- Canonical: `awd.domain.science.chemicalElement.name` +- Canonical: `awd.domain.science.chemicalElement.symbol` - Faker docs: [https://fakerjs.dev/api/science](https://fakerjs.dev/api/science) No parameters. Examples: +Shows the default science.chemicalElement.symbol call. + ```txt -science.chemicalElement.name() +science.chemicalElement.symbol ``` -Example return values: -- `Oxygen` +Returns: `Sn` -### `science.chemicalElement.symbol` +### `unit.name` -Generate a chemical element symbol. +Generate a scientific unit name. -- Canonical: `awd.domain.science.chemicalElement.symbol` +- Canonical: `awd.domain.science.unit.name` - Faker docs: [https://fakerjs.dev/api/science](https://fakerjs.dev/api/science) No parameters. Examples: +Shows the default science.unit.name call. + ```txt -science.chemicalElement.symbol() +science.unit.name ``` -Example return values: -- `O` +Returns: `watt` -### `science.unit` +### `unit.symbol` -Returns a random scientific unit. +Generate a scientific unit symbol. -- Canonical: `awd.domain.science.unit` +- Canonical: `awd.domain.science.unit.symbol` - Faker docs: [https://fakerjs.dev/api/science](https://fakerjs.dev/api/science) No parameters. Examples: +Shows the default science.unit.symbol call. + ```txt -science.unit() +science.unit.symbol ``` -Example return values: -- `{"name":"farad","symbol":"F"}` +Returns: `W` diff --git a/docs-src/docs/040-test-data/domain/260-string.md b/docs-src/docs/040-test-data/domain/260-string.md index 44cedd9d..3e38c29d 100644 --- a/docs-src/docs/040-test-data/domain/260-string.md +++ b/docs-src/docs/040-test-data/domain/260-string.md @@ -24,21 +24,58 @@ Generating a string consisting of letters in the English alphabet. | Arg | Type | Required | Description | | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | -| `casing` | `string` | no | The casing of the characters. | +| `casing` | `upper\|lower\|mixed` | no | The casing of the characters. | | `exclude` | `array` | no | An array with characters which should be excluded in the generated string. | Examples: +Shows string.alpha with all optional params omitted. + ```txt string.alpha() ``` +Returns: `v` + +Shows string.alpha generating a fixed-length alphabetic value. + +```txt +string.alpha(length=5) +``` + +Returns: `vLaph` + +Shows string.alpha using only the casing option. + +```txt +string.alpha(casing="upper") +``` + +Returns: `K` + +Shows string.alpha with explicit uppercase output. + +```txt +string.alpha(length=5, casing="upper") +``` + +Returns: `KSAHD` + +Shows string.alpha excluding specific characters without setting length or casing. + +```txt +string.alpha(exclude=["A","B","C"]) +``` + +Returns: `u` + +Shows string.alpha excluding specific characters from the candidate set. + ```txt -string.alpha(length=1, casing="lower", exclude=["item"]) +string.alpha(length=5, casing="upper", exclude=["A","B","C"]) ``` -Example return values: -- `R` +Returns: `MTDJG` ### `string.alphanumeric` @@ -50,21 +87,42 @@ Generating a string consisting of alpha characters and digits. | Arg | Type | Required | Description | | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | -| `casing` | `string` | no | The casing of the characters. | +| `casing` | `upper\|lower\|mixed` | no | The casing of the characters. | | `exclude` | `array` | no | An array of characters and digits which should be excluded in the generated string. | Examples: +Shows string.alphanumeric when optional params are omitted. + ```txt string.alphanumeric() ``` +Returns: `p` + +Shows string.alphanumeric using length. + +```txt +string.alphanumeric(length=5) +``` + +Returns: `pI0i9` + +Shows string.alphanumeric using casing. + +```txt +string.alphanumeric(casing="upper") +``` + +Returns: `F` + +Shows string.alphanumeric using exclude. + ```txt -string.alphanumeric(length=1, casing="lower", exclude=["item"]) +string.alphanumeric(exclude=["A","B","C"]) ``` -Example return values: -- `s` +Returns: `o` ### `string.binary` @@ -80,23 +138,35 @@ Returns a binary string. Examples: +Shows string.binary when optional params are omitted. + ```txt string.binary() ``` +Returns: `0b0` + +Shows string.binary using length. + +```txt +string.binary(length=5) +``` + +Returns: `0b01000` + +Shows string.binary using prefix. + ```txt -string.binary(length=1, prefix="#") +string.binary(prefix="PRE-") ``` -Example return values: -- `0b0` +Returns: `PRE-0` ### `string.counterString` Generates a counterstring for a random length between min and max (or fixed length when only one value is provided). Defaults to min=1 and max=25 when omitted. - Canonical: `awd.domain.string.counterString` -- Docs: [/docs/test-data/counterstrings](/docs/test-data/counterstrings) | Arg | Type | Required | Description | | --- | --- | --- | --- | @@ -106,25 +176,61 @@ Generates a counterstring for a random length between min and max (or fixed leng Examples: +Shows string.counterString default from 1 to 25 chars. + ```txt string.counterString() ``` +Returns: `*3*5*7*10*13*` + +Shows string.counterString with a fixed length of 15 chars. + ```txt -string.counterString(15) +string.counterString(min=15) ``` +Returns: `*3*5*7*9*12*15*` + +Shows string.counterString with a length between 5 and 12 chars. + ```txt string.counterString(min=5, max=12) ``` +Returns: `*3*5*7*9*` + +Shows string.counterString with a fixed length of 12 chars and a custom delimiter. + ```txt string.counterString(min=12, max=12, delimiter="#") ``` -Example return values: -- `*3*5*7*9*12*15*` -- `#3#5#7#9#12#` +Returns: `#3#5#7#9#12#` + +Shows string.counterString with a length between 1 and 10 chars. + +```txt +string.counterString(max=10, min=1) +``` + +Returns: `2*4*6*` + +Shows string.counterString with a length between 1 and 12 chars. + +```txt +string.counterString(max=12) +``` + +Returns: `*3*5*7*` + +Shows string.counterString using a custom delimiter and a length between 1 and 25 chars. + +```txt +string.counterString(delimiter="#") +``` + +Returns: `#3#5#7#10#13#` ### `string.fromCharacters` @@ -140,17 +246,29 @@ Generates a string from the given characters. Examples: +Shows string.fromCharacters with only the required characters argument. + ```txt -string.fromCharacters("ABC123", 6) +string.fromCharacters(characters="ABC123") ``` +Returns: `C` + +Shows string.fromCharacters in use. + ```txt string.fromCharacters(characters=["A", "B", "C"], length=4) ``` -Example return values: -- `A1B2` -- `CB2A` +Returns: `BCAA` + +Shows string.fromCharacters using length. + +```txt +string.fromCharacters(characters="ABC123", length=4) +``` + +Returns: `C2AB` ### `string.hexadecimal` @@ -161,22 +279,43 @@ Returns a hexadecimal string. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `casing` | `string` | no | Casing of the generated number. | +| `casing` | `upper\|lower\|mixed` | no | Casing of the generated number. | | `length` | `number` | no | The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. | | `prefix` | `string` | no | Prefix for the generated number. | Examples: +Shows string.hexadecimal when optional params are omitted. + ```txt string.hexadecimal() ``` +Returns: `0x9` + +Shows string.hexadecimal using casing. + +```txt +string.hexadecimal(casing="upper") +``` + +Returns: `0x9` + +Shows string.hexadecimal using length. + +```txt +string.hexadecimal(length=5) +``` + +Returns: `0x9f063` + +Shows string.hexadecimal using prefix. + ```txt -string.hexadecimal(casing="lower", length=1, prefix="#") +string.hexadecimal(prefix="PRE-") ``` -Example return values: -- `0x1` +Returns: `PRE-9` ### `string.nanoid` @@ -191,16 +330,21 @@ Generates a Nano ID. Examples: +Shows string.nanoid when optional params are omitted. + ```txt string.nanoid() ``` +Returns: `Ii5lxGSFycYGT2SqxjPK-` + +Shows string.nanoid using length. + ```txt -string.nanoid(length=1) +string.nanoid(length=5) ``` -Example return values: -- `KLm49ferlh-eUmJpZdSIO` +Returns: `Ii5lx` ### `string.numeric` @@ -217,16 +361,37 @@ Generates a given length string of digits. Examples: +Shows string.numeric when optional params are omitted. + ```txt string.numeric() ``` +Returns: `4` + +Shows string.numeric using length. + +```txt +string.numeric(length=5) +``` + +Returns: `47031` + +Shows string.numeric using allowLeadingZeros. + +```txt +string.numeric(allowLeadingZeros=true) +``` + +Returns: `4` + +Shows string.numeric using exclude. + ```txt -string.numeric(length=1, allowLeadingZeros=true, exclude=["item"]) +string.numeric(exclude=["A","B","C"]) ``` -Example return values: -- `7` +Returns: `4` ### `string.octal` @@ -242,16 +407,29 @@ Returns an octal string. Examples: +Shows string.octal when optional params are omitted. + ```txt string.octal() ``` +Returns: `0o3` + +Shows string.octal using length. + +```txt +string.octal(length=5) +``` + +Returns: `0o35021` + +Shows string.octal using prefix. + ```txt -string.octal(length=1, prefix="#") +string.octal(prefix="PRE-") ``` -Example return values: -- `0o6` +Returns: `PRE-3` ### `string.sample` @@ -266,20 +444,25 @@ Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`). Examples: +Shows string.sample when optional params are omitted. + ```txt string.sample() ``` +Returns: `Gc!=.)2AES` + +Shows string.sample using length. + ```txt -string.sample(length=1) +string.sample(length=5) ``` -Example return values: -- `\Fw;0e:G.H` +Returns: `Gc!=.` ### `string.symbol` -Returns a string containing only special characters from the following list: +Returns a string containing only ASCII symbol characters such as !, ", #, $, %, &, (, ), *, +, -, /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, and ~. - Canonical: `awd.domain.string.symbol` - Faker docs: [https://fakerjs.dev/api/string](https://fakerjs.dev/api/string) @@ -290,16 +473,21 @@ Returns a string containing only special characters from the following list: Examples: +Shows string.symbol when optional params are omitted. + ```txt string.symbol() ``` +Returns: `.` + +Shows string.symbol using length. + ```txt -string.symbol(length=1) +string.symbol(length=5) ``` -Example return values: -- `.` +Returns: `.\!*%` ### `string.ulid` @@ -314,16 +502,21 @@ Returns a ULID (Universally Unique Lexicographically Sortable Identifier). Examples: +Shows string.ulid when optional params are omitted. + ```txt string.ulid() ``` +Returns: `01KVDQ3AJ0DQ09425BCHDN6W0N` + +Shows string.ulid using refDate. + ```txt -string.ulid(refDate=1) +string.ulid(refDate=1718755200000) ``` -Example return values: -- `01KQADM2A0728G4D2HKCPWKS6N` +Returns: `01J0PWP300DQ09425BCHDN6W0N` ### `string.uuid` @@ -334,18 +527,31 @@ Returns a UUID (Universally Unique Identifier). | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `version` | `4\|7` | no | The specific UUID version to use. If `refDate` is supplied and `version` is omitted, version `7` is used automatically. | -| `refDate` | `string\|number\|date` | no | The timestamp to encode into the UUID. This is only valid for UUID v7. If `refDate` is supplied and `version` is omitted, version `7` is used automatically. Providing `refDate` with version `4` is invalid. | +| `version` | `4\|7` | no | The specific UUID version to use. If refDate is supplied and version is omitted, version 7 is used automatically. | +| `refDate` | `string\|number\|date` | no | The timestamp to encode into the UUID. This is only valid for UUID v7. If refDate is supplied and version is omitted, version 7 is used automatically. Providing refDate with version 4 is invalid. | Examples: +Shows string.uuid when optional params are omitted. + ```txt string.uuid() ``` +Returns: `6b042125-686a-43e0-8a68-23cf5bee102e` + +Shows string.uuid using version. + +```txt +string.uuid(version=7) +``` + +Returns: `019edb71-aa40-76b0-8421-25686a3e0a68` + +Shows string.uuid using refDate. + ```txt -string.uuid(refDate=1) +string.uuid(refDate="2026-06-18T00:00:00.000Z") ``` -Example return values: -- `0628ae51-7b6c-4d33-9f24-dae19fb245df` +Returns: `019ed807-0800-76b0-8421-25686a3e0a68` diff --git a/docs-src/docs/040-test-data/domain/270-system.md b/docs-src/docs/040-test-data/domain/270-system.md index 25ff2991..fe889729 100644 --- a/docs-src/docs/040-test-data/domain/270-system.md +++ b/docs-src/docs/040-test-data/domain/270-system.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default system.commonFileExt call. + ```txt -system.commonFileExt() +system.commonFileExt ``` -Example return values: -- `pdf` +Returns: `png` ### `system.commonFileName` @@ -45,16 +46,21 @@ Returns a random file name with a given extension or a commonly used extension. Examples: +Shows system.commonFileName when optional params are omitted. + ```txt system.commonFileName() ``` +Returns: `fog_aboard.mp4v` + +Shows system.commonFileName using extension. + ```txt system.commonFileName(extension="txt") ``` -Example return values: -- `bleak.pdf` +Returns: `fog_aboard.txt` ### `system.commonFileType` @@ -67,12 +73,13 @@ No parameters. Examples: +Shows the default system.commonFileType call. + ```txt -system.commonFileType() +system.commonFileType ``` -Example return values: -- `video` +Returns: `image` ### `system.cron` @@ -88,16 +95,29 @@ Returns a random cron expression. Examples: +Shows system.cron when optional params are omitted. + ```txt system.cron() ``` +Returns: `25 17 * 4 *` + +Shows system.cron using includeNonStandard. + ```txt -system.cron(includeNonStandard=true, includeYear=true) +system.cron(includeNonStandard=true) ``` -Example return values: -- `* 15 * * SAT` +Returns: `@annually` + +Shows system.cron using includeYear. + +```txt +system.cron(includeYear=true) +``` + +Returns: `25 17 * 4 * 1994` ### `system.directoryPath` @@ -110,12 +130,13 @@ No parameters. Examples: +Shows the default system.directoryPath call. + ```txt -system.directoryPath() +system.directoryPath ``` -Example return values: -- `/bin` +Returns: `/opt/include` ### `system.fileExt` @@ -130,16 +151,21 @@ Returns a file extension. Examples: +Shows system.fileExt when optional params are omitted. + ```txt system.fileExt() ``` +Returns: `7z` + +Shows system.fileExt using mimeType. + ```txt system.fileExt(mimeType="image/png") ``` -Example return values: -- `xsl` +Returns: `7z` ### `system.fileName` @@ -152,12 +178,13 @@ No parameters. Examples: +Shows the default system.fileName call. + ```txt -system.fileName() +system.fileName ``` -Example return values: -- `unsightly.woff` +Returns: `fog_aboard.otf` ### `system.filePath` @@ -170,12 +197,13 @@ No parameters. Examples: +Shows the default system.filePath call. + ```txt -system.filePath() +system.filePath ``` -Example return values: -- `/tmp/ouch.xlt` +Returns: `/opt/include/down_reproachfully_besides.woff2` ### `system.fileType` @@ -188,12 +216,13 @@ No parameters. Examples: +Shows the default system.fileType call. + ```txt -system.fileType() +system.fileType ``` -Example return values: -- `font` +Returns: `font` ### `system.mimeType` @@ -206,12 +235,13 @@ No parameters. Examples: +Shows the default system.mimeType call. + ```txt -system.mimeType() +system.mimeType ``` -Example return values: -- `application/gzip` +Returns: `application/x-httpd-php` ### `system.networkInterface` @@ -224,12 +254,13 @@ No parameters. Examples: +Shows the default system.networkInterface call. + ```txt -system.networkInterface() +system.networkInterface ``` -Example return values: -- `wlx3fba717f9f9c` +Returns: `wlx042125686a3e` ### `system.semver` @@ -242,9 +273,10 @@ No parameters. Examples: +Shows the default system.semver call. + ```txt -system.semver() +system.semver ``` -Example return values: -- `4.3.6` +Returns: `4.15.0` diff --git a/docs-src/docs/040-test-data/domain/280-vehicle.md b/docs-src/docs/040-test-data/domain/280-vehicle.md index 5d0c5443..e9c043f1 100644 --- a/docs-src/docs/040-test-data/domain/280-vehicle.md +++ b/docs-src/docs/040-test-data/domain/280-vehicle.md @@ -25,12 +25,13 @@ No parameters. Examples: +Shows the default vehicle.bicycle call. + ```txt -vehicle.bicycle() +vehicle.bicycle ``` -Example return values: -- `Touring Bicycle` +Returns: `Flat-Foot Comfort Bicycle` ### `vehicle.color` @@ -43,12 +44,13 @@ No parameters. Examples: +Shows the default vehicle.color call. + ```txt -vehicle.color() +vehicle.color ``` -Example return values: -- `sky blue` +Returns: `magenta` ### `vehicle.fuel` @@ -61,12 +63,13 @@ No parameters. Examples: +Shows the default vehicle.fuel call. + ```txt -vehicle.fuel() +vehicle.fuel ``` -Example return values: -- `Gasoline` +Returns: `Electric` ### `vehicle.manufacturer` @@ -79,12 +82,13 @@ No parameters. Examples: +Shows the default vehicle.manufacturer call. + ```txt -vehicle.manufacturer() +vehicle.manufacturer ``` -Example return values: -- `Hyundai` +Returns: `Lamborghini` ### `vehicle.model` @@ -97,12 +101,13 @@ No parameters. Examples: +Shows the default vehicle.model call. + ```txt -vehicle.model() +vehicle.model ``` -Example return values: -- `Aventador` +Returns: `Escalade` ### `vehicle.type` @@ -115,12 +120,13 @@ No parameters. Examples: +Shows the default vehicle.type call. + ```txt -vehicle.type() +vehicle.type ``` -Example return values: -- `Hatchback` +Returns: `Extended Cab Pickup` ### `vehicle.vehicle` @@ -133,12 +139,13 @@ No parameters. Examples: +Shows the default vehicle.vehicle call. + ```txt -vehicle.vehicle() +vehicle.vehicle ``` -Example return values: -- `Ford CTS` +Returns: `Lamborghini Model X` ### `vehicle.vin` @@ -151,12 +158,13 @@ No parameters. Examples: +Shows the default vehicle.vin call. + ```txt -vehicle.vin() +vehicle.vin ``` -Example return values: -- `7SJ9N0LM3LM265056` +Returns: `DP09436BDHKN28064` ### `vehicle.vrm` @@ -169,9 +177,10 @@ No parameters. Examples: +Shows the default vehicle.vrm call. + ```txt -vehicle.vrm() +vehicle.vrm ``` -Example return values: -- `OD11RTZ` +Returns: `KS03DCE` diff --git a/docs-src/docs/040-test-data/domain/290-word.md b/docs-src/docs/040-test-data/domain/290-word.md index 6ad5f96e..02e8b2db 100644 --- a/docs-src/docs/040-test-data/domain/290-word.md +++ b/docs-src/docs/040-test-data/domain/290-word.md @@ -25,20 +25,41 @@ Returns a random adjective. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.adjective when optional params are omitted. + ```txt word.adjective() ``` +Returns: `inferior` + +Shows word.adjective using length. + +```txt +word.adjective(length=5) +``` + +Returns: `major` + +Shows word.adjective using max. + +```txt +word.adjective(max=5) +``` + +Returns: `inferior` + +Shows word.adjective using strategy. + ```txt -word.adjective(length=1, max=1, strategy="any-length") +word.adjective(strategy="any-length") ``` -Example return values: -- `heavenly` +Returns: `inferior` ### `word.adverb` @@ -51,20 +72,41 @@ Returns a random adverb. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.adverb when optional params are omitted. + ```txt word.adverb() ``` +Returns: `knavishly` + +Shows word.adverb using length. + +```txt +word.adverb(length=5) +``` + +Returns: `never` + +Shows word.adverb using max. + ```txt -word.adverb(length=1, max=1, strategy="any-length") +word.adverb(max=5) ``` -Example return values: -- `selfishly` +Returns: `knavishly` + +Shows word.adverb using strategy. + +```txt +word.adverb(strategy="any-length") +``` + +Returns: `knavishly` ### `word.conjunction` @@ -77,20 +119,41 @@ Returns a random conjunction. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.conjunction when optional params are omitted. + ```txt word.conjunction() ``` +Returns: `likewise` + +Shows word.conjunction using length. + +```txt +word.conjunction(length=5) +``` + +Returns: `until` + +Shows word.conjunction using max. + +```txt +word.conjunction(max=5) +``` + +Returns: `likewise` + +Shows word.conjunction using strategy. + ```txt -word.conjunction(length=1, max=1, strategy="any-length") +word.conjunction(strategy="any-length") ``` -Example return values: -- `indeed` +Returns: `likewise` ### `word.interjection` @@ -103,20 +166,41 @@ Returns a random interjection. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.interjection when optional params are omitted. + ```txt word.interjection() ``` +Returns: `woot` + +Shows word.interjection using length. + +```txt +word.interjection(length=5) +``` + +Returns: `fooey` + +Shows word.interjection using max. + +```txt +word.interjection(max=5) +``` + +Returns: `woot` + +Shows word.interjection using strategy. + ```txt -word.interjection(length=1, max=1, strategy="any-length") +word.interjection(strategy="any-length") ``` -Example return values: -- `er` +Returns: `woot` ### `word.noun` @@ -129,20 +213,41 @@ Returns a random noun. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.noun when optional params are omitted. + ```txt word.noun() ``` +Returns: `heating` + +Shows word.noun using length. + +```txt +word.noun(length=5) +``` + +Returns: `humor` + +Shows word.noun using max. + +```txt +word.noun(max=5) +``` + +Returns: `heating` + +Shows word.noun using strategy. + ```txt -word.noun(length=1, max=1, strategy="any-length") +word.noun(strategy="any-length") ``` -Example return values: -- `cook` +Returns: `heating` ### `word.preposition` @@ -155,20 +260,41 @@ Returns a random preposition. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.preposition when optional params are omitted. + ```txt word.preposition() ``` +Returns: `except` + +Shows word.preposition using length. + +```txt +word.preposition(length=5) +``` + +Returns: `aside` + +Shows word.preposition using max. + +```txt +word.preposition(max=5) +``` + +Returns: `except` + +Shows word.preposition using strategy. + ```txt -word.preposition(length=1, max=1, strategy="any-length") +word.preposition(strategy="any-length") ``` -Example return values: -- `beside` +Returns: `except` ### `word.sample` @@ -181,20 +307,41 @@ Returns a random word, that can be an adjective, adverb, conjunction, interjecti | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.sample when optional params are omitted. + ```txt word.sample() ``` +Returns: `boohoo` + +Shows word.sample using length. + +```txt +word.sample(length=5) +``` + +Returns: `yowza` + +Shows word.sample using max. + +```txt +word.sample(max=5) +``` + +Returns: `boohoo` + +Shows word.sample using strategy. + ```txt -word.sample(length=1, max=1, strategy="any-length") +word.sample(strategy="any-length") ``` -Example return values: -- `snoopy` +Returns: `boohoo` ### `word.verb` @@ -207,20 +354,41 @@ Returns a random verb. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | +| `strategy` | `fail\|closest\|shortest\|longest\|any-length` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: +Shows word.verb when optional params are omitted. + ```txt word.verb() ``` +Returns: `hunger` + +Shows word.verb using length. + +```txt +word.verb(length=5) +``` + +Returns: `mould` + +Shows word.verb using max. + +```txt +word.verb(max=5) +``` + +Returns: `hunger` + +Shows word.verb using strategy. + ```txt -word.verb(length=1, max=1, strategy="any-length") +word.verb(strategy="any-length") ``` -Example return values: -- `embalm` +Returns: `hunger` ### `word.words` @@ -236,13 +404,26 @@ Returns a random string containing some words separated by spaces. Examples: +Shows word.words when optional params are omitted. + ```txt word.words() ``` +Returns: `fog aboard` + +Shows word.words using count. + +```txt +word.words(count=5) +``` + +Returns: `boohoo pish tenderly above pop` + +Shows word.words using max. + ```txt -word.words(count=1, max=1) +word.words(max=5) ``` -Example return values: -- `geez` +Returns: `fog aboard` diff --git a/docs-src/src/css/custom.css b/docs-src/src/css/custom.css index 2bc6a4cf..a561e781 100644 --- a/docs-src/src/css/custom.css +++ b/docs-src/src/css/custom.css @@ -28,3 +28,10 @@ --ifm-color-primary-lightest: #4fddbf; --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); } + +.theme-doc-markdown table { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} diff --git a/docs/faker-10.4.0-comparison-report.md b/docs/faker-10.4.0-comparison-report.md index 56435604..c6b03caf 100644 --- a/docs/faker-10.4.0-comparison-report.md +++ b/docs/faker-10.4.0-comparison-report.md @@ -54,9 +54,6 @@ These are already on borrowed time in the current curation and should be address - `image.urlPlaceholder` - `internet.userName` - `internet.color` -- `image.urlLoremFlickr` - -`image.urlLoremFlickr` still resolves in faker `10.4.0`, but the runtime emitted a deprecation warning saying it has been deprecated since `10.1.0` and is scheduled for removal in `11.0.0`. ## New Public Commands In Faker 10.4.0 diff --git a/docs/faker-options-param-report.md b/docs/faker-options-param-report.md index 77468326..468195c8 100644 --- a/docs/faker-options-param-report.md +++ b/docs/faker-options-param-report.md @@ -58,7 +58,6 @@ Generated from `packages/core/js/faker/faker-command-help-metadata.js` in the cu - `image.dataUri` - `image.personPortrait` - `image.url` -- `image.urlLoremFlickr` - `image.urlPicsumPhotos` - `internet.displayName` - `internet.emoji` diff --git a/jest.config.cjs b/jest.config.cjs index 1e3ca63c..bc9506fd 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -3,6 +3,7 @@ module.exports = { transform: {}, testMatch: [ '**/packages/core/src/tests/**/*.test.js', + '**/packages/core/src/tests/**/*-test.js', '**/packages/core-ui/src/tests/**/*.test.js', '**/tests/integration/**/*.test.js', '**/apps/web/src/tests/jest/**/*.test.js', diff --git a/packages/core-ui/js/gui_components/app/test-data-grid/generation/test-data-generation-service.js b/packages/core-ui/js/gui_components/app/test-data-grid/generation/test-data-generation-service.js index fc38e92b..0a11df30 100644 --- a/packages/core-ui/js/gui_components/app/test-data-grid/generation/test-data-generation-service.js +++ b/packages/core-ui/js/gui_components/app/test-data-grid/generation/test-data-generation-service.js @@ -6,7 +6,10 @@ */ import { schemaErrorsToText } from '../../../shared/test-data/schema/schema-error-text.js'; -import { createConfiguredGeneratorFromSchemaRows } from '../../../shared/test-data/generation/generation-controller.js'; +import { + createConfiguredGeneratorFromSchemaRows, + schemaRowsToGenerationSpec, +} from '../../../shared/test-data/generation/generation-controller.js'; import { isNWiseEligibleForSchemaRows } from '../../../shared/test-data/generation/ui-derived-state.js'; import { buildConstraintImpactMessage, @@ -105,6 +108,12 @@ function createTestDataGenerationService({ getValidatedSchemaState: getCurrentSchemaRowValidation, getSchemaText, schemaRowsToSpec, + schemaRowsToGenerationSpec: (schemaRows) => + schemaRowsToGenerationSpec({ + schemaRows, + buildRuleSpecFromSchemaRow, + SOURCE_TYPE_REGEX, + }), schemaSource: 'app-test-data-grid', GenericDataTableClass, CombinationsTestDataGeneratorClass, diff --git a/packages/core-ui/js/gui_components/generator/generation/data-generator-generation-actions.js b/packages/core-ui/js/gui_components/generator/generation/data-generator-generation-actions.js index 7caa5761..a3d62b16 100644 --- a/packages/core-ui/js/gui_components/generator/generation/data-generator-generation-actions.js +++ b/packages/core-ui/js/gui_components/generator/generation/data-generator-generation-actions.js @@ -88,6 +88,7 @@ function previewGeneratorData({ getPreviewRowCount, schemaGenerationService, setPreviewDataTable, + clearOutputPreview, renderOutputPreviewForCurrentSelection, surfacePageError, clearPageError, @@ -95,6 +96,8 @@ function previewGeneratorData({ }) { function applyResult(result) { if (!result?.ok) { + setPreviewDataTable?.(null); + clearOutputPreview?.(); surfaceGenerationResult({ operationKind: 'generateRows', result: result || {}, @@ -111,6 +114,8 @@ function previewGeneratorData({ const rowCount = getPreviewRowCount(); if (rowCount.errors.length > 0) { + setPreviewDataTable?.(null); + clearOutputPreview?.(); surfacePageError(rowCount.errors.join('\n')); return; } diff --git a/packages/core-ui/js/gui_components/generator/generation/generator-schema-generation-service.js b/packages/core-ui/js/gui_components/generator/generation/generator-schema-generation-service.js index 27e91db9..a48abbf6 100644 --- a/packages/core-ui/js/gui_components/generator/generation/generator-schema-generation-service.js +++ b/packages/core-ui/js/gui_components/generator/generation/generator-schema-generation-service.js @@ -1,6 +1,9 @@ import { GenericDataTable } from '@anywaydata/core/data_formats/generic-data-table.js'; import { CombinationsTestDataGenerator } from '@anywaydata/core/data_generation/n-wise/combinationsTestDataGenerator.js'; -import { createConfiguredGeneratorFromSchemaRows } from '../../shared/test-data/generation/generation-controller.js'; +import { + createConfiguredGeneratorFromSchemaRows, + schemaRowsToGenerationSpec, +} from '../../shared/test-data/generation/generation-controller.js'; import { createUiGenerationSessionService } from '../../shared/test-data/generation/ui-generation-session-service.js'; import { SOURCE_TYPE_FAKER, @@ -67,6 +70,12 @@ function createGeneratorSchemaGenerationService({ getValidatedSchemaState, getSchemaText, schemaRowsToSpec, + schemaRowsToGenerationSpec: (schemaRows) => + schemaRowsToGenerationSpec({ + schemaRows, + buildRuleSpecFromSchemaRow, + SOURCE_TYPE_REGEX, + }), schemaSource: 'generator-page', GenericDataTableClass: GenericDataTable, CombinationsTestDataGeneratorClass: CombinationsTestDataGenerator, diff --git a/packages/core-ui/js/gui_components/generator/page/generator-page-shell-view.js b/packages/core-ui/js/gui_components/generator/page/generator-page-shell-view.js index b16c9a23..c618d581 100644 --- a/packages/core-ui/js/gui_components/generator/page/generator-page-shell-view.js +++ b/packages/core-ui/js/gui_components/generator/page/generator-page-shell-view.js @@ -14,10 +14,12 @@ class GeneratorPageShellView { template() { return ` -
+ +
+

Data Generator

-
+ `; } diff --git a/packages/core-ui/js/gui_components/generator/preview/generator-preview-view.js b/packages/core-ui/js/gui_components/generator/preview/generator-preview-view.js index 9fd6ed9e..e1e4e240 100644 --- a/packages/core-ui/js/gui_components/generator/preview/generator-preview-view.js +++ b/packages/core-ui/js/gui_components/generator/preview/generator-preview-view.js @@ -135,6 +135,11 @@ class GeneratorPreviewView { setPreviewDataTable(dataTable) { this.controller.setPreviewDataTable(dataTable); + if (!dataTable) { + this.previewGrid?.clearGrid?.(); + this.previewGridAdapter?.getGridApi?.()?.clearGrid?.(); + return; + } if (this.previewGrid?.setGridFromGenericDataTable) { this.previewGrid.setGridFromGenericDataTable(dataTable); return; diff --git a/packages/core-ui/js/gui_components/generator/runtime/generator-page-actions-service.js b/packages/core-ui/js/gui_components/generator/runtime/generator-page-actions-service.js index 84b37f65..b3bd0bea 100644 --- a/packages/core-ui/js/gui_components/generator/runtime/generator-page-actions-service.js +++ b/packages/core-ui/js/gui_components/generator/runtime/generator-page-actions-service.js @@ -55,6 +55,7 @@ function createGeneratorPageActionsService({ getPreviewRowCount: () => getResolvedViewState()?.getPreviewRowCount?.(), schemaGenerationService: getResolvedSchemaGenerationService(), setPreviewDataTable: (dataTable) => getResolvedViewState()?.setPreviewDataTable?.(dataTable), + clearOutputPreview: () => getResolvedViewState()?.clearOutputPreview?.(), renderOutputPreviewForCurrentSelection: () => getResolvedViewState()?.renderOutputPreviewForCurrentSelection?.(), surfacePageError: (message, options) => getResolvedSchemaRuntime()?.surfacePageError?.(message, options), diff --git a/packages/core-ui/js/gui_components/generator/runtime/generator-page-view-state.js b/packages/core-ui/js/gui_components/generator/runtime/generator-page-view-state.js index 6746fb17..b931b7ba 100644 --- a/packages/core-ui/js/gui_components/generator/runtime/generator-page-view-state.js +++ b/packages/core-ui/js/gui_components/generator/runtime/generator-page-view-state.js @@ -35,6 +35,9 @@ function createGeneratorPageViewState({ runtime, createUnavailableRowCountResult setPreviewDataTable(dataTable) { runtime?.generatorPreview?.setPreviewDataTable?.(dataTable); }, + clearOutputPreview() { + runtime?.generatorPreview?.clearOutputPreview?.(); + }, renderOutputPreviewForCurrentSelection() { runtime?.generatorPreview?.renderOutputPreview?.(getSelectedOutputType(), runtime?.exporter || null); }, diff --git a/packages/core-ui/js/gui_components/shared/domain-command-help-metadata.js b/packages/core-ui/js/gui_components/shared/domain-command-help-metadata.js index 22a7f4f8..4fa5cb47 100644 --- a/packages/core-ui/js/gui_components/shared/domain-command-help-metadata.js +++ b/packages/core-ui/js/gui_components/shared/domain-command-help-metadata.js @@ -1,4 +1,6 @@ import { getDomainKeywordHelpByAlias } from '@anywaydata/core/domain/domain-keywords.js'; +import { normalizeUsageExamples } from '@anywaydata/core/command-help/command-help-contract.js'; +import { validateEnumMemberValue } from '@anywaydata/core/command-help/command-help-validators.js'; const ANYWAYDATA_DOMAIN_DOCS_BASE = 'https://anywaydata.com/docs/test-data/domain'; @@ -8,10 +10,15 @@ const SYNTHETIC_DOMAIN_HELP = Object.freeze({ summary: 'Enum helper accepts a list of values and returns one value at random. Supports enum(value1,value2), enum value1,value2, or datatype.enum(value1,value2).', docsUrl: `${ANYWAYDATA_DOMAIN_DOCS_BASE}/datatype`, - example: 'datatype.enum(active,inactive,pending)', - examples: ['datatype.enum(active,inactive,pending)'], - exampleReturnValues: ['active', 'inactive', 'pending'], + usageExamples: [ + { + functionCall: 'datatype.enum(active,inactive,pending)', + sampleReturnValue: 'active', + description: 'Shows the canonical datatype enum helper with three discrete values.', + }, + ], returnType: 'string', + validator: validateEnumMemberValue, args: [ { name: 'values', @@ -25,6 +32,26 @@ const SYNTHETIC_DOMAIN_HELP = Object.freeze({ }, }); +function normalizeSyntheticDomainHelp(command, definition) { + const args = Array.isArray(definition?.args) ? definition.args : []; + const usageExamples = normalizeUsageExamples({ + command, + returnType: definition?.returnType, + usageExamples: definition?.usageExamples, + }); + + return { + canonical: definition.canonical, + summary: definition.summary, + docsUrl: definition.docsUrl, + fakerDocsUrl: String(definition.fakerDocsUrl || '').trim(), + usageExamples, + validator: definition?.validator, + returnType: definition.returnType, + args, + }; +} + function getDomainPageFromCommand(command) { const value = String(command || '').trim(); if (!value.includes('.')) { @@ -54,9 +81,10 @@ function resolveDomainDocsUrl(command, keywordDocsUrl) { } function getDomainCommandHelp(command) { - const synthetic = SYNTHETIC_DOMAIN_HELP[String(command || '').trim()]; + const normalizedCommand = String(command || '').trim(); + const synthetic = SYNTHETIC_DOMAIN_HELP[normalizedCommand]; if (synthetic) { - return synthetic; + return normalizeSyntheticDomainHelp(normalizedCommand, synthetic); } const commandHelp = getDomainKeywordHelpByAlias(command); if (!commandHelp) { @@ -67,9 +95,9 @@ function getDomainCommandHelp(command) { canonical: commandHelp.canonical, summary: commandHelp.summary || '', docsUrl: resolveDomainDocsUrl(command, commandHelp.docsUrl || ''), - example: commandHelp.example || '', - examples: Array.isArray(commandHelp.examples) ? commandHelp.examples : [], - exampleReturnValues: Array.isArray(commandHelp.exampleReturnValues) ? commandHelp.exampleReturnValues : [], + fakerDocsUrl: String(commandHelp.fakerDocsUrl || '').trim(), + usageExamples: Array.isArray(commandHelp.usageExamples) ? commandHelp.usageExamples : [], + validator: commandHelp.validator, returnType: commandHelp.returnType || '', args: Array.isArray(commandHelp.args) ? commandHelp.args : [], }; diff --git a/packages/core-ui/js/gui_components/shared/instructions/instructions-view.js b/packages/core-ui/js/gui_components/shared/instructions/instructions-view.js index 6e70ca00..8d0f5d6c 100644 --- a/packages/core-ui/js/gui_components/shared/instructions/instructions-view.js +++ b/packages/core-ui/js/gui_components/shared/instructions/instructions-view.js @@ -71,7 +71,7 @@ class InstructionsView { ${escapeHtml(state.title)} - +
    ${itemsHtml}
${actionsHtml} diff --git a/packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-view.js b/packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-view.js index a174379d..91f744f1 100644 --- a/packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-view.js +++ b/packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-view.js @@ -119,12 +119,13 @@ class SharedSchemaDefinitionView { ${headingMarkup} - + data-help="${viewModel.helpIconDataHelp}">