diff --git a/docs/.vitepress/components/Banner.vue b/docs/.vitepress/components/Banner.vue new file mode 100644 index 00000000000..9eea81c9c8f --- /dev/null +++ b/docs/.vitepress/components/Banner.vue @@ -0,0 +1,108 @@ + + + + + + + diff --git a/docs/.vitepress/components/shims.d.ts b/docs/.vitepress/components/shims.d.ts new file mode 100644 index 00000000000..7ae275ab099 --- /dev/null +++ b/docs/.vitepress/components/shims.d.ts @@ -0,0 +1,7 @@ +declare const __BANNER__: string | false; + +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + const component: DefineComponent; + export default component; +} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 1191ddd182f..aa0045d81dd 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'vitepress'; import { DefaultTheme } from 'vitepress/theme'; import { apiPages } from './api-pages'; -import { currentVersion, oldVersions } from './versions'; +import { currentVersion, oldVersions, versionBannerInfix } from './versions'; type SidebarGroup = DefaultTheme.SidebarGroup; @@ -51,7 +51,7 @@ function extendSideNav(current: SidebarGroup): SidebarGroup[] { return links; } -export default defineConfig({ +const config = defineConfig({ title: 'Faker', description, @@ -229,4 +229,29 @@ export default defineConfig({ }), }, }, + + vite: { + define: { + __BANNER__: versionBannerInfix ?? false, + }, + }, }); + +if (versionBannerInfix) { + config.head?.push([ + 'script', + { id: 'restore-banner-preference' }, + ` +(() => { + const restore = (key, cls, def = false) => { + const saved = localStorage.getItem(key); + if (saved ? saved !== 'false' && new Date() < saved : def) { + document.documentElement.classList.add(cls); + } + }; + restore('faker-version-banner', 'banner-dismissed'); +})();`, + ]); +} + +export default config; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 2423da6bf18..8555a839b70 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,22 @@ import DefaultTheme from 'vitepress/theme'; +import { defineAsyncComponent, h } from 'vue'; import './index.css'; -export default DefaultTheme; +export default { + ...DefaultTheme, + Layout() { + return h( + DefaultTheme.Layout, + null, + __BANNER__ + ? { + 'layout-top': () => + h( + defineAsyncComponent(() => import('../components/Banner.vue')), + { version: __BANNER__ } + ), + } + : null + ); + }, +}; diff --git a/docs/.vitepress/tsconfig.json b/docs/.vitepress/tsconfig.json index 74d4053ade1..75b15f9e2d4 100644 --- a/docs/.vitepress/tsconfig.json +++ b/docs/.vitepress/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target": "ES2020", + "module": "ES2020", "moduleResolution": "Node", "resolveJsonModule": true } diff --git a/docs/.vitepress/versions.ts b/docs/.vitepress/versions.ts index 7d37619deff..2964557cee9 100644 --- a/docs/.vitepress/versions.ts +++ b/docs/.vitepress/versions.ts @@ -41,6 +41,19 @@ const hiddenLink = const otherVersions = readOtherLatestReleaseTagNames(); const isReleaseBranch = /^v\d+$/.test(branchName); +export const versionBannerInfix: string | null = (() => { + if (deployContext === 'production') { + return null; + } + if (isReleaseBranch) { + return '"an old version"'; + } + if (branchName === 'next') { + return '"the next (unreleased) version"'; + } + return '"a development version"'; +})(); + export const currentVersion = isReleaseBranch ? `v${version}` : branchName; export const oldVersions = [ { diff --git a/docs/guide/usage.md b/docs/guide/usage.md index 471d905ea24..57ee4565d7a 100644 --- a/docs/guide/usage.md +++ b/docs/guide/usage.md @@ -11,7 +11,7 @@ const randomName = faker.person.fullName(); // Rowan Nikolaus const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz ``` -Or if you using CommonJS +Or if you're using CommonJS: ```js const { faker } = require('@faker-js/faker'); @@ -43,7 +43,7 @@ Using the browser is great for experimenting πŸ‘. However, due to all of the st ```js import { faker } from 'https://cdn.skypack.dev/@faker-js/faker'; -const randomName = faker.person.findName(); // Willie Bahringer +const randomName = faker.person.fullName(); // Willie Bahringer const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com ``` @@ -142,7 +142,7 @@ Let's refactor our current code: import { faker } from '@faker-js/faker'; function createRandomUser(): User { - const sex = this.faker.person.sexType(); + const sex = faker.person.sexType(); const firstName = faker.person.firstName(sex); const lastName = faker.person.lastName(); const email = faker.internet.email(firstName, lastName); @@ -179,7 +179,7 @@ Faker has your back, with another helper method: import { faker } from '@faker-js/faker'; function createRandomUser(): User { - const sex = this.faker.person.sexType(); + const sex = faker.person.sexType(); const firstName = faker.person.firstName(sex); const lastName = faker.person.lastName(); const email = faker.helpers.unique(faker.internet.email, [ diff --git a/package.json b/package.json index 6f770746a3f..eba95f2f042 100644 --- a/package.json +++ b/package.json @@ -97,25 +97,26 @@ "@algolia/client-search": "~4.14.2", "@types/glob": "~8.0.0", "@types/markdown-it": "~12.2.3", - "@types/node": "~18.8.4", + "@types/node": "~18.11.8", "@types/prettier": "~2.7.1", - "@types/react": "~18.0.21", + "@types/react": "~18.0.24", "@types/sanitize-html": "~2.6.2", - "@types/semver": "~7.3.12", - "@types/validator": "~13.7.9", - "@typescript-eslint/eslint-plugin": "~5.40.1", - "@typescript-eslint/parser": "~5.40.1", + "@types/semver": "~7.3.13", + "@types/validator": "~13.7.10", + "@typescript-eslint/eslint-plugin": "~5.41.0", + "@typescript-eslint/parser": "~5.41.0", "@vitest/coverage-c8": "~0.24.3", "@vitest/ui": "~0.24.3", + "@vueuse/core": "~9.4.0", "c8": "~7.12.0", "conventional-changelog-cli": "~2.2.2", - "cypress": "~10.10.0", + "cypress": "~10.11.0", "esbuild": "~0.15.12", "eslint": "~8.26.0", "eslint-config-prettier": "~8.5.0", - "eslint-define-config": "~1.8.0", + "eslint-define-config": "~1.11.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~39.3.23", + "eslint-plugin-jsdoc": "~39.4.0", "eslint-plugin-prettier": "~4.2.1", "glob": "~8.0.3", "lint-staged": "~13.0.3", @@ -127,22 +128,23 @@ "react": "~18.2.0", "react-dom": "~18.2.0", "rimraf": "~3.0.2", - "sanitize-html": "~2.7.2", + "sanitize-html": "~2.7.3", "semver": "~7.3.8", "simple-git-hooks": "~2.8.1", "standard-version": "~9.5.0", "tsx": "~3.11.0", - "typedoc": "~0.23.16", + "typedoc": "~0.23.19", "typedoc-plugin-missing-exports": "~1.0.0", "typescript": "~4.8.4", "validator": "~13.7.0", - "vite": "~3.1.8", - "vitepress": "1.0.0-alpha.21", - "vitest": "~0.24.3" + "vite": "~3.2.1", + "vitepress": "1.0.0-alpha.26", + "vitest": "~0.24.3", + "vue": "~3.2.41" }, - "packageManager": "pnpm@7.14.0", + "packageManager": "pnpm@7.14.1", "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" + "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 d44860ec88a..46cf4d870dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,25 +5,26 @@ specifiers: '@algolia/client-search': ~4.14.2 '@types/glob': ~8.0.0 '@types/markdown-it': ~12.2.3 - '@types/node': ~18.8.4 + '@types/node': ~18.11.8 '@types/prettier': ~2.7.1 - '@types/react': ~18.0.21 + '@types/react': ~18.0.24 '@types/sanitize-html': ~2.6.2 - '@types/semver': ~7.3.12 - '@types/validator': ~13.7.9 - '@typescript-eslint/eslint-plugin': ~5.40.1 - '@typescript-eslint/parser': ~5.40.1 + '@types/semver': ~7.3.13 + '@types/validator': ~13.7.10 + '@typescript-eslint/eslint-plugin': ~5.41.0 + '@typescript-eslint/parser': ~5.41.0 '@vitest/coverage-c8': ~0.24.3 '@vitest/ui': ~0.24.3 + '@vueuse/core': ~9.4.0 c8: ~7.12.0 conventional-changelog-cli: ~2.2.2 - cypress: ~10.10.0 + cypress: ~10.11.0 esbuild: ~0.15.12 eslint: ~8.26.0 eslint-config-prettier: ~8.5.0 - eslint-define-config: ~1.8.0 + eslint-define-config: ~1.11.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~39.3.23 + eslint-plugin-jsdoc: ~39.4.0 eslint-plugin-prettier: ~4.2.1 glob: ~8.0.3 lint-staged: ~13.0.3 @@ -35,43 +36,45 @@ specifiers: react: ~18.2.0 react-dom: ~18.2.0 rimraf: ~3.0.2 - sanitize-html: ~2.7.2 + sanitize-html: ~2.7.3 semver: ~7.3.8 simple-git-hooks: ~2.8.1 standard-version: ~9.5.0 tsx: ~3.11.0 - typedoc: ~0.23.16 + typedoc: ~0.23.19 typedoc-plugin-missing-exports: ~1.0.0 typescript: ~4.8.4 validator: ~13.7.0 - vite: ~3.1.8 - vitepress: 1.0.0-alpha.21 + vite: ~3.2.1 + vitepress: 1.0.0-alpha.26 vitest: ~0.24.3 + vue: ~3.2.41 devDependencies: '@actions/github': 5.1.1 '@algolia/client-search': 4.14.2 '@types/glob': 8.0.0 '@types/markdown-it': 12.2.3 - '@types/node': 18.8.4 + '@types/node': 18.11.8 '@types/prettier': 2.7.1 - '@types/react': 18.0.21 + '@types/react': 18.0.24 '@types/sanitize-html': 2.6.2 - '@types/semver': 7.3.12 - '@types/validator': 13.7.9 - '@typescript-eslint/eslint-plugin': 5.40.1_c4zyna56jjjrggqkyejnaxjxfu - '@typescript-eslint/parser': 5.40.1_wyqvi574yv7oiwfeinomdzmc3m + '@types/semver': 7.3.13 + '@types/validator': 13.7.10 + '@typescript-eslint/eslint-plugin': 5.41.0_huremdigmcnkianavgfk3x6iou + '@typescript-eslint/parser': 5.41.0_wyqvi574yv7oiwfeinomdzmc3m '@vitest/coverage-c8': 0.24.3_@vitest+ui@0.24.3 '@vitest/ui': 0.24.3 + '@vueuse/core': 9.4.0_vue@3.2.41 c8: 7.12.0 conventional-changelog-cli: 2.2.2 - cypress: 10.10.0 + cypress: 10.11.0 esbuild: 0.15.12 eslint: 8.26.0 eslint-config-prettier: 8.5.0_eslint@8.26.0 - eslint-define-config: 1.8.0 + eslint-define-config: 1.11.0 eslint-gitignore: 0.1.0_eslint@8.26.0 - eslint-plugin-jsdoc: 39.3.23_eslint@8.26.0 + eslint-plugin-jsdoc: 39.4.0_eslint@8.26.0 eslint-plugin-prettier: 4.2.1_aniwkeyvlpmwkidetuytnokvcm glob: 8.0.3 lint-staged: 13.0.3 @@ -83,18 +86,19 @@ devDependencies: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 rimraf: 3.0.2 - sanitize-html: 2.7.2 + sanitize-html: 2.7.3 semver: 7.3.8 simple-git-hooks: 2.8.1 standard-version: 9.5.0 tsx: 3.11.0 - typedoc: 0.23.16_typescript@4.8.4 - typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.16 + typedoc: 0.23.19_typescript@4.8.4 + typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.19 typescript: 4.8.4 validator: 13.7.0 - vite: 3.1.8 - vitepress: 1.0.0-alpha.21_w6dk4dwpgdxdglls4cxrxtpqg4 + vite: 3.2.1 + vitepress: 1.0.0-alpha.26_xx3kjywz6sp4etd6h74iqxwu3u vitest: 0.24.3_@vitest+ui@0.24.3 + vue: 3.2.41 packages: @@ -115,25 +119,25 @@ packages: tunnel: 0.0.6 dev: true - /@algolia/autocomplete-core/1.7.1: - resolution: {integrity: sha512-eiZw+fxMzNQn01S8dA/hcCpoWCOCwcIIEUtHHdzN5TGB3IpzLbuhqFeTfh2OUhhgkE8Uo17+wH+QJ/wYyQmmzg==} + /@algolia/autocomplete-core/1.7.2: + resolution: {integrity: sha512-eclwUDC6qfApNnEfu1uWcL/rudQsn59tjEoUYZYE2JSXZrHLRjBUGMxiCoknobU2Pva8ejb0eRxpIYDtVVqdsw==} dependencies: - '@algolia/autocomplete-shared': 1.7.1 + '@algolia/autocomplete-shared': 1.7.2 dev: true - /@algolia/autocomplete-preset-algolia/1.7.1_qs6lk5nhygj2o3hj4sf6xnr724: - resolution: {integrity: sha512-pJwmIxeJCymU1M6cGujnaIYcY3QPOVYZOXhFkWVM7IxKzy272BwCvMFMyc5NpG/QmiObBxjo7myd060OeTNJXg==} + /@algolia/autocomplete-preset-algolia/1.7.2_qs6lk5nhygj2o3hj4sf6xnr724: + resolution: {integrity: sha512-+RYEG6B0QiGGfRb2G3MtPfyrl0dALF3cQNTWBzBX6p5o01vCCGTTinAm2UKG3tfc2CnOMAtnPLkzNZyJUpnVJw==} peerDependencies: - '@algolia/client-search': ^4.9.1 - algoliasearch: ^4.9.1 + '@algolia/client-search': '>= 4.9.1 < 6' + algoliasearch: '>= 4.9.1 < 6' dependencies: - '@algolia/autocomplete-shared': 1.7.1 + '@algolia/autocomplete-shared': 1.7.2 '@algolia/client-search': 4.14.2 algoliasearch: 4.14.2 dev: true - /@algolia/autocomplete-shared/1.7.1: - resolution: {integrity: sha512-eTmGVqY3GeyBTT8IWiB2K5EuURAqhnumfktAEoHxfDY2o7vg2rSnO16ZtIG0fMgt3py28Vwgq42/bVEuaQV7pg==} + /@algolia/autocomplete-shared/1.7.2: + resolution: {integrity: sha512-QCckjiC7xXHIUaIL3ektBtjJ0w7tTA3iqKcAE/Hjn1lZ5omp7i3Y4e09rAr9ZybqirL7AbxCLLq0Ra5DDPKeug==} dev: true /@algolia/cache-browser-local-storage/4.14.2: @@ -313,14 +317,14 @@ packages: - supports-color dev: true - /@docsearch/css/3.2.1: - resolution: {integrity: sha512-gaP6TxxwQC+K8D6TRx5WULUWKrcbzECOPA2KCVMuI+6C7dNiGUk5yXXzVhc5sld79XKYLnO9DRTI4mjXDYkh+g==} + /@docsearch/css/3.3.0: + resolution: {integrity: sha512-rODCdDtGyudLj+Va8b6w6Y85KE85bXRsps/R4Yjwt5vueXKXZQKYw0aA9knxLBT6a/bI/GMrAcmCR75KYOM6hg==} dev: true - /@docsearch/js/3.2.1_w6dk4dwpgdxdglls4cxrxtpqg4: - resolution: {integrity: sha512-H1PekEtSeS0msetR2YGGey2w7jQ2wAKfGODJvQTygSwMgUZ+2DHpzUgeDyEBIXRIfaBcoQneqrzsljM62pm6Xg==} + /@docsearch/js/3.3.0_xx3kjywz6sp4etd6h74iqxwu3u: + resolution: {integrity: sha512-oFXWRPNvPxAzBhnFJ9UCFIYZiQNc3Yrv6912nZHw/UIGxsyzKpNRZgHq8HDk1niYmOSoLKtVFcxkccpQmYGFyg==} dependencies: - '@docsearch/react': 3.2.1_w6dk4dwpgdxdglls4cxrxtpqg4 + '@docsearch/react': 3.3.0_xx3kjywz6sp4etd6h74iqxwu3u preact: 10.11.1 transitivePeerDependencies: - '@algolia/client-search' @@ -329,8 +333,8 @@ packages: - react-dom dev: true - /@docsearch/react/3.2.1_w6dk4dwpgdxdglls4cxrxtpqg4: - resolution: {integrity: sha512-EzTQ/y82s14IQC5XVestiK/kFFMe2aagoYFuTAIfIb/e+4FU7kSMKonRtLwsCiLQHmjvNQq+HO+33giJ5YVtaQ==} + /@docsearch/react/3.3.0_xx3kjywz6sp4etd6h74iqxwu3u: + resolution: {integrity: sha512-fhS5adZkae2SSdMYEMVg6pxI5a/cE+tW16ki1V0/ur4Fdok3hBRkmN/H8VvlXnxzggkQIIRIVvYPn00JPjen3A==} peerDependencies: '@types/react': '>= 16.8.0 < 19.0.0' react: '>= 16.8.0 < 19.0.0' @@ -343,10 +347,10 @@ packages: react-dom: optional: true dependencies: - '@algolia/autocomplete-core': 1.7.1 - '@algolia/autocomplete-preset-algolia': 1.7.1_qs6lk5nhygj2o3hj4sf6xnr724 - '@docsearch/css': 3.2.1 - '@types/react': 18.0.21 + '@algolia/autocomplete-core': 1.7.2 + '@algolia/autocomplete-preset-algolia': 1.7.2_qs6lk5nhygj2o3hj4sf6xnr724 + '@docsearch/css': 3.3.0 + '@types/react': 18.0.24 algoliasearch: 4.14.2 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -354,8 +358,8 @@ packages: - '@algolia/client-search' dev: true - /@es-joy/jsdoccomment/0.33.0: - resolution: {integrity: sha512-bkxMGTlHPE4vfarXt1L1fOm81O18jTRFNgh3Fm4iPKctfWxcpJw4cpth5BhLkGZy4HFzGn/KfD/zGks/J+ZIIw==} + /@es-joy/jsdoccomment/0.33.4: + resolution: {integrity: sha512-02XyYuvR/Gn+3BT6idHVNQ4SSQlA1X1FeEfeKm2ypv8ANB6Lt9KRFZ2S7y5xjwR+EPQ/Rzb0XFaD+xKyqe4ALw==} engines: {node: ^14 || ^16 || ^17 || ^18 || ^19} dependencies: comment-parser: 1.3.1 @@ -592,7 +596,7 @@ packages: resolution: {integrity: sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 18.8.4 + '@types/node': 18.11.8 dev: true /@types/istanbul-lib-coverage/2.0.4: @@ -630,8 +634,8 @@ packages: resolution: {integrity: sha512-Y6S38pFr04yb13qqHf8uk1nHE3lXgQ30WZbv1mLliV9pt0NjvqdWttLcrOYLnXbOafknVYRHZGoMSpR9UwfYow==} dev: true - /@types/node/18.8.4: - resolution: {integrity: sha512-WdlVphvfR/GJCLEMbNA8lJ0lhFNBj4SW3O+O5/cEGw9oYrv0al9zTwuQsq+myDUXgNx2jgBynoVgZ2MMJ6pbow==} + /@types/node/18.11.8: + resolution: {integrity: sha512-uGwPWlE0Hj972KkHtCDVwZ8O39GmyjfMane1Z3GUBGGnkZ2USDq7SxLpVIiIHpweY9DS0QTDH0Nw7RNBsAAZ5A==} dev: true /@types/normalize-package-data/2.4.1: @@ -646,8 +650,8 @@ packages: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true - /@types/react/18.0.21: - resolution: {integrity: sha512-7QUCOxvFgnD5Jk8ZKlUAhVcRj7GuJRjnjjiY/IUBWKgOlnvDvTMLD4RTF7NPyVmbRhNrbomZiOepg7M/2Kj1mA==} + /@types/react/18.0.24: + resolution: {integrity: sha512-wRJWT6ouziGUy+9uX0aW4YOJxAY0bG6/AOk5AW5QSvZqI7dk6VBIbXvcVgIw/W5Jrl24f77df98GEKTJGOLx7Q==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.2 @@ -664,8 +668,8 @@ packages: resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} dev: true - /@types/semver/7.3.12: - resolution: {integrity: sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==} + /@types/semver/7.3.13: + resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true /@types/sinonjs__fake-timers/8.1.1: @@ -676,24 +680,24 @@ packages: resolution: {integrity: sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==} dev: true - /@types/validator/13.7.9: - resolution: {integrity: sha512-y5KJ1PjGXPpU4CZ7lThDu31s+FqvzhqwMOR6Go/x6xaQMFjgzwfzfOvCwABsylr/5n8sB1qFQm1Vi7TaCB8P+A==} + /@types/validator/13.7.10: + resolution: {integrity: sha512-t1yxFAR2n0+VO6hd/FJ9F2uezAZVWHLmpmlJzm1eX03+H7+HsuTAp7L8QJs+2pQCfWkP1+EXsGK9Z9v7o/qPVQ==} dev: true - /@types/web-bluetooth/0.0.15: - resolution: {integrity: sha512-w7hEHXnPMEZ+4nGKl/KDRVpxkwYxYExuHOYXyzIzCDzEZ9ZCGMAewulr9IqJu2LR4N37fcnb1XVeuZ09qgOxhA==} + /@types/web-bluetooth/0.0.16: + resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} dev: true /@types/yauzl/2.10.0: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 18.8.4 + '@types/node': 18.11.8 dev: true optional: true - /@typescript-eslint/eslint-plugin/5.40.1_c4zyna56jjjrggqkyejnaxjxfu: - resolution: {integrity: sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==} + /@typescript-eslint/eslint-plugin/5.41.0_huremdigmcnkianavgfk3x6iou: + resolution: {integrity: sha512-DXUS22Y57/LAFSg3x7Vi6RNAuLpTXwxB9S2nIA7msBb/Zt8p7XqMwdpdc1IU7CkOQUPgAqR5fWvxuKCbneKGmA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -703,10 +707,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.40.1_wyqvi574yv7oiwfeinomdzmc3m - '@typescript-eslint/scope-manager': 5.40.1 - '@typescript-eslint/type-utils': 5.40.1_wyqvi574yv7oiwfeinomdzmc3m - '@typescript-eslint/utils': 5.40.1_wyqvi574yv7oiwfeinomdzmc3m + '@typescript-eslint/parser': 5.41.0_wyqvi574yv7oiwfeinomdzmc3m + '@typescript-eslint/scope-manager': 5.41.0 + '@typescript-eslint/type-utils': 5.41.0_wyqvi574yv7oiwfeinomdzmc3m + '@typescript-eslint/utils': 5.41.0_wyqvi574yv7oiwfeinomdzmc3m debug: 4.3.4 eslint: 8.26.0 ignore: 5.2.0 @@ -718,8 +722,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.40.1_wyqvi574yv7oiwfeinomdzmc3m: - resolution: {integrity: sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg==} + /@typescript-eslint/parser/5.41.0_wyqvi574yv7oiwfeinomdzmc3m: + resolution: {integrity: sha512-HQVfix4+RL5YRWZboMD1pUfFN8MpRH4laziWkkAzyO1fvNOY/uinZcvo3QiFJVS/siNHupV8E5+xSwQZrl6PZA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -728,9 +732,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.40.1 - '@typescript-eslint/types': 5.40.1 - '@typescript-eslint/typescript-estree': 5.40.1_typescript@4.8.4 + '@typescript-eslint/scope-manager': 5.41.0 + '@typescript-eslint/types': 5.41.0 + '@typescript-eslint/typescript-estree': 5.41.0_typescript@4.8.4 debug: 4.3.4 eslint: 8.26.0 typescript: 4.8.4 @@ -738,16 +742,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager/5.40.1: - resolution: {integrity: sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==} + /@typescript-eslint/scope-manager/5.41.0: + resolution: {integrity: sha512-xOxPJCnuktUkY2xoEZBKXO5DBCugFzjrVndKdUnyQr3+9aDWZReKq9MhaoVnbL+maVwWJu/N0SEtrtEUNb62QQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.40.1 - '@typescript-eslint/visitor-keys': 5.40.1 + '@typescript-eslint/types': 5.41.0 + '@typescript-eslint/visitor-keys': 5.41.0 dev: true - /@typescript-eslint/type-utils/5.40.1_wyqvi574yv7oiwfeinomdzmc3m: - resolution: {integrity: sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==} + /@typescript-eslint/type-utils/5.41.0_wyqvi574yv7oiwfeinomdzmc3m: + resolution: {integrity: sha512-L30HNvIG6A1Q0R58e4hu4h+fZqaO909UcnnPbwKiN6Rc3BUEx6ez2wgN7aC0cBfcAjZfwkzE+E2PQQ9nEuoqfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -756,8 +760,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.40.1_typescript@4.8.4 - '@typescript-eslint/utils': 5.40.1_wyqvi574yv7oiwfeinomdzmc3m + '@typescript-eslint/typescript-estree': 5.41.0_typescript@4.8.4 + '@typescript-eslint/utils': 5.41.0_wyqvi574yv7oiwfeinomdzmc3m debug: 4.3.4 eslint: 8.26.0 tsutils: 3.21.0_typescript@4.8.4 @@ -766,13 +770,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.40.1: - resolution: {integrity: sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==} + /@typescript-eslint/types/5.41.0: + resolution: {integrity: sha512-5BejraMXMC+2UjefDvrH0Fo/eLwZRV6859SXRg+FgbhA0R0l6lDqDGAQYhKbXhPN2ofk2kY5sgGyLNL907UXpA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.40.1_typescript@4.8.4: - resolution: {integrity: sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==} + /@typescript-eslint/typescript-estree/5.41.0_typescript@4.8.4: + resolution: {integrity: sha512-SlzFYRwFSvswzDSQ/zPkIWcHv8O5y42YUskko9c4ki+fV6HATsTODUPbRbcGDFYP86gaJL5xohUEytvyNNcXWg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -780,8 +784,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.40.1 - '@typescript-eslint/visitor-keys': 5.40.1 + '@typescript-eslint/types': 5.41.0 + '@typescript-eslint/visitor-keys': 5.41.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -792,17 +796,17 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.40.1_wyqvi574yv7oiwfeinomdzmc3m: - resolution: {integrity: sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==} + /@typescript-eslint/utils/5.41.0_wyqvi574yv7oiwfeinomdzmc3m: + resolution: {integrity: sha512-QlvfwaN9jaMga9EBazQ+5DDx/4sAdqDkcs05AsQHMaopluVCUyu1bTRUVKzXbgjDlrRAQrYVoi/sXJ9fmG+KLQ==} 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.12 - '@typescript-eslint/scope-manager': 5.40.1 - '@typescript-eslint/types': 5.40.1 - '@typescript-eslint/typescript-estree': 5.40.1_typescript@4.8.4 + '@types/semver': 7.3.13 + '@typescript-eslint/scope-manager': 5.41.0 + '@typescript-eslint/types': 5.41.0 + '@typescript-eslint/typescript-estree': 5.41.0_typescript@4.8.4 eslint: 8.26.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.26.0 @@ -812,23 +816,23 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.40.1: - resolution: {integrity: sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==} + /@typescript-eslint/visitor-keys/5.41.0: + resolution: {integrity: sha512-vilqeHj267v8uzzakbm13HkPMl7cbYpKVjgFWZPIOHIJHZtinvypUhJ5xBXfWYg4eFKqztbMMpOgFpT9Gfx4fw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.40.1 + '@typescript-eslint/types': 5.41.0 eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/3.1.2_vite@3.1.8+vue@3.2.40: + /@vitejs/plugin-vue/3.1.2_vite@3.2.1+vue@3.2.41: resolution: {integrity: sha512-3zxKNlvA3oNaKDYX0NBclgxTQ1xaFdL7PzwF6zj9tGFziKwmBa3Q/6XcJQxudlT81WxDjEhHmevvIC4Orc1LhQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^3.0.0 vue: ^3.2.25 dependencies: - vite: 3.1.8 - vue: 3.2.40 + vite: 3.2.1 + vue: 3.2.41 dev: true /@vitest/coverage-c8/0.24.3_@vitest+ui@0.24.3: @@ -845,6 +849,7 @@ packages: - less - sass - stylus + - sugarss - supports-color - terser dev: true @@ -855,113 +860,113 @@ packages: sirv: 2.0.2 dev: true - /@vue/compiler-core/3.2.40: - resolution: {integrity: sha512-2Dc3Stk0J/VyQ4OUr2yEC53kU28614lZS+bnrCbFSAIftBJ40g/2yQzf4mPBiFuqguMB7hyHaujdgZAQ67kZYA==} + /@vue/compiler-core/3.2.41: + resolution: {integrity: sha512-oA4mH6SA78DT+96/nsi4p9DX97PHcNROxs51lYk7gb9Z4BPKQ3Mh+BLn6CQZBw857Iuhu28BfMSRHAlPvD4vlw==} dependencies: '@babel/parser': 7.19.4 - '@vue/shared': 3.2.40 + '@vue/shared': 3.2.41 estree-walker: 2.0.2 source-map: 0.6.1 dev: true - /@vue/compiler-dom/3.2.40: - resolution: {integrity: sha512-OZCNyYVC2LQJy4H7h0o28rtk+4v+HMQygRTpmibGoG9wZyomQiS5otU7qo3Wlq5UfHDw2RFwxb9BJgKjVpjrQw==} + /@vue/compiler-dom/3.2.41: + resolution: {integrity: sha512-xe5TbbIsonjENxJsYRbDJvthzqxLNk+tb3d/c47zgREDa/PCp6/Y4gC/skM4H6PIuX5DAxm7fFJdbjjUH2QTMw==} dependencies: - '@vue/compiler-core': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/compiler-core': 3.2.41 + '@vue/shared': 3.2.41 dev: true - /@vue/compiler-sfc/3.2.40: - resolution: {integrity: sha512-tzqwniIN1fu1PDHC3CpqY/dPCfN/RN1thpBC+g69kJcrl7mbGiHKNwbA6kJ3XKKy8R6JLKqcpVugqN4HkeBFFg==} + /@vue/compiler-sfc/3.2.41: + resolution: {integrity: sha512-+1P2m5kxOeaxVmJNXnBskAn3BenbTmbxBxWOtBq3mQTCokIreuMULFantBUclP0+KnzNCMOvcnKinqQZmiOF8w==} dependencies: '@babel/parser': 7.19.4 - '@vue/compiler-core': 3.2.40 - '@vue/compiler-dom': 3.2.40 - '@vue/compiler-ssr': 3.2.40 - '@vue/reactivity-transform': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/compiler-core': 3.2.41 + '@vue/compiler-dom': 3.2.41 + '@vue/compiler-ssr': 3.2.41 + '@vue/reactivity-transform': 3.2.41 + '@vue/shared': 3.2.41 estree-walker: 2.0.2 magic-string: 0.25.9 - postcss: 8.4.17 + postcss: 8.4.18 source-map: 0.6.1 dev: true - /@vue/compiler-ssr/3.2.40: - resolution: {integrity: sha512-80cQcgasKjrPPuKcxwuCx7feq+wC6oFl5YaKSee9pV3DNq+6fmCVwEEC3vvkf/E2aI76rIJSOYHsWSEIxK74oQ==} + /@vue/compiler-ssr/3.2.41: + resolution: {integrity: sha512-Y5wPiNIiaMz/sps8+DmhaKfDm1xgj6GrH99z4gq2LQenfVQcYXmHIOBcs5qPwl7jaW3SUQWjkAPKMfQemEQZwQ==} dependencies: - '@vue/compiler-dom': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/compiler-dom': 3.2.41 + '@vue/shared': 3.2.41 dev: true - /@vue/devtools-api/6.4.4: - resolution: {integrity: sha512-Ku31WzpOV/8cruFaXaEZKF81WkNnvCSlBY4eOGtz5WMSdJvX1v1WWlSMGZeqUwPtQ27ZZz7B62erEMq8JDjcXw==} + /@vue/devtools-api/6.4.5: + resolution: {integrity: sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==} dev: true - /@vue/reactivity-transform/3.2.40: - resolution: {integrity: sha512-HQUCVwEaacq6fGEsg2NUuGKIhUveMCjOk8jGHqLXPI2w6zFoPrlQhwWEaINTv5kkZDXKEnCijAp+4gNEHG03yw==} + /@vue/reactivity-transform/3.2.41: + resolution: {integrity: sha512-mK5+BNMsL4hHi+IR3Ft/ho6Za+L3FA5j8WvreJ7XzHrqkPq8jtF/SMo7tuc9gHjLDwKZX1nP1JQOKo9IEAn54A==} dependencies: '@babel/parser': 7.19.4 - '@vue/compiler-core': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/compiler-core': 3.2.41 + '@vue/shared': 3.2.41 estree-walker: 2.0.2 magic-string: 0.25.9 dev: true - /@vue/reactivity/3.2.40: - resolution: {integrity: sha512-N9qgGLlZmtUBMHF9xDT4EkD9RdXde1Xbveb+niWMXuHVWQP5BzgRmE3SFyUBBcyayG4y1lhoz+lphGRRxxK4RA==} + /@vue/reactivity/3.2.41: + resolution: {integrity: sha512-9JvCnlj8uc5xRiQGZ28MKGjuCoPhhTwcoAdv3o31+cfGgonwdPNuvqAXLhlzu4zwqavFEG5tvaoINQEfxz+l6g==} dependencies: - '@vue/shared': 3.2.40 + '@vue/shared': 3.2.41 dev: true - /@vue/runtime-core/3.2.40: - resolution: {integrity: sha512-U1+rWf0H8xK8aBUZhnrN97yoZfHbjgw/bGUzfgKPJl69/mXDuSg8CbdBYBn6VVQdR947vWneQBFzdhasyzMUKg==} + /@vue/runtime-core/3.2.41: + resolution: {integrity: sha512-0LBBRwqnI0p4FgIkO9q2aJBBTKDSjzhnxrxHYengkAF6dMOjeAIZFDADAlcf2h3GDALWnblbeprYYpItiulSVQ==} dependencies: - '@vue/reactivity': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/reactivity': 3.2.41 + '@vue/shared': 3.2.41 dev: true - /@vue/runtime-dom/3.2.40: - resolution: {integrity: sha512-AO2HMQ+0s2+MCec8hXAhxMgWhFhOPJ/CyRXnmTJ6XIOnJFLrH5Iq3TNwvVcODGR295jy77I6dWPj+wvFoSYaww==} + /@vue/runtime-dom/3.2.41: + resolution: {integrity: sha512-U7zYuR1NVIP8BL6jmOqmapRAHovEFp7CSw4pR2FacqewXNGqZaRfHoNLQsqQvVQ8yuZNZtxSZy0FFyC70YXPpA==} dependencies: - '@vue/runtime-core': 3.2.40 - '@vue/shared': 3.2.40 + '@vue/runtime-core': 3.2.41 + '@vue/shared': 3.2.41 csstype: 2.6.21 dev: true - /@vue/server-renderer/3.2.40_vue@3.2.40: - resolution: {integrity: sha512-gtUcpRwrXOJPJ4qyBpU3EyxQa4EkV8I4f8VrDePcGCPe4O/hd0BPS7v9OgjIQob6Ap8VDz9G+mGTKazE45/95w==} + /@vue/server-renderer/3.2.41_vue@3.2.41: + resolution: {integrity: sha512-7YHLkfJdTlsZTV0ae5sPwl9Gn/EGr2hrlbcS/8naXm2CDpnKUwC68i1wGlrYAfIgYWL7vUZwk2GkYLQH5CvFig==} peerDependencies: - vue: 3.2.40 + vue: 3.2.41 dependencies: - '@vue/compiler-ssr': 3.2.40 - '@vue/shared': 3.2.40 - vue: 3.2.40 + '@vue/compiler-ssr': 3.2.41 + '@vue/shared': 3.2.41 + vue: 3.2.41 dev: true - /@vue/shared/3.2.40: - resolution: {integrity: sha512-0PLQ6RUtZM0vO3teRfzGi4ltLUO5aO+kLgwh4Um3THSR03rpQWLTuRCkuO5A41ITzwdWeKdPHtSARuPkoo5pCQ==} + /@vue/shared/3.2.41: + resolution: {integrity: sha512-W9mfWLHmJhkfAmV+7gDjcHeAWALQtgGT3JErxULl0oz6R6+3ug91I7IErs93eCFhPCZPHBs4QJS7YWEV7A3sxw==} dev: true - /@vueuse/core/9.3.0_vue@3.2.40: - resolution: {integrity: sha512-64Rna8IQDWpdrJxgitDg7yv1yTp41ZmvV8zlLEylK4QQLWAhz1OFGZDPZ8bU4lwcGgbEJ2sGi2jrdNh4LttUSQ==} + /@vueuse/core/9.4.0_vue@3.2.41: + resolution: {integrity: sha512-JzgenGj1ZF2BHOen5rsFiAyyI9sXAv7aKhNLlm9b7SwYQeKTcxTWdhudonURCSP3Egl9NQaRBzes2lv/1JUt/Q==} dependencies: - '@types/web-bluetooth': 0.0.15 - '@vueuse/metadata': 9.3.0 - '@vueuse/shared': 9.3.0_vue@3.2.40 - vue-demi: 0.13.11_vue@3.2.40 + '@types/web-bluetooth': 0.0.16 + '@vueuse/metadata': 9.4.0 + '@vueuse/shared': 9.4.0_vue@3.2.41 + vue-demi: 0.13.11_vue@3.2.41 transitivePeerDependencies: - '@vue/composition-api' - vue dev: true - /@vueuse/metadata/9.3.0: - resolution: {integrity: sha512-GnnfjbzIPJIh9ngL9s9oGU1+Hx/h5/KFqTfJykzh/1xjaHkedV9g0MASpdmPZIP+ynNhKAcEfA6g5i8KXwtoMA==} + /@vueuse/metadata/9.4.0: + resolution: {integrity: sha512-7GKMdGAsJyQJl35MYOz/RDpP0FxuiZBRDSN79QIPbdqYx4Sd0sVTnIC68KJ6Oln0t0SouvSUMvRHuno216Ud2Q==} dev: true - /@vueuse/shared/9.3.0_vue@3.2.40: - resolution: {integrity: sha512-caGUWLY0DpPC6l31KxeUy6vPVNA0yKxx81jFYLoMpyP6cF84FG5Dkf69DfSUqL57wX8JcUkJDMnQaQIZPWFEQQ==} + /@vueuse/shared/9.4.0_vue@3.2.41: + resolution: {integrity: sha512-fTuem51KwMCnqUKkI8B57qAIMcFovtGgsCtAeqxIzH3i6nE9VYge+gVfneNHAAy7lj8twbkNfqQSygOPJTm4tQ==} dependencies: - vue-demi: 0.13.11_vue@3.2.40 + vue-demi: 0.13.11_vue@3.2.41 transitivePeerDependencies: - '@vue/composition-api' - vue @@ -1640,8 +1645,8 @@ packages: resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==} dev: true - /cypress/10.10.0: - resolution: {integrity: sha512-bU8r44x1NIYAUNNXt3CwJpLOVth7HUv2hUhYCxZmgZ1IugowDvuHNpevnoZRQx1KKOEisLvIJW+Xen5Pjn41pg==} + /cypress/10.11.0: + resolution: {integrity: sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true @@ -2180,9 +2185,9 @@ packages: eslint: 8.26.0 dev: true - /eslint-define-config/1.8.0: - resolution: {integrity: sha512-YibjbNkHKMo3QAnV3bgc+BdvmYCcCpuoRdAIc+6W/P91G02ZOrCVaPrco9Uf4md25NanjkV2bnfwce8XfPRS7A==} - engines: {node: '>= 14.6.0', npm: '>= 6.0.0', pnpm: '>= 7.0.0'} + /eslint-define-config/1.11.0: + resolution: {integrity: sha512-J5xNmL5EyXJzrRCGuyr8eKia2boFnJl3Lzurrv1tpM3oxtNONlp9/HW+zRFZ6+W3U7BQDCtnLunGmyCCtFHioQ==} + 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.26.0: @@ -2199,13 +2204,13 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/39.3.23_eslint@8.26.0: - resolution: {integrity: sha512-ZwutuEmsdz8sj9fCXz4r/4x3uZ4qrB6+ca3rIyH3HHEEj5t6xgOSBWIj8IkxZkBUKvoadWHM6iCPzkmXgPHpsA==} + /eslint-plugin-jsdoc/39.4.0_eslint@8.26.0: + resolution: {integrity: sha512-2FXAmh8lpO22aqZgu6NLB6berVnYgwbZx95BmjIIQjbRNwLIAwY0dtvSJDUZVW5nflv58c1gSWQjIJ8yLZ/+fw==} engines: {node: ^14 || ^16 || ^17 || ^18 || ^19} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@es-joy/jsdoccomment': 0.33.0 + '@es-joy/jsdoccomment': 0.33.4 comment-parser: 1.3.1 debug: 4.3.4 escape-string-regexp: 4.0.0 @@ -3854,6 +3859,15 @@ packages: source-map-js: 1.0.2 dev: true + /postcss/8.4.18: + resolution: {integrity: sha512-Wi8mWhncLJm11GATDaQKobXSNEYGUHeQLiQqDFG1qQ5UTDPTEvKw0Xt5NsTpktGTwLps3ByrWsBrG0rB8YQ9oA==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.4 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + /preact/10.11.1: resolution: {integrity: sha512-1Wz5PCRm6Fg+6BTXWJHhX4wRK9MZbZBHuwBqfZlOdVm2NqPe8/rjYpufvYCwJSGb9layyzB2jTTXfpCTynLqFQ==} dev: true @@ -3900,7 +3914,7 @@ packages: dev: true /proxy-from-env/1.0.0: - resolution: {integrity: sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=} + resolution: {integrity: sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==} dev: true /psl/1.9.0: @@ -4083,8 +4097,8 @@ packages: glob: 7.2.3 dev: true - /rollup/2.78.1: - resolution: {integrity: sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==} + /rollup/2.79.1: + resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==} engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: @@ -4123,8 +4137,8 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true - /sanitize-html/2.7.2: - resolution: {integrity: sha512-DggSTe7MviO+K4YTCwprG6W1vsG+IIX67yp/QY55yQqKCJYSWzCA1rZbaXzkjoKeL9+jqwm56wD6srYLtUNivg==} + /sanitize-html/2.7.3: + resolution: {integrity: sha512-jMaHG29ak4miiJ8wgqA1849iInqORgNv7SLfSw9LtfOhEUQ1C0YHKH73R+hgyufBW9ZFeJrb057k9hjlfBCVlw==} dependencies: deepmerge: 4.2.2 escape-string-regexp: 4.0.0 @@ -4186,6 +4200,14 @@ packages: resolution: {integrity: sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==} dev: true + /shiki-processor/0.1.0_shiki@0.11.1: + resolution: {integrity: sha512-7ty3VouP7AQMlERKeiobVeyhjUW6rPMM1b+xFcFF/XwhkN4//Fg9Ju6hPfIOvO4ztylkbLqYufbJmLJmw7SfQA==} + peerDependencies: + shiki: ^0.11.1 + dependencies: + shiki: 0.11.1 + dev: true + /shiki/0.11.1: resolution: {integrity: sha512-EugY9VASFuDqOexOgXR18ZV+TbFrQHeCpEYaXamO+SZlsnT/2LxuLBX25GGtIrwaEVFXUAbUQ601SWE2rMwWHA==} dependencies: @@ -4673,16 +4695,16 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: true - /typedoc-plugin-missing-exports/1.0.0_typedoc@0.23.16: + /typedoc-plugin-missing-exports/1.0.0_typedoc@0.23.19: resolution: {integrity: sha512-7s6znXnuAj1eD9KYPyzVzR1lBF5nwAY8IKccP5sdoO9crG4lpd16RoFpLsh2PccJM+I2NASpr0+/NMka6ThwVA==} peerDependencies: typedoc: 0.22.x || 0.23.x dependencies: - typedoc: 0.23.16_typescript@4.8.4 + typedoc: 0.23.19_typescript@4.8.4 dev: true - /typedoc/0.23.16_typescript@4.8.4: - resolution: {integrity: sha512-rumYsCeNRXlyuZVzefD7050n7ptL2uudsCJg50dY0v/stKniqIlRpvx/F/6expC0/Q6Dbab+g/JpZuB7Sw90FA==} + /typedoc/0.23.19_typescript@4.8.4: + resolution: {integrity: sha512-70jPL0GQnSJtgQqI7ifOWxpTXrB3sxc4SWPPRn3K0wdx3txI6ZIT/ZYMF39dNg2Gjmql45cO+cAKXJp0TpqOVA==} engines: {node: '>= 14.14'} hasBin: true peerDependencies: @@ -4775,7 +4797,7 @@ packages: dev: true /verror/1.10.0: - resolution: {integrity: sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=} + resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} dependencies: assert-plus: 1.0.0 @@ -4783,14 +4805,15 @@ packages: extsprintf: 1.3.0 dev: true - /vite/3.1.8: - resolution: {integrity: sha512-m7jJe3nufUbuOfotkntGFupinL/fmuTNuQmiVE7cH2IZMuf4UbfbGYMUT3jVWgGYuRVLY9j8NnrRqgw5rr5QTg==} + /vite/3.2.1: + resolution: {integrity: sha512-ADtMkfHuWq4tskJsri2n2FZkORO8ZyhI+zIz7zTrDAgDEtct1jdxOg3YsZBfHhKjmMoWLOSCr+64qrEDGo/DbQ==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: less: '*' sass: '*' stylus: '*' + sugarss: '*' terser: ^5.4.0 peerDependenciesMeta: less: @@ -4799,30 +4822,33 @@ packages: optional: true stylus: optional: true + sugarss: + optional: true terser: optional: true dependencies: esbuild: 0.15.12 - postcss: 8.4.17 + postcss: 8.4.18 resolve: 1.22.1 - rollup: 2.78.1 + rollup: 2.79.1 optionalDependencies: fsevents: 2.3.2 dev: true - /vitepress/1.0.0-alpha.21_w6dk4dwpgdxdglls4cxrxtpqg4: - resolution: {integrity: sha512-D/tkoDW16uUZ9pnWd28Kk1vX26zNiTml3m9oGbfx2pAfYg99PHd1GceZyEm4jZsJU0+n9S++1ctFxoQvsq376A==} + /vitepress/1.0.0-alpha.26_xx3kjywz6sp4etd6h74iqxwu3u: + resolution: {integrity: sha512-XpDpflrdmyBmUQrg06q29Mhez144NvoZ48pRvNhANy/wV7E7XJ1zenQROOSADnOsAlhV1gzcNjqiFNObCk7l8A==} hasBin: true dependencies: - '@docsearch/css': 3.2.1 - '@docsearch/js': 3.2.1_w6dk4dwpgdxdglls4cxrxtpqg4 - '@vitejs/plugin-vue': 3.1.2_vite@3.1.8+vue@3.2.40 - '@vue/devtools-api': 6.4.4 - '@vueuse/core': 9.3.0_vue@3.2.40 + '@docsearch/css': 3.3.0 + '@docsearch/js': 3.3.0_xx3kjywz6sp4etd6h74iqxwu3u + '@vitejs/plugin-vue': 3.1.2_vite@3.2.1+vue@3.2.41 + '@vue/devtools-api': 6.4.5 + '@vueuse/core': 9.4.0_vue@3.2.41 body-scroll-lock: 4.0.0-beta.0 shiki: 0.11.1 - vite: 3.1.8 - vue: 3.2.40 + shiki-processor: 0.1.0_shiki@0.11.1 + vite: 3.2.1 + vue: 3.2.41 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -4832,6 +4858,7 @@ packages: - react-dom - sass - stylus + - sugarss - terser dev: true @@ -4859,7 +4886,7 @@ packages: dependencies: '@types/chai': 4.3.3 '@types/chai-subset': 1.3.3 - '@types/node': 18.8.4 + '@types/node': 18.11.8 '@vitest/ui': 0.24.3 chai: 4.3.6 debug: 4.3.4 @@ -4868,11 +4895,12 @@ packages: tinybench: 2.3.0 tinypool: 0.3.0 tinyspy: 1.0.2 - vite: 3.1.8 + vite: 3.2.1 transitivePeerDependencies: - less - sass - stylus + - sugarss - supports-color - terser dev: true @@ -4885,7 +4913,7 @@ packages: resolution: {integrity: sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ==} dev: true - /vue-demi/0.13.11_vue@3.2.40: + /vue-demi/0.13.11_vue@3.2.41: resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==} engines: {node: '>=12'} hasBin: true @@ -4897,17 +4925,17 @@ packages: '@vue/composition-api': optional: true dependencies: - vue: 3.2.40 + vue: 3.2.41 dev: true - /vue/3.2.40: - resolution: {integrity: sha512-1mGHulzUbl2Nk3pfvI5aXYYyJUs1nm4kyvuz38u4xlQkLUn1i2R7nDbI4TufECmY8v1qNBHYy62bCaM+3cHP2A==} + /vue/3.2.41: + resolution: {integrity: sha512-uuuvnrDXEeZ9VUPljgHkqB5IaVO8SxhPpqF2eWOukVrBnRBx2THPSGQBnVRt0GrIG1gvCmFXMGbd7FqcT1ixNQ==} dependencies: - '@vue/compiler-dom': 3.2.40 - '@vue/compiler-sfc': 3.2.40 - '@vue/runtime-dom': 3.2.40 - '@vue/server-renderer': 3.2.40_vue@3.2.40 - '@vue/shared': 3.2.40 + '@vue/compiler-dom': 3.2.41 + '@vue/compiler-sfc': 3.2.41 + '@vue/runtime-dom': 3.2.41 + '@vue/server-renderer': 3.2.41_vue@3.2.41 + '@vue/shared': 3.2.41 dev: true /webidl-conversions/3.0.1: diff --git a/scripts/bundle.ts b/scripts/bundle.ts index 3b72941a828..a94d31830b9 100644 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -7,7 +7,7 @@ console.log('Building dist for node (cjs)...'); // Generate entry-points for cjs compatibility const localeDir = 'locale'; -const target = ['ES2019', 'node14.6']; +const target = ['ES2019', 'node14.17']; if (existsSync(localeDir)) { rmSync(localeDir, { recursive: true, force: true }); diff --git a/src/faker.ts b/src/faker.ts index f8a46511882..fd7ed5223a2 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -1,7 +1,8 @@ import type { LocaleDefinition } from './definitions'; import { FakerError } from './errors/faker-error'; import { deprecated } from './internal/deprecated'; -import { MersenneModule } from './internal/mersenne/mersenne'; +import type { Mersenne } from './internal/mersenne/mersenne'; +import mersenne from './internal/mersenne/mersenne'; import type { KnownLocale } from './locales'; import { AnimalModule } from './modules/animal'; import { ColorModule } from './modules/color'; @@ -79,7 +80,7 @@ export class Faker { readonly definitions: LocaleDefinition = this.initDefinitions(); /** @internal */ - private readonly _mersenne: MersenneModule = new MersenneModule(); + private readonly _mersenne: Mersenne = mersenne(); readonly random: RandomModule = new RandomModule(this); @@ -286,11 +287,7 @@ export class Faker { seed( seed: number | number[] = Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER) ): number | number[] { - if (Array.isArray(seed) && seed.length) { - this._mersenne.seed_array(seed); - } else if (!Array.isArray(seed) && !isNaN(seed)) { - this._mersenne.seed(seed); - } + this._mersenne.seed(seed); return seed; } diff --git a/src/internal/mersenne/mersenne.ts b/src/internal/mersenne/mersenne.ts index 16019e2925a..e7c0355ce4f 100644 --- a/src/internal/mersenne/mersenne.ts +++ b/src/internal/mersenne/mersenne.ts @@ -1,81 +1,49 @@ -import { FakerError } from '../../errors/faker-error'; -import Gen from './twister'; +import Twister from './twister'; /** - * Module to generate seed based random numbers. + * Generate seed based random numbers. * * @internal */ -export class MersenneModule { - private gen = new Gen(); - - constructor() { - this.gen.initGenrand(Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER)); - - // Bind `this` so namespaced is working correctly - for (const name of Object.getOwnPropertyNames(MersenneModule.prototype)) { - if (name === 'constructor' || typeof this[name] !== 'function') { - continue; - } - this[name] = this[name].bind(this); - } - } - +export interface Mersenne { /** - * Generates a random number between `[min, max)`. - * - * @param max The maximum number. Defaults to `32768`. - * @param min The minimum number. Defaults to `0`. + * Generates a random number between `[min, max)`. The result is already floored. * - * @example - * faker.mersenne.rand() // 15515 - * faker.mersenne.rand(1000, 500) // 578 - * - * @since 5.5.0 + * @param options The options to generate a random number. + * @param options.min The minimum number. + * @param options.max The maximum number. */ - rand(max = 32768, min = 0): number { - if (min > max) { - const temp = min; - min = max; - max = temp; - } - - return Math.floor(this.gen.genrandReal2() * (max - min) + min); - } + next(options: { max: number; min: number }): number; /** * Sets the seed to use. * - * @param S The seed to use. - * @throws If the seed is not a `number`. - * - * @since 5.5.0 + * @param seed The seed to use. */ - seed(S: number): void { - if (typeof S !== 'number') { - throw new FakerError( - `seed(S) must take numeric argument; is ${typeof S}` - ); - } + seed(seed: number | number[]): void; +} + +/** + * Generate seed based random numbers. + * + * @internal + */ +export default function mersenne(): Mersenne { + const twister = new Twister(); - this.gen.initGenrand(S); - } + twister.initGenrand(Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER)); - /** - * Sets the seed to use. - * - * @param A The seed to use. - * @throws If the seed is not a `number[]`. - * - * @since 5.5.0 - */ - seed_array(A: number[]): void { - if (typeof A !== 'object') { - throw new FakerError( - `seed_array(A) must take array of numbers; is ${typeof A}` - ); - } + return { + next({ min, max }): number { + return Math.floor(twister.genrandReal2() * (max - min) + min); + }, - this.gen.initByArray(A, A.length); - } + seed(seed: number | number[]): void { + if (typeof seed === 'number') { + twister.initGenrand(seed); + } else if (Array.isArray(seed)) { + twister.initByArray(seed, seed.length); + } + }, + }; } diff --git a/src/locales/ko/color/human.ts b/src/locales/ko/color/human.ts new file mode 100644 index 00000000000..49d2012ac47 --- /dev/null +++ b/src/locales/ko/color/human.ts @@ -0,0 +1,27 @@ +export default [ + '검은색', + 'κΈˆμƒ‰', + 'λ‚œμ΄ˆμƒ‰', + 'λ…Έλž€μƒ‰', + 'λΌμž„μƒ‰', + 'λ§ˆμ  νƒ€', + 'λ―ΌνŠΈμƒ‰', + '뢄홍색', + '빨간색', + '상아색', + '연보라색', + '연어색', + 'μ˜₯색', + '올리브', + '은색', + 'μžλ‘μƒ‰', + 'μžμ£Όμƒ‰', + 'μ κ°ˆμƒ‰', + '주황색', + '청둝색', + 'μ΄ˆλ‘μƒ‰', + 'ν‘Έλ₯Έμƒ‰', + 'ν•˜λŠ˜μƒ‰', + 'ν•˜μ–€μƒ‰', + 'νšŒμƒ‰', +]; diff --git a/src/locales/ko/color/index.ts b/src/locales/ko/color/index.ts new file mode 100644 index 00000000000..79cc39f02f3 --- /dev/null +++ b/src/locales/ko/color/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { ColorDefinitions } from '../../..'; +import human from './human'; + +const color: ColorDefinitions = { + human, +}; + +export default color; diff --git a/src/locales/ko/company/suffix.ts b/src/locales/ko/company/suffix.ts index 10b29c85334..c7523d1df67 100644 --- a/src/locales/ko/company/suffix.ts +++ b/src/locales/ko/company/suffix.ts @@ -1 +1,12 @@ -export default ['μ—°κ΅¬μ†Œ', 'κ²Œμž„μ¦ˆ', 'κ·Έλ£Ή', 'μ „μž', 'λ¬Όμ‚°', '코리아']; +export default [ + 'μ—°κ΅¬μ†Œ', + 'κ²Œμž„μ¦ˆ', + 'κ·Έλ£Ή', + 'μ „μž', + 'λ¬Όμ‚°', + '코리아', + '곡사', + '증ꢌ', + '은행', + '쀑곡업', +]; diff --git a/src/locales/ko/date/index.ts b/src/locales/ko/date/index.ts new file mode 100644 index 00000000000..cd296b42a45 --- /dev/null +++ b/src/locales/ko/date/index.ts @@ -0,0 +1,14 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { DateDefinitions } from '../../..'; +import month from './month'; +import weekday from './weekday'; + +const date: DateDefinitions = { + month, + weekday, +}; + +export default date; diff --git a/src/locales/ko/date/month.ts b/src/locales/ko/date/month.ts new file mode 100644 index 00000000000..c5ba13e56a9 --- /dev/null +++ b/src/locales/ko/date/month.ts @@ -0,0 +1,36 @@ +export default { + wide: [ + '1μ›”', + '2μ›”', + '3μ›”', + '4μ›”', + '5μ›”', + '6μ›”', + '7μ›”', + '8μ›”', + '9μ›”', + '10μ›”', + '11μ›”', + '12μ›”', + ], + // Property "wide_context" is optional, if not set then "wide" will be used instead + // It is used to specify a word in context, which may differ from a stand-alone word + // wide_context: [], + abbr: [ + '1μ›”', + '2μ›”', + '3μ›”', + '4μ›”', + '5μ›”', + '6μ›”', + '7μ›”', + '8μ›”', + '9μ›”', + '10μ›”', + '11μ›”', + '12μ›”', + ], + // Property "abbr_context" is optional, if not set then "abbr" will be used instead + // It is used to specify a word in context, which may differ from a stand-alone word + // abbr_context: [], +}; diff --git a/src/locales/ko/date/weekday.ts b/src/locales/ko/date/weekday.ts new file mode 100644 index 00000000000..ad46f425754 --- /dev/null +++ b/src/locales/ko/date/weekday.ts @@ -0,0 +1,10 @@ +export default { + wide: ['μΌμš”μΌ', 'μ›”μš”μΌ', 'ν™”μš”μΌ', 'μˆ˜μš”μΌ', 'λͺ©μš”일', 'κΈˆμš”μΌ', 'ν† μš”μΌ'], + // Property "wide_context" is optional, if not set then "wide" will be used instead + // It is used to specify a word in context, which may differ from a stand-alone word + // wide_context: [], + abbr: ['일', 'μ›”', 'ν™”', '수', 'λͺ©', '금', 'ν† '], + // Property "abbr_context" is optional, if not set then "abbr" will be used instead + // It is used to specify a word in context, which may differ from a stand-alone word + // abbr_context: [], +}; diff --git a/src/locales/ko/index.ts b/src/locales/ko/index.ts index 47bc6286da5..05aacdf0ca5 100644 --- a/src/locales/ko/index.ts +++ b/src/locales/ko/index.ts @@ -3,21 +3,27 @@ * Run 'pnpm run generate:locales' to update. */ import type { LocaleDefinition } from '../..'; +import color from './color'; import company from './company'; +import date from './date'; import internet from './internet'; import location from './location'; import lorem from './lorem'; import person from './person'; import phone_number from './phone_number'; +import word from './word'; const ko: LocaleDefinition = { title: 'Korean', + color, company, + date, internet, location, lorem, person, phone_number, + word, }; export default ko; diff --git a/src/locales/ko/location/index.ts b/src/locales/ko/location/index.ts index 1a954b76598..3d3789970c1 100644 --- a/src/locales/ko/location/index.ts +++ b/src/locales/ko/location/index.ts @@ -7,6 +7,7 @@ import city from './city'; import city_name from './city_name'; import city_suffix from './city_suffix'; import postcode from './postcode'; +import secondary_address from './secondary_address'; import state from './state'; import state_abbr from './state_abbr'; import street from './street'; @@ -18,6 +19,7 @@ const location: LocationDefinitions = { city_name, city_suffix, postcode, + secondary_address, state, state_abbr, street, diff --git a/src/locales/ko/location/secondary_address.ts b/src/locales/ko/location/secondary_address.ts new file mode 100644 index 00000000000..bd9383b1b86 --- /dev/null +++ b/src/locales/ko/location/secondary_address.ts @@ -0,0 +1 @@ +export default ['μ•„νŒŒνŠΈ ###동', '###호']; diff --git a/src/locales/ko/word/adjective.ts b/src/locales/ko/word/adjective.ts new file mode 100644 index 00000000000..00e16a3d461 --- /dev/null +++ b/src/locales/ko/word/adjective.ts @@ -0,0 +1,207 @@ +export default [ + '감정적인', + '같은', + 'κ±°λŒ€ν•œ', + 'κ±°μ°½ν•œ', + 'κ±΄μ‘°ν•œ', + '겁 μ—†λŠ”', + 'κ²©λ ¬ν•œ', + '결정적인', + 'κ²½μ†”ν•œ', + 'κ²½ν—˜ν•œ', + 'κ³ κ·€ν•œ', + 'κ³ κΈ‰μ˜', + 'κ³ λŒ€μ˜', + 'κ³΅μ •ν•œ', + '관심 μžˆλŠ”', + 'ꡉμž₯ν•œ', + 'ꡐ양 μžˆλŠ”', + 'κ΅μœ‘λ°›μ€', + 'κ΅ν™œν•œ', + 'κ΅¬λΆ€λŸ¬μ§„', + '꡴곑진', + 'ꡡ은', + 'κΆŒμœ„ μžˆλŠ”', + 'κ·€μ—¬μš΄', + '극적인', + '금발의', + 'κΈ°λ―Όν•œ', + 'κΈ°λΆ„ 쒋은', + '기쁜', + '기초적인', + 'κΉŠμ€', + 'κΉ¨λ—ν•œ', + '깨진', + 'λŠμž„μ—†λŠ”', + 'λ”μ°ν•œ', + 'λ‚˜μœ', + 'λ‚ μ”¬ν•œ', + 'λƒ‰λ‹΄ν•œ', + '넓은 λ§ˆμŒμ„ 가진', + 'λ†€λΌμš΄', + 'λˆˆλΆ€μ‹ ', + '눈이 λ¨Ό', + 'λŠ™μ€', + 'λŠ₯μˆ™ν•œ', + 'λ‹€λ₯Έ', + 'λ‹¨μ‘°λ‘œμš΄', + 'λ‹¨ν˜Έν•œ', + 'λ‹«νžŒ', + 'λ‹Ήν™©μŠ€λŸ¬μš΄', + 'λŒ€λ‹΄ν•œ', + 'λŒ€λŸ‰', + 'λ”λŸ¬μš΄', + '동꡴ 같은', + 'λ‘λ €μš΄', + 'λ›°μ–΄λ‚œ', + '마λ₯Έ', + 'λ§‰λŒ€ν•œ', + 'λ§›μžˆλŠ”', + '맀λ ₯적인', + '맀혹적인', + '먹을 수 μžˆλŠ”', + 'λ¨Ό', + '멍든', + 'λ©”λ§ˆλ₯Έ', + 'λͺ…ν™•ν•œ', + 'λͺ¨λ²”적인', + 'λ¬΄λ”μš΄', + 'λ¬΄μ„œμš΄', + 'λ¬΄μ‹¬ν•œ', + '미친', + 'λ°€μ§‘ν•œ', + '밝은', + 'λ°©μ–΄', + '방음', + '버렀진', + 'λ³„κ°œμ˜', + 'λ³΅μž‘ν•œ', + 'λΆ€λ„λŸ¬μš΄', + 'λΆ€λ‹΄μŠ€λŸ¬μš΄', + 'λΆ€λ“œλŸ¬μš΄', + 'λΆ€λŸ¬μ›Œν•˜λŠ”', + 'λΆ€μ •ν•œ', + 'λΆ€μ‘±ν•œ', + 'λΆ„λͺ…ν•œ', + 'λΆ„μ£Όν•œ', + 'λΆˆκ²°ν•œ', + 'λΆˆλ£©ν•œ', + 'λΆˆμ•ˆν•œ', + 'λΆˆμΆ©μ‹€ν•œ', + 'λΆλΉ„λŠ”', + 'λΉ„λš€μ–΄μ§„', + 'λΉ„μ‹Ό', + 'λΉ„μ–΄ μžˆλŠ”', + 'λΉ„μ°Έν•œ', + 'λΉ λ₯Έ', + 'μ‚¬λž‘μŠ€λŸ¬μš΄', + 'μ‚¬λž‘ν•˜λŠ”', + '사렀 κΉŠμ€', + 'μ‚¬μ•…ν•œ', + 'μ‚΄μ•„ μžˆλŠ”', + 'μƒμ„Έν•œ', + 'μƒμΎŒν•œ', + '생기 μžˆλŠ”', + '생뢄해성', + 'μ„±μ‹€ν•œ', + 'μ„Έλ ¨λœ', + 'μ†Œλ¦„ λΌμΉ˜λŠ”', + 'μ†”μ§ν•œ', + 'μˆœμˆ˜ν•œ', + 'μ‰¬μš΄', + 'μŠ΅ν•œ', + 'μ‹œμ›ν•œ', + 'μ‹ λ‚˜λŠ”', + 'μ‹ λ’°ν•  수 μžˆλŠ”', + 'μ‹Ό', + 'μ•„λ¦„λ‹€μš΄', + 'μ•Œκ³  μžˆλŠ”', + 'μ•½κ°„μ˜', + 'μ–΄λŠ', + 'μ–΄λ‘μš΄', + 'μ–΄λ €μš΄', + '어리석은', + 'μ–΄μƒ‰ν•œ', + 'μ–΄μ„€ν”ˆ', + 'μ–΄μ§€λŸ¬μš΄', + 'μ–΅μ„Ό', + 'μ—„μ²­λ‚œ', + 'μ—­κ²¨μš΄', + 'μ—΄μ‹¬νžˆ', + 'μ˜λ¦¬ν•œ', + '예술적인', + '예의 λ°”λ₯Έ', + 'μ˜¨ν™”ν•œ', + 'μ™„λ²½ν•œ', + 'μ™Έν–₯적인', + 'μš©κ°ν•œ', + '용기 μžˆλŠ”', + 'μš°μ•„ν•œ', + 'μ›ν†΅ν˜•', + 'μœ„λ…ν•œ', + 'μœ™μœ™', + 'μœ λ¦¬ν•œ', + '유λͺ…ν•œ', + 'μœ μ΅ν•œ', + 'μœ μΉ˜ν•œ', + '윀리적', + 'μŒμΉ¨ν•œ', + '의기 μ–‘μ–‘ν•œ', + 'μ˜μ‹ν•˜λŠ”', + '이ꡭ적인', + '이타적인', + '인기 λ§Žμ€', + '인정 λ§Žμ€', + '일찍', + 'μžμ‹  μžˆλŠ”', + 'μž”ν˜Ήν•œ', + 'μ €λͺ…ν•œ', + '저주받은', + '적극적인', + 'μ μ ˆν•œ', + '전톡적인', + 'μ Šμ€', + 'μ •κ΅ν•œ', + 'μ •ν†΅ν•œ', + 'μ •ν™•ν•œ', + 'μ‘°μž‘ν•œ', + 'μ‘΄κ²½ν•˜λŠ”', + '주의 κΉŠμ€', + '죽은', + '즐거운', + 'μ§€λ£¨ν•œ', + 'μ§„μ§€ν•œ', + '짧은', + 'μ°¨κ°€μš΄', + '창의적인', + 'μ² μ €ν•œ', + 'μΆ”μš΄', + 'μΆ©μ‹€ν•œ', + '치λͺ…적인', + 'μΉœμˆ™ν•œ', + 'μΉœμ ˆν•œ', + 'μΉ¨μ°©ν•œ', + 'μΎŒν™œν•œ', + '큰', + 'νƒ€μ›ν˜•μ˜', + '탄λ ₯ μžˆλŠ”', + 'νƒˆμ§„ν•œ', + 'νƒμš•μŠ€λŸ¬μš΄', + 'ν†΅ν†΅ν•œ', + 'νŽΈμ•ˆν•œ', + 'ν’ˆμœ„ μžˆλŠ”', + 'ν’λΆ€ν•œ', + 'ν•„μˆ˜μ μΈ', + 'ν–‰λ³΅ν•œ', + 'ν–₯κΈ‹ν•œ', + 'ν˜Όλž€μŠ€λŸ¬μš΄', + 'ν™”λ‚œ', + 'ν™”λ €ν•œ', + 'ν™˜μƒμ ', + 'ν™œλ™μ μΈ', + 'ν™œλ°œν•œ', + 'ν›Œλ₯­ν•œ', + 'ν”ν•œ', + 'ν₯λΆ„ν•œ', + 'ν¬λ―Έν•œ', +]; diff --git a/src/locales/ko/word/adverb.ts b/src/locales/ko/word/adverb.ts new file mode 100644 index 00000000000..6421274aefe --- /dev/null +++ b/src/locales/ko/word/adverb.ts @@ -0,0 +1,47 @@ +export default [ + 'κ°„λ‹¨νžˆ', + '거꾸둜', + 'κ±°λ§Œν•˜κ²Œ', + '거의', + 'κ³ μš”νžˆ', + '고의둜', + 'κ·Ήμ§„νžˆ', + '깊이', + 'λ‚˜μ€‘μ—', + 'λ…Έν•˜μ—¬', + 'λ‹€μ†Œ', + 'λ‹€μ±„λ‘­κ²Œ', + 'λŒ€λ‹΄ν•˜κ²Œ', + 'λŒ€μ²΄λ‘œ', + 'λ„μ „μ μœΌλ‘œ', + 'λ˜‘λ˜‘ν•˜κ²Œ', + '마ꡬ', + 'λ§Ήλͺ©μ μœΌλ‘œ', + 'λ©΄λ°€νžˆ', + 'λͺ…λž‘ν•˜κ²Œ', + 'λͺΉμ‹œ', + 'λ°”λ₯΄κ²Œ', + 'λ°”μ˜κ²Œ', + '밝게', + 'λΆ„λͺ…νžˆ', + 'λΉ„μ •μƒμ μœΌλ‘œ', + 'λΉ λ₯΄κ²Œ', + 'μ‹¬ν•˜κ²Œ', + 'μ•„λ¦„λ‹΅κ²Œ', + 'μ–΄μƒ‰ν•˜κ²Œ', + 'μ–Έμ œλ‚˜', + 'μ—΄μ‹¬νžˆ', + 'μš©κ°ν•˜κ²Œ', + 'μš°μ—°νžˆ', + '유감슀럽게', + 'μ˜μ‹¬μŠ€λŸ½κ²Œ', + 'μžλž‘μŠ€λŸ½κ²Œ', + 'μž”μΈν•˜κ²Œ', + '즐겁게', + 'μ§€μ†μ μœΌλ‘œ', + 'μ²œν•˜κ²Œ', + 'μΏ¨ν•˜κ²Œ', + 'ν–‰λ³΅ν•˜κ²Œ', + 'ν₯미둭게', + 'ν¬λ―Έν•˜κ²Œ', +]; diff --git a/src/locales/ko/word/index.ts b/src/locales/ko/word/index.ts new file mode 100644 index 00000000000..fe65880a4b8 --- /dev/null +++ b/src/locales/ko/word/index.ts @@ -0,0 +1,16 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { WordDefinitions } from '../../..'; +import adjective from './adjective'; +import adverb from './adverb'; +import noun from './noun'; + +const word: WordDefinitions = { + adjective, + adverb, + noun, +}; + +export default word; diff --git a/src/locales/ko/word/noun.ts b/src/locales/ko/word/noun.ts new file mode 100644 index 00000000000..e2caa2bf199 --- /dev/null +++ b/src/locales/ko/word/noun.ts @@ -0,0 +1,111 @@ +export default [ + 'κ°€μž…', + '경보', + 'κ³ λ‡Œ', + '고도', + 'κ³ λ¬Έ', + '골λͺ©', + '곡ꡰ', + '곡기', + '곡적', + '곡항', + '관리', + 'κ΄€λ¦¬μž', + 'κ΄‘κ³ ', + 'ꡬ급차', + 'ꡬ싀', + 'λ‚˜μ΄', + 'λ‚΄μ„Έ', + 'λ†€λžŒ', + '농업', + '달λ ₯', + 'λŒ€μ‚¬', + 'λŒ€μˆ˜ν•™', + 'λŒ€μ•ˆ', + 'λŒ€ν–‰μ‚¬', + '도토리', + '동맹', + 'λ™μž‘', + 'λ¬΄μ •λΆ€μ£Όμ˜μž', + '반침', + 'λ°°λ‹Ή', + '배우', + 'λ³€κ²½', + '별λͺ…', + '보적', + 'λ³΄μ’Œκ΄€', + '뢀사', + '뢄석', + 'λΆ„μ„μž', + 'λΆ„μœ„κΈ°', + 'λΆˆμŒν•œ', + 'λΉ„ν–‰κΈ°', + '비행사', + 'λΉ„ν–‰μ„ ', + 'λΉ„ν–‰μž₯', + '성인', + 'μ„±μ·¨', + 'μ„±μ·¨μž', + '쇠뢙이', + '술', + '승인', + 'μ•„λ“œλ ˆλ‚ λ¦°', + 'μ•„λ§ˆμ‘΄', + 'μ•„λͺ¬λ“œ', + 'μ•…μ–΄', + 'μ•ˆκ±΄', + 'μ•ŒνŒŒλ²³', + 'μ•ŒνŒŒμΉ΄', + 'μ• ν”„ν„°μ…°μ΄λΈŒ', + '앨범', + 'μ–‘', + 'μ–‘μž', + 'μ–΄λŒ‘ν„°', + '에어백', + 'μ—μ΄μ „νŠΈ', + '에일', + 'μ—¬λ°°μš°', + '여진', + 'μ—¬νŒŒ', + 'μ—°μ‚°', + '예의', + 'μ˜€ν›„', + '옹호', + '외계인', + '용돈', + 'μœ μ—°', + 'μœ μΆ”', + '음ν–₯ν•™', + '응집', + '이점', + '일', + '적응', + 'μ „λŠ₯자', + '전진', + 'μ œλ‹¨', + 'μ‘°μ–Έ', + 'μ‘°μ •', + 'μ£Όμ†Œ', + '즐거움', + '지원', + '진보', + 'μ§„μˆ ', + 'μ§„μˆ μ„œ', + 'μΆœν˜„', + '침랡', + '탄약', + '탐닉', + 'νŠΉμ‚¬', + 'ν•©κΈˆ', + 'ν•©μ˜', + '항곡기', + 'ν•­κ³΅λ£Œ', + 'ν•­κ³΅νŽΈ', + '해석학', + '행동', + 'ν˜•μš©μ‚¬', + 'ν˜Έλ°•μƒ‰', + 'ν™œλ™', + 'ν™œλ™κ°€', + 'ν™œμ„±ν™”', +]; diff --git a/src/modules/datatype/index.ts b/src/modules/datatype/index.ts index 1d48de4703d..185dcb8c82f 100644 --- a/src/modules/datatype/index.ts +++ b/src/modules/datatype/index.ts @@ -1,7 +1,7 @@ import type { Faker } from '../..'; import { FakerError } from '../../errors/faker-error'; import { deprecated } from '../../internal/deprecated'; -import type { MersenneModule } from '../../internal/mersenne/mersenne'; +import type { Mersenne } from '../../internal/mersenne/mersenne'; /** * Module to generate various primitive values and data types. @@ -56,13 +56,14 @@ export class DatatypeModule { throw new FakerError(`Max ${max} should be greater than min ${min}.`); } - const mersenne: MersenneModule = + const mersenne: Mersenne = // @ts-expect-error: access private member field this.faker._mersenne; - const randomNumber = Math.floor( - mersenne.rand(max / precision + 1, min / precision) - ); + const randomNumber = mersenne.next({ + min: min / precision, + max: max / precision + 1, + }); // Workaround problem in float point arithmetics for e.g. 6681493 / 0.01 return randomNumber / (1 / precision); diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts index 1c7e85cc44b..60e3ac55a46 100644 --- a/src/modules/internet/index.ts +++ b/src/modules/internet/index.ts @@ -20,6 +20,8 @@ export type HTTPStatusCodeType = | 'serverError' | 'redirection'; +export type HTTPProtocolType = 'http' | 'https'; + /** * Module to generate internet related entries. */ @@ -226,15 +228,28 @@ export class InternetModule { } /** - * Generates a random url. + * Generates a random http(s) url. + * + * @param options Optional options object. + * @param options.appendSlash Whether to append a slash to the end of the url (path). Defaults to a random boolean value. + * @param options.protocol The protocol to use. Defaults to `'https'`. * * @example * faker.internet.url() // 'https://remarkable-hackwork.info' + * faker.internet.url({ appendSlash: true }) // 'https://slow-timer.info/' + * faker.internet.url({ protocol: 'http', appendSlash: false }) // 'http://www.terrible-idea.com' * * @since 2.1.5 */ - url(): string { - return `${this.protocol()}://${this.domainName()}`; + url( + options: { + appendSlash?: boolean; + protocol?: HTTPProtocolType; + } = {} + ): string { + const { appendSlash = this.faker.datatype.boolean(), protocol = 'https' } = + options; + return `${protocol}://${this.domainName()}${appendSlash ? '/' : ''}`; } /** diff --git a/test/__snapshots__/internet.spec.ts.snap b/test/__snapshots__/internet.spec.ts.snap index a5ec46f2b1d..a4ea2714397 100644 --- a/test/__snapshots__/internet.spec.ts.snap +++ b/test/__snapshots__/internet.spec.ts.snap @@ -52,7 +52,11 @@ exports[`internet > 42 > port 1`] = `24545`; exports[`internet > 42 > protocol 1`] = `"http"`; -exports[`internet > 42 > url 1`] = `"http://staid-veil.biz"`; +exports[`internet > 42 > url > noArgs 1`] = `"https://staid-veil.biz"`; + +exports[`internet > 42 > url > with slash appended 1`] = `"https://hasty-shin.org/"`; + +exports[`internet > 42 > url > without slash appended and with http protocol 1`] = `"http://hasty-shin.org"`; exports[`internet > 42 > userAgent 1`] = `"Mozilla/5.0 (Windows; U; Windows NT 6.2) AppleWebKit/538.0.2 (KHTML, like Gecko) Chrome/29.0.815.0 Safari/538.0.2"`; @@ -112,7 +116,11 @@ exports[`internet > 1211 > port 1`] = `60851`; exports[`internet > 1211 > protocol 1`] = `"https"`; -exports[`internet > 1211 > url 1`] = `"https://jubilant-temple.net"`; +exports[`internet > 1211 > url > noArgs 1`] = `"https://jubilant-temple.net/"`; + +exports[`internet > 1211 > url > with slash appended 1`] = `"https://vibrant-infix.org/"`; + +exports[`internet > 1211 > url > without slash appended and with http protocol 1`] = `"http://vibrant-infix.org"`; exports[`internet > 1211 > userAgent 1`] = `"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6 rv:3.0; PT) AppleWebKit/538.2.0 (KHTML, like Gecko) Version/4.1.0 Safari/538.2.0"`; @@ -172,7 +180,11 @@ exports[`internet > 1337 > port 1`] = `17172`; exports[`internet > 1337 > protocol 1`] = `"http"`; -exports[`internet > 1337 > url 1`] = `"http://neat-chopstick.biz"`; +exports[`internet > 1337 > url > noArgs 1`] = `"https://neat-chopstick.biz"`; + +exports[`internet > 1337 > url > with slash appended 1`] = `"https://fair-migration.com/"`; + +exports[`internet > 1337 > url > without slash appended and with http protocol 1`] = `"http://fair-migration.com"`; exports[`internet > 1337 > userAgent 1`] = `"Mozilla/5.0 (Windows; U; Windows NT 6.1) AppleWebKit/532.0.0 (KHTML, like Gecko) Chrome/13.0.832.0 Safari/532.0.0"`; diff --git a/test/__snapshots__/mersenne.spec.ts.snap b/test/__snapshots__/mersenne.spec.ts.snap index 1c221b19624..21d3e4cc84d 100644 --- a/test/__snapshots__/mersenne.spec.ts.snap +++ b/test/__snapshots__/mersenne.spec.ts.snap @@ -1,49 +1,37 @@ // Vitest Snapshot v1 -exports[`mersenne twister > seed: [42,1,2] > rand() 1`] = `28056`; +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `44`; -exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(100, 0) 1`] = `85`; +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-9`; -exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(100, undefined) 1`] = `85`; +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `85`; -exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `28056`; +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `48`; -exports[`mersenne twister > seed: [1211,1,2] > rand() 1`] = `29217`; +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-7`; -exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(100, 0) 1`] = `89`; +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `89`; -exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(100, undefined) 1`] = `89`; +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `-31`; -exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `29217`; +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-50`; -exports[`mersenne twister > seed: [1337,1,2] > rand() 1`] = `5895`; +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `17`; -exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(100, 0) 1`] = `17`; +exports[`mersenne twister > seed: 42 > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `-9`; -exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(100, undefined) 1`] = `17`; +exports[`mersenne twister > seed: 42 > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-38`; -exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `5895`; +exports[`mersenne twister > seed: 42 > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `37`; -exports[`mersenne twister > seed: 42 > rand() 1`] = `12272`; +exports[`mersenne twister > seed: 1211 > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `52`; -exports[`mersenne twister > seed: 42 > should return deterministic values for rand(100, 0) 1`] = `37`; +exports[`mersenne twister > seed: 1211 > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-5`; -exports[`mersenne twister > seed: 42 > should return deterministic values for rand(100, undefined) 1`] = `37`; +exports[`mersenne twister > seed: 1211 > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `92`; -exports[`mersenne twister > seed: 42 > should return deterministic values for rand(undefined, 0) 1`] = `12272`; +exports[`mersenne twister > seed: 1337 > should return deterministic values for next({ min: -50, max: 60 }) 1`] = `-22`; -exports[`mersenne twister > seed: 1211 > rand() 1`] = `30425`; +exports[`mersenne twister > seed: 1337 > should return deterministic values for next({ min: -60, max: 0 }) 1`] = `-45`; -exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(100, 0) 1`] = `92`; - -exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(100, undefined) 1`] = `92`; - -exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(undefined, 0) 1`] = `30425`; - -exports[`mersenne twister > seed: 1337 > rand() 1`] = `8586`; - -exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(100, 0) 1`] = `26`; - -exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(100, undefined) 1`] = `26`; - -exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(undefined, 0) 1`] = `8586`; +exports[`mersenne twister > seed: 1337 > should return deterministic values for next({ min: 0, max: 100 }) 1`] = `26`; diff --git a/test/internet.spec.ts b/test/internet.spec.ts index cbbf2745ddd..02f0edaa760 100644 --- a/test/internet.spec.ts +++ b/test/internet.spec.ts @@ -16,7 +16,6 @@ describe('internet', () => { 'avatar', 'protocol', 'httpMethod', - 'url', 'domainName', 'domainSuffix', 'domainWord', @@ -61,6 +60,15 @@ describe('internet', () => { t.describe('emoji', (t) => { t.it('noArgs').it('with options', { types: ['nature'] }); }); + + t.describe('url', (t) => { + t.it('noArgs') + .it('with slash appended', { appendSlash: true }) + .it('without slash appended and with http protocol', { + appendSlash: false, + protocol: 'http', + }); + }); }); describe(`random seeded tests for seed ${faker.seed()}`, () => { @@ -325,6 +333,23 @@ describe('internet', () => { expect(url).toBeTypeOf('string'); expect(url).toSatisfy(validator.isURL); }); + + it('should return a valid url with slash appended at the end', () => { + const url = faker.internet.url({ appendSlash: true }); + + expect(url).toBeTruthy(); + expect(url).toBeTypeOf('string'); + expect(url).toSatisfy(validator.isURL); + expect(url.endsWith('/')).toBeTruthy(); + }); + + it('should return a valid url with given protocol', () => { + const url = faker.internet.url({ protocol: 'http' }); + + expect(url).toBeTruthy(); + expect(url).toBeTypeOf('string'); + expect(url).toSatisfy(validator.isURL); + }); }); describe('domainName()', () => { diff --git a/test/mersenne.spec.ts b/test/mersenne.spec.ts index 6b0a3125a0a..f6585783063 100644 --- a/test/mersenne.spec.ts +++ b/test/mersenne.spec.ts @@ -1,53 +1,39 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { FakerError } from '../src/errors/faker-error'; -import { MersenneModule } from '../src/internal/mersenne/mersenne'; +import type { Mersenne } from '../src/internal/mersenne/mersenne'; +import mersenneFn from '../src/internal/mersenne/mersenne'; import { seededRuns } from './support/seededRuns'; const minMaxTestCases = [ - { max: 100, min: 0 }, - { max: undefined, min: 0 }, - { max: 100, min: undefined }, + { min: 0, max: 100 }, + { min: -60, max: 0 }, + { min: -50, max: 60 }, ]; -const functionNames = ['rand']; - const NON_SEEDED_BASED_RUN = 25; describe('mersenne twister', () => { - let mersenne: MersenneModule; + let mersenne: Mersenne; beforeEach(() => { - mersenne = new MersenneModule(); + mersenne = mersenneFn(); }); for (const seed of [...seededRuns, [42, 1, 2], [1337, 1, 2], [1211, 1, 2]]) { describe(`seed: ${JSON.stringify(seed)}`, () => { beforeEach(() => { - if (Array.isArray(seed)) { - mersenne.seed_array(seed); - } else { - mersenne.seed(seed); - } + mersenne.seed(seed); }); - for (const functionName of functionNames) { - it(`${functionName}()`, () => { - const actual = mersenne[functionName](); - - expect(actual).toMatchSnapshot(); - }); - } - for (const { min, max } of minMaxTestCases) { - it(`should return deterministic values for rand(${max}, ${min})`, () => { - const actual = mersenne.rand(max, min); + it(`should return deterministic values for next({ min: ${min}, max: ${max} })`, () => { + const actual = mersenne.next({ min, max }); expect(actual).toMatchSnapshot(); }); } - it.todo(`should return 0 for rand(1)`, () => { - const actual = mersenne.rand(1); + it.todo(`should return 0 for next({ min: ${0}, max: ${1} })`, () => { + const actual = mersenne.next({ min: 0, max: 1 }); expect(actual).toEqual(0); }); @@ -66,22 +52,13 @@ describe('mersenne twister', () => { for (const seed of seeds) { describe(`random seeded tests ${JSON.stringify(seed)}`, () => { beforeAll(() => { - if (Array.isArray(seed)) { - mersenne.seed_array(seed); - } else { - mersenne.seed(seed); - } + mersenne.seed(seed); }); for (let i = 1; i <= NON_SEEDED_BASED_RUN; i++) { - describe('rand', () => { - it('should return a random number without given min / max arguments', () => { - const randomNumber = mersenne.rand(); - expect(randomNumber).toBeTypeOf('number'); - }); - + describe('next', () => { it('should return random number from interval [min, max)', () => { - const actual = mersenne.rand(0, 2); + const actual = mersenne.next({ min: 0, max: 2 }); expect(actual).toBeGreaterThanOrEqual(0); expect(actual).toBeLessThan(2); @@ -90,26 +67,4 @@ describe('mersenne twister', () => { } }); } - - it('should throw an error when attempting to seed() a non-integer', () => { - expect(() => - mersenne.seed( - // @ts-expect-error: non-integer error - 'abc' - ) - ).toThrowError( - new FakerError('seed(S) must take numeric argument; is string') - ); - }); - - it('should throw an error when attempting to seed() a non-integer', () => { - expect(() => - mersenne.seed_array( - // @ts-expect-error: non-integer error - 'abc' - ) - ).toThrowError( - new FakerError('seed_array(A) must take array of numbers; is string') - ); - }); }); diff --git a/test/scripts/apidoc/signature.expected.json b/test/scripts/apidoc/signature.expected.json index 6268978988d..05809105a62 100644 --- a/test/scripts/apidoc/signature.expected.json +++ b/test/scripts/apidoc/signature.expected.json @@ -13,7 +13,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.defaultBooleanParamMethod(c: boolean = true): number\n
\n
", + "examples": "
ts
faker.defaultBooleanParamMethod(c: boolean = true): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -30,7 +30,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.functionParamMethod(fn: (a: string) => number): number\n
\n
", + "examples": "
ts
faker.functionParamMethod(fn: (a: string) => number): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -47,7 +47,7 @@ ], "since": "", "returns": "string", - "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string): string\n
\n
", + "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string): string\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -58,7 +58,7 @@ "parameters": [], "since": "", "returns": "number", - "examples": "
ts
faker.methodWithDeprecated(): number\n
\n
", + "examples": "
ts
faker.methodWithDeprecated(): number\n
\n
", "deprecated": true, "seeAlsos": ["test.apidoc.methodWithExample()"] }, @@ -69,7 +69,7 @@ "parameters": [], "since": "", "returns": "number", - "examples": "
ts
faker.methodWithExample(): number\ntest.apidoc.methodWithExample() // 0\n
\n
", + "examples": "
ts
faker.methodWithExample(): number\ntest.apidoc.methodWithExample() // 0\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -80,7 +80,7 @@ "parameters": [], "since": "", "returns": "number", - "examples": "
ts
faker.methodWithMultipleSeeMarkers(): number\n
\n
", + "examples": "
ts
faker.methodWithMultipleSeeMarkers(): number\n
\n
", "deprecated": false, "seeAlsos": [ "test.apidoc.methodWithExample()", @@ -94,7 +94,7 @@ "parameters": [], "since": "1.0.0", "returns": "number", - "examples": "
ts
faker.methodWithSinceMarker(): number\n
\n
", + "examples": "
ts
faker.methodWithSinceMarker(): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -122,7 +122,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.multiParamMethod(a: number, b?: string, c: boolean = true): number\n
\n
", + "examples": "
ts
faker.multiParamMethod(a: number, b?: string, c: boolean = true): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -133,7 +133,7 @@ "parameters": [], "since": "", "returns": "number", - "examples": "
ts
faker.noParamMethod(): number\n
\n
", + "examples": "
ts
faker.noParamMethod(): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -150,7 +150,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.optionalStringParamMethod(b?: string): number\n
\n
", + "examples": "
ts
faker.optionalStringParamMethod(b?: string): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -195,7 +195,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.optionsInlineParamMethodWithDefaults(a: {\n  value: number\n} = { value: 1 }, b: {\n  value: number\n} = { value: 1 }, c: {\n  value: number\n}): number\n
\n
", + "examples": "
ts
faker.optionsInlineParamMethodWithDefaults(a: {\n  value: number\n} = { value: 1 }, b: {\n  value: number\n} = { value: 1 }, c: {\n  value: number\n}): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -224,7 +224,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number\n
\n
", + "examples": "
ts
faker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -261,7 +261,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.optionsParamMethod(options: {\n  a: number,\n  b: string,\n  c: boolean,\n  d: () => string\n}): number\n
\n
", + "examples": "
ts
faker.optionsParamMethod(options: {\n  a: number,\n  b: string,\n  c: boolean,\n  d: () => string\n}): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -290,7 +290,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number\n
\n
", + "examples": "
ts
faker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -307,7 +307,7 @@ ], "since": "", "returns": "number", - "examples": "
ts
faker.requiredNumberParamMethod(a: number): number\n
\n
", + "examples": "
ts
faker.requiredNumberParamMethod(a: number): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -324,7 +324,7 @@ ], "since": "", "returns": "string", - "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b'): string\n
\n
", + "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b'): string\n
\n
", "deprecated": false, "seeAlsos": [] }