diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 2e6775d0905..9f8bd12e164 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -181,7 +181,7 @@ const config = defineConfig({ link: '/guide/localization', }, { - text: 'Upgrading to v7', + text: 'Upgrading to v8', link: '/guide/upgrading', }, ], diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index ac95b6b5f77..11bf4d133b5 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -1,59 +1,89 @@ -# Upgrading to v7 +# Upgrading to v8 -This is the migration guide for upgrading from v6 to v7. +This is the migration guide for upgrading from v7 to v8. + +Since v8 has not yet been released, this is a work in progress list of any major and breaking changes in v8. ::: info Not the version you are looking for? -- [v6.fakerjs.dev](https://v6.fakerjs.dev/migration-guide-v5/) +- [Upgrading to v7](https://v7.fakerjs.dev/guide/upgrading.html) +- [Upgrading to v6](https://v6.fakerjs.dev/migration-guide-v5/) ::: -## Node 12 no longer supported - -You need at least Node 14 to use Faker. - -## Default export removed - -If you were previously importing faker like this: - -```js -import faker from '@faker-js/faker'; -``` - -You must instead use: - -```js -import { faker } from '@faker-js/faker'; -``` - -## Deprecated methods changed - -Several methods were renamed or moved: - -| Old method | New alternative | -| -------------------------- | ------------------------------------------------------ | -| faker.random.number | faker.datatype.number | -| faker.random.float | faker.datatype.float | -| faker.random.arrayElement | faker.helpers.arrayElement | -| faker.random.arrayElements | faker.helpers.arrayElements | -| faker.random.objectElement | faker.helpers.objectKey
faker.helpers.objectValue | -| faker.random.uuid | faker.datatype.uuid | -| faker.random.boolean | faker.datatype.boolean | -| faker.random.image | faker.image.image | -| faker.random.hexaDecimal | faker.datatype.hexadecimal | -| faker.helpers.randomize | faker.helpers.arrayElement | -| faker.datatype.hexaDecimal | faker.datatype.hexadecimal | -| faker.name.title | faker.name.jobTitle | - -## Deprecated methods removed - -Some methods were removed without a direct alternative. If you are using any of these methods you should build an object containing the specific properties you need. - -| Removed method | -| ------------------------------- | -| faker.helpers.createCard | -| faker.helpers.contextualCard | -| faker.helpers.userCard | -| faker.time | -| faker.helpers.createTransaction | +## `faker.mersenne` and `faker.helpers.repeatString` removed + +`faker.mersenne` and `faker.helpers.repeatString` were only ever intended for internal use, and are no longer available. + +## Other deprecated methods replaced + +| Old method | New method | +| ------------------------------- | ----------------------------------------------------------------- | +| `faker.unique` | `faker.helpers.unique` | +| `faker.fake` | `faker.helpers.fake` | +| `faker.commerce.color` | `faker.color.human` | +| `faker.company.companyName` | `faker.company.name` | +| `faker.phone.phoneNumber` | `faker.phone.number` | +| `faker.phone.phoneNumberFormat` | No direct replacement, see documentation for `faker.phone.number` | +| `faker.phone.phoneFormats` | No direct replacement, see documentation for `faker.phone.number` | + +## `faker.name` changed to `faker.person` + +The whole `faker.name` module is now located at `faker.person`, as it contains more information than just names. +The `faker.name.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.person.*` + +| Old method | New method | +| -------------------------- | ----------------------------------------------- | +| `faker.name.firstName` | `faker.person.firstName` | +| `faker.name.lastName` | `faker.person.lastName` | +| `faker.name.middleName` | `faker.person.middleName` | +| `faker.name.fullName` | `faker.person.fullName` | +| `faker.name.gender` | `faker.person.gender` | +| `faker.name.sex` | `faker.person.sex` | +| `faker.name.sexType` | `faker.person.sexType` | +| `faker.name.prefix` | `faker.person.prefix` | +| `faker.name.suffix` | `faker.person.suffix` | +| `faker.name.jobTitle` | `faker.person.jobTitle` | +| `faker.name.jobDescriptor` | `faker.person.jobDescriptor` | +| `faker.name.jobArea` | `faker.person.jobArea` | +| `faker.name.jobType` | `faker.person.jobType` | +| `faker.name.findName` | _Removed, replace with `faker.person.fullName`_ | + +## `faker.address` changed to `faker.location` + +The whole `faker.address` module is now located at `faker.location`, as it contains more information than just addresses. +The `faker.address.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.location.*` + +| Old method | New method | +| ----------------------------------- | ------------------------------------ | +| `faker.address.buildingNumber` | `faker.location.buildingNumber` | +| `faker.address.cardinalDirection` | `faker.location.cardinalDirection` | +| `faker.address.city` | `faker.location.city` | +| `faker.address.cityName` | `faker.location.cityName` | +| `faker.address.country` | `faker.location.country` | +| `faker.address.countryCode` | `faker.location.countryCode` | +| `faker.address.county` | `faker.location.county` | +| `faker.address.direction` | `faker.location.direction` | +| `faker.address.faker` | `faker.location.faker` | +| `faker.address.latitude` | `faker.location.latitude` | +| `faker.address.longitude` | `faker.location.longitude` | +| `faker.address.nearbyGPSCoordinate` | `faker.location.nearbyGPSCoordinate` | +| `faker.address.ordinalDirection` | `faker.location.ordinalDirection` | +| `faker.address.secondaryAddress` | `faker.location.secondaryAddress` | +| `faker.address.state` | `faker.location.state` | +| `faker.address.stateAbbr` | `faker.location.stateAbbr` | +| `faker.address.street` | `faker.location.street` | +| `faker.address.streetAddress` | `faker.location.streetAddress` | +| `faker.address.streetName` | `faker.location.streetName` | +| `faker.address.timeZone` | `faker.location.timeZone` | +| `faker.address.zipCode` | `faker.location.zipCode` | +| `faker.address.zipCodeByState` | `faker.location.zipCodeByState` | +| `faker.address.cityPrefix` | _Removed_ | +| `faker.address.citySuffix` | _Removed_ | +| `faker.address.streetPrefix` | _Removed_ | +| `faker.address.streetSuffix` | _Removed_ | + +## Locale renamed + +The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales. diff --git a/docs/guide/usage.md b/docs/guide/usage.md index 57ee4565d7a..63a0c183ba8 100644 --- a/docs/guide/usage.md +++ b/docs/guide/usage.md @@ -91,7 +91,7 @@ import type { SexType } from '@faker-js/faker'; type SubscriptionTier = 'free' | 'basic' | 'business'; -class User { +interface User { _id: string; avatar: string; birthday: Date; @@ -112,7 +112,7 @@ Let's create our first user factory function: ```ts import { faker } from '@faker-js/faker'; -class User { ... } +interface User { ... } function createRandomUser(): User { return { diff --git a/package.json b/package.json index 6158396e80a..6b233c89987 100644 --- a/package.json +++ b/package.json @@ -103,16 +103,16 @@ "@types/sanitize-html": "~2.6.2", "@types/semver": "~7.3.13", "@types/validator": "~13.7.10", - "@typescript-eslint/eslint-plugin": "~5.42.1", - "@typescript-eslint/parser": "~5.42.1", - "@vitest/coverage-c8": "~0.25.1", - "@vitest/ui": "~0.25.1", + "@typescript-eslint/eslint-plugin": "~5.43.0", + "@typescript-eslint/parser": "~5.43.0", + "@vitest/coverage-c8": "~0.25.2", + "@vitest/ui": "~0.25.2", "@vueuse/core": "~9.5.0", "c8": "~7.12.0", "conventional-changelog-cli": "~2.2.2", - "cypress": "~11.0.1", - "esbuild": "~0.15.13", - "eslint": "~8.27.0", + "cypress": "~11.1.0", + "esbuild": "~0.15.15", + "eslint": "~8.28.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.12.0", "eslint-gitignore": "~0.1.0", @@ -135,14 +135,14 @@ "tsx": "~3.12.1", "typedoc": "~0.23.21", "typedoc-plugin-missing-exports": "~1.0.0", - "typescript": "~4.8.4", + "typescript": "~4.9.3", "validator": "~13.7.0", - "vite": "~3.2.3", - "vitepress": "1.0.0-alpha.28", - "vitest": "~0.25.1", + "vite": "~3.2.4", + "vitepress": "1.0.0-alpha.29", + "vitest": "~0.25.2", "vue": "~3.2.45" }, - "packageManager": "pnpm@7.15.0", + "packageManager": "pnpm@7.17.0", "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0", "npm": ">=6.14.13" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe5d337ece7..6828cd666db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,16 +11,16 @@ specifiers: '@types/sanitize-html': ~2.6.2 '@types/semver': ~7.3.13 '@types/validator': ~13.7.10 - '@typescript-eslint/eslint-plugin': ~5.42.1 - '@typescript-eslint/parser': ~5.42.1 - '@vitest/coverage-c8': ~0.25.1 - '@vitest/ui': ~0.25.1 + '@typescript-eslint/eslint-plugin': ~5.43.0 + '@typescript-eslint/parser': ~5.43.0 + '@vitest/coverage-c8': ~0.25.2 + '@vitest/ui': ~0.25.2 '@vueuse/core': ~9.5.0 c8: ~7.12.0 conventional-changelog-cli: ~2.2.2 - cypress: ~11.0.1 - esbuild: ~0.15.13 - eslint: ~8.27.0 + cypress: ~11.1.0 + esbuild: ~0.15.15 + eslint: ~8.28.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.12.0 eslint-gitignore: ~0.1.0 @@ -43,11 +43,11 @@ specifiers: tsx: ~3.12.1 typedoc: ~0.23.21 typedoc-plugin-missing-exports: ~1.0.0 - typescript: ~4.8.4 + typescript: ~4.9.3 validator: ~13.7.0 - vite: ~3.2.3 - vitepress: 1.0.0-alpha.28 - vitest: ~0.25.1 + vite: ~3.2.4 + vitepress: 1.0.0-alpha.29 + vitest: ~0.25.2 vue: ~3.2.45 devDependencies: @@ -61,28 +61,28 @@ devDependencies: '@types/sanitize-html': 2.6.2 '@types/semver': 7.3.13 '@types/validator': 13.7.10 - '@typescript-eslint/eslint-plugin': 5.42.1_2udltptbznfmezdozpdoa2aemq - '@typescript-eslint/parser': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@vitest/coverage-c8': 0.25.1_@vitest+ui@0.25.1 - '@vitest/ui': 0.25.1 + '@typescript-eslint/eslint-plugin': 5.43.0_nqj4bdx4ekws7aecttskpih4py + '@typescript-eslint/parser': 5.43.0_hsf322ms6xhhd4b5ne6lb74y4a + '@vitest/coverage-c8': 0.25.2_@vitest+ui@0.25.2 + '@vitest/ui': 0.25.2 '@vueuse/core': 9.5.0_vue@3.2.45 c8: 7.12.0 conventional-changelog-cli: 2.2.2 - cypress: 11.0.1 - esbuild: 0.15.13 - eslint: 8.27.0 - eslint-config-prettier: 8.5.0_eslint@8.27.0 + cypress: 11.1.0 + esbuild: 0.15.15 + eslint: 8.28.0 + eslint-config-prettier: 8.5.0_eslint@8.28.0 eslint-define-config: 1.12.0 - eslint-gitignore: 0.1.0_eslint@8.27.0 - eslint-plugin-jsdoc: 39.6.2_eslint@8.27.0 - eslint-plugin-prettier: 4.2.1_v7o5sx5x3wbs57ifz6wc4f76we + eslint-gitignore: 0.1.0_eslint@8.28.0 + eslint-plugin-jsdoc: 39.6.2_eslint@8.28.0 + eslint-plugin-prettier: 4.2.1_pgxuib4rd7wiymfktharf5ydt4 glob: 8.0.3 lint-staged: 13.0.3 mime-db: 1.52.0 npm-run-all: 4.1.5 picocolors: 1.0.0 prettier: 2.7.1 - prettier-plugin-organize-imports: 3.2.0_dmjzcauo3cshxeipj7bv64ktgm + prettier-plugin-organize-imports: 3.2.0_wbcyan4knibwiqrg7345gyo3qi react: 18.2.0 react-dom: 18.2.0_react@18.2.0 rimraf: 3.0.2 @@ -91,13 +91,13 @@ devDependencies: simple-git-hooks: 2.8.1 standard-version: 9.5.0 tsx: 3.12.1 - typedoc: 0.23.21_typescript@4.8.4 + typedoc: 0.23.21_typescript@4.9.3 typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.21 - typescript: 4.8.4 + typescript: 4.9.3 validator: 13.7.0 - vite: 3.2.3_@types+node@18.11.9 - vitepress: 1.0.0-alpha.28_ftj2nf53q7xylmjs4grbzsajkm - vitest: 0.25.1_@vitest+ui@0.25.1 + vite: 3.2.4_@types+node@18.11.9 + vitepress: 1.0.0-alpha.29_ftj2nf53q7xylmjs4grbzsajkm + vitest: 0.25.2_@vitest+ui@0.25.2 vue: 3.2.45 packages: @@ -377,7 +377,7 @@ packages: /@esbuild-kit/core-utils/3.0.0: resolution: {integrity: sha512-TXmwH9EFS3DC2sI2YJWJBgHGhlteK0Xyu1VabwetMULfm3oYhbrsWV5yaSr2NTWZIgDGVLHbRf0inxbjXqAcmQ==} dependencies: - esbuild: 0.15.13 + esbuild: 0.15.15 source-map-support: 0.5.21 dev: true @@ -388,8 +388,8 @@ packages: get-tsconfig: 4.2.0 dev: true - /@esbuild/android-arm/0.15.13: - resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==} + /@esbuild/android-arm/0.15.15: + resolution: {integrity: sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -397,8 +397,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64/0.15.13: - resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==} + /@esbuild/linux-loong64/0.15.15: + resolution: {integrity: sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -696,8 +696,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.42.1_2udltptbznfmezdozpdoa2aemq: - resolution: {integrity: sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg==} + /@typescript-eslint/eslint-plugin/5.43.0_nqj4bdx4ekws7aecttskpih4py: + resolution: {integrity: sha512-wNPzG+eDR6+hhW4yobEmpR36jrqqQv1vxBq5LJO3fBAktjkvekfr4BRl+3Fn1CM/A+s8/EiGUbOMDoYqWdbtXA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -707,24 +707,24 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/type-utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/parser': 5.43.0_hsf322ms6xhhd4b5ne6lb74y4a + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/type-utils': 5.43.0_hsf322ms6xhhd4b5ne6lb74y4a + '@typescript-eslint/utils': 5.43.0_hsf322ms6xhhd4b5ne6lb74y4a debug: 4.3.4 - eslint: 8.27.0 + eslint: 8.28.0 ignore: 5.2.0 natural-compare-lite: 1.4.0 regexpp: 3.2.0 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q==} + /@typescript-eslint/parser/5.43.0_hsf322ms6xhhd4b5ne6lb74y4a: + resolution: {integrity: sha512-2iHUK2Lh7PwNUlhFxxLI2haSDNyXvebBO9izhjhMoDC+S3XI9qt2DGFUsiJ89m2k7gGYch2aEpYqV5F/+nwZug==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -733,26 +733,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 debug: 4.3.4 - eslint: 8.27.0 - typescript: 4.8.4 + eslint: 8.28.0 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.42.1: - resolution: {integrity: sha512-QAZY/CBP1Emx4rzxurgqj3rUinfsh/6mvuKbLNMfJMMKYLRBfweus8brgXF8f64ABkIZ3zdj2/rYYtF8eiuksQ==} + /@typescript-eslint/scope-manager/5.43.0: + resolution: {integrity: sha512-XNWnGaqAtTJsUiZaoiGIrdJYHsUOd3BZ3Qj5zKp9w6km6HsrjPk/TGZv0qMTWyWj0+1QOqpHQ2gZOLXaGA9Ekw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/visitor-keys': 5.42.1 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/visitor-keys': 5.43.0 dev: true - /@typescript-eslint/type-utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg==} + /@typescript-eslint/type-utils/5.43.0_hsf322ms6xhhd4b5ne6lb74y4a: + resolution: {integrity: sha512-K21f+KY2/VvYggLf5Pk4tgBOPs2otTaIHy2zjclo7UZGLyFH86VfUOm5iq+OtDtxq/Zwu2I3ujDBykVW4Xtmtg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -761,23 +761,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 + '@typescript-eslint/utils': 5.43.0_hsf322ms6xhhd4b5ne6lb74y4a debug: 4.3.4 - eslint: 8.27.0 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + eslint: 8.28.0 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.42.1: - resolution: {integrity: sha512-Qrco9dsFF5lhalz+lLFtxs3ui1/YfC6NdXu+RAGBa8uSfn01cjO7ssCsjIsUs484vny9Xm699FSKwpkCcqwWwA==} + /@typescript-eslint/types/5.43.0: + resolution: {integrity: sha512-jpsbcD0x6AUvV7tyOlyvon0aUsQpF8W+7TpJntfCUWU1qaIKu2K34pMwQKSzQH8ORgUrGYY6pVIh1Pi8TNeteg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.42.1_typescript@4.8.4: - resolution: {integrity: sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw==} + /@typescript-eslint/typescript-estree/5.43.0_typescript@4.9.3: + resolution: {integrity: sha512-BZ1WVe+QQ+igWal2tDbNg1j2HWUkAa+CVqdU79L4HP9izQY6CNhXfkNwd1SS4+sSZAP/EthI1uiCSY/+H0pROg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -785,62 +785,62 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/visitor-keys': 5.42.1 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/visitor-keys': 5.43.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.8.4 - typescript: 4.8.4 + tsutils: 3.21.0_typescript@4.9.3 + typescript: 4.9.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: - resolution: {integrity: sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ==} + /@typescript-eslint/utils/5.43.0_hsf322ms6xhhd4b5ne6lb74y4a: + resolution: {integrity: sha512-8nVpA6yX0sCjf7v/NDfeaOlyaIIqL7OaIGOWSPFqUKK59Gnumd3Wa+2l8oAaYO2lk0sO+SbWFWRSvhu8gLGv4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.11 '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/types': 5.42.1 - '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 - eslint: 8.27.0 + '@typescript-eslint/scope-manager': 5.43.0 + '@typescript-eslint/types': 5.43.0 + '@typescript-eslint/typescript-estree': 5.43.0_typescript@4.9.3 + eslint: 8.28.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint-utils: 3.0.0_eslint@8.28.0 semver: 7.3.8 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys/5.42.1: - resolution: {integrity: sha512-LOQtSF4z+hejmpUvitPlc4hA7ERGoj2BVkesOcG91HCn8edLGUXbTrErmutmPbl8Bo9HjAvOO/zBKQHExXNA2A==} + /@typescript-eslint/visitor-keys/5.43.0: + resolution: {integrity: sha512-icl1jNH/d18OVHLfcwdL3bWUKsBeIiKYTGxMJCoGe7xFht+E4QgzOqoWYrU8XSLJWhVw8nTacbm03v23J/hFTg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.42.1 + '@typescript-eslint/types': 5.43.0 eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/3.2.0_vite@3.2.3+vue@3.2.45: + /@vitejs/plugin-vue/3.2.0_vite@3.2.4+vue@3.2.45: resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^3.0.0 vue: ^3.2.25 dependencies: - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 vue: 3.2.45 dev: true - /@vitest/coverage-c8/0.25.1_@vitest+ui@0.25.1: - resolution: {integrity: sha512-gpl5QNaNeIN0mfRiosCqBFoZcizb5GA458TDnOQXkGDc4kklazxn70u9evGfV62wiiAUfGGebgRhxlBkAa6m6g==} + /@vitest/coverage-c8/0.25.2_@vitest+ui@0.25.2: + resolution: {integrity: sha512-qKsiUJh3bjbB5Q229CbxEWCqiDBwvIrcZ9OOuQdMEC0pce3/LlTUK3+K3hd7WqAYEbbiqXfC5MVMKHZkV82PgA==} dependencies: c8: 7.12.0 - vitest: 0.25.1_@vitest+ui@0.25.1 + vitest: 0.25.2_@vitest+ui@0.25.2 transitivePeerDependencies: - '@edge-runtime/vm' - '@vitest/browser' @@ -855,8 +855,8 @@ packages: - terser dev: true - /@vitest/ui/0.25.1: - resolution: {integrity: sha512-VjzyfLjNS5Zc7XCCFJW3cM2iVW305D65NG0PIWefA4A8mwOH/QJJ4nFj/4cwXzwL0/VT3/ppvpv3UDNZoh/YOQ==} + /@vitest/ui/0.25.2: + resolution: {integrity: sha512-/pUR88zjiF/5qnzb8Ou9i3+NDgteMcqk7G8VZox/qzcs7Z06dLpNzAxANOANP9m8U/yrJtPNjQqeuMI26HbWwA==} dependencies: sirv: 2.0.2 dev: true @@ -1651,8 +1651,8 @@ packages: resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==} dev: true - /cypress/11.0.1: - resolution: {integrity: sha512-NuEfd0Vim492RJ3m/+bbTZ3OZrqXgfAfuLaZfIQ9D5lKocS3EDr2tyAarZdAhKwLyoh7OJ33jwMeMFIDbzYqog==} + /cypress/11.1.0: + resolution: {integrity: sha512-kzizbG9s3p3ahWqxUwG/21NqLWEGtScMevMyUPeYlcmMX9RzVxWM18MkA3B4Cb3jKx72hSyIE2mHgHymfCM1bg==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true @@ -1957,8 +1957,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.15.13: - resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==} + /esbuild-android-64/0.15.15: + resolution: {integrity: sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1966,8 +1966,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.15.13: - resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==} + /esbuild-android-arm64/0.15.15: + resolution: {integrity: sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1975,8 +1975,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.15.13: - resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==} + /esbuild-darwin-64/0.15.15: + resolution: {integrity: sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1984,8 +1984,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.15.13: - resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==} + /esbuild-darwin-arm64/0.15.15: + resolution: {integrity: sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1993,8 +1993,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.15.13: - resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==} + /esbuild-freebsd-64/0.15.15: + resolution: {integrity: sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -2002,8 +2002,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.15.13: - resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==} + /esbuild-freebsd-arm64/0.15.15: + resolution: {integrity: sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -2011,8 +2011,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.15.13: - resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==} + /esbuild-linux-32/0.15.15: + resolution: {integrity: sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -2020,8 +2020,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.15.13: - resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==} + /esbuild-linux-64/0.15.15: + resolution: {integrity: sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -2029,8 +2029,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.15.13: - resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==} + /esbuild-linux-arm/0.15.15: + resolution: {integrity: sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -2038,8 +2038,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.15.13: - resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==} + /esbuild-linux-arm64/0.15.15: + resolution: {integrity: sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -2047,8 +2047,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.15.13: - resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==} + /esbuild-linux-mips64le/0.15.15: + resolution: {integrity: sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -2056,8 +2056,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.15.13: - resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==} + /esbuild-linux-ppc64le/0.15.15: + resolution: {integrity: sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -2065,8 +2065,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.15.13: - resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==} + /esbuild-linux-riscv64/0.15.15: + resolution: {integrity: sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -2074,8 +2074,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.15.13: - resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==} + /esbuild-linux-s390x/0.15.15: + resolution: {integrity: sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -2083,8 +2083,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.15.13: - resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==} + /esbuild-netbsd-64/0.15.15: + resolution: {integrity: sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -2092,8 +2092,8 @@ packages: dev: true optional: true - /esbuild-openbsd-64/0.15.13: - resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==} + /esbuild-openbsd-64/0.15.15: + resolution: {integrity: sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -2101,8 +2101,8 @@ packages: dev: true optional: true - /esbuild-sunos-64/0.15.13: - resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==} + /esbuild-sunos-64/0.15.15: + resolution: {integrity: sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -2110,8 +2110,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.15.13: - resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==} + /esbuild-windows-32/0.15.15: + resolution: {integrity: sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -2119,8 +2119,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.15.13: - resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==} + /esbuild-windows-64/0.15.15: + resolution: {integrity: sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -2128,8 +2128,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.15.13: - resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==} + /esbuild-windows-arm64/0.15.15: + resolution: {integrity: sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -2137,34 +2137,34 @@ packages: dev: true optional: true - /esbuild/0.15.13: - resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==} + /esbuild/0.15.15: + resolution: {integrity: sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.15.13 - '@esbuild/linux-loong64': 0.15.13 - esbuild-android-64: 0.15.13 - esbuild-android-arm64: 0.15.13 - esbuild-darwin-64: 0.15.13 - esbuild-darwin-arm64: 0.15.13 - esbuild-freebsd-64: 0.15.13 - esbuild-freebsd-arm64: 0.15.13 - esbuild-linux-32: 0.15.13 - esbuild-linux-64: 0.15.13 - esbuild-linux-arm: 0.15.13 - esbuild-linux-arm64: 0.15.13 - esbuild-linux-mips64le: 0.15.13 - esbuild-linux-ppc64le: 0.15.13 - esbuild-linux-riscv64: 0.15.13 - esbuild-linux-s390x: 0.15.13 - esbuild-netbsd-64: 0.15.13 - esbuild-openbsd-64: 0.15.13 - esbuild-sunos-64: 0.15.13 - esbuild-windows-32: 0.15.13 - esbuild-windows-64: 0.15.13 - esbuild-windows-arm64: 0.15.13 + '@esbuild/android-arm': 0.15.15 + '@esbuild/linux-loong64': 0.15.15 + esbuild-android-64: 0.15.15 + esbuild-android-arm64: 0.15.15 + esbuild-darwin-64: 0.15.15 + esbuild-darwin-arm64: 0.15.15 + esbuild-freebsd-64: 0.15.15 + esbuild-freebsd-arm64: 0.15.15 + esbuild-linux-32: 0.15.15 + esbuild-linux-64: 0.15.15 + esbuild-linux-arm: 0.15.15 + esbuild-linux-arm64: 0.15.15 + esbuild-linux-mips64le: 0.15.15 + esbuild-linux-ppc64le: 0.15.15 + esbuild-linux-riscv64: 0.15.15 + esbuild-linux-s390x: 0.15.15 + esbuild-netbsd-64: 0.15.15 + esbuild-openbsd-64: 0.15.15 + esbuild-sunos-64: 0.15.15 + esbuild-windows-32: 0.15.15 + esbuild-windows-64: 0.15.15 + esbuild-windows-arm64: 0.15.15 dev: true /escalade/3.1.1: @@ -2182,13 +2182,13 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier/8.5.0_eslint@8.27.0: + /eslint-config-prettier/8.5.0_eslint@8.28.0: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.27.0 + eslint: 8.28.0 dev: true /eslint-define-config/1.12.0: @@ -2196,7 +2196,7 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13', pnpm: '>= 7.0.0'} dev: true - /eslint-gitignore/0.1.0_eslint@8.27.0: + /eslint-gitignore/0.1.0_eslint@8.28.0: resolution: {integrity: sha512-VFvY5Wyjuz5xXDC/NeONHzsh4YQNok2Gzg4SftAAuhkbrdHv5CChjfiFyLKhRlgOdCJr5kBquaLXHtuDBTW2/Q==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -2204,13 +2204,13 @@ packages: dependencies: array.prototype.flatmap: 1.3.0 debug: 4.3.4 - eslint: 8.27.0 + eslint: 8.28.0 fast-glob: 3.2.12 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-jsdoc/39.6.2_eslint@8.27.0: + /eslint-plugin-jsdoc/39.6.2_eslint@8.28.0: resolution: {integrity: sha512-dvgY/W7eUFoAIIiaWHERIMI61ZWqcz9YFjEeyTzdPlrZc3TY/3aZm5aB91NUoTLWYZmO/vFlYSuQi15tF7uE5A==} engines: {node: ^14 || ^16 || ^17 || ^18 || ^19} peerDependencies: @@ -2220,7 +2220,7 @@ packages: comment-parser: 1.3.1 debug: 4.3.4 escape-string-regexp: 4.0.0 - eslint: 8.27.0 + eslint: 8.28.0 esquery: 1.4.0 semver: 7.3.8 spdx-expression-parse: 3.0.1 @@ -2228,7 +2228,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.2.1_v7o5sx5x3wbs57ifz6wc4f76we: + /eslint-plugin-prettier/4.2.1_pgxuib4rd7wiymfktharf5ydt4: resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -2239,8 +2239,8 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.27.0 - eslint-config-prettier: 8.5.0_eslint@8.27.0 + eslint: 8.28.0 + eslint-config-prettier: 8.5.0_eslint@8.28.0 prettier: 2.7.1 prettier-linter-helpers: 1.0.0 dev: true @@ -2261,13 +2261,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.27.0: + /eslint-utils/3.0.0_eslint@8.28.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.27.0 + eslint: 8.28.0 eslint-visitor-keys: 2.1.0 dev: true @@ -2281,8 +2281,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.27.0: - resolution: {integrity: sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==} + /eslint/8.28.0: + resolution: {integrity: sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: @@ -2297,7 +2297,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint-utils: 3.0.0_eslint@8.28.0 eslint-visitor-keys: 3.3.0 espree: 9.4.0 esquery: 1.4.0 @@ -3894,7 +3894,7 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/3.2.0_dmjzcauo3cshxeipj7bv64ktgm: + /prettier-plugin-organize-imports/3.2.0_wbcyan4knibwiqrg7345gyo3qi: resolution: {integrity: sha512-jeZ13YVKgXYCzkuwnoR6saKxJmdRYWMxS2G/su1V3qDWqTo1Q5iSoTblBxsXXAmomXfPqa/uA7YCK0/S86KLOQ==} peerDependencies: '@volar/vue-language-plugin-pug': ^1.0.4 @@ -3908,7 +3908,7 @@ packages: optional: true dependencies: prettier: 2.7.1 - typescript: 4.8.4 + typescript: 4.9.3 dev: true /prettier/2.7.1: @@ -4623,14 +4623,14 @@ packages: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} dev: true - /tsutils/3.21.0_typescript@4.8.4: + /tsutils/3.21.0_typescript@4.9.3: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.8.4 + typescript: 4.9.3 dev: true /tsx/3.12.1: @@ -4705,10 +4705,10 @@ packages: peerDependencies: typedoc: 0.22.x || 0.23.x dependencies: - typedoc: 0.23.21_typescript@4.8.4 + typedoc: 0.23.21_typescript@4.9.3 dev: true - /typedoc/0.23.21_typescript@4.8.4: + /typedoc/0.23.21_typescript@4.9.3: resolution: {integrity: sha512-VNE9Jv7BgclvyH9moi2mluneSviD43dCE9pY8RWkO88/DrEgJZk9KpUk7WO468c9WWs/+aG6dOnoH7ccjnErhg==} engines: {node: '>= 14.14'} hasBin: true @@ -4719,11 +4719,11 @@ packages: marked: 4.1.1 minimatch: 5.1.0 shiki: 0.11.1 - typescript: 4.8.4 + typescript: 4.9.3 dev: true - /typescript/4.8.4: - resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + /typescript/4.9.3: + resolution: {integrity: sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -4810,8 +4810,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite/3.2.3_@types+node@18.11.9: - resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==} + /vite/3.2.4_@types+node@18.11.9: + resolution: {integrity: sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -4836,7 +4836,7 @@ packages: optional: true dependencies: '@types/node': 18.11.9 - esbuild: 0.15.13 + esbuild: 0.15.15 postcss: 8.4.18 resolve: 1.22.1 rollup: 2.79.1 @@ -4844,18 +4844,18 @@ packages: fsevents: 2.3.2 dev: true - /vitepress/1.0.0-alpha.28_ftj2nf53q7xylmjs4grbzsajkm: - resolution: {integrity: sha512-pvbLssDMgLUN1terajmPlFBxHSDGO4DqwexKbjFyr7LeELerVuwGrG6F2J1hxmwOlbpLd1kHXEDqGm9JX/kTDQ==} + /vitepress/1.0.0-alpha.29_ftj2nf53q7xylmjs4grbzsajkm: + resolution: {integrity: sha512-oaRaeMLcN9M3Bxz97fFVF6Gzm3Aqtb0CijTt5TOW0XPzNPuKA0YpFnsmS97gdKmA+VztM6itRJ8K7JJuU0VS3g==} hasBin: true dependencies: '@docsearch/css': 3.3.0 '@docsearch/js': 3.3.0_bbqmvyebg44zjqjhzodbnnxkxa - '@vitejs/plugin-vue': 3.2.0_vite@3.2.3+vue@3.2.45 + '@vitejs/plugin-vue': 3.2.0_vite@3.2.4+vue@3.2.45 '@vue/devtools-api': 6.4.5 '@vueuse/core': 9.5.0_vue@3.2.45 body-scroll-lock: 4.0.0-beta.0 shiki: 0.11.1 - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 vue: 3.2.45 transitivePeerDependencies: - '@algolia/client-search' @@ -4871,8 +4871,8 @@ packages: - terser dev: true - /vitest/0.25.1_@vitest+ui@0.25.1: - resolution: {integrity: sha512-eH74h6MkuEgsqR4mAQZeMK9O0PROiKY+i+1GMz/fBi5A3L2ml5U7JQs7LfPU7+uWUziZyLHagl+rkyfR8SLhlA==} + /vitest/0.25.2_@vitest+ui@0.25.2: + resolution: {integrity: sha512-qqkzfzglEFbQY7IGkgSJkdOhoqHjwAao/OrphnHboeYHC5JzsVFoLCaB2lnAy8krhj7sbrFTVRApzpkTOeuDWQ==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -4896,7 +4896,7 @@ packages: '@types/chai': 4.3.3 '@types/chai-subset': 1.3.3 '@types/node': 18.11.9 - '@vitest/ui': 0.25.1 + '@vitest/ui': 0.25.2 acorn: 8.8.0 acorn-walk: 8.2.0 chai: 4.3.6 @@ -4907,7 +4907,7 @@ packages: tinybench: 2.3.1 tinypool: 0.3.0 tinyspy: 1.0.2 - vite: 3.2.3_@types+node@18.11.9 + vite: 3.2.4_@types+node@18.11.9 transitivePeerDependencies: - less - sass diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 7a8309ee84b..0e85b22b308 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -1,4 +1,4 @@ -// import sanitizeHtml from 'sanitize-html'; +import sanitizeHtml from 'sanitize-html'; import type { Comment, DeclarationReflection, @@ -50,31 +50,51 @@ export async function initMarkdownRenderer(): Promise { ); } -// const htmlSanitizeOptions: sanitizeHtml.IOptions = { -// allowedTags: ['a', 'code', 'div', 'li', 'span', 'p', 'pre', 'ul'], -// allowedAttributes: { -// a: ['href', 'target', 'rel'], -// div: ['class'], -// pre: ['v-pre'], -// span: ['class'], -// }, -// selfClosing: [], -// }; +const htmlSanitizeOptions: sanitizeHtml.IOptions = { + allowedTags: [ + 'a', + 'button', + 'code', + 'div', + 'li', + 'p', + 'pre', + 'span', + 'strong', + 'ul', + ], + allowedAttributes: { + a: ['href', 'target', 'rel'], + button: ['class', 'title'], + div: ['class'], + pre: ['class', 'v-pre'], + span: ['class', 'style'], + }, + selfClosing: [], +}; + +function comparableSanitizedHtml(html: string): string { + return html + .replace(/>/g, '>') + .replace(/ /g, '') + .replace(/"/g, '"') + .replace(/'/g, "'"); +} function mdToHtml(md: string): string { const rawHtml = markdown.render(md); - // TODO @Shinigami92 2022-06-24: Sanitize html to prevent XSS - return rawHtml; - // const safeHtml: string = sanitizeHtml(rawHtml, htmlSanitizeOptions); - // // Revert some escaped characters for comparison. - // if (rawHtml.replace(/>/g, '>') === safeHtml.replace(/>/g, '>')) { - // return safeHtml; - // } else { - // console.debug('Rejected unsafe md:', md); - // console.error('Rejected unsafe html:', rawHtml.replace(/>/g, '>')); - // console.error('Expected safe html:', safeHtml.replace(/>/g, '>')); - // throw new Error('Found unsafe html'); - // } + + const safeHtml: string = sanitizeHtml(rawHtml, htmlSanitizeOptions); + // Revert some escaped characters for comparison. + if (comparableSanitizedHtml(rawHtml) === comparableSanitizedHtml(safeHtml)) { + return safeHtml; + } else { + console.debug('Rejected unsafe md:', md); + console.error('Rejected unsafe html:', rawHtml); + console.error('Rejected unsafe html:', comparableSanitizedHtml(rawHtml)); + console.error('Expected safe html:', comparableSanitizedHtml(safeHtml)); + throw new Error('Found unsafe html'); + } } export function analyzeSignature( diff --git a/src/definitions/company.ts b/src/definitions/company.ts index 83806c7416c..354fc3c6601 100644 --- a/src/definitions/company.ts +++ b/src/definitions/company.ts @@ -25,7 +25,7 @@ export type CompanyDefinitions = LocaleEntry<{ adjective: string[]; /** - * Catchphrase adjectives. + * Catchphrase descriptors. */ descriptor: string[]; @@ -35,12 +35,12 @@ export type CompanyDefinitions = LocaleEntry<{ name_patterns: string[]; /** - * Catchphrase adjectives. + * Catchphrase nouns. */ noun: string[]; /** - * Company suffixes. + * Company/Business entity types. */ suffix: string[]; }>; diff --git a/src/locales/zh_CN/index.ts b/src/locales/zh_CN/index.ts index eae7d1f624f..ea4a0014ec3 100644 --- a/src/locales/zh_CN/index.ts +++ b/src/locales/zh_CN/index.ts @@ -3,12 +3,14 @@ * Run 'pnpm run generate:locales' to update. */ import type { LocaleDefinition } from '../..'; +import internet from './internet'; import location from './location'; import person from './person'; import phone_number from './phone_number'; const zh_CN: LocaleDefinition = { title: 'Chinese', + internet, location, person, phone_number, diff --git a/src/locales/zh_CN/internet/free_email.ts b/src/locales/zh_CN/internet/free_email.ts new file mode 100644 index 00000000000..034f87e2616 --- /dev/null +++ b/src/locales/zh_CN/internet/free_email.ts @@ -0,0 +1,16 @@ +export default [ + '126.com', + '139.com', + '163.com', + '21cn.com', + 'gmail.com', + 'hotmail.com', + 'qq.com', + 'sina.com', + 'sohu.com', + 'tom.com', + 'vip.qq.com', + 'yahoo.cn', + 'yahoo.com.cn', + 'yeah.net', +]; diff --git a/src/locales/zh_CN/internet/index.ts b/src/locales/zh_CN/internet/index.ts new file mode 100644 index 00000000000..911ddd9549e --- /dev/null +++ b/src/locales/zh_CN/internet/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { InternetDefinitions } from '../../..'; +import free_email from './free_email'; + +const internet: InternetDefinitions = { + free_email, +}; + +export default internet; diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 7da4fbc8889..406f7f19c94 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -627,6 +627,26 @@ export class HelpersModule { return this.fake(res); } + /** + * Helper method that converts the given number or range to a number. + * + * @param numberOrRange The number or range to convert. + * @param numberOrRange.min The minimum value for the range. + * @param numberOrRange.max The maximum value for the range. + * + * @example + * faker.helpers.rangeToNumber(1) // 1 + * faker.helpers.rangeToNumber({ min: 1, max: 10 }) // 5 + * + * @since 8.0.0 + */ + rangeToNumber(numberOrRange: number | { min: number; max: number }): number { + if (typeof numberOrRange === 'number') { + return numberOrRange; + } + return this.faker.datatype.number(numberOrRange); + } + /** * Generates a unique result using the results of the given method. * Used unique entries will be stored internally and filtered from subsequent calls. diff --git a/src/modules/lorem/index.ts b/src/modules/lorem/index.ts index ac1ba7563c9..c73a92c8ff5 100644 --- a/src/modules/lorem/index.ts +++ b/src/modules/lorem/index.ts @@ -36,7 +36,7 @@ export class LoremModule { * faker.lorem.word() // 'temporibus' * faker.lorem.word(5) // 'velit' * faker.lorem.word({ strategy: 'shortest' }) // 'a' - * faker.lorem.word({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'quaerat' + * faker.lorem.word({ length: { min: 5, max: 7 }, strategy: 'fail' }) // 'quaerat' * * @since 3.1.0 */ @@ -60,55 +60,62 @@ export class LoremModule { /** * Generates a space separated list of words. * - * @param num The number of words to generate. Defaults to `3`. + * @param wordCount The number of words to generate. Defaults to `3`. + * @param wordCount.min The minimum number of words to generate. + * @param wordCount.max The maximum number of words to generate. * * @example * faker.lorem.words() // 'qui praesentium pariatur' * faker.lorem.words(10) // 'debitis consectetur voluptatem non doloremque ipsum autem totam eum ratione' + * faker.lorem.words({ min: 1, max: 3 }) // 'tenetur error cum' * * @since 2.0.1 */ - words(num: number = 3): string { - const words: string[] = []; - for (let i = 0; i < num; i++) { - words.push(this.word()); - } - return words.join(' '); + words(wordCount: number | { min: number; max: number } = 3): string { + wordCount = this.faker.helpers.rangeToNumber(wordCount); + + return Array.from({ length: wordCount }) + .map(() => this.word()) + .join(' '); } /** - * Generates a space separated list of words beginning a capital letter and ending with a dot. + * Generates a space separated list of words beginning with a capital letter and ending with a period. * * @param wordCount The number of words, that should be in the sentence. Defaults to a random number between `3` and `10`. + * @param wordCount.min The minimum number of words to generate. Defaults to `3`. + * @param wordCount.max The maximum number of words to generate. Defaults to `10`. * * @example * faker.lorem.sentence() // 'Voluptatum cupiditate suscipit autem eveniet aut dolorem aut officiis distinctio.' * faker.lorem.sentence(5) // 'Laborum voluptatem officiis est et.' + * faker.lorem.sentence({ min: 3, max: 5 }) // 'Fugiat repellendus nisi.' * * @since 2.0.1 */ - sentence(wordCount?: number): string { - if (wordCount == null) { - wordCount = this.faker.datatype.number({ min: 3, max: 10 }); - } - + sentence( + wordCount: number | { min: number; max: number } = { min: 3, max: 10 } + ): string { const sentence = this.words(wordCount); - return `${sentence.charAt(0).toUpperCase() + sentence.slice(1)}.`; + return `${sentence.charAt(0).toUpperCase() + sentence.substring(1)}.`; } /** * Generates a slugified text consisting of the given number of hyphen separated words. * * @param wordCount The number of words to generate. Defaults to `3`. + * @param wordCount.min The minimum number of words to generate. + * @param wordCount.max The maximum number of words to generate. * * @example * faker.lorem.slug() // 'dolores-illo-est' + * faker.lorem.slug(5) // 'delectus-totam-iusto-itaque-placeat' + * faker.lorem.slug({ min: 1, max: 3 }) // 'illo-ratione' * * @since 4.0.0 */ - slug(wordCount?: number): string { + slug(wordCount: number | { min: number; max: number } = 3): string { const words = this.words(wordCount); - return this.faker.helpers.slugify(words); } @@ -116,6 +123,8 @@ export class LoremModule { * Generates the given number of sentences. * * @param sentenceCount The number of sentences to generate. Defaults to a random number between `2` and `6`. + * @param sentenceCount.min The minimum number of sentences to generate. Defaults to `2`. + * @param sentenceCount.max The maximum number of sentences to generate. Defaults to `6`. * @param separator The separator to add between sentences. Defaults to `' '`. * * @example @@ -124,39 +133,45 @@ export class LoremModule { * faker.lorem.sentences(2, '\n') * // 'Et rerum a unde tempora magnam sit nisi. * // Et perspiciatis ipsam omnis.' + * faker.lorem.sentences({ min: 1, max: 3 }) // 'Placeat ex natus tenetur repellendus repellendus iste. Optio nostrum veritatis.' * * @since 2.0.1 */ - sentences(sentenceCount?: number, separator: string = ' '): string { - if (sentenceCount == null) { - sentenceCount = this.faker.datatype.number({ min: 2, max: 6 }); - } - const sentences: string[] = []; - for (sentenceCount; sentenceCount > 0; sentenceCount--) { - sentences.push(this.sentence()); - } - return sentences.join(separator); + sentences( + sentenceCount: number | { min: number; max: number } = { min: 2, max: 6 }, + separator: string = ' ' + ): string { + sentenceCount = this.faker.helpers.rangeToNumber(sentenceCount); + + return Array.from({ length: sentenceCount }) + .map(() => this.sentence()) + .join(separator); } /** - * Generates a paragraph with at least the given number of sentences. + * Generates a paragraph with the given number of sentences. * - * @param sentenceCount The minim number of sentences to generate. Defaults to `3`. + * @param sentenceCount The number of sentences to generate. Defaults to `3`. + * @param sentenceCount.min The minimum number of sentences to generate. + * @param sentenceCount.max The maximum number of sentences to generate. * * @example * faker.lorem.paragraph() // 'Non architecto nam unde sint. Ex tenetur dolor facere optio aut consequatur. Ea laudantium reiciendis repellendus.' - * faker.lorem.paragraph() // 'Animi possimus nemo consequuntur ut ea et tempore unde qui. Quis corporis esse occaecati.' + * faker.lorem.paragraph(2) // 'Animi possimus nemo consequuntur ut ea et tempore unde qui. Quis corporis esse occaecati.' + * faker.lorem.paragraph({ min: 1, max: 3 }) // 'Quis doloribus necessitatibus sint. Rerum accusamus impedit corporis porro.' * * @since 2.0.1 */ - paragraph(sentenceCount: number = 3): string { - return this.sentences(sentenceCount + this.faker.datatype.number(3)); + paragraph(sentenceCount: number | { min: number; max: number } = 3): string { + return this.sentences(sentenceCount); } /** * Generates the given number of paragraphs. * * @param paragraphCount The number of paragraphs to generate. Defaults to `3`. + * @param paragraphCount.min The minimum number of paragraphs to generate. + * @param paragraphCount.max The maximum number of paragraphs to generate. * @param separator The separator to use. Defaults to `'\n'`. * * @example @@ -176,14 +191,22 @@ export class LoremModule { * // 'Eos magnam aut qui accusamus. Sapiente quas culpa totam excepturi. Blanditiis totam distinctio occaecati dignissimos cumque atque qui officiis.
* // Nihil quis vel consequatur. Blanditiis commodi deserunt sunt animi dolorum. A optio porro hic dolorum fugit aut et sint voluptas. Minima ad sed ipsa est non dolores.' * + * faker.lorem.paragraphs({ min: 1, max: 3 }) + * // 'Eum nam fugiat laudantium. + * // Dignissimos tempore porro necessitatibus commodi nam. + * // Veniam at commodi iste perferendis totam dolorum corporis ipsam.' + * * @since 2.0.1 */ - paragraphs(paragraphCount: number = 3, separator: string = '\n'): string { - const paragraphs: string[] = []; - for (paragraphCount; paragraphCount > 0; paragraphCount--) { - paragraphs.push(this.paragraph()); - } - return paragraphs.join(separator); + paragraphs( + paragraphCount: number | { min: number; max: number } = 3, + separator: string = '\n' + ): string { + paragraphCount = this.faker.helpers.rangeToNumber(paragraphCount); + + return Array.from({ length: paragraphCount }) + .map(() => this.paragraph()) + .join(separator); } /** @@ -202,8 +225,6 @@ export class LoremModule { */ text(): string { const methods: Array = [ - 'word', - 'words', 'sentence', 'sentences', 'paragraph', @@ -220,6 +241,8 @@ export class LoremModule { * Generates the given number lines of lorem separated by `'\n'`. * * @param lineCount The number of lines to generate. Defaults to a random number between `1` and `5`. + * @param lineCount.min The minimum number of lines to generate. Defaults to `1`. + * @param lineCount.max The maximum number of lines to generate. Defaults to `5`. * * @example * faker.lorem.lines() @@ -232,12 +255,20 @@ export class LoremModule { * // 'Soluta deserunt eos quam reiciendis libero autem enim nam ut. * // Voluptate aut aut.' * + * faker.lorem.lines(2) + * // 'Quod quas nam quis impedit aut consequuntur. + * // Animi dolores aspernatur.' + * + * faker.lorem.lines({ min: 1, max: 3 }) + * // 'Error dolorem natus quos eum consequatur necessitatibus.' + * * @since 3.1.0 */ - lines(lineCount?: number): string { - if (lineCount == null) { - lineCount = this.faker.datatype.number({ min: 1, max: 5 }); - } + lines( + lineCount: number | { min: number; max: number } = { min: 1, max: 5 } + ): string { + lineCount = this.faker.helpers.rangeToNumber(lineCount); + return this.sentences(lineCount, '\n'); } } diff --git a/src/modules/string/index.ts b/src/modules/string/index.ts index 22cb39d5360..f1a13c1d073 100644 --- a/src/modules/string/index.ts +++ b/src/modules/string/index.ts @@ -98,14 +98,15 @@ export class StringModule { /** * Generating a string consisting of letters in the English alphabet. * - * @param options Either the number of characters or an options instance. Defaults to `{ length: 1, casing: 'mixed', exclude: [] }`. - * @param options.length The number of characters to generate. Defaults to `1`. + * @param options Either the number of characters or an options instance. + * @param options.length The number or range of characters to generate. Defaults to `1`. * @param options.casing The casing of the characters. Defaults to `'mixed'`. * @param options.exclude An array with characters which should be excluded in the generated string. Defaults to `[]`. * * @example * faker.string.alpha() // 'b' * faker.string.alpha(10) // 'fEcAaCVbaR' + * faker.string.alpha({ length: { min: 5, max: 10 } }) // 'HcVrCf' * faker.string.alpha({ casing: 'lower' }) // 'r' * faker.string.alpha({ exclude: ['W'] }) // 'Z' * faker.string.alpha({ length: 5, casing: 'upper', exclude: ['A'] }) // 'DTCIC' @@ -116,7 +117,7 @@ export class StringModule { options: | number | { - length?: number; + length?: number | { min: number; max: number }; casing?: Casing; exclude?: readonly LiteralUnion[] | string; } = {} @@ -127,17 +128,18 @@ export class StringModule { }; } - const { length = 1, casing = 'mixed' } = options; + const length = this.faker.helpers.rangeToNumber(options.length ?? 1); + if (length <= 0) { + return ''; + } + + const { casing = 'mixed' } = options; let { exclude = [] } = options; if (typeof exclude === 'string') { exclude = exclude.split(''); } - if (length <= 0) { - return ''; - } - let charsArray: string[]; switch (casing) { case 'upper': @@ -168,14 +170,15 @@ export class StringModule { /** * Generating a string consisting of alpha characters and digits. * - * @param options Either the number of characters or an options instance. Defaults to `{ length: 1, casing: 'mixed', exclude: [] }`. - * @param options.length The number of characters and digits to generate. Defaults to `1`. + * @param options Either the number of characters or an options instance. + * @param options.length The number or range of characters and digits to generate. Defaults to `1`. * @param options.casing The casing of the characters. Defaults to `'mixed'`. * @param options.exclude An array of characters and digits which should be excluded in the generated string. Defaults to `[]`. * * @example * faker.string.alphanumeric() // '2' * faker.string.alphanumeric(5) // '3e5V7' + * faker.string.alphanumeric({ length: { min: 5, max: 10 } }) // 'muaApG' * faker.string.alphanumeric({ casing: 'upper' }) // 'A' * faker.string.alphanumeric({ exclude: ['W'] }) // 'r' * faker.string.alphanumeric({ length: 5, exclude: ["a"] }) // 'x1Z7f' @@ -186,7 +189,7 @@ export class StringModule { options: | number | { - length?: number; + length?: number | { min: number; max: number }; casing?: Casing; exclude?: readonly LiteralUnion[] | string; } = {} @@ -197,12 +200,12 @@ export class StringModule { }; } - const { length = 1, casing = 'mixed' } = options; - + const length = this.faker.helpers.rangeToNumber(options.length ?? 1); if (length <= 0) { return ''; } + const { casing = 'mixed' } = options; let { exclude = [] } = options; if (typeof exclude === 'string') { @@ -241,13 +244,14 @@ export class StringModule { * Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) string. * * @param options The optional options object. - * @param options.length Length of the generated number. Defaults to `1`. + * @param options.length The number or range of characters to generate after the prefix. Defaults to `1`. * @param options.casing Casing of the generated number. Defaults to `'mixed'`. * @param options.prefix Prefix for the generated number. Defaults to `'0x'`. * * @example * faker.string.hexadecimal() // '0xB' * faker.string.hexadecimal({ length: 10 }) // '0xaE13d044cB' + * faker.string.hexadecimal({ length: { min: 5, max: 10 } }) // '0x7dEf7FCD' * faker.string.hexadecimal({ prefix: '0x' }) // '0xE' * faker.string.hexadecimal({ casing: 'lower' }) // '0xf' * faker.string.hexadecimal({ length: 10, prefix: '#' }) // '#f12a974eB1' @@ -259,12 +263,16 @@ export class StringModule { */ hexadecimal( options: { - length?: number; + length?: number | { min: number; max: number }; casing?: Casing; prefix?: string; } = {} ): string { - const { length = 1, casing = 'mixed', prefix = '0x' } = options; + const { casing = 'mixed', prefix = '0x' } = options; + const length = this.faker.helpers.rangeToNumber(options.length ?? 1); + if (length <= 0) { + return prefix; + } let wholeString = ''; @@ -307,8 +315,8 @@ export class StringModule { /** * Generates a given length string of digits. * - * @param options Either the number of characters or the options to use. Defaults to `{ length: 1, allowLeadingZeros = false, exclude = [] }`. - * @param options.length The number of digits to generate. Defaults to `1`. + * @param options Either the number of characters or the options to use. + * @param options.length The number or range of digits to generate. Defaults to `1`. * @param options.allowLeadingZeros If true, leading zeros will be allowed. Defaults to `false`. * @param options.exclude An array of digits which should be excluded in the generated string. Defaults to `[]`. * @@ -316,6 +324,7 @@ export class StringModule { * faker.string.numeric() // '2' * faker.string.numeric(5) // '31507' * faker.string.numeric(42) // '56434563150765416546479875435481513188548' + * faker.string.numeric({ length: { min: 5, max: 10 } }) // '197089478' * faker.string.numeric({ length: 42, allowLeadingZeros: true }) // '00564846278453876543517840713421451546115' * faker.string.numeric({ length: 6, exclude: ['0'] }) // '943228' * @@ -325,7 +334,7 @@ export class StringModule { options: | number | { - length?: number; + length?: number | { min: number; max: number }; allowLeadingZeros?: boolean; exclude?: readonly LiteralUnion[] | string; } = {} @@ -336,11 +345,12 @@ export class StringModule { }; } - const { length = 1, allowLeadingZeros = false } = options; + const length = this.faker.helpers.rangeToNumber(options.length ?? 1); if (length <= 0) { return ''; } + const { allowLeadingZeros = false } = options; let { exclude = [] } = options; if (typeof exclude === 'string') { @@ -381,14 +391,18 @@ export class StringModule { * Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`). * * @param length Length of the generated string. Max length is `2^20`. Defaults to `10`. + * @param length.min The minimum number of characters to generate. + * @param length.max The maximum number of characters to generate. * * @example * faker.string.sample() // 'Zo!.:*e>wR' * faker.string.sample(5) // '6Bye8' + * faker.string.sample({ min: 5, max: 10 }) // 'FeKunG' * * @since 8.0.0 */ - sample(length = 10): string { + sample(length: number | { min: number; max: number } = 10): string { + length = this.faker.helpers.rangeToNumber(length); if (length >= SAMPLE_MAX_LENGTH) { length = SAMPLE_MAX_LENGTH; } diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts index 8c935c88bda..12bb25ba6b7 100644 --- a/src/modules/system/index.ts +++ b/src/modules/system/index.ts @@ -50,23 +50,26 @@ export class SystemModule { * Returns a random file name with extension. * * @param options An options object. - * @param options.extensionCount Define how many extensions the file name should have. A negative number will be treated as `0`. Defaults to `1`. + * @param options.extensionCount Define how many extensions the file name should have. Defaults to `1`. * * @example * faker.system.fileName() // 'faithfully_calculating.u8mdn' * faker.system.fileName({ extensionCount: 2 }) // 'times_after.swf.ntf' + * faker.system.fileName({ extensionCount: { min: 1, max: 2 } }) // 'jaywalk_like_ill.osfpvg' * * @since 3.1.0 */ fileName( options: { /** - * Define how many extensions the file name should have. A negative number will be treated as `0`. Defaults to `1`. + * Define how many extensions the file name should have. Defaults to `1`. */ - extensionCount?: number; + extensionCount?: number | { min: number; max: number }; } = {} ): string { - const { extensionCount = 1 } = options; + const extensionCount = this.faker.helpers.rangeToNumber( + options.extensionCount ?? 1 + ); const baseName = this.faker.word.words().toLowerCase().replace(/\W/g, '_'); diff --git a/src/modules/word/index.ts b/src/modules/word/index.ts index 897959196a6..d326cd70976 100644 --- a/src/modules/word/index.ts +++ b/src/modules/word/index.ts @@ -375,18 +375,26 @@ export class WordModule { /** * Returns a string containing a number of space separated random words. * - * @param count Number of words. Defaults to a random value between `1` and `3`. + * @param options The optional options object or the number of words to return. + * @param options.count The number of words to return. Defaults to a random value between `1` and `3`. * * @example * faker.word.words() // 'almost' * faker.word.words(5) // 'before hourly patiently dribble equal' + * faker.word.words({ count: 5 }) // 'whoever edible um kissingly faraway' + * faker.word.words({ count: { min: 5, max: 10 } }) // 'vice buoyant through apropos poised total wary boohoo' * * @since 8.0.0 */ - words(count?: number): string { - if (count == null) { - count = this.faker.datatype.number({ min: 1, max: 3 }); + words( + options: number | { count?: number | { min: number; max: number } } = {} + ): string { + if (typeof options === 'number') { + options = { count: options }; } + const count = this.faker.helpers.rangeToNumber( + options.count ?? { min: 1, max: 3 } + ); return Array.from({ length: count }, () => this.sample()).join(' '); } diff --git a/test/__snapshots__/helpers.spec.ts.snap b/test/__snapshots__/helpers.spec.ts.snap index 6c6c31bdcd9..3dc76f896a9 100644 --- a/test/__snapshots__/helpers.spec.ts.snap +++ b/test/__snapshots__/helpers.spec.ts.snap @@ -45,6 +45,10 @@ exports[`helpers > 42 > objectKey > simple 1`] = `"b"`; exports[`helpers > 42 > objectValue > simple 1`] = `2`; +exports[`helpers > 42 > rangeToNumber > with number 1`] = `5`; + +exports[`helpers > 42 > rangeToNumber > with range 1`] = `4`; + exports[`helpers > 42 > regexpStyleStringParse > noArgs 1`] = `""`; exports[`helpers > 42 > regexpStyleStringParse > only symbols 1`] = `"###test2"`; @@ -193,6 +197,10 @@ exports[`helpers > 1211 > objectKey > simple 1`] = `"c"`; exports[`helpers > 1211 > objectValue > simple 1`] = `3`; +exports[`helpers > 1211 > rangeToNumber > with number 1`] = `5`; + +exports[`helpers > 1211 > rangeToNumber > with range 1`] = `10`; + exports[`helpers > 1211 > regexpStyleStringParse > noArgs 1`] = `""`; exports[`helpers > 1211 > regexpStyleStringParse > only symbols 1`] = `"###test5"`; @@ -331,6 +339,10 @@ exports[`helpers > 1337 > objectKey > simple 1`] = `"a"`; exports[`helpers > 1337 > objectValue > simple 1`] = `1`; +exports[`helpers > 1337 > rangeToNumber > with number 1`] = `5`; + +exports[`helpers > 1337 > rangeToNumber > with range 1`] = `3`; + exports[`helpers > 1337 > regexpStyleStringParse > noArgs 1`] = `""`; exports[`helpers > 1337 > regexpStyleStringParse > only symbols 1`] = `"###test2"`; diff --git a/test/__snapshots__/lorem.spec.ts.snap b/test/__snapshots__/lorem.spec.ts.snap index 9d167ea1715..c30488a92e0 100644 --- a/test/__snapshots__/lorem.spec.ts.snap +++ b/test/__snapshots__/lorem.spec.ts.snap @@ -18,44 +18,88 @@ Aperiam nulla omnis dolorum dolores in. Aut tenetur hic." `; -exports[`lorem > 42 > paragraph > noArgs 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus."`; +exports[`lorem > 42 > lines > with length range 1`] = ` +"A qui tempore quo perspiciatis perspiciatis quia in quia. +Ipsa esse pariatur. +Unde fugit facilis mollitia perferendis. +Reiciendis nam repellendus. +Dolorem alias qui asperiores qui natus aliquam iste rem consequatur. +Sit dolore rem iste aliquid odit. +Dolore voluptatibus nemo. +Esse et porro natus. +Suscipit laudantium maiores provident. +Aperiam nulla omnis dolorum dolores in. +Aut tenetur hic. +Molestias placeat laboriosam aliquam aut quasi consectetur fuga adipisci reprehenderit. +Sunt iste ducimus repellendus accusantium dolores eveniet nisi. +Qui id eligendi quaerat vel." +`; + +exports[`lorem > 42 > paragraph > noArgs 1`] = `"Minus a qui tempore quo. Perspiciatis quia in quia architecto ipsa esse. Veniam unde fugit facilis mollitia perferendis ipsa reiciendis nam."`; -exports[`lorem > 42 > paragraph > with length 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus. Dolorem alias qui asperiores qui natus aliquam iste rem consequatur. Sit dolore rem iste aliquid odit. Dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. Aut tenetur hic."`; +exports[`lorem > 42 > paragraph > with length 1`] = `"Minus a qui tempore quo. Perspiciatis quia in quia architecto ipsa esse. Veniam unde fugit facilis mollitia perferendis ipsa reiciendis nam. Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid. Aperiam dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. Aut tenetur hic."`; + +exports[`lorem > 42 > paragraph > with length range 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus. Dolorem alias qui asperiores qui natus aliquam iste rem consequatur. Sit dolore rem iste aliquid odit. Dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. Aut tenetur hic. Molestias placeat laboriosam aliquam aut quasi consectetur fuga adipisci reprehenderit. Sunt iste ducimus repellendus accusantium dolores eveniet nisi. Qui id eligendi quaerat vel."`; exports[`lorem > 42 > paragraphs > noArgs 1`] = ` -"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus. -Alias qui asperiores qui. Aliquam iste rem consequatur eum sit dolore. Iste aliquid odit aperiam dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. -Tenetur hic delectus. Placeat laboriosam aliquam aut quasi consectetur fuga. Reprehenderit fuga sunt iste." +"Minus a qui tempore quo. Perspiciatis quia in quia architecto ipsa esse. Veniam unde fugit facilis mollitia perferendis ipsa reiciendis nam. +Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid. Aperiam dolore voluptatibus nemo. +Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in." `; exports[`lorem > 42 > paragraphs > with length 1`] = ` -"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus. -Alias qui asperiores qui. Aliquam iste rem consequatur eum sit dolore. Iste aliquid odit aperiam dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. -Tenetur hic delectus. Placeat laboriosam aliquam aut quasi consectetur fuga. Reprehenderit fuga sunt iste. -Accusantium dolores eveniet nisi eius qui id eligendi quaerat. Totam neque corrupti excepturi qui voluptatem. Quibusdam quo in earum nisi debitis recusandae perspiciatis libero repudiandae. Et excepturi sequi totam aperiam. -Quibusdam laboriosam nobis tempora atque. Cupiditate ullam delectus ut omnis atque incidunt odit dolore. Magni illo aut doloribus vel impedit nisi nesciunt dolore. Aut facere nesciunt. Expedita libero quisquam impedit omnis illo recusandae corporis. Dicta voluptates pariatur illum error in veniam quasi. -Quaerat est minima est libero. Officia tempora officiis molestias nihil suscipit dicta. Expedita illum optio nam molestias consectetur impedit numquam dignissimos doloremque. -Vel vitae sit iure beatae nesciunt voluptatem necessitatibus. Molestiae enim molestias praesentium quidem eveniet odit non. Ea atque eligendi nesciunt amet hic inventore. Labore quidem consequuntur accusamus itaque error placeat. Culpa beatae at esse maxime. -Commodi debitis accusamus atque. Maxime sunt necessitatibus ullam enim. Vitae tempora amet deserunt vel alias facere ullam nulla aliquam. -Praesentium deleniti commodi odio. Quidem dicta tempora quis. Hic magni ad ipsum. -Rerum ex nemo quae reiciendis numquam delectus. Non quidem ducimus expedita. Fugit ut repellat accusantium modi. Voluptatibus blanditiis ea eaque accusantium incidunt nostrum. Culpa adipisci dolorum fugit voluptatum dignissimos in doloribus quos velit." +"Minus a qui tempore quo. Perspiciatis quia in quia architecto ipsa esse. Veniam unde fugit facilis mollitia perferendis ipsa reiciendis nam. +Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid. Aperiam dolore voluptatibus nemo. +Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. +Aut tenetur hic. Molestias placeat laboriosam aliquam aut quasi consectetur fuga adipisci reprehenderit. Sunt iste ducimus repellendus accusantium dolores eveniet nisi. +Qui id eligendi quaerat vel. Neque corrupti excepturi qui voluptatem reiciendis quibusdam. In earum nisi debitis recusandae perspiciatis libero repudiandae minima. +Excepturi sequi totam. Sapiente minima quibusdam. Nobis tempora atque assumenda cupiditate ullam. +Ut omnis atque incidunt odit dolore quod magni illo aut. Vel impedit nisi nesciunt dolore consequatur aut facere nesciunt facilis. Libero quisquam impedit omnis illo recusandae corporis mollitia. +Voluptates pariatur illum. In veniam quasi quae ipsam quaerat est. Est libero provident officia tempora. +Molestias nihil suscipit dicta reiciendis expedita illum optio nam molestias. Impedit numquam dignissimos doloremque. Expedita vel vitae sit iure beatae nesciunt. +Necessitatibus culpa molestiae. Molestias praesentium quidem eveniet odit. Omnis ea atque eligendi." +`; + +exports[`lorem > 42 > paragraphs > with length range 1`] = ` +"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. +Reiciendis nam repellendus. Dolorem alias qui asperiores qui natus aliquam iste rem consequatur. Sit dolore rem iste aliquid odit. +Dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. +Aperiam nulla omnis dolorum dolores in. Aut tenetur hic. Molestias placeat laboriosam aliquam aut quasi consectetur fuga adipisci reprehenderit. +Sunt iste ducimus repellendus accusantium dolores eveniet nisi. Qui id eligendi quaerat vel. Neque corrupti excepturi qui voluptatem reiciendis quibusdam. +In earum nisi debitis recusandae perspiciatis libero repudiandae minima. Excepturi sequi totam. Sapiente minima quibusdam. +Nobis tempora atque assumenda cupiditate ullam. Ut omnis atque incidunt odit dolore quod magni illo aut. Vel impedit nisi nesciunt dolore consequatur aut facere nesciunt facilis. +Libero quisquam impedit omnis illo recusandae corporis mollitia. Voluptates pariatur illum. In veniam quasi quae ipsam quaerat est. +Est libero provident officia tempora. Molestias nihil suscipit dicta reiciendis expedita illum optio nam molestias. Impedit numquam dignissimos doloremque. +Expedita vel vitae sit iure beatae nesciunt. Necessitatibus culpa molestiae. Molestias praesentium quidem eveniet odit. +Omnis ea atque eligendi. Amet hic inventore perspiciatis. Quidem consequuntur accusamus itaque error. +Dolore culpa beatae at esse maxime ipsum qui commodi. Accusamus atque minima maxime sunt necessitatibus ullam enim eveniet vitae. Amet deserunt vel alias facere. +Nulla aliquam consequatur consequuntur praesentium. Commodi odio dolor quidem dicta tempora quis. Hic magni ad ipsum. +Quas rerum ex nemo quae reiciendis numquam. Velit non quidem ducimus expedita magnam fugit ut repellat accusantium. Omnis voluptatibus blanditiis ea eaque." `; exports[`lorem > 42 > sentence > noArgs 1`] = `"Minus a qui tempore quo."`; exports[`lorem > 42 > sentence > with length 1`] = `"Voluptas minus a qui tempore quo perspiciatis perspiciatis quia in."`; +exports[`lorem > 42 > sentence > with length range 1`] = `"Minus a qui tempore quo perspiciatis perspiciatis quia in quia architecto ipsa esse pariatur."`; + exports[`lorem > 42 > sentences > noArgs 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis."`; exports[`lorem > 42 > sentences > with length 1`] = `"Minus a qui tempore quo. Perspiciatis quia in quia architecto ipsa esse. Veniam unde fugit facilis mollitia perferendis ipsa reiciendis nam. Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid. Aperiam dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. Aut tenetur hic."`; +exports[`lorem > 42 > sentences > with length range 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia. Ipsa esse pariatur. Unde fugit facilis mollitia perferendis. Reiciendis nam repellendus. Dolorem alias qui asperiores qui natus aliquam iste rem consequatur. Sit dolore rem iste aliquid odit. Dolore voluptatibus nemo. Esse et porro natus. Suscipit laudantium maiores provident. Aperiam nulla omnis dolorum dolores in. Aut tenetur hic. Molestias placeat laboriosam aliquam aut quasi consectetur fuga adipisci reprehenderit. Sunt iste ducimus repellendus accusantium dolores eveniet nisi. Qui id eligendi quaerat vel."`; + exports[`lorem > 42 > slug > noArgs 1`] = `"voluptas-minus-a"`; exports[`lorem > 42 > slug > with length 1`] = `"voluptas-minus-a-qui-tempore-quo-perspiciatis-perspiciatis-quia-in"`; -exports[`lorem > 42 > text > noArgs 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia."`; +exports[`lorem > 42 > slug > with length range 1`] = `"minus-a-qui-tempore-quo-perspiciatis-perspiciatis-quia-in-quia-architecto-ipsa-esse-pariatur"`; + +exports[`lorem > 42 > text > noArgs 1`] = `"Qui tempore quo perspiciatis perspiciatis quia in quia architecto ipsa. Pariatur veniam unde fugit facilis mollitia. Ipsa reiciendis nam. Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid."`; -exports[`lorem > 42 > text > with length 1`] = `"A qui tempore quo perspiciatis perspiciatis quia in quia."`; +exports[`lorem > 42 > text > with length 1`] = `"Qui tempore quo perspiciatis perspiciatis quia in quia architecto ipsa. Pariatur veniam unde fugit facilis mollitia. Ipsa reiciendis nam. Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid."`; + +exports[`lorem > 42 > text > with length range 1`] = `"Qui tempore quo perspiciatis perspiciatis quia in quia architecto ipsa. Pariatur veniam unde fugit facilis mollitia. Ipsa reiciendis nam. Earum dolorem alias qui asperiores qui natus aliquam iste. Consequatur eum sit dolore rem iste aliquid."`; exports[`lorem > 42 > word > noArgs 1`] = `"voluptas"`; @@ -71,6 +115,8 @@ exports[`lorem > 42 > words > noArgs 1`] = `"voluptas minus a"`; exports[`lorem > 42 > words > with length 1`] = `"voluptas minus a qui tempore quo perspiciatis perspiciatis quia in"`; +exports[`lorem > 42 > words > with length range 1`] = `"minus a qui tempore quo perspiciatis perspiciatis quia in quia architecto ipsa esse pariatur"`; + exports[`lorem > 1211 > lines > noArgs 1`] = ` "Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. @@ -92,41 +138,95 @@ Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque." `; -exports[`lorem > 1211 > paragraph > noArgs 1`] = `"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis."`; +exports[`lorem > 1211 > lines > with length range 1`] = ` +"Debitis quo amet explicabo repellat accusantium. +Quia fuga dolorem cumque autem ullam consequuntur quidem. +Placeat aut cumque est animi libero repellendus recusandae. +Magnam pariatur doloribus nulla doloribus ipsum. +Provident saepe nesciunt sed ipsam error. +Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. +Dolor occaecati magnam eos. +Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. +Eius aliquid quaerat sint dolores inventore quas. +Quidem amet odit doloremque. +Quibusdam dignissimos culpa velit neque ea eum neque. +Quibusdam commodi sint excepturi iusto inventore accusantium. +Quidem quos qui error facilis ducimus incidunt sed. +Est laudantium rerum quam iusto ipsum sed iste corrupti. +In architecto rem illum quam quam ipsa voluptas cupiditate. +Expedita sint et placeat officiis corrupti. +Itaque a reiciendis cum placeat quasi at. +Ipsum rerum distinctio. +Repellendus dignissimos quis cupiditate debitis alias perferendis nobis. +Suscipit optio doloribus nihil modi inventore at." +`; + +exports[`lorem > 1211 > paragraph > noArgs 1`] = `"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga. Cumque autem ullam consequuntur. Nobis placeat aut cumque est animi libero repellendus."`; + +exports[`lorem > 1211 > paragraph > with length 1`] = `"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga. Cumque autem ullam consequuntur. Nobis placeat aut cumque est animi libero repellendus. Iure magnam pariatur doloribus nulla doloribus ipsum voluptate provident saepe. Sed ipsam error doloribus. Cumque consequatur aliquid aliquam earum perferendis. Autem reiciendis quia dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque."`; -exports[`lorem > 1211 > paragraph > with length 1`] = `"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. Dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque. Quibusdam dignissimos culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. Quidem quos qui error facilis ducimus incidunt sed."`; +exports[`lorem > 1211 > paragraph > with length range 1`] = `"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. Dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque. Quibusdam dignissimos culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. Quidem quos qui error facilis ducimus incidunt sed. Est laudantium rerum quam iusto ipsum sed iste corrupti. In architecto rem illum quam quam ipsa voluptas cupiditate. Expedita sint et placeat officiis corrupti. Itaque a reiciendis cum placeat quasi at. Ipsum rerum distinctio. Repellendus dignissimos quis cupiditate debitis alias perferendis nobis. Suscipit optio doloribus nihil modi inventore at."`; exports[`lorem > 1211 > paragraphs > noArgs 1`] = ` -"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. -Occaecati magnam eos facilis. Totam voluptates exercitationem doloribus illum quaerat. Provident eius aliquid quaerat sint dolores. -Adipisci quidem amet odit doloremque rerum quibusdam. Culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium." +"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga. Cumque autem ullam consequuntur. Nobis placeat aut cumque est animi libero repellendus. +Iure magnam pariatur doloribus nulla doloribus ipsum voluptate provident saepe. Sed ipsam error doloribus. Cumque consequatur aliquid aliquam earum perferendis. +Autem reiciendis quia dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas." `; exports[`lorem > 1211 > paragraphs > with length 1`] = ` -"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. -Occaecati magnam eos facilis. Totam voluptates exercitationem doloribus illum quaerat. Provident eius aliquid quaerat sint dolores. -Adipisci quidem amet odit doloremque rerum quibusdam. Culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. -Quos qui error facilis ducimus incidunt sed quo. Laudantium rerum quam iusto ipsum sed iste corrupti. In architecto rem illum quam quam ipsa voluptas cupiditate. Expedita sint et placeat officiis corrupti. Itaque a reiciendis cum placeat quasi at. -Rerum distinctio id repellendus. Quis cupiditate debitis alias perferendis nobis. Suscipit optio doloribus nihil modi inventore at. -Aspernatur quas incidunt eveniet dolorem iure eveniet. Repellat velit commodi ipsam ratione voluptate iste neque molestias pariatur. Facere natus nobis placeat natus culpa fugiat. Deserunt nobis reprehenderit quibusdam saepe eveniet hic deleniti est. -Deleniti dolor in. Exercitationem in repellendus aut sequi ad tenetur doloribus quasi adipisci. Ducimus accusantium minima recusandae. Autem necessitatibus repudiandae delectus perspiciatis non sapiente minus. -Ullam ex natus nostrum nobis temporibus saepe. Explicabo necessitatibus rem vero harum odit tempore vitae. Corrupti repellendus accusamus itaque iusto. Non facilis harum illo. Iure dignissimos culpa fugiat enim. Sit optio amet facilis amet libero recusandae debitis perspiciatis. -Nesciunt deleniti amet id impedit perspiciatis minima necessitatibus. In enim nihil repellendus possimus architecto quos est sit dicta. Soluta nihil dolorem reprehenderit deserunt quasi culpa. Distinctio commodi aut sed vel magni reiciendis. -Repudiandae expedita doloribus consectetur maxime. Porro ea nihil vero esse ad tenetur temporibus accusamus. Officia ad omnis architecto repudiandae. Facere minima illo asperiores. Accusamus voluptate corporis voluptatibus reiciendis temporibus." +"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga. Cumque autem ullam consequuntur. Nobis placeat aut cumque est animi libero repellendus. +Iure magnam pariatur doloribus nulla doloribus ipsum voluptate provident saepe. Sed ipsam error doloribus. Cumque consequatur aliquid aliquam earum perferendis. +Autem reiciendis quia dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. +Quidem amet odit doloremque. Quibusdam dignissimos culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. +Quidem quos qui error facilis ducimus incidunt sed. Est laudantium rerum quam iusto ipsum sed iste corrupti. In architecto rem illum quam quam ipsa voluptas cupiditate. +Expedita sint et placeat officiis corrupti. Itaque a reiciendis cum placeat quasi at. Ipsum rerum distinctio. +Repellendus dignissimos quis cupiditate debitis alias perferendis nobis. Suscipit optio doloribus nihil modi inventore at. Provident aspernatur quas incidunt eveniet. +Iure eveniet debitis repellat. Commodi ipsam ratione voluptate. Neque molestias pariatur occaecati facere natus nobis. +Natus culpa fugiat assumenda deserunt nobis reprehenderit quibusdam saepe. Hic deleniti est nostrum inventore deleniti dolor in hic exercitationem. Repellendus aut sequi ad tenetur doloribus. +Adipisci velit ducimus. Minima recusandae expedita. Necessitatibus repudiandae delectus perspiciatis non sapiente." +`; + +exports[`lorem > 1211 > paragraphs > with length range 1`] = ` +"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. +Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. +Dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. +Quidem amet odit doloremque. Quibusdam dignissimos culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. +Quidem quos qui error facilis ducimus incidunt sed. Est laudantium rerum quam iusto ipsum sed iste corrupti. In architecto rem illum quam quam ipsa voluptas cupiditate. +Expedita sint et placeat officiis corrupti. Itaque a reiciendis cum placeat quasi at. Ipsum rerum distinctio. +Repellendus dignissimos quis cupiditate debitis alias perferendis nobis. Suscipit optio doloribus nihil modi inventore at. Provident aspernatur quas incidunt eveniet. +Iure eveniet debitis repellat. Commodi ipsam ratione voluptate. Neque molestias pariatur occaecati facere natus nobis. +Natus culpa fugiat assumenda deserunt nobis reprehenderit quibusdam saepe. Hic deleniti est nostrum inventore deleniti dolor in hic exercitationem. Repellendus aut sequi ad tenetur doloribus. +Adipisci velit ducimus. Minima recusandae expedita. Necessitatibus repudiandae delectus perspiciatis non sapiente. +Doloribus blanditiis ullam ex natus nostrum nobis temporibus saepe. Explicabo necessitatibus rem vero harum odit tempore vitae. Corrupti repellendus accusamus itaque iusto. +Non facilis harum illo. Iure dignissimos culpa fugiat enim. Sit optio amet facilis amet libero recusandae debitis perspiciatis. +Mollitia nesciunt deleniti amet id. Perspiciatis minima necessitatibus sapiente in enim nihil repellendus possimus. Quos est sit. +Excepturi soluta nihil. Reprehenderit deserunt quasi culpa. Distinctio commodi aut sed vel magni reiciendis. +Dolore repudiandae expedita doloribus consectetur maxime illum. Ea nihil vero esse ad tenetur temporibus accusamus ipsam. Ad omnis architecto repudiandae eos facere minima illo. +Commodi accusamus voluptate corporis voluptatibus reiciendis temporibus quis itaque similique. Facere ex fugiat labore. Explicabo optio in veniam iste. +Beatae natus nemo deleniti aliquam rem iste doloribus error minus. Ad quos nulla reprehenderit ut. Dolorum numquam a. +Fugit delectus necessitatibus voluptatibus nemo itaque temporibus voluptatum atque. Iusto quisquam a id. Unde ea alias enim maiores vel repellat. +Expedita quis nostrum. Similique nisi alias dicta omnis. Explicabo deserunt sunt omnis impedit dolor reiciendis magni perferendis officia. +Hic blanditiis quidem possimus ex id. At nihil magni nam. Optio tempora maiores fugiat impedit quae." `; exports[`lorem > 1211 > sentence > noArgs 1`] = `"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga."`; exports[`lorem > 1211 > sentence > with length 1`] = `"Recusandae esse debitis quo amet explicabo repellat accusantium laborum quia."`; +exports[`lorem > 1211 > sentence > with length range 1`] = `"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga dolorem cumque autem ullam consequuntur quidem nobis placeat aut cumque."`; + exports[`lorem > 1211 > sentences > noArgs 1`] = `"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis."`; exports[`lorem > 1211 > sentences > with length 1`] = `"Esse debitis quo amet explicabo repellat accusantium laborum quia fuga. Cumque autem ullam consequuntur. Nobis placeat aut cumque est animi libero repellendus. Iure magnam pariatur doloribus nulla doloribus ipsum voluptate provident saepe. Sed ipsam error doloribus. Cumque consequatur aliquid aliquam earum perferendis. Autem reiciendis quia dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque."`; +exports[`lorem > 1211 > sentences > with length range 1`] = `"Debitis quo amet explicabo repellat accusantium. Quia fuga dolorem cumque autem ullam consequuntur quidem. Placeat aut cumque est animi libero repellendus recusandae. Magnam pariatur doloribus nulla doloribus ipsum. Provident saepe nesciunt sed ipsam error. Reprehenderit cumque consequatur aliquid aliquam earum perferendis voluptatum autem reiciendis. Dolor occaecati magnam eos. Laboriosam totam voluptates exercitationem doloribus illum quaerat suscipit. Eius aliquid quaerat sint dolores inventore quas. Quidem amet odit doloremque. Quibusdam dignissimos culpa velit neque ea eum neque. Quibusdam commodi sint excepturi iusto inventore accusantium. Quidem quos qui error facilis ducimus incidunt sed. Est laudantium rerum quam iusto ipsum sed iste corrupti. In architecto rem illum quam quam ipsa voluptas cupiditate. Expedita sint et placeat officiis corrupti. Itaque a reiciendis cum placeat quasi at. Ipsum rerum distinctio. Repellendus dignissimos quis cupiditate debitis alias perferendis nobis. Suscipit optio doloribus nihil modi inventore at."`; + exports[`lorem > 1211 > slug > noArgs 1`] = `"recusandae-esse-debitis"`; exports[`lorem > 1211 > slug > with length 1`] = `"recusandae-esse-debitis-quo-amet-explicabo-repellat-accusantium-laborum-quia"`; +exports[`lorem > 1211 > slug > with length range 1`] = `"esse-debitis-quo-amet-explicabo-repellat-accusantium-laborum-quia-fuga-dolorem-cumque-autem-ullam-consequuntur-quidem-nobis-placeat-aut-cumque"`; + exports[`lorem > 1211 > text > noArgs 1`] = ` "Quo amet explicabo repellat accusantium laborum quia fuga dolorem cumque. Ullam consequuntur quidem nobis placeat aut. @@ -139,6 +239,12 @@ Ullam consequuntur quidem nobis placeat aut. Est animi libero repellendus recusandae iure magnam pariatur doloribus." `; +exports[`lorem > 1211 > text > with length range 1`] = ` +"Quo amet explicabo repellat accusantium laborum quia fuga dolorem cumque. +Ullam consequuntur quidem nobis placeat aut. +Est animi libero repellendus recusandae iure magnam pariatur doloribus." +`; + exports[`lorem > 1211 > word > noArgs 1`] = `"recusandae"`; exports[`lorem > 1211 > word > with length 1`] = `"reiciendis"`; @@ -153,6 +259,8 @@ exports[`lorem > 1211 > words > noArgs 1`] = `"recusandae esse debitis"`; exports[`lorem > 1211 > words > with length 1`] = `"recusandae esse debitis quo amet explicabo repellat accusantium laborum quia"`; +exports[`lorem > 1211 > words > with length range 1`] = `"esse debitis quo amet explicabo repellat accusantium laborum quia fuga dolorem cumque autem ullam consequuntur quidem nobis placeat aut cumque"`; + exports[`lorem > 1337 > lines > noArgs 1`] = ` "Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam." @@ -171,44 +279,84 @@ Qui sapiente sapiente accusamus vel facere blanditiis. Praesentium quidem aut temporibus tempore natus asperiores est." `; -exports[`lorem > 1337 > paragraph > noArgs 1`] = `"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias."`; +exports[`lorem > 1337 > lines > with length range 1`] = ` +"Quia dolorem incidunt atque esse accusantium ad. +Totam provident eius veniam. +Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. +Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. +Quam commodi suscipit cupiditate totam. +Ipsam ratione molestiae labore pariatur est ex ducimus reprehenderit. +Odit commodi possimus nesciunt. +Voluptatum recusandae repellendus natus qui sapiente sapiente accusamus vel facere. +Harum praesentium quidem aut temporibus tempore natus. +Est consequuntur esse explicabo commodi voluptas similique quidem maxime alias. +Ipsam illum ipsa optio quisquam sapiente exercitationem eaque. +Rem dignissimos dolorum voluptatibus nobis temporibus atque iste." +`; + +exports[`lorem > 1337 > paragraph > noArgs 1`] = `"Molestias quia dolorem incidunt atque. Accusantium ad consectetur totam provident eius. Voluptatibus tempora tempore aliquam vitae."`; -exports[`lorem > 1337 > paragraph > with length 1`] = `"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. Quam commodi suscipit cupiditate totam. Ipsam ratione molestiae labore pariatur est ex ducimus reprehenderit. Odit commodi possimus nesciunt. Voluptatum recusandae repellendus natus qui sapiente sapiente accusamus vel facere. Harum praesentium quidem aut temporibus tempore natus. Est consequuntur esse explicabo commodi voluptas similique quidem maxime alias. Ipsam illum ipsa optio quisquam sapiente exercitationem eaque."`; +exports[`lorem > 1337 > paragraph > with length 1`] = `"Molestias quia dolorem incidunt atque. Accusantium ad consectetur totam provident eius. Voluptatibus tempora tempore aliquam vitae. Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit. Quisquam quisquam minus alias corporis quam commodi suscipit cupiditate. Optio ipsam ratione molestiae labore pariatur est. Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. Qui sapiente sapiente accusamus vel facere blanditiis. Praesentium quidem aut temporibus tempore natus asperiores est."`; + +exports[`lorem > 1337 > paragraph > with length range 1`] = `"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. Quam commodi suscipit cupiditate totam. Ipsam ratione molestiae labore pariatur est ex ducimus reprehenderit. Odit commodi possimus nesciunt. Voluptatum recusandae repellendus natus qui sapiente sapiente accusamus vel facere. Harum praesentium quidem aut temporibus tempore natus. Est consequuntur esse explicabo commodi voluptas similique quidem maxime alias. Ipsam illum ipsa optio quisquam sapiente exercitationem eaque. Rem dignissimos dolorum voluptatibus nobis temporibus atque iste."`; exports[`lorem > 1337 > paragraphs > noArgs 1`] = ` -"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. -Commodi suscipit cupiditate totam optio ipsam. Molestiae labore pariatur est. Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. -Sapiente sapiente accusamus vel. Blanditiis harum praesentium quidem aut temporibus tempore natus asperiores. Consequuntur esse explicabo commodi voluptas similique quidem maxime. Dolorum ipsam illum. Optio quisquam sapiente." +"Molestias quia dolorem incidunt atque. Accusantium ad consectetur totam provident eius. Voluptatibus tempora tempore aliquam vitae. +Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit. Quisquam quisquam minus alias corporis quam commodi suscipit cupiditate. Optio ipsam ratione molestiae labore pariatur est. +Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. Qui sapiente sapiente accusamus vel facere blanditiis." `; exports[`lorem > 1337 > paragraphs > with length 1`] = ` -"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. -Commodi suscipit cupiditate totam optio ipsam. Molestiae labore pariatur est. Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. -Sapiente sapiente accusamus vel. Blanditiis harum praesentium quidem aut temporibus tempore natus asperiores. Consequuntur esse explicabo commodi voluptas similique quidem maxime. Dolorum ipsam illum. Optio quisquam sapiente. -Rerum rem dignissimos. Voluptatibus nobis temporibus atque iste modi molestias temporibus. Tempore numquam nulla aut aliquam et omnis earum incidunt voluptatibus. Dignissimos labore nostrum praesentium nam fugit consequatur harum optio officiis. -Ratione cumque est esse eveniet est consequuntur. Eveniet quisquam minima vero rerum nulla modi. Totam maiores eos nam nihil. In laborum aliquid officiis minus iusto. Commodi nam ipsa minus harum exercitationem. -Ipsam expedita provident necessitatibus iusto autem nesciunt nihil id saepe. Culpa nihil voluptatum perferendis adipisci modi tenetur voluptatum quas fugit. Blanditiis consectetur magnam eum voluptas nisi asperiores praesentium minus. -Fuga molestias voluptatem animi. Expedita cum rem earum. Iste inventore ea nemo fugiat. -Similique dolore harum nisi nobis rerum dolor ullam dolor voluptatem. Exercitationem dignissimos odio nesciunt aperiam quis. At libero molestiae impedit fugit quasi tenetur accusantium libero eius. -Alias adipisci quis fuga. Iusto veniam earum voluptate occaecati dolor qui assumenda ratione. Quis accusantium eum dolor illo tempora culpa ab ipsa esse. Exercitationem id minima consequatur maxime optio illum quis. -Molestias quis minus occaecati magni dolores ullam illum officiis. Unde soluta quisquam molestias natus. Necessitatibus corrupti nesciunt sit repellendus inventore excepturi a perspiciatis voluptate. Fugit quasi laborum quidem error ea quos necessitatibus saepe. Necessitatibus tempore eius doloremque distinctio impedit odio tempore." +"Molestias quia dolorem incidunt atque. Accusantium ad consectetur totam provident eius. Voluptatibus tempora tempore aliquam vitae. +Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit. Quisquam quisquam minus alias corporis quam commodi suscipit cupiditate. Optio ipsam ratione molestiae labore pariatur est. +Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. Qui sapiente sapiente accusamus vel facere blanditiis. +Praesentium quidem aut temporibus tempore natus asperiores est. Esse explicabo commodi voluptas. Quidem maxime alias dolorum ipsam illum ipsa optio. +Sapiente exercitationem eaque rerum rem dignissimos dolorum voluptatibus nobis. Atque iste modi molestias temporibus repellat tempore numquam nulla. Aliquam et omnis. +Incidunt voluptatibus accusamus dignissimos labore nostrum praesentium nam fugit consequatur. Optio officiis laborum deleniti ratione cumque est esse. Est consequuntur quos eveniet quisquam minima vero rerum nulla modi. +Totam maiores eos nam nihil. In laborum aliquid officiis minus iusto. Commodi nam ipsa minus harum exercitationem. +Eveniet ipsam expedita. Necessitatibus iusto autem nesciunt nihil id saepe. Culpa nihil voluptatum perferendis adipisci modi tenetur voluptatum quas fugit. +Blanditiis consectetur magnam eum voluptas nisi asperiores praesentium minus. Ipsum fuga molestias voluptatem. Consectetur expedita cum rem earum veniam iste inventore. +Nemo fugiat aut asperiores similique dolore. Nisi nobis rerum dolor ullam dolor voluptatem laboriosam. Dignissimos odio nesciunt aperiam quis." +`; + +exports[`lorem > 1337 > paragraphs > with length range 1`] = ` +"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. +Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. Quam commodi suscipit cupiditate totam. Ipsam ratione molestiae labore pariatur est ex ducimus reprehenderit. +Odit commodi possimus nesciunt. Voluptatum recusandae repellendus natus qui sapiente sapiente accusamus vel facere. Harum praesentium quidem aut temporibus tempore natus. +Est consequuntur esse explicabo commodi voluptas similique quidem maxime alias. Ipsam illum ipsa optio quisquam sapiente exercitationem eaque. Rem dignissimos dolorum voluptatibus nobis temporibus atque iste. +Molestias temporibus repellat tempore numquam. Aut aliquam et omnis earum incidunt voluptatibus accusamus dignissimos. Nostrum praesentium nam fugit consequatur. +Optio officiis laborum deleniti ratione cumque est esse. Est consequuntur quos eveniet quisquam minima vero rerum nulla modi. Totam maiores eos nam nihil. +In laborum aliquid officiis minus iusto. Commodi nam ipsa minus harum exercitationem. Eveniet ipsam expedita. +Necessitatibus iusto autem nesciunt nihil id saepe. Culpa nihil voluptatum perferendis adipisci modi tenetur voluptatum quas fugit. Blanditiis consectetur magnam eum voluptas nisi asperiores praesentium minus. +Ipsum fuga molestias voluptatem. Consectetur expedita cum rem earum veniam iste inventore. Nemo fugiat aut asperiores similique dolore. +Nisi nobis rerum dolor ullam dolor voluptatem laboriosam. Dignissimos odio nesciunt aperiam quis. At libero molestiae impedit fugit quasi tenetur accusantium libero eius. +Sunt alias adipisci quis fuga. Iusto veniam earum voluptate occaecati dolor qui assumenda ratione. Quis accusantium eum dolor illo tempora culpa ab ipsa esse. +Exercitationem id minima consequatur maxime optio illum quis. Quo molestias quis minus occaecati magni dolores ullam. Officiis tempora unde soluta quisquam molestias natus necessitatibus necessitatibus." `; exports[`lorem > 1337 > sentence > noArgs 1`] = `"Molestias quia dolorem incidunt atque."`; exports[`lorem > 1337 > sentence > with length 1`] = `"Eius molestias quia dolorem incidunt atque esse accusantium ad consectetur."`; +exports[`lorem > 1337 > sentence > with length range 1`] = `"Molestias quia dolorem incidunt atque esse accusantium ad consectetur totam provident eius."`; + exports[`lorem > 1337 > sentences > noArgs 1`] = `"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt."`; exports[`lorem > 1337 > sentences > with length 1`] = `"Molestias quia dolorem incidunt atque. Accusantium ad consectetur totam provident eius. Voluptatibus tempora tempore aliquam vitae. Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit. Quisquam quisquam minus alias corporis quam commodi suscipit cupiditate. Optio ipsam ratione molestiae labore pariatur est. Ducimus reprehenderit eos odit commodi possimus. Necessitatibus voluptatum recusandae repellendus. Qui sapiente sapiente accusamus vel facere blanditiis. Praesentium quidem aut temporibus tempore natus asperiores est."`; +exports[`lorem > 1337 > sentences > with length range 1`] = `"Quia dolorem incidunt atque esse accusantium ad. Totam provident eius veniam. Tempora tempore aliquam vitae maxime laboriosam quasi similique nemo sunt. Doloribus consequuntur reprehenderit pariatur quisquam quisquam minus alias. Quam commodi suscipit cupiditate totam. Ipsam ratione molestiae labore pariatur est ex ducimus reprehenderit. Odit commodi possimus nesciunt. Voluptatum recusandae repellendus natus qui sapiente sapiente accusamus vel facere. Harum praesentium quidem aut temporibus tempore natus. Est consequuntur esse explicabo commodi voluptas similique quidem maxime alias. Ipsam illum ipsa optio quisquam sapiente exercitationem eaque. Rem dignissimos dolorum voluptatibus nobis temporibus atque iste."`; + exports[`lorem > 1337 > slug > noArgs 1`] = `"eius-molestias-quia"`; exports[`lorem > 1337 > slug > with length 1`] = `"eius-molestias-quia-dolorem-incidunt-atque-esse-accusantium-ad-consectetur"`; -exports[`lorem > 1337 > text > noArgs 1`] = `"molestias quia dolorem"`; +exports[`lorem > 1337 > slug > with length range 1`] = `"molestias-quia-dolorem-incidunt-atque-esse-accusantium-ad-consectetur-totam-provident-eius"`; + +exports[`lorem > 1337 > text > noArgs 1`] = `"Dolorem incidunt atque esse. Ad consectetur totam. Eius veniam voluptatibus tempora tempore aliquam vitae. Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit."`; -exports[`lorem > 1337 > text > with length 1`] = `"molestias quia dolorem"`; +exports[`lorem > 1337 > text > with length 1`] = `"Dolorem incidunt atque esse. Ad consectetur totam. Eius veniam voluptatibus tempora tempore aliquam vitae. Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit."`; + +exports[`lorem > 1337 > text > with length range 1`] = `"Dolorem incidunt atque esse. Ad consectetur totam. Eius veniam voluptatibus tempora tempore aliquam vitae. Laboriosam quasi similique nemo sunt cum doloribus consequuntur reprehenderit."`; exports[`lorem > 1337 > word > noArgs 1`] = `"eius"`; @@ -223,3 +371,5 @@ exports[`lorem > 1337 > word > with options.strategy 1`] = `"a"`; exports[`lorem > 1337 > words > noArgs 1`] = `"eius molestias quia"`; exports[`lorem > 1337 > words > with length 1`] = `"eius molestias quia dolorem incidunt atque esse accusantium ad consectetur"`; + +exports[`lorem > 1337 > words > with length range 1`] = `"molestias quia dolorem incidunt atque esse accusantium ad consectetur totam provident eius"`; diff --git a/test/__snapshots__/string.spec.ts.snap b/test/__snapshots__/string.spec.ts.snap index bcac1178965..339f7aecf7c 100644 --- a/test/__snapshots__/string.spec.ts.snap +++ b/test/__snapshots__/string.spec.ts.snap @@ -22,6 +22,8 @@ exports[`string > 42 > alpha > with length parameter 4`] = `"rFhKH"`; exports[`string > 42 > alpha > with length parameter 5`] = `"bcYLR"`; +exports[`string > 42 > alpha > with length range 1`] = `"PXjMOFFixifdxT"`; + exports[`string > 42 > alpha > with length, casing and exclude 1`] = `"fwzcvwj"`; exports[`string > 42 > alphanumeric > noArgs 1`] = `"n"`; @@ -46,6 +48,8 @@ exports[`string > 42 > alphanumeric > with length parameter 4`] = `"kB8HE"`; exports[`string > 42 > alphanumeric > with length parameter 5`] = `"13YIP"`; +exports[`string > 42 > alphanumeric > with length range 1`] = `"NWbJMBB9r963sR"`; + exports[`string > 42 > alphanumeric > with length, casing and exclude 1`] = `"cvy4kvh"`; exports[`string > 42 > hexadecimal > noArgs 1`] = `"0x8"`; @@ -60,6 +64,8 @@ exports[`string > 42 > hexadecimal > with custom prefix 1`] = `"hex_8"`; exports[`string > 42 > hexadecimal > with length 1`] = `"0x8BE4AB"`; +exports[`string > 42 > hexadecimal > with length range 1`] = `"0xBE4ABdd39321aD"`; + exports[`string > 42 > hexadecimal > with length, casing and empty prefix 1`] = `"8be4abd"`; exports[`string > 42 > numeric > noArgs 1`] = `"4"`; @@ -80,6 +86,8 @@ exports[`string > 42 > numeric > with length parameter 4`] = `"46176"`; exports[`string > 42 > numeric > with length parameter 5`] = `"10978"`; +exports[`string > 42 > numeric > with length range 1`] = `"89177551410048"`; + exports[`string > 42 > numeric > with length, allowLeadingZeros and exclude 1`] = `"6890887"`; exports[`string > 42 > sample > noArgs 1`] = `"Cky2eiXX/J"`; @@ -94,6 +102,8 @@ exports[`string > 42 > sample > with length parameter 4`] = `"@X.b]"`; exports[`string > 42 > sample > with length parameter 5`] = `"\\"&{dn"`; +exports[`string > 42 > sample > with length range 1`] = `"ky2eiXX/J/*&Kq"`; + exports[`string > 42 > uuid 1`] = `"5cf2bc99-2721-407d-992b-a00fbdf302f2"`; exports[`string > 42 > uuid 2`] = `"94980604-8962-404f-9371-c9368f970d9a"`; @@ -126,6 +136,8 @@ exports[`string > 1211 > alpha > with length parameter 4`] = `"iKMQa"`; exports[`string > 1211 > alpha > with length parameter 5`] = `"NIILR"`; +exports[`string > 1211 > alpha > with length range 1`] = `"xUOlgZbIiJkNvsiKMQaN"`; + exports[`string > 1211 > alpha > with length, casing and exclude 1`] = `"yhywdcz"`; exports[`string > 1211 > alphanumeric > noArgs 1`] = `"V"`; @@ -150,6 +162,8 @@ exports[`string > 1211 > alphanumeric > with length parameter 4`] = `"aHKO0"`; exports[`string > 1211 > alphanumeric > with length parameter 5`] = `"LFEJP"`; +exports[`string > 1211 > alphanumeric > with length range 1`] = `"sTMd8Z2F9GdLqlaHKO0L"`; + exports[`string > 1211 > alphanumeric > with length, casing and exclude 1`] = `"yexv53z"`; exports[`string > 1211 > hexadecimal > noArgs 1`] = `"0xE"`; @@ -164,6 +178,8 @@ exports[`string > 1211 > hexadecimal > with custom prefix 1`] = `"hex_E"`; exports[`string > 1211 > hexadecimal > with length 1`] = `"0xEaDB42"`; +exports[`string > 1211 > hexadecimal > with length range 1`] = `"0xaDB42F0e3f4A973fAB0A"`; + exports[`string > 1211 > hexadecimal > with length, casing and empty prefix 1`] = `"eadb42f"`; exports[`string > 1211 > numeric > noArgs 1`] = `"9"`; @@ -184,6 +200,8 @@ exports[`string > 1211 > numeric > with length parameter 4`] = `"26780"`; exports[`string > 1211 > numeric > with length parameter 5`] = `"76678"`; +exports[`string > 1211 > numeric > with length range 1`] = `"58721906162743167807"`; + exports[`string > 1211 > numeric > with length, allowLeadingZeros and exclude 1`] = `"9798609"`; exports[`string > 1211 > sample > noArgs 1`] = `"wKti5-}$_/"`; @@ -198,6 +216,8 @@ exports[`string > 1211 > sample > with length parameter 4`] = `"0afl\\""`; exports[`string > 1211 > sample > with length parameter 5`] = `"h^]dn"`; +exports[`string > 1211 > sample > with length range 1`] = `"Kti5-}$_/\`4hHA0afl\\"h"`; + exports[`string > 1211 > uuid 1`] = `"e7ec32f0-a2a3-4c65-abbd-0caabde64dfd"`; exports[`string > 1211 > uuid 2`] = `"f379e325-9f7c-4064-a086-f23942b68e5f"`; @@ -230,6 +250,8 @@ exports[`string > 1337 > alpha > with length parameter 4`] = `"oMpfP"`; exports[`string > 1337 > alpha > with length parameter 5`] = `"ueGsg"`; +exports[`string > 1337 > alpha > with length range 1`] = `"DiloCxbqmAEn"`; + exports[`string > 1337 > alpha > with length, casing and exclude 1`] = `"eicdeih"`; exports[`string > 1337 > alphanumeric > noArgs 1`] = `"g"`; @@ -254,6 +276,8 @@ exports[`string > 1337 > alphanumeric > with length parameter 4`] = `"gJj7N"`; exports[`string > 1337 > alphanumeric > with length parameter 5`] = `"n5Cm7"`; +exports[`string > 1337 > alphanumeric > with length range 1`] = `"y9dhxs2jewAg"`; + exports[`string > 1337 > alphanumeric > with length, casing and exclude 1`] = `"ag45age"`; exports[`string > 1337 > hexadecimal > noArgs 1`] = `"0x5"`; @@ -268,6 +292,8 @@ exports[`string > 1337 > hexadecimal > with custom prefix 1`] = `"hex_5"`; exports[`string > 1337 > hexadecimal > with length 1`] = `"0x5c346b"`; +exports[`string > 1337 > hexadecimal > with length range 1`] = `"0xc346ba075bd5"`; + exports[`string > 1337 > hexadecimal > with length, casing and empty prefix 1`] = `"5c346ba"`; exports[`string > 1337 > numeric > noArgs 1`] = `"3"`; @@ -288,6 +314,8 @@ exports[`string > 1337 > numeric > with length parameter 4`] = `"37318"`; exports[`string > 1337 > numeric > with length parameter 5`] = `"40631"`; +exports[`string > 1337 > numeric > with length range 1`] = `"612254032552"`; + exports[`string > 1337 > numeric > with length, allowLeadingZeros and exclude 1`] = `"6706677"`; exports[`string > 1337 > sample > noArgs 1`] = `"9U/4:SK$>6"`; @@ -302,6 +330,8 @@ exports[`string > 1337 > sample > with length parameter 4`] = `":e=+k"`; exports[`string > 1337 > sample > with length parameter 5`] = `"D)[B,"`; +exports[`string > 1337 > sample > with length range 1`] = `"U/4:SK$>6QX9"`; + exports[`string > 1337 > uuid 1`] = `"48234870-5389-445f-8b41-c61a52bf27dc"`; exports[`string > 1337 > uuid 2`] = `"cc057669-8c53-474d-a677-226d3e8ed92f"`; diff --git a/test/__snapshots__/system.spec.ts.snap b/test/__snapshots__/system.spec.ts.snap index ba863597e16..025ad494af7 100644 --- a/test/__snapshots__/system.spec.ts.snap +++ b/test/__snapshots__/system.spec.ts.snap @@ -28,6 +28,8 @@ exports[`system > 42 > fileName > noArgs 1`] = `"nonbeliever_stub.skt"`; exports[`system > 42 > fileName > with extensionCount 1`] = `"nonbeliever_stub.skt.latex"`; +exports[`system > 42 > fileName > with extensionCount range 1`] = `"crowded_fail_woefully.dra"`; + exports[`system > 42 > filePath 1`] = `"/opt/bin/crowded_fail_woefully.dra"`; exports[`system > 42 > fileType 1`] = `"image"`; @@ -106,6 +108,8 @@ exports[`system > 1211 > fileName > noArgs 1`] = `"although_instantly_though.ust exports[`system > 1211 > fileName > with extensionCount 1`] = `"although_instantly_though.ustar.ecelp4800"`; +exports[`system > 1211 > fileName > with extensionCount range 1`] = `"outside_even.xhvml.ttc"`; + exports[`system > 1211 > filePath 1`] = `"/var/log/outside_even.xhvml"`; exports[`system > 1211 > fileType 1`] = `"x-shader"`; @@ -184,6 +188,8 @@ exports[`system > 1337 > fileName > noArgs 1`] = `"although.chrt"`; exports[`system > 1337 > fileName > with extensionCount 1`] = `"although.chrt.dpg"`; +exports[`system > 1337 > fileName > with extensionCount range 1`] = `"yum_fast"`; + exports[`system > 1337 > filePath 1`] = `"/Library/yum_fast.aiff"`; exports[`system > 1337 > fileType 1`] = `"font"`; diff --git a/test/__snapshots__/word.spec.ts.snap b/test/__snapshots__/word.spec.ts.snap index 247bb241c4a..dabcfa9c8fc 100644 --- a/test/__snapshots__/word.spec.ts.snap +++ b/test/__snapshots__/word.spec.ts.snap @@ -100,6 +100,12 @@ exports[`word > 42 > words > noArgs 1`] = `"nonbeliever stub"`; exports[`word > 42 > words > with count = 10 1`] = `"eek loudly alibi abnormally aw great-grandmother nor without conjoin mind"`; +exports[`word > 42 > words > with count = 20 1`] = `"eek loudly alibi abnormally aw great-grandmother nor without conjoin mind power till gadzooks yippee unbend gentle between offensive yowza hone"`; + +exports[`word > 42 > words > with options.count 1`] = `"eek loudly alibi abnormally aw great-grandmother nor without conjoin mind"`; + +exports[`word > 42 > words > with options.count range 1`] = `"nonbeliever stub across dreamily accurate chunder boo neuropathologist loftily through detoxify about when boohoo grasp busily to grouchy beneath"`; + exports[`word > 1211 > adjective > noArgs 1`] = `"vibrant"`; exports[`word > 1211 > adjective > with length = 10 1`] = `"unpleasant"`; @@ -200,6 +206,12 @@ exports[`word > 1211 > words > noArgs 1`] = `"although instantly though"`; exports[`word > 1211 > words > with count = 10 1`] = `"youthfully woot speedily gracefully positively hurry aw content thin monster"`; +exports[`word > 1211 > words > with count = 20 1`] = `"youthfully woot speedily gracefully positively hurry aw content thin monster cinch for moonscape motivate science consequently whether per upon but"`; + +exports[`word > 1211 > words > with options.count 1`] = `"youthfully woot speedily gracefully positively hurry aw content thin monster"`; + +exports[`word > 1211 > words > with options.count range 1`] = `"although instantly though which zowie salon except pumpkin frightened contain ark kindly next colorlessness out penalise internalize minus upgrade excitedly"`; + exports[`word > 1337 > adjective > noArgs 1`] = `"fair"`; exports[`word > 1337 > adjective > with length = 10 1`] = `"enchanting"`; @@ -299,3 +311,9 @@ exports[`word > 1337 > verb > with options.strategy 1`] = `"be"`; exports[`word > 1337 > words > noArgs 1`] = `"although"`; exports[`word > 1337 > words > with count = 10 1`] = `"nor brr instead anenst intently hard larder team vacation repentant"`; + +exports[`word > 1337 > words > with count = 20 1`] = `"nor brr instead anenst intently hard larder team vacation repentant compress the where duh ugh embryo lather rudely plaintiff sesame"`; + +exports[`word > 1337 > words > with options.count 1`] = `"nor brr instead anenst intently hard larder team vacation repentant"`; + +exports[`word > 1337 > words > with options.count range 1`] = `"although within along limply loyally elegantly implicate maggot underneath afraid nor abrogate oof within gosh against editorialize sag"`; diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index a8a89b3ad2d..412dff30982 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -102,6 +102,10 @@ describe('helpers', () => { ); }); + t.describe('rangeToNumber', (t) => { + t.it('with number', 5).it('with range', { min: 1, max: 10 }); + }); + t.describe('unique', (t) => { t.it('with customMethod', customUniqueMethod) .it('with customMethod and args', customUniqueMethod, ['prefix-1-']) @@ -683,6 +687,18 @@ describe('helpers', () => { }); }); + describe('rangeToNumber()', () => { + it('should return a number', () => { + expect(faker.helpers.rangeToNumber(1)).toBe(1); + }); + + it('should return a number in a range', () => { + const actual = faker.helpers.rangeToNumber({ min: 1, max: 10 }); + expect(actual).toBeGreaterThanOrEqual(1); + expect(actual).toBeLessThanOrEqual(10); + }); + }); + describe('unique()', () => { it('should be possible to call a function with no arguments and return a result', () => { const result = faker.helpers.unique(faker.internet.email); diff --git a/test/lorem.spec.ts b/test/lorem.spec.ts index f36f7e9b2e5..e1d74a4013b 100644 --- a/test/lorem.spec.ts +++ b/test/lorem.spec.ts @@ -32,7 +32,9 @@ describe('lorem', () => { 'text', 'lines' )((t) => { - t.it('noArgs').it('with length', 10); + t.it('noArgs') + .it('with length', 10) + .it('with length range', { min: 10, max: 20 }); }); }); @@ -94,6 +96,22 @@ describe('lorem', () => { } } ); + + it('should return a random amount of words', () => { + const actual = faker.lorem.words({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const words = actual.split(' '); + + expect(words.length).toBeGreaterThanOrEqual(10); + expect(words.length).toBeLessThanOrEqual(20); + + for (const word of words) { + expect(faker.definitions.lorem.words).toContain(word); + } + }); }); describe('sentence()', () => { @@ -119,6 +137,18 @@ describe('lorem', () => { expect(words).toHaveLength(wordCount); } ); + + it('should return a sentence with a random amount of words', () => { + const actual = faker.lorem.sentence({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const words = actual.split(' '); + + expect(words.length).toBeGreaterThanOrEqual(10); + expect(words.length).toBeLessThanOrEqual(20); + }); }); describe('slug()', () => { @@ -189,6 +219,18 @@ describe('lorem', () => { } } ); + + it('should return a random amount of sentences', () => { + const actual = faker.lorem.sentences({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const sentences = actual.split('. '); + + expect(sentences.length).toBeGreaterThanOrEqual(10); + expect(sentences.length).toBeLessThanOrEqual(20); + }); }); describe('paragraph()', () => { @@ -215,6 +257,18 @@ describe('lorem', () => { expect(sentences.length).toBeLessThanOrEqual(sentenceCount + 3); } ); + + it('should return a paragraph with a random amount of sentences', () => { + const actual = faker.lorem.paragraph({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const sentences = actual.split('. '); + + expect(sentences.length).toBeGreaterThanOrEqual(10); + expect(sentences.length).toBeLessThanOrEqual(20); + }); }); describe('paragraphs()', () => { @@ -253,6 +307,18 @@ describe('lorem', () => { expect(paragraphs).toHaveLength(paragraphCount); } ); + + it('should return a random amount of paragraphs', () => { + const actual = faker.lorem.paragraphs({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const paragraphs = actual.split('\n'); + + expect(paragraphs.length).toBeGreaterThanOrEqual(10); + expect(paragraphs.length).toBeLessThanOrEqual(20); + }); }); describe('text()', () => { @@ -282,6 +348,18 @@ describe('lorem', () => { expect(lines).toHaveLength(lineCount); }); + + it('should return a random amount of lines', () => { + const actual = faker.lorem.lines({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const lines = actual.split('\n'); + + expect(lines.length).toBeGreaterThanOrEqual(10); + expect(lines.length).toBeLessThanOrEqual(20); + }); }); } }); diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap index 096e4b722c7..b5beb4a7a08 100644 --- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap +++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap @@ -5,7 +5,7 @@ exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = ` "deprecated": false, "description": "

Test with a default parameter.

", - "examples": "
ts
faker.defaultBooleanParamMethod(c: boolean = true): number
+  "examples": "
ts
faker.defaultBooleanParamMethod(c: boolean = true): number
 
", "name": "defaultBooleanParamMethod", @@ -51,7 +51,7 @@ exports[`signature > analyzeSignature() > functionParamMethod 1`] = ` "deprecated": false, "description": "

Test with a function parameters.

", - "examples": "
ts
faker.functionParamMethod(fn: (a: string) => number): number
+  "examples": "
ts
faker.functionParamMethod(fn: (a: string) => number): number
 
", "name": "functionParamMethod", @@ -76,7 +76,7 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "deprecated": false, "description": "

Test with LiteralUnion.

", - "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string): string
+  "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string): string
 
", "name": "literalUnionParamMethod", @@ -101,7 +101,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = ` "deprecated": true, "description": "

Test with deprecated and see marker.

", - "examples": "
ts
faker.methodWithDeprecated(): number
+  "examples": "
ts
faker.methodWithDeprecated(): number
 
", "name": "methodWithDeprecated", @@ -120,8 +120,8 @@ exports[`signature > analyzeSignature() > methodWithExample 1`] = ` "deprecated": false, "description": "

Test with example marker.

", - "examples": "
ts
faker.methodWithExample(): number
-test.apidoc.methodWithExample() // 0
+  "examples": "
ts
faker.methodWithExample(): number
+test.apidoc.methodWithExample() // 0
 
", "name": "methodWithExample", @@ -138,7 +138,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = ` "deprecated": false, "description": "

Test with multiple see markers.

", - "examples": "
ts
faker.methodWithMultipleSeeMarkers(): number
+  "examples": "
ts
faker.methodWithMultipleSeeMarkers(): number
 
", "name": "methodWithMultipleSeeMarkers", @@ -158,7 +158,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = ` "deprecated": false, "description": "

Test with since marker.

", - "examples": "
ts
faker.methodWithSinceMarker(): number
+  "examples": "
ts
faker.methodWithSinceMarker(): number
 
", "name": "methodWithSinceMarker", @@ -175,7 +175,7 @@ exports[`signature > analyzeSignature() > multiParamMethod 1`] = ` "deprecated": false, "description": "

Test with multiple parameters.

", - "examples": "
ts
faker.multiParamMethod(a: number, b?: string, c: boolean = true): number
+  "examples": "
ts
faker.multiParamMethod(a: number, b?: string, c: boolean = true): number
 
", "name": "multiParamMethod", @@ -214,7 +214,7 @@ exports[`signature > analyzeSignature() > noParamMethod 1`] = ` "deprecated": false, "description": "

Test with no parameters.

", - "examples": "
ts
faker.noParamMethod(): number
+  "examples": "
ts
faker.noParamMethod(): number
 
", "name": "noParamMethod", @@ -231,7 +231,7 @@ exports[`signature > analyzeSignature() > optionalStringParamMethod 1`] = ` "deprecated": false, "description": "

Test with an optional parameter.

", - "examples": "
ts
faker.optionalStringParamMethod(b?: string): number
+  "examples": "
ts
faker.optionalStringParamMethod(b?: string): number
 
", "name": "optionalStringParamMethod", @@ -256,13 +256,13 @@ exports[`signature > analyzeSignature() > optionsInlineParamMethodWithDefaults 1 "deprecated": false, "description": "

Test with a function parameters (inline types) with defaults.

", - "examples": "
ts
faker.optionsInlineParamMethodWithDefaults(a: {
-  value: number
-} = { value: 1 }, b: {
-  value: number
-} = { value: 1 }, c: {
-  value: number
-}): number
+  "examples": "
ts
faker.optionsInlineParamMethodWithDefaults(a: {
+  value: number
+} = { value: 1 }, b: {
+  value: number
+} = { value: 1 }, c: {
+  value: number
+}): number
 
", "name": "optionsInlineParamMethodWithDefaults", @@ -324,7 +324,7 @@ exports[`signature > analyzeSignature() > optionsInterfaceParamMethodWithDefault "deprecated": false, "description": "

Test with a function parameters with defaults.

", - "examples": "
ts
faker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number
+  "examples": "
ts
faker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number
 
", "name": "optionsInterfaceParamMethodWithDefaults", @@ -363,12 +363,12 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = ` "deprecated": false, "description": "

Test with a function parameters.

", - "examples": "
ts
faker.optionsParamMethod(options: {
-  a: number,
-  b: string,
-  c: boolean,
-  d: () => string
-}): number
+  "examples": "
ts
faker.optionsParamMethod(options: {
+  a: number,
+  b: string,
+  c: boolean,
+  d: () => string
+}): number
 
", "name": "optionsParamMethod", @@ -421,7 +421,7 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`] "deprecated": false, "description": "

Test with a function parameters with defaults.

", - "examples": "
ts
faker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number
+  "examples": "
ts
faker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number
 
", "name": "optionsTypeParamMethodWithDefaults", @@ -460,7 +460,7 @@ exports[`signature > analyzeSignature() > requiredNumberParamMethod 1`] = ` "deprecated": false, "description": "

Test with a required parameter.

", - "examples": "
ts
faker.requiredNumberParamMethod(a: number): number
+  "examples": "
ts
faker.requiredNumberParamMethod(a: number): number
 
", "name": "requiredNumberParamMethod", @@ -485,7 +485,7 @@ exports[`signature > analyzeSignature() > stringUnionParamMethod 1`] = ` "deprecated": false, "description": "

Test with string union.

", - "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b'): string
+  "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b'): string
 
", "name": "stringUnionParamMethod", diff --git a/test/string.spec.ts b/test/string.spec.ts index 6d34f098653..32dc2ddfefc 100644 --- a/test/string.spec.ts +++ b/test/string.spec.ts @@ -11,6 +11,7 @@ describe('string', () => { t.it('noArgs') .itRepeated('with length parameter', 5, 5) .it('with length', { length: 6 }) + .it('with length range', { length: { min: 10, max: 20 } }) .it('with casing = lower', { casing: 'lower' }) .it('with casing = upper', { casing: 'upper' }) .it('with casing = mixed', { casing: 'mixed' }) @@ -26,6 +27,7 @@ describe('string', () => { t.it('noArgs') .itRepeated('with length parameter', 5, 5) .it('with length', { length: 6 }) + .it('with length range', { length: { min: 10, max: 20 } }) .it('with casing = lower', { casing: 'lower' }) .it('with casing = upper', { casing: 'upper' }) .it('with casing = mixed', { casing: 'mixed' }) @@ -40,6 +42,7 @@ describe('string', () => { t.describe('hexadecimal', (t) => { t.it('noArgs') .it('with length', { length: 6 }) + .it('with length range', { length: { min: 10, max: 20 } }) .it('with casing = lower', { casing: 'lower' }) .it('with casing = upper', { casing: 'upper' }) .it('with casing = mixed', { casing: 'mixed' }) @@ -55,6 +58,7 @@ describe('string', () => { t.it('noArgs') .itRepeated('with length parameter', 5, 5) .it('with length', { length: 6 }) + .it('with length range', { length: { min: 10, max: 20 } }) .it('with allowLeadingZeros', { allowLeadingZeros: true }) .it('with exclude', { exclude: '12345' }) .it('with length, allowLeadingZeros and exclude', { @@ -65,7 +69,9 @@ describe('string', () => { }); t.describe('sample', (t) => { - t.it('noArgs').itRepeated('with length parameter', 5, 5); + t.it('noArgs') + .itRepeated('with length parameter', 5, 5) + .it('with length range', { min: 10, max: 20 }); }); t.itRepeated('uuid', 5); @@ -95,7 +101,7 @@ describe('string', () => { expect(actual).toMatch(pattern); }); - it('should generate many random letters', () => { + it('should generate 5 random letters', () => { const actual = faker.string.alpha(5); expect(actual).toHaveLength(5); @@ -110,6 +116,16 @@ describe('string', () => { } ); + it('should return a random amount of characters', () => { + const actual = faker.string.alpha({ length: { min: 10, max: 20 } }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + expect(actual.length).toBeGreaterThanOrEqual(10); + expect(actual.length).toBeLessThanOrEqual(20); + }); + it('should be able to ban some characters', () => { const actual = faker.string.alpha({ length: 5, @@ -190,7 +206,7 @@ describe('string', () => { expect(actual).toMatch(pattern); }); - it('should generate many random characters', () => { + it('should generate 5 random characters', () => { const actual = faker.string.alphanumeric(5); expect(actual).toHaveLength(5); @@ -205,6 +221,18 @@ describe('string', () => { } ); + it('should return a random amount of characters', () => { + const actual = faker.string.alphanumeric({ + length: { min: 10, max: 20 }, + }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + expect(actual.length).toBeGreaterThanOrEqual(10); + expect(actual.length).toBeLessThanOrEqual(20); + }); + it('should be able to ban all alphabetic characters', () => { const exclude = 'abcdefghijklmnopqrstuvwxyz'.split(''); const alphaText = faker.string.alphanumeric({ @@ -325,6 +353,28 @@ describe('string', () => { expect(hex).toMatch(/^[0-9a-f]*$/i); expect(hex).toHaveLength(5); }); + + it.each([0, -1, -100])( + 'should return the prefix when length is <= 0', + (length) => { + const actual = faker.string.hexadecimal({ length }); + + expect(actual).toBe('0x'); + } + ); + + it('should return a random amount of characters', () => { + const actual = faker.string.hexadecimal({ + length: { min: 10, max: 20 }, + prefix: '', + }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + expect(actual.length).toBeGreaterThanOrEqual(10); + expect(actual.length).toBeLessThanOrEqual(20); + }); }); describe('numeric', () => { @@ -345,6 +395,18 @@ describe('string', () => { } ); + it('should return a random amount of characters', () => { + const actual = faker.string.numeric({ + length: { min: 10, max: 20 }, + }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + expect(actual.length).toBeGreaterThanOrEqual(10); + expect(actual.length).toBeLessThanOrEqual(20); + }); + it('should return empty string with a length of 0', () => { const actual = faker.string.numeric(0); @@ -468,6 +530,16 @@ describe('string', () => { const generatedString = faker.string.sample(length); expect(generatedString).toHaveLength(length); }); + + it('should return a random amount of characters', () => { + const actual = faker.string.sample({ min: 10, max: 20 }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + expect(actual.length).toBeGreaterThanOrEqual(10); + expect(actual.length).toBeLessThanOrEqual(20); + }); }); describe(`uuid`, () => { diff --git a/test/system.spec.ts b/test/system.spec.ts index 7d45f198ee2..7a566b2160e 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -38,7 +38,11 @@ describe('system', () => { ); t.describe('fileName', (t) => { - t.it('noArgs').it('with extensionCount', { extensionCount: 2 }); + t.it('noArgs') + .it('with extensionCount', { extensionCount: 2 }) + .it('with extensionCount range', { + extensionCount: { min: 0, max: 2 }, + }); }); t.describe('commonFileName', (t) => { @@ -275,6 +279,20 @@ describe('system', () => { expect(parts).length(extensionCount + 1); } ); + + it('should return a random amount of file extensions', () => { + const actual = faker.system.fileName({ + extensionCount: { min: 2, max: 5 }, + }); + + expect(actual).toBeTruthy(); + expect(actual).toBeTypeOf('string'); + + const parts = actual.split('.'); + + expect(parts.length, actual).toBeGreaterThanOrEqual(3); + expect(parts.length, actual).toBeLessThanOrEqual(6); + }); }); describe('filePath()', () => { @@ -421,7 +439,7 @@ describe('system', () => { ); it('should return non-standard cron expressions', () => { - const validResults = ['1', '2', '3', '5', '*', '@']; + const validResults = ['1', '2', '3', '4', '5', '*', '@']; expect( faker.system.cron({ includeNonStandard: true })[0], 'generated cron, string should contain non-standard cron labels' diff --git a/test/word.spec.ts b/test/word.spec.ts index 1300c00a658..14ac3aaebba 100644 --- a/test/word.spec.ts +++ b/test/word.spec.ts @@ -31,8 +31,13 @@ describe('word', () => { strategy: 'closest', }); }); + t.describe('words', (t) => { - t.it('noArgs').it('with count = 10', 10); + t.it('noArgs') + .it('with count = 10', 10) + .it('with count = 20', 20) + .it('with options.count', { count: 10 }) + .it('with options.count range', { count: { min: 18, max: 20 } }); }); });