From 3c491b2aeb99c8490dc967499e7d5c604453f1ec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 12:23:42 +0100 Subject: [PATCH 001/130] chore(deps): update devdependencies (#618) Co-authored-by: Renovate Bot --- package.json | 6 +- pnpm-lock.yaml | 168 ++++++++++++++++++++++++------------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/package.json b/package.json index da1c6526878..b7eb1dba7d3 100644 --- a/package.json +++ b/package.json @@ -99,13 +99,13 @@ "@vitest/ui": "~0.6.0", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", - "cypress": "~9.5.1", - "esbuild": "~0.14.25", + "cypress": "~9.5.2", + "esbuild": "~0.14.27", "eslint": "~8.11.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.2.5", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.0.2", + "eslint-plugin-jsdoc": "~38.0.4", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31fd64331a9..00647209dc5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,13 +11,13 @@ specifiers: '@vitest/ui': ~0.6.0 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 - cypress: ~9.5.1 - esbuild: ~0.14.25 + cypress: ~9.5.2 + esbuild: ~0.14.27 eslint: ~8.11.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.2.5 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.0.2 + eslint-plugin-jsdoc: ~38.0.4 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.5 @@ -48,13 +48,13 @@ devDependencies: '@vitest/ui': 0.6.0 c8: 7.11.0 conventional-changelog-cli: 2.2.2 - cypress: 9.5.1 - esbuild: 0.14.25 + cypress: 9.5.2 + esbuild: 0.14.27 eslint: 8.11.0 eslint-config-prettier: 8.5.0_eslint@8.11.0 eslint-define-config: 1.2.5 eslint-gitignore: 0.1.0_eslint@8.11.0 - eslint-plugin-jsdoc: 38.0.2_eslint@8.11.0 + eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 eslint-plugin-prettier: 4.0.0_c9d5adccfd1d43a8805a302169f6a967 esno: 0.14.1 lint-staged: 12.3.5 @@ -279,13 +279,13 @@ packages: - '@algolia/client-search' dev: true - /@es-joy/jsdoccomment/0.20.1: - resolution: {integrity: sha512-oeJK41dcdqkvdZy/HctKklJNkt/jh+av3PZARrZEl+fs/8HaHeeYoAvEwOV0u5I6bArTF17JEsTZMY359e/nfQ==} + /@es-joy/jsdoccomment/0.21.2: + resolution: {integrity: sha512-k8NwNnnYgUR/hyC/JdAbKvaIzTgnT5XJeCeVFo5tpT/4Fu5WiXmhdi6M/c4diqXSDf3ZENyrCtgzCUhIbfT8Zg==} engines: {node: ^12 || ^14 || ^16 || ^17} dependencies: comment-parser: 1.3.0 esquery: 1.4.0 - jsdoc-type-pratt-parser: 2.2.3 + jsdoc-type-pratt-parser: 2.2.5 dev: true /@eslint/eslintrc/1.2.1: @@ -1361,8 +1361,8 @@ packages: resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==} dev: true - /cypress/9.5.1: - resolution: {integrity: sha512-H7lUWB3Svr44gz1rNnj941xmdsCljXoJa2cDneAltjI9leKLMQLm30x6jLlpQ730tiVtIbW5HdUmBzPzwzfUQg==} + /cypress/9.5.2: + resolution: {integrity: sha512-gYiQYvJozMzDOriUV1rCt6CeRM/pRK4nhwGJj3nJQyX2BoUdTCVwp30xDMKc771HiNVhBtgj5o5/iBdVDVXQUg==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true @@ -1659,8 +1659,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.14.25: - resolution: {integrity: sha512-L5vCUk7TzFbBnoESNoXjU3x9+/+7TDIE/1mTfy/erAfvZAqC+S3sp/Qa9wkypFMcFvN9FzvESkTlpeQDolREtQ==} + /esbuild-android-64/0.14.27: + resolution: {integrity: sha512-LuEd4uPuj/16Y8j6kqy3Z2E9vNY9logfq8Tq+oTE2PZVuNs3M1kj5Qd4O95ee66yDGb3isaOCV7sOLDwtMfGaQ==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1668,8 +1668,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.25: - resolution: {integrity: sha512-4jv5xPjM/qNm27T5j3ZEck0PvjgQtoMHnz4FzwF5zNP56PvY2CT0WStcAIl6jNlsuDdN63rk2HRBIsO6xFbcFw==} + /esbuild-android-arm64/0.14.27: + resolution: {integrity: sha512-E8Ktwwa6vX8q7QeJmg8yepBYXaee50OdQS3BFtEHKrzbV45H4foMOeEE7uqdjGQZFBap5VAqo7pvjlyA92wznQ==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1677,8 +1677,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.25: - resolution: {integrity: sha512-TGp8tuudIxOyWd1+8aYPxQmC1ZQyvij/AfNBa35RubixD0zJ1vkKHVAzo0Zao1zcG6pNqiSyzfPto8vmg0s7oA==} + /esbuild-darwin-64/0.14.27: + resolution: {integrity: sha512-czw/kXl/1ZdenPWfw9jDc5iuIYxqUxgQ/Q+hRd4/3udyGGVI31r29LCViN2bAJgGvQkqyLGVcG03PJPEXQ5i2g==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1686,8 +1686,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.25: - resolution: {integrity: sha512-oTcDgdm0MDVEmw2DWu8BV68pYuImpFgvWREPErBZmNA4MYKGuBRaCiJqq6jZmBR1x+3y1DWCjez+5uLtuAm6mw==} + /esbuild-darwin-arm64/0.14.27: + resolution: {integrity: sha512-BEsv2U2U4o672oV8+xpXNxN9bgqRCtddQC6WBh4YhXKDcSZcdNh7+6nS+DM2vu7qWIWNA4JbRG24LUUYXysimQ==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1695,8 +1695,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.25: - resolution: {integrity: sha512-ueAqbnMZ8arnuLH8tHwTCQYeptnHOUV7vA6px6j4zjjQwDx7TdP7kACPf3TLZLdJQ3CAD1XCvQ2sPhX+8tacvQ==} + /esbuild-freebsd-64/0.14.27: + resolution: {integrity: sha512-7FeiFPGBo+ga+kOkDxtPmdPZdayrSzsV9pmfHxcyLKxu+3oTcajeZlOO1y9HW+t5aFZPiv7czOHM4KNd0tNwCA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -1704,8 +1704,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.25: - resolution: {integrity: sha512-+ZVWud2HKh+Ob6k/qiJWjBtUg4KmJGGmbvEXXW1SNKS7hW7HU+Zq2ZCcE1akFxOPkVB+EhOty/sSek30tkCYug==} + /esbuild-freebsd-arm64/0.14.27: + resolution: {integrity: sha512-8CK3++foRZJluOWXpllG5zwAVlxtv36NpHfsbWS7TYlD8S+QruXltKlXToc/5ZNzBK++l6rvRKELu/puCLc7jA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -1713,8 +1713,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.25: - resolution: {integrity: sha512-3OP/lwV3kCzEz45tobH9nj+uE4ubhGsfx+tn0L26WAGtUbmmcRpqy7XRG/qK7h1mClZ+eguIANcQntYMdYklfw==} + /esbuild-linux-32/0.14.27: + resolution: {integrity: sha512-qhNYIcT+EsYSBClZ5QhLzFzV5iVsP1YsITqblSaztr3+ZJUI+GoK8aXHyzKd7/CKKuK93cxEMJPpfi1dfsOfdw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -1722,8 +1722,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.25: - resolution: {integrity: sha512-+aKHdHZmX9qwVlQmu5xYXh7GsBFf4TWrePgeJTalhXHOG7NNuUwoHmketGiZEoNsWyyqwH9rE5BC+iwcLY30Ug==} + /esbuild-linux-64/0.14.27: + resolution: {integrity: sha512-ESjck9+EsHoTaKWlFKJpPZRN26uiav5gkI16RuI8WBxUdLrrAlYuYSndxxKgEn1csd968BX/8yQZATYf/9+/qg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -1731,8 +1731,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.25: - resolution: {integrity: sha512-aTLcE2VBoLydL943REcAcgnDi3bHtmULSXWLbjtBdtykRatJVSxKMjK9YlBXUZC4/YcNQfH7AxwVeQr9fNxPhw==} + /esbuild-linux-arm/0.14.27: + resolution: {integrity: sha512-JnnmgUBdqLQO9hoNZQqNHFWlNpSX82vzB3rYuCJMhtkuaWQEmQz6Lec1UIxJdC38ifEghNTBsF9bbe8dFilnCw==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -1740,8 +1740,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.25: - resolution: {integrity: sha512-UxfenPx/wSZx55gScCImPtXekvZQLI2GW3qe5dtlmU7luiqhp5GWPzGeQEbD3yN3xg/pHc671m5bma5Ns7lBHw==} + /esbuild-linux-arm64/0.14.27: + resolution: {integrity: sha512-no6Mi17eV2tHlJnqBHRLekpZ2/VYx+NfGxKcBE/2xOMYwctsanCaXxw4zapvNrGE9X38vefVXLz6YCF8b1EHiQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -1749,8 +1749,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.25: - resolution: {integrity: sha512-wLWYyqVfYx9Ur6eU5RT92yJVsaBGi5RdkoWqRHOqcJ38Kn60QMlcghsKeWfe9jcYut8LangYZ98xO1LxIoSXrQ==} + /esbuild-linux-mips64le/0.14.27: + resolution: {integrity: sha512-NolWP2uOvIJpbwpsDbwfeExZOY1bZNlWE/kVfkzLMsSgqeVcl5YMen/cedRe9mKnpfLli+i0uSp7N+fkKNU27A==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -1758,8 +1758,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.25: - resolution: {integrity: sha512-0dR6Csl6Zas3g4p9ULckEl8Mo8IInJh33VCJ3eaV1hj9+MHGdmDOakYMN8MZP9/5nl+NU/0ygpd14cWgy8uqRw==} + /esbuild-linux-ppc64le/0.14.27: + resolution: {integrity: sha512-/7dTjDvXMdRKmsSxKXeWyonuGgblnYDn0MI1xDC7J1VQXny8k1qgNp6VmrlsawwnsymSUUiThhkJsI+rx0taNA==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -1767,8 +1767,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.25: - resolution: {integrity: sha512-J4d20HDmTrgvhR0bdkDhvvJGaikH3LzXQnNaseo8rcw9Yqby9A90gKUmWpfwqLVNRILvNnAmKLfBjCKU9ajg8w==} + /esbuild-linux-riscv64/0.14.27: + resolution: {integrity: sha512-D+aFiUzOJG13RhrSmZgrcFaF4UUHpqj7XSKrIiCXIj1dkIkFqdrmqMSOtSs78dOtObWiOrFCDDzB24UyeEiNGg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -1776,8 +1776,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.25: - resolution: {integrity: sha512-YI2d5V6nTE73ZnhEKQD7MtsPs1EtUZJ3obS21oxQxGbbRw1G+PtJKjNyur+3t6nzHP9oTg6GHQ3S3hOLLmbDIQ==} + /esbuild-linux-s390x/0.14.27: + resolution: {integrity: sha512-CD/D4tj0U4UQjELkdNlZhQ8nDHU5rBn6NGp47Hiz0Y7/akAY5i0oGadhEIg0WCY/HYVXFb3CsSPPwaKcTOW3bg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -1785,8 +1785,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.25: - resolution: {integrity: sha512-TKIVgNWLUOkr+Exrye70XTEE1lJjdQXdM4tAXRzfHE9iBA7LXWcNtVIuSnphTqpanPzTDFarF0yqq4kpbC6miA==} + /esbuild-netbsd-64/0.14.27: + resolution: {integrity: sha512-h3mAld69SrO1VoaMpYl3a5FNdGRE/Nqc+E8VtHOag4tyBwhCQXxtvDDOAKOUQexBGca0IuR6UayQ4ntSX5ij1Q==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -1797,11 +1797,11 @@ packages: /esbuild-node-loader/0.6.5: resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} dependencies: - esbuild: 0.14.25 + esbuild: 0.14.27 dev: true - /esbuild-openbsd-64/0.14.25: - resolution: {integrity: sha512-QgFJ37A15D7NIXBTYEqz29+uw3nNBOIyog+3kFidANn6kjw0GHZ0lEYQn+cwjyzu94WobR+fes7cTl/ZYlHb1A==} + /esbuild-openbsd-64/0.14.27: + resolution: {integrity: sha512-xwSje6qIZaDHXWoPpIgvL+7fC6WeubHHv18tusLYMwL+Z6bEa4Pbfs5IWDtQdHkArtfxEkIZz77944z8MgDxGw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -1809,16 +1809,16 @@ packages: dev: true optional: true - /esbuild-register/3.3.2_esbuild@0.14.25: + /esbuild-register/3.3.2_esbuild@0.14.27: resolution: {integrity: sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==} peerDependencies: esbuild: '>=0.12 <1' dependencies: - esbuild: 0.14.25 + esbuild: 0.14.27 dev: true - /esbuild-sunos-64/0.14.25: - resolution: {integrity: sha512-rmWfjUItYIVlqr5EnTH1+GCxXiBOC42WBZ3w++qh7n2cS9Xo0lO5pGSG2N+huOU2fX5L+6YUuJ78/vOYvefeFw==} + /esbuild-sunos-64/0.14.27: + resolution: {integrity: sha512-/nBVpWIDjYiyMhuqIqbXXsxBc58cBVH9uztAOIfWShStxq9BNBik92oPQPJ57nzWXRNKQUEFWr4Q98utDWz7jg==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -1826,8 +1826,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.25: - resolution: {integrity: sha512-HGAxVUofl3iUIz9W10Y9XKtD0bNsK9fBXv1D55N/ljNvkrAYcGB8YCm0v7DjlwtyS6ws3dkdQyXadbxkbzaKOA==} + /esbuild-windows-32/0.14.27: + resolution: {integrity: sha512-Q9/zEjhZJ4trtWhFWIZvS/7RUzzi8rvkoaS9oiizkHTTKd8UxFwn/Mm2OywsAfYymgUYm8+y2b+BKTNEFxUekw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -1835,8 +1835,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.25: - resolution: {integrity: sha512-TirEohRkfWU9hXLgoDxzhMQD1g8I2mOqvdQF2RS9E/wbkORTAqJHyh7wqGRCQAwNzdNXdg3JAyhQ9/177AadWA==} + /esbuild-windows-64/0.14.27: + resolution: {integrity: sha512-b3y3vTSl5aEhWHK66ngtiS/c6byLf6y/ZBvODH1YkBM+MGtVL6jN38FdHUsZasCz9gFwYs/lJMVY9u7GL6wfYg==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1844,8 +1844,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.25: - resolution: {integrity: sha512-4ype9ERiI45rSh+R8qUoBtaj6kJvUOI7oVLhKqPEpcF4Pa5PpT3hm/mXAyotJHREkHpM87PAJcA442mLnbtlNA==} + /esbuild-windows-arm64/0.14.27: + resolution: {integrity: sha512-I/reTxr6TFMcR5qbIkwRGvldMIaiBu2+MP0LlD7sOlNXrfqIl9uNjsuxFPGEG4IRomjfQ5q8WT+xlF/ySVkqKg==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -1853,32 +1853,32 @@ packages: dev: true optional: true - /esbuild/0.14.25: - resolution: {integrity: sha512-4JHEIOMNFvK09ziiL+iVmldIhLbn49V4NAVo888tcGFKedEZY/Y8YapfStJ6zSE23tzYPKxqKwQBnQoIO0BI/Q==} + /esbuild/0.14.27: + resolution: {integrity: sha512-MZQt5SywZS3hA9fXnMhR22dv0oPGh6QtjJRIYbgL1AeqAoQZE+Qn5ppGYQAoHv/vq827flj4tIJ79Mrdiwk46Q==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.25 - esbuild-android-arm64: 0.14.25 - esbuild-darwin-64: 0.14.25 - esbuild-darwin-arm64: 0.14.25 - esbuild-freebsd-64: 0.14.25 - esbuild-freebsd-arm64: 0.14.25 - esbuild-linux-32: 0.14.25 - esbuild-linux-64: 0.14.25 - esbuild-linux-arm: 0.14.25 - esbuild-linux-arm64: 0.14.25 - esbuild-linux-mips64le: 0.14.25 - esbuild-linux-ppc64le: 0.14.25 - esbuild-linux-riscv64: 0.14.25 - esbuild-linux-s390x: 0.14.25 - esbuild-netbsd-64: 0.14.25 - esbuild-openbsd-64: 0.14.25 - esbuild-sunos-64: 0.14.25 - esbuild-windows-32: 0.14.25 - esbuild-windows-64: 0.14.25 - esbuild-windows-arm64: 0.14.25 + esbuild-android-64: 0.14.27 + esbuild-android-arm64: 0.14.27 + esbuild-darwin-64: 0.14.27 + esbuild-darwin-arm64: 0.14.27 + esbuild-freebsd-64: 0.14.27 + esbuild-freebsd-arm64: 0.14.27 + esbuild-linux-32: 0.14.27 + esbuild-linux-64: 0.14.27 + esbuild-linux-arm: 0.14.27 + esbuild-linux-arm64: 0.14.27 + esbuild-linux-mips64le: 0.14.27 + esbuild-linux-ppc64le: 0.14.27 + esbuild-linux-riscv64: 0.14.27 + esbuild-linux-s390x: 0.14.27 + esbuild-netbsd-64: 0.14.27 + esbuild-openbsd-64: 0.14.27 + esbuild-sunos-64: 0.14.27 + esbuild-windows-32: 0.14.27 + esbuild-windows-64: 0.14.27 + esbuild-windows-arm64: 0.14.27 dev: true /escalade/3.1.1: @@ -1924,13 +1924,13 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/38.0.2_eslint@8.11.0: - resolution: {integrity: sha512-ln9eUYcok3zTX1MG6RE37SbsF81f1Lopy9ucYoIXbYOYQJqmFcAdnzlUMCaMhzR6v5SeKugchtOYXh7Oy+cZlA==} + /eslint-plugin-jsdoc/38.0.4_eslint@8.11.0: + resolution: {integrity: sha512-/McOYm7BEmiwNd5niCea2iHuFRtTrqeZN6IKJPJoC2PO8hfQn3FFRgYoGs17hoo6PaIWQLxo6hvCJsu+/KSRfg==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@es-joy/jsdoccomment': 0.20.1 + '@es-joy/jsdoccomment': 0.21.2 comment-parser: 1.3.0 debug: 4.3.3 escape-string-regexp: 4.0.0 @@ -2045,9 +2045,9 @@ packages: hasBin: true dependencies: cross-spawn: 7.0.3 - esbuild: 0.14.25 + esbuild: 0.14.27 esbuild-node-loader: 0.6.5 - esbuild-register: 3.3.2_esbuild@0.14.25 + esbuild-register: 3.3.2_esbuild@0.14.27 import-meta-resolve: 1.1.1 dev: true @@ -2835,8 +2835,8 @@ packages: resolution: {integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=} dev: true - /jsdoc-type-pratt-parser/2.2.3: - resolution: {integrity: sha512-QPyxq62Q8veBSDtDrWmqaEPjSCeknUV9dH/OAGt3q9an8qC8UQDqitQiw1NvoMskIESpoRZ6qzt4H3rlK0xo8A==} + /jsdoc-type-pratt-parser/2.2.5: + resolution: {integrity: sha512-2a6eRxSxp1BW040hFvaJxhsCMI9lT8QB8t14t+NY5tC5rckIR0U9cr2tjOeaFirmEOy6MHvmJnY7zTBHq431Lw==} engines: {node: '>=12.0.0'} dev: true @@ -4383,7 +4383,7 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.25 + esbuild: 0.14.27 postcss: 8.4.7 resolve: 1.22.0 rollup: 2.69.0 From c933d24c2b448f2f6566af13b1f2d3f31af0f4d6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:21:44 +0100 Subject: [PATCH 002/130] chore(deps): update vitest to ~0.6.1 (#619) Co-authored-by: Renovate Bot --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b7eb1dba7d3..fb4d02efdcf 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.14.0", "@typescript-eslint/parser": "~5.14.0", - "@vitest/ui": "~0.6.0", + "@vitest/ui": "~0.6.1", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.6.0" + "vitest": "~0.6.1" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 00647209dc5..96d0a9c0346 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.14.0 '@typescript-eslint/parser': ~5.14.0 - '@vitest/ui': ~0.6.0 + '@vitest/ui': ~0.6.1 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.6.0 + vitest: ~0.6.1 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.14.0_ace6f9e7722b813e21eaf2dc993bc413 '@typescript-eslint/parser': 5.14.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.6.0 + '@vitest/ui': 0.6.1 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.6.0_@vitest+ui@0.6.0+c8@7.11.0 + vitest: 0.6.1_@vitest+ui@0.6.1+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.6.0: - resolution: {integrity: sha512-hune6gWckOm9sIo5vY0u3wpUZRpo3o0bALmvQcIzbL6IMMEbK9sW7AXY4Pu2XGq2IqHWoEKqdY8aantPJzfOHg==} + /@vitest/ui/0.6.1: + resolution: {integrity: sha512-eBquWSP0C1InsHY34PktjL9cKCKO28q4HNhJEwa8rrPaXGYL3/abQuqJRqNH+ApUAUQd/q2RDAfzBdNoKWvAKg==} dependencies: sirv: 2.0.2 dev: true @@ -4412,8 +4412,8 @@ packages: - stylus dev: true - /vitest/0.6.0_@vitest+ui@0.6.0+c8@7.11.0: - resolution: {integrity: sha512-FuIkLHCQxz6rO35MQROUtVdwcBaYnt198YpPGIrJXmuNHGolfPbrZIiwpD7bek0OiETxuphK3+KR5oJ5Qi1g5A==} + /vitest/0.6.1_@vitest+ui@0.6.1+c8@7.11.0: + resolution: {integrity: sha512-rgHgTO3xHCrbgmqYdUz4ViO0g2ekHeOfV60J6+1c6Ypzk1EqCE2sN8IpF4TDGs6BOvWIsVd/ob5c6U4Ozzu92g==} engines: {node: '>=14.14.0'} hasBin: true peerDependencies: @@ -4433,7 +4433,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.6.0 + '@vitest/ui': 0.6.1 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From f038937c973a0ad4b0014c5aaa56a0323c94fff4 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 15 Mar 2022 16:13:43 +0100 Subject: [PATCH 003/130] docs: improve visualization for complex types (#608) --- scripts/apidoc/signature.ts | 94 ++++++++++++++++++--- src/unique.ts | 2 +- test/scripts/apidoc/signature.example.ts | 8 +- test/scripts/apidoc/signature.expected.json | 13 ++- 4 files changed, 101 insertions(+), 16 deletions(-) diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 287fc737fc3..bfeb01e6cb6 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -1,10 +1,12 @@ import sanitizeHtml from 'sanitize-html'; import type { Comment, + DeclarationReflection, ParameterReflection, Reflection, SignatureReflection, SomeType, + Type, } from 'typedoc'; import { ReflectionFlag, ReflectionKind } from 'typedoc'; import { createMarkdownRenderer } from 'vitepress'; @@ -78,7 +80,8 @@ export function analyzeSignature( for (const parameter of typeParameters) { signatureTypeParameters.push(parameter.name); parameters.push({ - name: parameter.name, + name: `<${parameter.name}>`, + type: parameter.type ? typeToText(parameter.type) : undefined, description: mdToHtml(toBlock(parameter.comment)), }); } @@ -145,7 +148,7 @@ export function analyzeSignature( title: prettyMethodName, description: mdToHtml(toBlock(signature.comment)), parameters: parameters, - returns: signature.type.toString(), + returns: typeToText(signature.type), examples: mdToHtml('```ts\n' + examples + '```'), deprecated: signature.comment?.hasTag('deprecated') ?? false, seeAlsos, @@ -159,7 +162,6 @@ function analyzeParameter(parameter: ParameterReflection): { const name = parameter.name; const declarationName = name + (isOptional(parameter) ? '?' : ''); const type = parameter.type; - const typeText = type.toString(); const defaultValue = parameter.defaultValue; let signatureText = ''; @@ -167,12 +169,12 @@ function analyzeParameter(parameter: ParameterReflection): { signatureText = ' = ' + defaultValue; } - const signature = declarationName + ': ' + typeText + signatureText; + const signature = declarationName + ': ' + typeToText(type) + signatureText; const parameters: MethodParameter[] = [ { name: declarationName, - type: typeText, + type: typeToText(type, true), default: defaultValue, description: mdToHtml(toBlock(parameter.comment)), }, @@ -194,13 +196,13 @@ function analyzeParameterOptions( analyzeParameterOptions(name, type) ); } else if (parameterType.type === 'reflection') { - const properties = parameterType.declaration.getChildrenByKind( - ReflectionKind.Property - ); + const properties = parameterType.declaration.children ?? []; return properties.map((property) => ({ name: `${name}.${property.name}${isOptional(property) ? '?' : ''}`, - type: property.type.toString(), - description: mdToHtml(toBlock(property.comment)), + type: declarationTypeToText(property), + description: mdToHtml( + toBlock(property.comment ?? property.signatures?.[0].comment) + ), })); } @@ -210,3 +212,75 @@ function analyzeParameterOptions( function isOptional(parameter: Reflection): boolean { return parameter.flags.hasFlag(ReflectionFlag.Optional); } + +function typeToText(type_: Type, short = false): string { + const type = type_ as SomeType; + switch (type.type) { + case 'array': + return `${typeToText(type.elementType, short)}[]`; + case 'union': + return type.types + .map((t) => typeToText(t, short)) + .sort() + .join(' | '); + case 'reference': + if ( + typeof type.typeArguments === 'undefined' || + !type.typeArguments.length + ) { + return type.name; + } else { + return `${type.name}<${type.typeArguments + .map((t) => typeToText(t, short)) + .join(', ')}>`; + } + case 'reflection': + return declarationTypeToText(type.declaration, short); + case 'indexedAccess': + return `${typeToText(type.objectType, short)}[${typeToText( + type.indexType, + short + )}]`; + default: + return type.toString(); + } +} + +function declarationTypeToText( + declaration: DeclarationReflection, + short = false +): string { + switch (declaration.kind) { + case ReflectionKind.Method: + return signatureTypeToText(declaration.signatures[0]); + case ReflectionKind.Property: + return typeToText(declaration.type); + case ReflectionKind.TypeLiteral: + if (declaration.children?.length) { + if (short) { + // This is too long for the parameter table, thus we abbreviate this. + return '{ ... }'; + } + return ( + '{' + + declaration.children + .map((c) => `\n${c.name}: ${declarationTypeToText(c)}`) + .join() + .replace(/\n/g, '\n ') + + '\n}' + ); + } else if (declaration.signatures?.length) { + return signatureTypeToText(declaration.signatures[0]); + } else { + return declaration.toString(); + } + default: + return declaration.toString(); + } +} + +function signatureTypeToText(signature: SignatureReflection): string { + return `(${signature.parameters + .map((p) => `${p.name}: ${typeToText(p.type)}`) + .join(', ')}) => ${typeToText(signature.type)}`; +} diff --git a/src/unique.ts b/src/unique.ts index 6ef5eee5502..718b3391fff 100644 --- a/src/unique.ts +++ b/src/unique.ts @@ -40,7 +40,7 @@ export class Unique { * @param opts.compare The function used to determine whether a value was already returned. * * @example - * faker.unique(faker.name.firstName) + * faker.unique(faker.name.firstName) // 'Corbin' */ unique RecordKey>( method: Method, diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 8f1ada32f4d..b413dd20122 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -60,8 +60,14 @@ export class SignatureTest { * @param options.a The number parameter. * @param options.b The string parameter. * @param options.c The boolean parameter. + * @param options.d The method parameter. */ - optionsParamMethod(options: { a: number; b?: string; c: boolean }): number { + optionsParamMethod(options: { + a: number; + b?: string; + c: boolean; + d: () => string; + }): number { return options.c ? options.a : +options.b; } diff --git a/test/scripts/apidoc/signature.expected.json b/test/scripts/apidoc/signature.expected.json index d0674899053..da7c2e87bda 100644 --- a/test/scripts/apidoc/signature.expected.json +++ b/test/scripts/apidoc/signature.expected.json @@ -33,12 +33,12 @@ "parameters": [ { "name": "fn", - "type": "Function", + "type": "(a: string) => number", "description": "

The function parameter.

\n" } ], "returns": "number", - "examples": "
faker.functionParamMethod(fn: Function): number\n
\n
", + "examples": "
faker.functionParamMethod(fn: (a: string) => number): number\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -112,7 +112,7 @@ "parameters": [ { "name": "options", - "type": "Object", + "type": "{ ... }", "description": "

The function parameter.

\n" }, { @@ -129,10 +129,15 @@ "name": "options.c", "type": "boolean", "description": "

The boolean parameter.

\n" + }, + { + "name": "options.d", + "type": "() => string", + "description": "

The method parameter.

\n" } ], "returns": "number", - "examples": "
faker.optionsParamMethod(options: Object): number\n
\n
", + "examples": "
faker.optionsParamMethod(options: {\n  a: number,\n  b: string,\n  c: boolean,\n  d: () => string\n}): number\n
\n
", "deprecated": false, "seeAlsos": [] }, From 09487b6b3a6e6cc3de0303851b9913ecdf1390dc Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 15 Mar 2022 16:19:03 +0100 Subject: [PATCH 004/130] docs: add image_providers jsdocs (#612) --- src/image_providers/lorempicsum.ts | 62 ++++++++------ src/image_providers/lorempixel.ts | 132 +++++++++++++++-------------- src/image_providers/unsplash.ts | 81 ++++++++++-------- 3 files changed, 150 insertions(+), 125 deletions(-) diff --git a/src/image_providers/lorempicsum.ts b/src/image_providers/lorempicsum.ts index 56553af07a0..9fed741ed5f 100644 --- a/src/image_providers/lorempicsum.ts +++ b/src/image_providers/lorempicsum.ts @@ -1,15 +1,19 @@ import type { Faker } from '..'; +/** + * Module to generate links to random images on `https://picsum.photos/`. + */ +// TODO ST-DDT 2022-03-11: Rename to picsum? export class LoremPicsum { constructor(private readonly faker: Faker) {} /** - * Search image from unsplash + * Generates a new picsum image url. * - * @param width - * @param height - * @param grayscale - * @param blur 1-10 + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param grayscale Whether to return a grayscale image. Default to `false`. + * @param blur The optional level of blur to apply. Supports `1` - `10`. */ image( width?: number, @@ -21,22 +25,22 @@ export class LoremPicsum { } /** - * Search grayscale image from unsplash + * Generates a new picsum image url. * - * @param width - * @param height - * @param grayscale + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param grayscale Whether to return a grayscale image. Default to `false`. */ imageGrayscale(width?: number, height?: number, grayscale?: boolean): string { return this.imageUrl(width, height, grayscale); } /** - * Search blurred image from unsplash + * Generates a new picsum image url. * - * @param width - * @param height - * @param blur 1-10 + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param blur The optional level of blur to apply. Supports `1` - `10`. */ imageBlurred( width?: number, @@ -47,13 +51,13 @@ export class LoremPicsum { } /** - * Search same random image from unsplash, based on a seed + * Generates a new picsum image url. * - * @param width - * @param height - * @param grayscale - * @param blur 1-10 - * @param seed + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param grayscale Whether to return a grayscale image. Default to `false`. + * @param blur The optional level of blur to apply. Supports `1` - `10`. + * @param seed The optional seed to use. */ imageRandomSeeded( width?: number, @@ -62,24 +66,30 @@ export class LoremPicsum { blur?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10, seed?: string ): string { + // TODO ST-DDT 2022-03-11: This method does the same as image url, maybe generate a seed, if it is missig? return this.imageUrl(width, height, grayscale, blur, seed); } /** - * avatar + * Returns a random avatar url. + * + * @example + * faker.internet.avatar() + * // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/315.jpg' */ + // TODO ST-DDT 2022-03-11: Deprecate this method as it is duplicate and has nothing to do with lorempicsum. avatar(): string { return this.faker.internet.avatar(); } /** - * imageUrl + * Generates a new picsum image url. * - * @param width - * @param height - * @param grayscale - * @param blur 1-10 - * @param seed + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param grayscale Whether to return a grayscale image. Default to `false`. + * @param blur The optional level of blur to apply. Supports `1` - `10`. + * @param seed The optional seed to use. */ imageUrl( width?: number, diff --git a/src/image_providers/lorempixel.ts b/src/image_providers/lorempixel.ts index 2b7d526300c..e58aa30b844 100644 --- a/src/image_providers/lorempixel.ts +++ b/src/image_providers/lorempixel.ts @@ -1,14 +1,17 @@ import type { Faker } from '..'; +/** + * Module to generate links to random images on `https://lorempixel.com/`. + */ export class Lorempixel { constructor(private readonly faker: Faker) {} /** - * image + * Generates a new lorempixel image url for a random supported category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ image(width?: number, height?: number, randomize?: boolean): string { const categories = [ @@ -34,19 +37,24 @@ export class Lorempixel { } /** - * avatar + * Returns a random avatar url. + * + * @example + * faker.internet.avatar() + * // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/315.jpg' */ + // TODO ST-DDT 2022-03-11: Deprecate this method as it is duplicate and has nothing to do with lorempixel. avatar(): string { return this.faker.internet.avatar(); } /** - * imageUrl + * Generates a new lorempixel image url. * - * @param width - * @param height - * @param category - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param category The category of the image to generate. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ imageUrl( width?: number, @@ -70,11 +78,11 @@ export class Lorempixel { } /** - * abstract + * Generates a new lorempixel image url using the "abstract" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ abstract(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -86,11 +94,11 @@ export class Lorempixel { } /** - * animals + * Generates a new lorempixel image url using the "animals" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ animals(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -102,11 +110,11 @@ export class Lorempixel { } /** - * business + * Generates a new lorempixel image url using the "business" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ business(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -118,11 +126,11 @@ export class Lorempixel { } /** - * cats + * Generates a new lorempixel image url using the "cats" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ cats(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -134,11 +142,11 @@ export class Lorempixel { } /** - * city + * Generates a new lorempixel image url using the "city" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ city(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -150,11 +158,11 @@ export class Lorempixel { } /** - * food + * Generates a new lorempixel image url using the "food" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ food(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -166,11 +174,11 @@ export class Lorempixel { } /** - * nightlife + * Generates a new lorempixel image url using the "nightlife" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ nightlife(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -182,11 +190,11 @@ export class Lorempixel { } /** - * fashion + * Generates a new lorempixel image url using the "fashion" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ fashion(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -198,11 +206,11 @@ export class Lorempixel { } /** - * people + * Generates a new lorempixel image url using the "people" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ people(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -214,11 +222,11 @@ export class Lorempixel { } /** - * nature + * Generates a new lorempixel image url using the "nature" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ nature(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -230,11 +238,11 @@ export class Lorempixel { } /** - * sports + * Generates a new lorempixel image url using the "sports" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ sports(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -246,11 +254,11 @@ export class Lorempixel { } /** - * technics + * Generates a new lorempixel image url using the "technics" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ technics(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( @@ -262,11 +270,11 @@ export class Lorempixel { } /** - * transport + * Generates a new lorempixel image url using the "transport" category. * - * @param width - * @param height - * @param randomize + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param randomize Whether to append a seed to the url. Defaults to `false`. */ transport(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.lorempixel.imageUrl( diff --git a/src/image_providers/unsplash.ts b/src/image_providers/unsplash.ts index 45fbdd6c527..47157eb20cf 100644 --- a/src/image_providers/unsplash.ts +++ b/src/image_providers/unsplash.ts @@ -1,6 +1,10 @@ import type { Faker } from '..'; +/** + * Module to generate links to random images on `https://source.unsplash.com/`. + */ export class Unsplash { + // TODO ST-DDT 2022-03-11: Remove unused(?) constant categories = [ 'food', 'nature', @@ -13,30 +17,35 @@ export class Unsplash { constructor(private readonly faker: Faker) {} /** - * Search image from unsplash + * Generates a new unsplash image url for a random supported category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ image(width?: number, height?: number, keyword?: string): string { return this.imageUrl(width, height, undefined, keyword); } /** - * avatar + * Returns a random avatar url. + * + * @example + * faker.internet.avatar() + * // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/315.jpg' */ + // TODO ST-DDT 2022-03-11: Deprecate this method as it is duplicate and has nothing to do with unsplash. avatar(): string { return this.faker.internet.avatar(); } /** - * imageUrl + * Generates a new unsplash image url. * - * @param width - * @param height - * @param category - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param category The category of the image to generate. + * @param keyword The image keywords to use. */ imageUrl( width?: number, @@ -56,9 +65,7 @@ export class Unsplash { url += `/${width}x${height}`; if (typeof keyword !== 'undefined') { - const keywordFormat = new RegExp( - '^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$' - ); + const keywordFormat = /^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$/; if (keywordFormat.test(keyword)) { url += '?' + keyword; } @@ -68,44 +75,44 @@ export class Unsplash { } /** - * food + * Generates a new unsplash image url using the "food" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ food(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl(width, height, 'food', keyword); } /** - * people + * Generates a new unsplash image url using the "people" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ people(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl(width, height, 'people', keyword); } /** - * nature + * Generates a new unsplash image url using the "nature" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ nature(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl(width, height, 'nature', keyword); } /** - * technology + * Generates a new unsplash image url using the "technology" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ technology(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl( @@ -117,11 +124,11 @@ export class Unsplash { } /** - * objects + * Generates a new unsplash image url using the "objects" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ objects(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl( @@ -133,11 +140,11 @@ export class Unsplash { } /** - * buildings + * Generates a new unsplash image url using the "buildings" category. * - * @param width - * @param height - * @param keyword + * @param width The width of the image. Defaults to `640`. + * @param height The height of the image. Defaults to `480`. + * @param keyword The image keywords to use. */ buildings(width?: number, height?: number, keyword?: string): string { return this.faker.image.unsplash.imageUrl( From 5cb74b1bf31f44311b4ee54ea320b81f68879f07 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 15 Mar 2022 19:16:56 +0100 Subject: [PATCH 005/130] chore: fix some lint warnings (#613) Co-authored-by: Shinigami --- src/date.ts | 59 +++++++++++++++++++++------------------- src/definitions/utils.ts | 4 +++ src/fake.ts | 4 +-- src/finance.ts | 3 +- src/helpers.ts | 16 ++++++----- src/system.ts | 6 ++++ test/fake.spec.ts | 2 +- 7 files changed, 54 insertions(+), 40 deletions(-) diff --git a/src/date.ts b/src/date.ts index 818a946ae9e..dcc2360091b 100644 --- a/src/date.ts +++ b/src/date.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import type { DateEntryDefinition } from './definitions'; /** * Module to generate dates. @@ -205,23 +206,24 @@ export class _Date { * faker.date.month({ abbr: true, context: true }) // 'Sep' */ month(options?: { abbr?: boolean; context?: boolean }): string { - options = options || {}; + const abbr = options?.abbr ?? false; + const context = options?.context ?? false; - let type = 'wide'; - if (options.abbr) { - type = 'abbr'; - } - if ( - options.context && - typeof this.faker.definitions.date.month[type + '_context'] !== - 'undefined' - ) { - type += '_context'; + const source = this.faker.definitions.date.month; + let type: keyof DateEntryDefinition; + if (abbr) { + if (context && typeof source['abbr_context'] !== 'undefined') { + type = 'abbr_context'; + } else { + type = 'abbr'; + } + } else if (context && typeof source['wide_context'] !== 'undefined') { + type = 'wide_context'; + } else { + type = 'wide'; } - const source = this.faker.definitions.date.month[type]; - - return this.faker.random.arrayElement(source); + return this.faker.random.arrayElement(source[type]); } /** @@ -238,22 +240,23 @@ export class _Date { * faker.date.weekday({ abbr: true, context: true }) // 'Fri' */ weekday(options?: { abbr?: boolean; context?: boolean }): string { - options = options || {}; + const abbr = options?.abbr ?? false; + const context = options?.context ?? false; - let type = 'wide'; - if (options.abbr) { - type = 'abbr'; - } - if ( - options.context && - typeof this.faker.definitions.date.weekday[type + '_context'] !== - 'undefined' - ) { - type += '_context'; + const source = this.faker.definitions.date.weekday; + let type: keyof DateEntryDefinition; + if (abbr) { + if (context && typeof source['abbr_context'] !== 'undefined') { + type = 'abbr_context'; + } else { + type = 'abbr'; + } + } else if (context && typeof source['wide_context'] !== 'undefined') { + type = 'wide_context'; + } else { + type = 'wide'; } - const source = this.faker.definitions.date.weekday[type]; - - return this.faker.random.arrayElement(source); + return this.faker.random.arrayElement(source[type]); } } diff --git a/src/definitions/utils.ts b/src/definitions/utils.ts index b7b826a1657..03764c1dfeb 100644 --- a/src/definitions/utils.ts +++ b/src/definitions/utils.ts @@ -1,6 +1,10 @@ // https://stackoverflow.com/a/53395649/4573065 export type AllOf = ['Needs to be all of', T]; +/** + * Creates a function that requires all keys of the generic type to be used as parameters. + * The function itself will return the given parameters. + */ export function allOf(): ( ...array: U & ([T] extends [U[number]] ? unknown : AllOf[]) ) => U & ([T] extends [U[number]] ? unknown : AllOf[]) { diff --git a/src/fake.ts b/src/fake.ts index d56b4794741..726bf89695e 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -90,13 +90,13 @@ export class Fake { } // assign the function from the module.function namespace - let fn: (args?: any) => string = this.faker[parts[0]][parts[1]]; + let fn: (args?: unknown) => string = this.faker[parts[0]][parts[1]]; fn = fn.bind(this); // If parameters are populated here, they are always going to be of string type // since we might actually be dealing with an object or array, // we always attempt to the parse the incoming parameters into JSON - let params: any; + let params: unknown; // Note: we experience a small performance hit here due to JSON.parse try / catch // If anyone actually needs to optimize this specific code path, please open a support issue on github try { diff --git a/src/finance.ts b/src/finance.ts index a25f6443a9b..ae70728eadf 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -347,8 +347,7 @@ export class Finance { let s = ''; let count = 0; - for (let b = 0; b < ibanFormat.bban.length; b++) { - const bban = ibanFormat.bban[b]; + for (const bban of ibanFormat.bban) { let c = bban.count; count += bban.count; while (c > 0) { diff --git a/src/helpers.ts b/src/helpers.ts index 0f970dbacbb..91111936d6d 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -342,7 +342,10 @@ export class Helpers { const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/; const REP_REG = /(.)\{(\d+)\}/; const RANGE_REG = /\[(\d+)\-(\d+)\]/; - let min, max, tmp, repetitions; + let min: number; + let max: number; + let tmp: number; + let repetitions: number; let token = string.match(RANGE_REP_REG); while (token !== null) { min = parseInt(token[2]); @@ -434,9 +437,9 @@ export class Helpers { * faker.helpers.uniqueArray(faker.definitions.name.first_name, 6) * faker.helpers.uniqueArray(["Hello", "World", "Goodbye"], 2) */ - uniqueArray(source: T[] | (() => T), length: number): T[] { + uniqueArray(source: readonly T[] | (() => T), length: number): T[] { if (Array.isArray(source)) { - const set = new Set(source); + const set = new Set(source); const array = Array.from(set); return this.faker.helpers.shuffle(array).splice(0, length); } @@ -447,11 +450,10 @@ export class Helpers { set.add(source()); } } - } finally { - // TODO @Shinigami92 2022-01-21: Check what to do here - // eslint-disable-next-line no-unsafe-finally - return Array.from(set); + } catch { + // Ignore } + return Array.from(set); } /** diff --git a/src/system.ts b/src/system.ts index 33413a23bc6..afaed741ceb 100644 --- a/src/system.ts +++ b/src/system.ts @@ -14,6 +14,12 @@ const commonMimeTypes = [ 'text/html', ]; +/** + * Converts the given set to an array. + * + * @param set The set to convert. + */ +// TODO ST-DDT 2022-03-11: Replace with Array.from(Set) function setToArray(set: Set): T[] { // shortcut if Array.from is available if (Array.from) { diff --git a/test/fake.spec.ts b/test/fake.spec.ts index c8223585771..d1e18ac484a 100644 --- a/test/fake.spec.ts +++ b/test/fake.spec.ts @@ -30,7 +30,7 @@ describe('fake', () => { it('does not allow undefined parameters', () => { expect(() => - // @ts-expect-error + // @ts-expect-error: The parameter is required faker.fake() ).toThrowError(Error('string parameter is required!')); }); From ad1509a81e3c679b4ad8fffc871f60cd9a922b19 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Tue, 15 Mar 2022 19:40:12 +0100 Subject: [PATCH 006/130] chore(release): 6.0.0 (#620) --- CHANGELOG.md | 15 +++++++++++++++ package.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5614cbbdbf..128c15521ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [6.0.0](https://github.com/faker-js/faker/compare/v6.0.0-beta.0...v6.0.0) (2022-03-15) + + +### Bug Fixes + +* fix some lint warnings ([#613](https://github.com/faker-js/faker/issues/613)) ([5cb74b1b](https://github.com/faker-js/faker/commit/5cb74b1bf31f44311b4ee54ea320b81f68879f07)) +* **docs:** add image_providers jsdocs ([#612](https://github.com/faker-js/faker/issues/612)) ([09487b6b](https://github.com/faker-js/faker/commit/09487b6b3a6e6cc3de0303851b9913ecdf1390dc)) +* **docs:** improve visualization for complex types ([#608](https://github.com/faker-js/faker/issues/608)) ([f038937c](https://github.com/faker-js/faker/commit/f038937c973a0ad4b0014c5aaa56a0323c94fff4)) +* configure eqeqeq lint rule ([#595](https://github.com/faker-js/faker/issues/595)) ([5cd3daef](https://github.com/faker-js/faker/commit/5cd3daef2b586b7f7c89b82259831ca4810d77d5)) +* fix eslint error ([#597](https://github.com/faker-js/faker/issues/597)) ([4f7447c3](https://github.com/faker-js/faker/commit/4f7447c3e38da71d261da254dd631b84fb4c22c4)) +* **docs:** comment out algolia until search is available ([#599](https://github.com/faker-js/faker/issues/599)) ([bcc97d69](https://github.com/faker-js/faker/commit/bcc97d69ba434b436d4b173dfba8122a417e8345)) +* **docs:** add test for api docs generation ([#574](https://github.com/faker-js/faker/issues/574)) ([c99160f0](https://github.com/faker-js/faker/commit/c99160f0ab059729af29d7ee08bd97c38d323b2a)) +* **docs:** display correct signature ([#596](https://github.com/faker-js/faker/issues/596)) ([c115056e](https://github.com/faker-js/faker/commit/c115056e04d1e42f97c8d77daed3d9056c375953)) +* **docs:** show union options parameters ([#602](https://github.com/faker-js/faker/issues/602)) ([5595b9fc](https://github.com/faker-js/faker/commit/5595b9fc7bf700cb0ca3d0792a3a879110ba43c5)) + ## [6.0.0-beta.0](https://github.com/faker-js/faker/compare/v6.0.0-alpha.6...v6.0.0-beta.0) (2022-03-07) diff --git a/package.json b/package.json index fb4d02efdcf..f9d38fa570e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@faker-js/faker", - "version": "6.0.0-beta.0", + "version": "6.0.0", "description": "Generate massive amounts of fake contextual data", "keywords": [ "faker", From f0ed4721026f998194eee679680ca03bba8aae4a Mon Sep 17 00:00:00 2001 From: Shinigami Date: Tue, 15 Mar 2022 21:03:30 +0100 Subject: [PATCH 007/130] chore: update automated labels (#621) --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/renovate.json5 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2f0dffd8622..1c4ba2d746f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: "\U0001F41E Bug report" description: Report an issue -labels: [pending triage] # This will automatically assign the 'pending triage' label +labels: ['c: pending triage'] # This will automatically assign the 'c: pending triage' label body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 3619e088c94..80dd97c89f9 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: "\U0001F680 New feature proposal" description: Propose a new feature -labels: ['pending triage'] # This will automatically assign the 'pending triage' label +labels: ['c: pending triage'] # This will automatically assign the 'c: pending triage' label body: - type: markdown attributes: diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 505c3cd8dc8..8791aa6dbc0 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,7 +1,7 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:base", "schedule:daily", "group:allNonMajor"], - "labels": ["dependencies"], + "labels": ["c: dependencies"], "reviewersFromCodeOwners": true, "rangeStrategy": "bump", "packageRules": [ @@ -51,7 +51,7 @@ } ], "vulnerabilityAlerts": { - "labels": ["security"], + "labels": ["c: security"], "assignees": ["team:maintainers"] } } From 5aaf8cb7c2078791b69928e1705744669363e97f Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 16 Mar 2022 10:13:18 +0100 Subject: [PATCH 008/130] chore: fix typos in issue templates (#624) --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1c4ba2d746f..4aef7e5ed88 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: "\U0001F41E Bug report" description: Report an issue -labels: ['c: pending triage'] # This will automatically assign the 'c: pending triage' label +labels: ['s: pending triage'] # This will automatically assign the 's: pending triage' label body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 80dd97c89f9..1b06f6594a6 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: "\U0001F680 New feature proposal" description: Propose a new feature -labels: ['c: pending triage'] # This will automatically assign the 'c: pending triage' label +labels: ['s: pending triage'] # This will automatically assign the 's: pending triage' label body: - type: markdown attributes: From 601905019d46d5df2e01bd5d2a71f3bf9c7498a1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Mar 2022 10:33:59 +0100 Subject: [PATCH 009/130] chore(deps): update typescript-eslint to ~5.15.0 (#622) --- package.json | 4 +-- pnpm-lock.yaml | 72 +++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index f9d38fa570e..92cd24f1c40 100644 --- a/package.json +++ b/package.json @@ -94,8 +94,8 @@ "@types/prettier": "~2.4.4", "@types/sanitize-html": "~2.6.2", "@types/validator": "~13.7.1", - "@typescript-eslint/eslint-plugin": "~5.14.0", - "@typescript-eslint/parser": "~5.14.0", + "@typescript-eslint/eslint-plugin": "~5.15.0", + "@typescript-eslint/parser": "~5.15.0", "@vitest/ui": "~0.6.1", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96d0a9c0346..31f51ca939b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ specifiers: '@types/prettier': ~2.4.4 '@types/sanitize-html': ~2.6.2 '@types/validator': ~13.7.1 - '@typescript-eslint/eslint-plugin': ~5.14.0 - '@typescript-eslint/parser': ~5.14.0 + '@typescript-eslint/eslint-plugin': ~5.15.0 + '@typescript-eslint/parser': ~5.15.0 '@vitest/ui': ~0.6.1 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 @@ -43,8 +43,8 @@ devDependencies: '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 '@types/validator': 13.7.1 - '@typescript-eslint/eslint-plugin': 5.14.0_ace6f9e7722b813e21eaf2dc993bc413 - '@typescript-eslint/parser': 5.14.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 + '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 '@vitest/ui': 0.6.1 c8: 7.11.0 conventional-changelog-cli: 2.2.2 @@ -434,8 +434,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.14.0_ace6f9e7722b813e21eaf2dc993bc413: - resolution: {integrity: sha512-ir0wYI4FfFUDfLcuwKzIH7sMVA+db7WYen47iRSaCGl+HMAZI9fpBwfDo45ZALD3A45ZGyHWDNLhbg8tZrMX4w==} + /@typescript-eslint/eslint-plugin/5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28: + resolution: {integrity: sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -445,10 +445,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.14.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/scope-manager': 5.14.0 - '@typescript-eslint/type-utils': 5.14.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/utils': 5.14.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.15.0 + '@typescript-eslint/type-utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 debug: 4.3.3 eslint: 8.11.0 functional-red-black-tree: 1.0.1 @@ -461,8 +461,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.14.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-aHJN8/FuIy1Zvqk4U/gcO/fxeMKyoSv/rS46UXMXOJKVsLQ+iYPuXNbpbH7cBLcpSbmyyFbwrniLx5+kutu1pw==} + /@typescript-eslint/parser/5.15.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -471,9 +471,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.14.0 - '@typescript-eslint/types': 5.14.0 - '@typescript-eslint/typescript-estree': 5.14.0_typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.15.0 + '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 debug: 4.3.3 eslint: 8.11.0 typescript: 4.6.2 @@ -481,16 +481,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager/5.14.0: - resolution: {integrity: sha512-LazdcMlGnv+xUc5R4qIlqH0OWARyl2kaP8pVCS39qSL3Pd1F7mI10DbdXeARcE62sVQE4fHNvEqMWsypWO+yEw==} + /@typescript-eslint/scope-manager/5.15.0: + resolution: {integrity: sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.14.0 - '@typescript-eslint/visitor-keys': 5.14.0 + '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/visitor-keys': 5.15.0 dev: true - /@typescript-eslint/type-utils/5.14.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-d4PTJxsqaUpv8iERTDSQBKUCV7Q5yyXjqXUl3XF7Sd9ogNLuKLkxz82qxokqQ4jXdTPZudWpmNtr/JjbbvUixw==} + /@typescript-eslint/type-utils/5.15.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -499,7 +499,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.14.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 debug: 4.3.3 eslint: 8.11.0 tsutils: 3.21.0_typescript@4.6.2 @@ -508,13 +508,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.14.0: - resolution: {integrity: sha512-BR6Y9eE9360LNnW3eEUqAg6HxS9Q35kSIs4rp4vNHRdfg0s+/PgHgskvu5DFTM7G5VKAVjuyaN476LCPrdA7Mw==} + /@typescript-eslint/types/5.15.0: + resolution: {integrity: sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.14.0_typescript@4.6.2: - resolution: {integrity: sha512-QGnxvROrCVtLQ1724GLTHBTR0lZVu13izOp9njRvMkCBgWX26PKvmMP8k82nmXBRD3DQcFFq2oj3cKDwr0FaUA==} + /@typescript-eslint/typescript-estree/5.15.0_typescript@4.6.2: + resolution: {integrity: sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -522,8 +522,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.14.0 - '@typescript-eslint/visitor-keys': 5.14.0 + '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/visitor-keys': 5.15.0 debug: 4.3.3 globby: 11.1.0 is-glob: 4.0.3 @@ -534,16 +534,16 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.14.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-EHwlII5mvUA0UsKYnVzySb/5EE/t03duUTweVy8Zqt3UQXBrpEVY144OTceFKaOe4xQXZJrkptCf7PjEBeGK4w==} + /@typescript-eslint/utils/5.15.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==} 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.9 - '@typescript-eslint/scope-manager': 5.14.0 - '@typescript-eslint/types': 5.14.0 - '@typescript-eslint/typescript-estree': 5.14.0_typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.15.0 + '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 eslint: 8.11.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.11.0 @@ -552,11 +552,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.14.0: - resolution: {integrity: sha512-yL0XxfzR94UEkjBqyymMLgCBdojzEuy/eim7N9/RIcTNxpJudAcqsU8eRyfzBbcEzGoPWfdM3AGak3cN08WOIw==} + /@typescript-eslint/visitor-keys/5.15.0: + resolution: {integrity: sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.14.0 + '@typescript-eslint/types': 5.15.0 eslint-visitor-keys: 3.3.0 dev: true From 54adb9c3beb2b0ac21bca17a7220f9e06b0d40b2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:42:01 +0000 Subject: [PATCH 010/130] chore(deps): update dependency lint-staged to ~12.3.6 (#625) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 92cd24f1c40..b5d6835e7bc 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "eslint-plugin-jsdoc": "~38.0.4", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", - "lint-staged": "~12.3.5", + "lint-staged": "~12.3.6", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", "prettier": "2.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31f51ca939b..fd873f44f14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ specifiers: eslint-plugin-jsdoc: ~38.0.4 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 - lint-staged: ~12.3.5 + lint-staged: ~12.3.6 npm-run-all: ~4.1.5 picocolors: ~1.0.0 prettier: 2.5.1 @@ -57,7 +57,7 @@ devDependencies: eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 eslint-plugin-prettier: 4.0.0_c9d5adccfd1d43a8805a302169f6a967 esno: 0.14.1 - lint-staged: 12.3.5 + lint-staged: 12.3.6 npm-run-all: 4.1.5 picocolors: 1.0.0 prettier: 2.5.1 @@ -2918,8 +2918,8 @@ packages: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true - /lint-staged/12.3.5: - resolution: {integrity: sha512-oOH36RUs1It7b9U/C7Nl/a0sLfoIBcMB8ramiB3nuJ6brBqzsWiUAFSR5DQ3yyP/OR7XKMpijtgKl2DV1lQ3lA==} + /lint-staged/12.3.6: + resolution: {integrity: sha512-tVNyl/HsAnplKh4oaoRNzyZLm0PE/6VaBUXvd/gA9zhYCC/+ivZwiwpoT6jOxcLzuIOjP19wW+mfOi7/Bw4c1A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -2933,6 +2933,7 @@ packages: micromatch: 4.0.4 normalize-path: 3.0.0 object-inspect: 1.12.0 + pidtree: 0.5.0 string-argv: 0.3.1 supports-color: 9.2.1 yaml: 1.10.2 @@ -3490,6 +3491,12 @@ packages: hasBin: true dev: true + /pidtree/0.5.0: + resolution: {integrity: sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==} + engines: {node: '>=0.10'} + hasBin: true + dev: true + /pify/2.3.0: resolution: {integrity: sha1-7RQaasBDqEnqWISY59yosVMw6Qw=} engines: {node: '>=0.10.0'} From c5df7ee507343086a3b35217aa1d44991023537e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Mar 2022 10:48:59 +0100 Subject: [PATCH 011/130] chore(deps): update dependency prettier to v2.6.0 (#626) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b5d6835e7bc..1550047d783 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "lint-staged": "~12.3.6", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", - "prettier": "2.5.1", + "prettier": "2.6.0", "prettier-plugin-organize-imports": "~2.3.4", "rimraf": "~3.0.2", "sanitize-html": "~2.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fd873f44f14..5f6cfeed3ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,7 +23,7 @@ specifiers: lint-staged: ~12.3.6 npm-run-all: ~4.1.5 picocolors: ~1.0.0 - prettier: 2.5.1 + prettier: 2.6.0 prettier-plugin-organize-imports: ~2.3.4 rimraf: ~3.0.2 sanitize-html: ~2.7.0 @@ -55,13 +55,13 @@ devDependencies: eslint-define-config: 1.2.5 eslint-gitignore: 0.1.0_eslint@8.11.0 eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 - eslint-plugin-prettier: 4.0.0_c9d5adccfd1d43a8805a302169f6a967 + eslint-plugin-prettier: 4.0.0_68edcf5670f37721baf5d2cac6124e4d esno: 0.14.1 lint-staged: 12.3.6 npm-run-all: 4.1.5 picocolors: 1.0.0 - prettier: 2.5.1 - prettier-plugin-organize-imports: 2.3.4_prettier@2.5.1+typescript@4.6.2 + prettier: 2.6.0 + prettier-plugin-organize-imports: 2.3.4_prettier@2.6.0+typescript@4.6.2 rimraf: 3.0.2 sanitize-html: 2.7.0 simple-git-hooks: 2.7.0 @@ -1943,7 +1943,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.0.0_c9d5adccfd1d43a8805a302169f6a967: + /eslint-plugin-prettier/4.0.0_68edcf5670f37721baf5d2cac6124e4d: resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} engines: {node: '>=6.0.0'} peerDependencies: @@ -1956,7 +1956,7 @@ packages: dependencies: eslint: 8.11.0 eslint-config-prettier: 8.5.0_eslint@8.11.0 - prettier: 2.5.1 + prettier: 2.6.0 prettier-linter-helpers: 1.0.0 dev: true @@ -3532,18 +3532,18 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/2.3.4_prettier@2.5.1+typescript@4.6.2: + /prettier-plugin-organize-imports/2.3.4_prettier@2.6.0+typescript@4.6.2: resolution: {integrity: sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==} peerDependencies: prettier: '>=2.0' typescript: '>=2.9' dependencies: - prettier: 2.5.1 + prettier: 2.6.0 typescript: 4.6.2 dev: true - /prettier/2.5.1: - resolution: {integrity: sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==} + /prettier/2.6.0: + resolution: {integrity: sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==} engines: {node: '>=10.13.0'} hasBin: true dev: true From 1f40ed82d40f841c2845d292d4b9f45dd8562035 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 17 Mar 2022 09:11:25 +0100 Subject: [PATCH 012/130] chore(deps): update dependency eslint-define-config to ~1.3.0 (#629) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1550047d783..317c14ae594 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "esbuild": "~0.14.27", "eslint": "~8.11.0", "eslint-config-prettier": "~8.5.0", - "eslint-define-config": "~1.2.5", + "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", "eslint-plugin-jsdoc": "~38.0.4", "eslint-plugin-prettier": "~4.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f6cfeed3ee..b3dc47a4645 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,7 +15,7 @@ specifiers: esbuild: ~0.14.27 eslint: ~8.11.0 eslint-config-prettier: ~8.5.0 - eslint-define-config: ~1.2.5 + eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 eslint-plugin-jsdoc: ~38.0.4 eslint-plugin-prettier: ~4.0.0 @@ -52,7 +52,7 @@ devDependencies: esbuild: 0.14.27 eslint: 8.11.0 eslint-config-prettier: 8.5.0_eslint@8.11.0 - eslint-define-config: 1.2.5 + eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.11.0 eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 eslint-plugin-prettier: 4.0.0_68edcf5670f37721baf5d2cac6124e4d @@ -1905,9 +1905,9 @@ packages: eslint: 8.11.0 dev: true - /eslint-define-config/1.2.5: - resolution: {integrity: sha512-WVvtYiovaQTUVHZmB5xnP6HyBktJIOpL4XWFPaSgA/gKFndnD4o5yRRv2EZXqQAU1kdwD/ZHKGrHJ2C6gdSgCA==} - engines: {node: '>= 16.9.0', npm: '>= 7.0.0', pnpm: '>= 6.30.1'} + /eslint-define-config/1.3.0: + resolution: {integrity: sha512-sFbHUnaXdJfG74c0EfFjXajjM3ugDVOMteKBnddCHQP5eas6p3nmS7PbSVhyZ8Y9DaNNtFbzlovdGmVdTwrHcw==} + engines: {node: '>= 16.9.0', npm: '>= 7.0.0', pnpm: '>= 6.32.2'} dev: true /eslint-gitignore/0.1.0_eslint@8.11.0: From 2b934c51e4e090ea169b7ef1ced9881b93f7eb79 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 17 Mar 2022 09:28:00 +0100 Subject: [PATCH 013/130] chore(deps): update vitest to ~0.7.0 (#630) Co-authored-by: Renovate Bot --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 317c14ae594..4060d131cf3 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.15.0", "@typescript-eslint/parser": "~5.15.0", - "@vitest/ui": "~0.6.1", + "@vitest/ui": "~0.7.0", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.6.1" + "vitest": "~0.7.0" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3dc47a4645..5d885196551 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.15.0 '@typescript-eslint/parser': ~5.15.0 - '@vitest/ui': ~0.6.1 + '@vitest/ui': ~0.7.0 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.6.1 + vitest: ~0.7.0 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.6.1 + '@vitest/ui': 0.7.0 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.6.1_@vitest+ui@0.6.1+c8@7.11.0 + vitest: 0.7.0_@vitest+ui@0.7.0+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.6.1: - resolution: {integrity: sha512-eBquWSP0C1InsHY34PktjL9cKCKO28q4HNhJEwa8rrPaXGYL3/abQuqJRqNH+ApUAUQd/q2RDAfzBdNoKWvAKg==} + /@vitest/ui/0.7.0: + resolution: {integrity: sha512-qs1Zn3NGlhKtqJmaRZGwIavpdW4in1Ysy9+pqxMFrcqkoko0Eyn/XRxQHfm1RNiDlqbGGeQhJJaphonWwFZYNA==} dependencies: sirv: 2.0.2 dev: true @@ -4419,8 +4419,8 @@ packages: - stylus dev: true - /vitest/0.6.1_@vitest+ui@0.6.1+c8@7.11.0: - resolution: {integrity: sha512-rgHgTO3xHCrbgmqYdUz4ViO0g2ekHeOfV60J6+1c6Ypzk1EqCE2sN8IpF4TDGs6BOvWIsVd/ob5c6U4Ozzu92g==} + /vitest/0.7.0_@vitest+ui@0.7.0+c8@7.11.0: + resolution: {integrity: sha512-qLq4VEWJRyhscfzjhlNA+mrCrBQ2Vh7M9ew90yudOfoNUT0ilmFdRriRMN8m8BkKw/7txoTvT1X3oQB7B4Pk3A==} engines: {node: '>=14.14.0'} hasBin: true peerDependencies: @@ -4440,7 +4440,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.6.1 + '@vitest/ui': 0.7.0 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From 27fbcb06e1eb826b5e6a0df5cea5499603df4a10 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Mar 2022 09:03:22 +0100 Subject: [PATCH 014/130] chore(deps): update vitest to ~0.7.4 (#632) Co-authored-by: Renovate Bot --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 4060d131cf3..4de5a09fec5 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.15.0", "@typescript-eslint/parser": "~5.15.0", - "@vitest/ui": "~0.7.0", + "@vitest/ui": "~0.7.4", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.0" + "vitest": "~0.7.4" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5d885196551..04585902c6a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.15.0 '@typescript-eslint/parser': ~5.15.0 - '@vitest/ui': ~0.7.0 + '@vitest/ui': ~0.7.4 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.0 + vitest: ~0.7.4 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.7.0 + '@vitest/ui': 0.7.4 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.0_@vitest+ui@0.7.0+c8@7.11.0 + vitest: 0.7.4_@vitest+ui@0.7.4+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.0: - resolution: {integrity: sha512-qs1Zn3NGlhKtqJmaRZGwIavpdW4in1Ysy9+pqxMFrcqkoko0Eyn/XRxQHfm1RNiDlqbGGeQhJJaphonWwFZYNA==} + /@vitest/ui/0.7.4: + resolution: {integrity: sha512-FfUU1um8o+Cic44fTWxbGXv6sPMSiZxTysPxbR+2/K8t9+d0DzWsSa3lUjTRgiJQ1tiQpRP2sT4kkM/UO8XdzQ==} dependencies: sirv: 2.0.2 dev: true @@ -4419,8 +4419,8 @@ packages: - stylus dev: true - /vitest/0.7.0_@vitest+ui@0.7.0+c8@7.11.0: - resolution: {integrity: sha512-qLq4VEWJRyhscfzjhlNA+mrCrBQ2Vh7M9ew90yudOfoNUT0ilmFdRriRMN8m8BkKw/7txoTvT1X3oQB7B4Pk3A==} + /vitest/0.7.4_@vitest+ui@0.7.4+c8@7.11.0: + resolution: {integrity: sha512-6kyJ/YZJFVj/zEVVHFyvLvAZlbg05yAyJrk7oP+FOCFanGRYK7bBEz4qsIpNHxX+dlf5vRkbBDjpdXzGL7udeA==} engines: {node: '>=14.14.0'} hasBin: true peerDependencies: @@ -4440,7 +4440,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.0 + '@vitest/ui': 0.7.4 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From f679f509bd88f03be5c873593258a64f465447d1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Mar 2022 10:17:21 +0100 Subject: [PATCH 015/130] chore(deps): update dependency lint-staged to ~12.3.7 (#631) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4de5a09fec5..d82b9416e9d 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "eslint-plugin-jsdoc": "~38.0.4", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", - "lint-staged": "~12.3.6", + "lint-staged": "~12.3.7", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", "prettier": "2.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04585902c6a..bbda4357d89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ specifiers: eslint-plugin-jsdoc: ~38.0.4 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 - lint-staged: ~12.3.6 + lint-staged: ~12.3.7 npm-run-all: ~4.1.5 picocolors: ~1.0.0 prettier: 2.6.0 @@ -57,7 +57,7 @@ devDependencies: eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 eslint-plugin-prettier: 4.0.0_68edcf5670f37721baf5d2cac6124e4d esno: 0.14.1 - lint-staged: 12.3.6 + lint-staged: 12.3.7 npm-run-all: 4.1.5 picocolors: 1.0.0 prettier: 2.6.0 @@ -2918,8 +2918,8 @@ packages: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true - /lint-staged/12.3.6: - resolution: {integrity: sha512-tVNyl/HsAnplKh4oaoRNzyZLm0PE/6VaBUXvd/gA9zhYCC/+ivZwiwpoT6jOxcLzuIOjP19wW+mfOi7/Bw4c1A==} + /lint-staged/12.3.7: + resolution: {integrity: sha512-/S4D726e2GIsDVWIk1XGvheCaDm1SJRQp8efamZFWJxQMVEbOwSysp7xb49Oo73KYCdy97mIWinhlxcoNqIfIQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: From 985c39c4dd82705548a9b53ec2658fa5ff93d42f Mon Sep 17 00:00:00 2001 From: Akbar Uddin Date: Fri, 18 Mar 2022 15:47:29 +0530 Subject: [PATCH 016/130] docs: fix prisis github profile link (#633) --- docs/update.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/update.md b/docs/update.md index a8a5ba4d58f..0cf210c6dc2 100644 --- a/docs/update.md +++ b/docs/update.md @@ -40,7 +40,7 @@ We have eight maintainers currently. - Damien Retzinger - [GitHub](https://github.com/damienwebdev), [Twitter](https://twitter.com/damienwebdev) - Shinigami - [Github](https://github.com/Shinigami92), [Twitter](https://twitter.com/Shini_92) -- Daniel Bannert - [Github](https://github.com/_prisis_), [Twitter](https://twitter.com/_prisis_) +- Daniel Bannert - [Github](https://github.com/prisis), [Twitter](https://twitter.com/_prisis_) - Erica Clark - [GitHub](https://github.com/clarkerican), [Twitter](https://twitter.com/clarkerican) - Mo Mahallawy - [GitHub](https://github.com/mmahalwy), [Twitter](https://twitter.com/mmahalwy) - griest - [GitLab](https://gitlab.com/griest) From ad8dae80fbd4ba76dfb9ac26f8291fb339d1f102 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 20 Mar 2022 11:17:05 +0100 Subject: [PATCH 017/130] chore(deps): update dependency eslint-plugin-jsdoc to ~38.0.6 (#637) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 59 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index d82b9416e9d..3a6a2faf79c 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.0.4", + "eslint-plugin-jsdoc": "~38.0.6", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbda4357d89..ff3c6358c9f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ specifiers: eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.0.4 + eslint-plugin-jsdoc: ~38.0.6 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.7 @@ -54,7 +54,7 @@ devDependencies: eslint-config-prettier: 8.5.0_eslint@8.11.0 eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.11.0 - eslint-plugin-jsdoc: 38.0.4_eslint@8.11.0 + eslint-plugin-jsdoc: 38.0.6_eslint@8.11.0 eslint-plugin-prettier: 4.0.0_68edcf5670f37721baf5d2cac6124e4d esno: 0.14.1 lint-staged: 12.3.7 @@ -279,11 +279,11 @@ packages: - '@algolia/client-search' dev: true - /@es-joy/jsdoccomment/0.21.2: - resolution: {integrity: sha512-k8NwNnnYgUR/hyC/JdAbKvaIzTgnT5XJeCeVFo5tpT/4Fu5WiXmhdi6M/c4diqXSDf3ZENyrCtgzCUhIbfT8Zg==} + /@es-joy/jsdoccomment/0.22.1: + resolution: {integrity: sha512-/WMkqLYfwCf0waCAMC8Eddt3iAOdghkDF5vmyKEu8pfO66KRFY1L15yks8mfgURiwOAOJpAQ3blvB3Znj6ZwBw==} engines: {node: ^12 || ^14 || ^16 || ^17} dependencies: - comment-parser: 1.3.0 + comment-parser: 1.3.1 esquery: 1.4.0 jsdoc-type-pratt-parser: 2.2.5 dev: true @@ -293,7 +293,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.3 + debug: 4.3.4 espree: 9.3.1 globals: 13.12.1 ignore: 5.2.0 @@ -310,7 +310,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.3 + debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -500,7 +500,7 @@ packages: optional: true dependencies: '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 - debug: 4.3.3 + debug: 4.3.4 eslint: 8.11.0 tsutils: 3.21.0_typescript@4.6.2 typescript: 4.6.2 @@ -524,7 +524,7 @@ packages: dependencies: '@typescript-eslint/types': 5.15.0 '@typescript-eslint/visitor-keys': 5.15.0 - debug: 4.3.3 + debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.5 @@ -1089,8 +1089,8 @@ packages: engines: {node: '>= 12'} dev: true - /comment-parser/1.3.0: - resolution: {integrity: sha512-hRpmWIKgzd81vn0ydoWoyPoALEOnF4wt8yKD35Ib1D6XC2siLiYaiqfGkYrunuKdsXGwpBpHU3+9r+RVw2NZfA==} + /comment-parser/1.3.1: + resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} dev: true @@ -1475,6 +1475,31 @@ packages: supports-color: 9.2.1 dev: true + /debug/4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + + /debug/4.3.4_supports-color@8.1.1: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + supports-color: 8.1.1 + dev: true + /decamelize-keys/1.1.0: resolution: {integrity: sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=} engines: {node: '>=0.10.0'} @@ -1924,15 +1949,15 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/38.0.4_eslint@8.11.0: - resolution: {integrity: sha512-/McOYm7BEmiwNd5niCea2iHuFRtTrqeZN6IKJPJoC2PO8hfQn3FFRgYoGs17hoo6PaIWQLxo6hvCJsu+/KSRfg==} + /eslint-plugin-jsdoc/38.0.6_eslint@8.11.0: + resolution: {integrity: sha512-Wvh5ERLUL8zt2yLZ8LLgi8RuF2UkjDvD+ri1/i7yMpbfreK2S29B9b5JC7iBIoFR7KDaEWCLnUPHTqgwcXX1Sg==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@es-joy/jsdoccomment': 0.21.2 - comment-parser: 1.3.0 - debug: 4.3.3 + '@es-joy/jsdoccomment': 0.22.1 + comment-parser: 1.3.1 + debug: 4.3.4 escape-string-regexp: 4.0.0 eslint: 8.11.0 esquery: 1.4.0 @@ -2143,7 +2168,7 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true dependencies: - debug: 4.3.3_supports-color@8.1.1 + debug: 4.3.4_supports-color@8.1.1 get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: From af3f99ea0434c84734ef5368fa3bbafbf7a17c4f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 20 Mar 2022 13:23:21 +0100 Subject: [PATCH 018/130] chore(deps): update vitest to ~0.7.6 (#638) --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 3a6a2faf79c..4446c6c2c23 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.15.0", "@typescript-eslint/parser": "~5.15.0", - "@vitest/ui": "~0.7.4", + "@vitest/ui": "~0.7.6", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.4" + "vitest": "~0.7.6" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff3c6358c9f..802b1c3a596 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.15.0 '@typescript-eslint/parser': ~5.15.0 - '@vitest/ui': ~0.7.4 + '@vitest/ui': ~0.7.6 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.4 + vitest: ~0.7.6 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.7.4 + '@vitest/ui': 0.7.6 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.4_@vitest+ui@0.7.4+c8@7.11.0 + vitest: 0.7.6_@vitest+ui@0.7.6+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.4: - resolution: {integrity: sha512-FfUU1um8o+Cic44fTWxbGXv6sPMSiZxTysPxbR+2/K8t9+d0DzWsSa3lUjTRgiJQ1tiQpRP2sT4kkM/UO8XdzQ==} + /@vitest/ui/0.7.6: + resolution: {integrity: sha512-UX99oH1XM9XXi6Py26CbzlqLhG8kOXVB2n7nneoj1uU+C9mKCaVKX8eN4reRU49ntby9FAMAVq4uIkVcAMHIAA==} dependencies: sirv: 2.0.2 dev: true @@ -4444,8 +4444,8 @@ packages: - stylus dev: true - /vitest/0.7.4_@vitest+ui@0.7.4+c8@7.11.0: - resolution: {integrity: sha512-6kyJ/YZJFVj/zEVVHFyvLvAZlbg05yAyJrk7oP+FOCFanGRYK7bBEz4qsIpNHxX+dlf5vRkbBDjpdXzGL7udeA==} + /vitest/0.7.6_@vitest+ui@0.7.6+c8@7.11.0: + resolution: {integrity: sha512-fqk0cn0I2BUpzwLfeZ725JeXJ7WGwDtVcVBksQ6SdyjrBi6aex8t3w70TWgyLOXgylS7FJ8C9DRap4MMgpkqYw==} engines: {node: '>=14.14.0'} hasBin: true peerDependencies: @@ -4465,7 +4465,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.4 + '@vitest/ui': 0.7.6 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From 6050d7acbb991568cbdac7b0c16a088aef200abc Mon Sep 17 00:00:00 2001 From: Benjamin MENANT Date: Mon, 21 Mar 2022 21:37:03 +0900 Subject: [PATCH 019/130] fix(finance): update iso-3166-1 country codes for IBAN/BIC (#168) --- src/iban.ts | 19 +------------------ test/finance.spec.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/iban.ts b/src/iban.ts index 0c90253423d..3f10e91be2e 100644 --- a/src/iban.ts +++ b/src/iban.ts @@ -1147,7 +1147,6 @@ export = { }, ], iso3166: [ - 'AC', 'AD', 'AE', 'AF', @@ -1155,7 +1154,6 @@ export = { 'AI', 'AL', 'AM', - 'AN', 'AO', 'AQ', 'AR', @@ -1182,7 +1180,6 @@ export = { 'BR', 'BS', 'BT', - 'BU', 'BV', 'BW', 'BY', @@ -1190,7 +1187,6 @@ export = { 'CA', 'CC', 'CD', - 'CE', 'CF', 'CG', 'CH', @@ -1200,25 +1196,19 @@ export = { 'CM', 'CN', 'CO', - 'CP', 'CR', - 'CS', - 'CS', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', - 'DD', 'DE', - 'DG', 'DJ', 'DK', 'DM', 'DO', 'DZ', - 'EA', 'EC', 'EE', 'EG', @@ -1226,14 +1216,12 @@ export = { 'ER', 'ES', 'ET', - 'EU', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', - 'FX', 'GA', 'GB', 'GD', @@ -1259,7 +1247,6 @@ export = { 'HR', 'HT', 'HU', - 'IC', 'ID', 'IE', 'IL', @@ -1329,7 +1316,6 @@ export = { 'NO', 'NP', 'NR', - 'NT', 'NU', 'NZ', 'OM', @@ -1370,12 +1356,10 @@ export = { 'SR', 'SS', 'ST', - 'SU', 'SV', 'SX', 'SY', 'SZ', - 'TA', 'TC', 'TD', 'TF', @@ -1407,12 +1391,11 @@ export = { 'VU', 'WF', 'WS', + 'XK', 'YE', 'YT', - 'YU', 'ZA', 'ZM', - 'ZR', 'ZW', ], }; diff --git a/test/finance.spec.ts b/test/finance.spec.ts index 227184c148d..d49e29a30f8 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -45,7 +45,7 @@ const seedRuns = [ creditCardCVV: '251', ethereumAddress: '0x5c346ba075bd57f5a62b82d72af39cbbb07a98cb', iban: 'FO7710540350900318', - bic: 'OEFELTL1032', + bic: 'OEFELYL1032', transactionDescription: 'deposit transaction at Cronin - Effertz using card ending with ***(...1830) for PEN 262.02 in account ***55239273', }, @@ -473,11 +473,15 @@ describe('finance', () => { ).toStrictEqual(1); }); - it('throws an error if the passed country code is not supported', () => { - expect(() => faker.finance.iban(false, 'AA')).toThrowError( - Error('Country code AA not supported.') - ); - }); + it.each(['AA', 'EU'])( + 'throws an error for unsupported country code "%s"', + (unsupportedCountryCode) => + expect(() => + faker.finance.iban(false, unsupportedCountryCode) + ).toThrowError( + Error(`Country code ${unsupportedCountryCode} not supported.`) + ) + ); }); describe('bic()', () => { From 1327b23e566af3845381b75d500f3afa9b1fa7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Prohaszka?= Date: Mon, 21 Mar 2022 13:43:15 +0100 Subject: [PATCH 020/130] chore: deprecate helpers.*Card methods (#543) --- README.md | 6 +++--- src/helpers.ts | 12 ++++++++++++ test/helpers.spec.ts | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d6341b9bd0c..ba750a77cc2 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ pnpm install @faker-js/faker -D ``` @@ -56,7 +56,7 @@ pnpm install @faker-js/faker -D const { faker } = require('@faker-js/faker'); const randomName = faker.name.findName(); // Rowan Nikolaus const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz -const randomCard = faker.helpers.createCard(); // random contact card containing many properties +const randomPhoneNumber = faker.phone.phoneNumber(); // (279) 329-8663 x30233 ``` ### CDN/Deno @@ -66,7 +66,7 @@ import { faker } from 'https://cdn.skypack.dev/@faker-js/faker'; const randomName = faker.name.findName(); // Willie Bahringer const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com -const randomCard = faker.helpers.createCard(); // random contact card containing many properties +const randomPhoneNumber = faker.phone.phoneNumber(); // 938-672-1359 x418 ``` ### TypeScript Support diff --git a/src/helpers.ts b/src/helpers.ts index 91111936d6d..c40fb7204cd 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -504,8 +504,12 @@ export class Helpers { * // address: { * // streetA: 'Drake Avenue', * // ... + * @deprecated If you need some specific object you should create your own method. */ createCard(): Card { + console.warn( + 'Deprecation Warning: If you need some specific object you should create your own method.' + ); return { name: this.faker.name.findName(), username: this.faker.internet.userName(), @@ -571,8 +575,12 @@ export class Helpers { * // email: 'Eveline.Brekke56.Hoppe@yahoo.com', * // dob: 1964-05-06T05:14:37.874Z, * // ... + * @deprecated If you need some specific object you should create your own method. */ contextualCard(): ContextualCard { + console.warn( + 'Deprecation Warning: If you need some specific object you should create your own method.' + ); const name = this.faker.name.firstName(); const userName = this.faker.internet.userName(name); return { @@ -618,8 +626,12 @@ export class Helpers { * // address: { * // street: 'McKenzie Estates', * // .... + * @deprecated If you need some specific object you should create your own method. */ userCard(): UserCard { + console.warn( + 'Deprecation Warning: If you need some specific object you should create your own method.' + ); return { name: this.faker.name.findName(), username: this.faker.internet.userName(), diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 929678c7f08..3769eacba6a 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -1,4 +1,4 @@ -import { afterEach, describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; import { faker } from '../src'; import { luhnCheck } from './support/luhnCheck'; @@ -766,4 +766,19 @@ describe('helpers', () => { }); } }); + describe('deprecation warnings', () => { + it.each(['createCard', 'contextualCard', 'userCard'])( + 'should warn user that function random.%s is deprecated', + (functionName) => { + const spy = vi.spyOn(console, 'warn'); + + faker.helpers[functionName](); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: If you need some specific object you should create your own method.` + ); + spy.mockRestore(); + } + ); + }); }); From 5a15c40ec98fc1d39309d875899b88a0b7684bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Mon, 21 Mar 2022 13:48:44 +0100 Subject: [PATCH 021/130] docs: deprecate randomize (#506) --- src/helpers.ts | 6 +++++- test/helpers.spec.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/helpers.ts b/src/helpers.ts index c40fb7204cd..ddf19ed905e 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -137,11 +137,15 @@ export class Helpers { * @example * faker.helpers.randomize() // 'c' * faker.helpers.randomize([1, 2, 3]) // '2' + * + * @deprecated */ - // TODO ST-DDT 2022-02-06: Mark as deprecated randomize( array: ReadonlyArray = ['a', 'b', 'c'] as unknown as ReadonlyArray ): T { + console.warn( + 'Deprecation Warning: faker.helpers.randomize is now located in faker.random.arrayElement' + ); return this.faker.random.arrayElement(array); } diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 3769eacba6a..64c12df5d7d 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -764,6 +764,22 @@ describe('helpers', () => { expect(transaction.account).toBeTruthy(); }); }); + + describe('deprecation warnings', () => { + it.each([['randomize', 'random.arrayElement']])( + 'should warn user that function helpers.%s is deprecated', + (functionName, newLocation) => { + const spy = vi.spyOn(console, 'warn'); + + faker.helpers[functionName](); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: faker.helpers.${functionName} is now located in faker.${newLocation}` + ); + spy.mockRestore(); + } + ); + }); } }); describe('deprecation warnings', () => { From c51fb1570669284e14915916636de97b7f644e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:09:40 +0100 Subject: [PATCH 022/130] fix: alphaNumeric all chars banned (#550) --- src/random.ts | 14 ++++++++++---- test/random.spec.ts | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/random.ts b/src/random.ts index c2d8ecb2bb4..dd58c3ce821 100644 --- a/src/random.ts +++ b/src/random.ts @@ -479,11 +479,17 @@ export class Random { 'y', 'z', ]; - if (options) { - if (options.bannedChars) { - charsArray = arrayRemove(charsArray, options.bannedChars); - } + + if (options.bannedChars) { + charsArray = arrayRemove(charsArray, options.bannedChars); } + + if (charsArray.length === 0) { + throw new Error( + 'Unable to generate string, because all possible characters are banned.' + ); + } + for (let i = 0; i < count; i++) { wholeString += this.faker.random.arrayElement(charsArray); } diff --git a/test/random.spec.ts b/test/random.spec.ts index 07b2a0f5b6b..f43cc5003d2 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -210,7 +210,7 @@ describe('random', () => { expect(alphaText).match(/[b-oq-z]/); }); - it.todo('should throw if all possible characters being banned', () => { + it('should throw if all possible characters being banned', () => { const bannedChars = 'abcdefghijklmnopqrstuvwxyz0123456789'.split(''); expect(() => faker.random.alphaNumeric(5, { From 486c76e34f22cf1fd66fa2c99e605d52c7077760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:14:57 +0100 Subject: [PATCH 023/130] fix: mersenne rand invalid input argument (#577) --- src/mersenne.ts | 13 ++++++------- test/mersenne.spec.ts | 30 ++++++++---------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/mersenne.ts b/src/mersenne.ts index 6539d738bc7..521456a1e89 100644 --- a/src/mersenne.ts +++ b/src/mersenne.ts @@ -22,18 +22,17 @@ export class Mersenne { * Generates a random number between `[min, max)`. * * @param max The maximum number. Defaults to `0`. - * @param min The minimum number. Defaults to `32768`. Required if `max` is set. + * @param min The minimum number. Defaults to `32768`. * * @example * faker.mersenne.rand() // 15515 * faker.mersenne.rand(500, 1000) // 578 */ - rand(max?: number, min?: number): number { - // TODO @Shinigami92 2022-01-11: This is buggy, cause if min is not passed but only max, - // then min will be undefined and this result in NaN for the whole function - if (max === undefined) { - min = 0; - max = 32768; + 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); diff --git a/test/mersenne.spec.ts b/test/mersenne.spec.ts index b2201240f03..e7ca6198966 100644 --- a/test/mersenne.spec.ts +++ b/test/mersenne.spec.ts @@ -8,7 +8,7 @@ type SeededRun = { type SeededRunExpectations = { rand: { noArgs: number; - minMax: { max?: number; min?: number; expected?: number; skip?: boolean }[]; + minMax: { max?: number; min?: number; expected?: number }[]; }; }; @@ -21,7 +21,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 37 }, { max: undefined, min: 0, expected: 12272 }, - { max: 100, min: undefined, expected: 37, skip: true }, + { max: 100, min: undefined, expected: 37 }, ], }, }, @@ -34,7 +34,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 26 }, { max: undefined, min: 0, expected: 8586 }, - { max: 100, min: undefined, expected: 26, skip: true }, + { max: 100, min: undefined, expected: 26 }, ], }, }, @@ -47,7 +47,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 92 }, { max: undefined, min: 0, expected: 30425 }, - { max: 100, min: undefined, expected: 92, skip: true }, + { max: 100, min: undefined, expected: 92 }, ], }, }, @@ -60,7 +60,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 85 }, { max: undefined, min: 0, expected: 28056 }, - { max: 100, min: undefined, expected: 85, skip: true }, + { max: 100, min: undefined, expected: 85 }, ], }, }, @@ -73,7 +73,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 17 }, { max: undefined, min: 0, expected: 5895 }, - { max: 100, min: undefined, expected: 17, skip: true }, + { max: 100, min: undefined, expected: 17 }, ], }, }, @@ -86,7 +86,7 @@ const seededRuns: SeededRun[] = [ minMax: [ { max: 100, min: 0, expected: 89 }, { max: undefined, min: 0, expected: 29217 }, - { max: 100, min: undefined, expected: 89, skip: true }, + { max: 100, min: undefined, expected: 89 }, ], }, }, @@ -122,9 +122,7 @@ describe('mersenne twister', () => { }); } - for (const { min, max, expected } of expectations.rand.minMax.filter( - (x) => !x.skip - )) { + for (const { min, max, expected } of expectations.rand.minMax) { it(`should return ${expected} for rand(${max}, ${min})`, () => { const actual = mersenne.rand(max, min); @@ -132,18 +130,6 @@ describe('mersenne twister', () => { }); } - // TODO @piotrekn 2022-02-13: There is a bug: https://github.com/faker-js/faker/issues/479 - // remove minMax.skip when fixed - for (const { min, max, expected } of expectations.rand.minMax.filter( - (x) => x.skip - )) { - it.todo(`should return ${expected} for rand(${max}, ${min})`, () => { - const actual = mersenne.rand(max, min); - - expect(actual).toEqual(expected); - }); - } - it.todo(`should return 0 for rand(1)`, () => { const actual = mersenne.rand(1); From 9ab0825add89474635bcc3b60595abd584088138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:19:36 +0100 Subject: [PATCH 024/130] refactor: make number input immutable (#545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Leyla Jähnig --- src/datatype.ts | 25 ++++++++++++------------- test/datatype.spec.ts | 27 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/datatype.ts b/src/datatype.ts index ba2ebdc4685..706ed60e906 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -47,32 +47,31 @@ export class Datatype { options = options ?? {}; - if (typeof options.min === 'undefined') { - options.min = 0; + let max = 99999; + let min = 0; + let precision = 1; + if (typeof options.min === 'number') { + min = options.min; } - if (typeof options.max === 'undefined') { - options.max = 99999; + if (typeof options.max === 'number') { + max = options.max; } - if (typeof options.precision === 'undefined') { - options.precision = 1; + if (typeof options.precision === 'number') { + precision = options.precision; } // Make the range inclusive of the max value - let max = options.max; if (max >= 0) { - max += options.precision; + max += precision; } let randomNumber = Math.floor( - this.faker.mersenne.rand( - max / options.precision, - options.min / options.precision - ) + this.faker.mersenne.rand(max / precision, min / precision) ); // Workaround problem in Float point arithmetics for e.g. 6681493 / 0.01 - randomNumber = randomNumber / (1 / options.precision); + randomNumber = randomNumber / (1 / precision); return randomNumber; } diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index bee280d7bf1..35ac512fd06 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -445,18 +445,27 @@ describe('datatype', () => { } }); - it('should not modify the input object', () => { - const min = 1; - const max = 2; - const opts = { - min: min, - max: max, + it('should not mutate the input object', () => { + const initalMin = 1; + const initalPrecision = 1; + const initalOtherProperty = 'hello darkness my old friend'; + const input: { + min?: number; + max?: number; + precision?: number; + otherProperty: string; + } = { + min: initalMin, + precision: initalPrecision, + otherProperty: initalOtherProperty, }; - faker.datatype.number(opts); + faker.datatype.number(input); - expect(opts.min).toBe(min); - expect(opts.max).toBe(max); + expect(input.min).toBe(initalMin); + expect(input.precision).toBe(initalPrecision); + expect(input.max).toBe(undefined); + expect(input.otherProperty).toBe(initalOtherProperty); }); }); From 1bc622a9499bf236052809610ecabe80f87de482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:42:44 +0100 Subject: [PATCH 025/130] fix: remove unreachable code finance (#508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Leyla Jähnig --- src/finance.ts | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/finance.ts b/src/finance.ts index ae70728eadf..b71e63b2e5c 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -258,32 +258,17 @@ export class Finance { */ creditCardNumber(provider = ''): string { let format: string; - let formats: string | string[]; const localeFormat = this.faker.definitions.finance.credit_card; if (provider in localeFormat) { - formats = localeFormat[provider]; // there could be multiple formats - if (typeof formats === 'string') { - format = formats; - } else { - format = this.faker.random.arrayElement(formats); - } + format = this.faker.random.arrayElement(localeFormat[provider]); } else if (provider.match(/#/)) { // The user chose an optional scheme format = provider; } else { // Choose a random provider - // TODO ST-DDT 2022-01-30: #375 This is impossible to access - if (typeof localeFormat === 'string') { - format = localeFormat; - } else if (typeof localeFormat === 'object') { - // Credit cards are in a object structure - formats = this.faker.random.objectElement(localeFormat, 'value'); // There could be multiple formats - if (typeof formats === 'string') { - format = formats; - } else { - format = this.faker.random.arrayElement(formats); - } - } + // Credit cards are in an object structure + const formats = this.faker.random.objectElement(localeFormat, 'value'); // There could be multiple formats + format = this.faker.random.arrayElement(formats); } format = format.replace(/\//g, ''); return this.Helpers.replaceCreditCardSymbols(format); From 56424709b7ccd7aa7fe6130c78a770a0a901d7b5 Mon Sep 17 00:00:00 2001 From: Ganesh Budhathoki Date: Mon, 21 Mar 2022 10:31:09 -0400 Subject: [PATCH 026/130] chore(locale): added curated names for default(en) locale (#440) Co-authored-by: Shinigami92 --- src/locales/en/name/female_middle_name.ts | 212 ++++++++++++++++++++++ src/locales/en/name/index.ts | 6 + src/locales/en/name/male_middle_name.ts | 100 ++++++++++ src/locales/en/name/middle_name.ts | 64 +++++++ test/name.spec.ts | 34 ++-- 5 files changed, 402 insertions(+), 14 deletions(-) create mode 100644 src/locales/en/name/female_middle_name.ts create mode 100644 src/locales/en/name/male_middle_name.ts create mode 100644 src/locales/en/name/middle_name.ts diff --git a/src/locales/en/name/female_middle_name.ts b/src/locales/en/name/female_middle_name.ts new file mode 100644 index 00000000000..02a892fdccf --- /dev/null +++ b/src/locales/en/name/female_middle_name.ts @@ -0,0 +1,212 @@ +export default [ + 'Abigail', + 'Adele', + 'Alex', + 'Alice', + 'Alisha', + 'Amber', + 'Amelia', + 'Amora', + 'Anaïs', + 'Angelou', + 'Anika', + 'Anise', + 'Annabel', + 'Anne', + 'Aphrodite', + 'Aretha', + 'Arya', + 'Ashton', + 'Aster', + 'Audrey', + 'Avery', + 'Bailee', + 'Bay', + 'Belle', + 'Beth', + 'Billie', + 'Blair', + 'Blaise', + 'Blake', + 'Blanche', + 'Blue', + 'Bree', + 'Brielle', + 'Brienne', + 'Brooke', + 'Caleen', + 'Candice', + 'Caprice', + 'Carelyn', + 'Caylen', + 'Celine', + 'Cerise', + 'Cia', + 'Claire', + 'Claudia', + 'Clementine', + 'Coral', + 'Coraline', + 'Dahlia', + 'Dakota', + 'Dawn', + 'Della', + 'Demi', + 'Denise', + 'Denver', + 'Devine', + 'Devon', + 'Diana', + 'Dylan', + 'Ebony', + 'Eden', + 'Eleanor', + 'Elein', + 'Elizabeth', + 'Ellen', + 'Elodie', + 'Eloise', + 'Ember', + 'Emma', + 'Erin', + 'Eyre', + 'Faith', + 'Farrah', + 'Fawn', + 'Fayre', + 'Fern', + 'France', + 'Francis', + 'Frida', + 'Genisis', + 'Georgia', + 'Grace', + 'Gwen', + 'Harley', + 'Harper', + 'Hazel', + 'Helen', + 'Hippolyta', + 'Holly', + 'Hope', + 'Imani', + 'Iowa', + 'Ireland', + 'Irene', + 'Iris', + 'Isa', + 'Isla', + 'Ivy', + 'Jade', + 'Jane', + 'Jazz', + 'Jean', + 'Jess', + 'Jett', + 'Jo', + 'Joan', + 'Jolie', + 'Jordan', + 'Josie', + 'Journey', + 'Joy', + 'Jules', + 'Julien', + 'Juliet', + 'Juniper', + 'Justice', + 'Kali', + 'Karma', + 'Kat', + 'Kate', + 'Kennedy', + 'Keva', + 'Kylie', + 'Lake', + 'Lane', + 'Lark', + 'Layla', + 'Lee', + 'Leigh', + 'Leona', + 'Lexi', + 'London', + 'Lou', + 'Louise', + 'Love', + 'Luna', + 'Lux', + 'Lynn', + 'Lyric', + 'Maddie', + 'Mae', + 'Marie', + 'Matilda', + 'Maude', + 'Maybel', + 'Meadow', + 'Medusa', + 'Mercy', + 'Michelle', + 'Mirabel', + 'Monroe', + 'Morgan', + 'Nalia', + 'Naomi', + 'Nova', + 'Olive', + 'Paige', + 'Parker', + 'Pax', + 'Pearl', + 'Penelope', + 'Phoenix', + 'Quinn', + 'Rae', + 'Rain', + 'Raven', + 'Ray', + 'Raye', + 'Rebel', + 'Reese', + 'Reeve', + 'Regan', + 'Riley', + 'River', + 'Robin', + 'Rory', + 'Rose', + 'Royal', + 'Ruth', + 'Rylie', + 'Sage', + 'Sam', + 'Saturn', + 'Scout', + 'Serena', + 'Sky', + 'Skylar', + 'Sofia', + 'Sophia', + 'Storm', + 'Sue', + 'Suzanne', + 'Sydney', + 'Taylen', + 'Taylor', + 'Teagan', + 'Tempest', + 'Tenley', + 'Thea', + 'Trinity', + 'Valerie', + 'Venus', + 'Vera', + 'Violet', + 'Willow', + 'Winter', + 'Xena', + 'Zaylee', + 'Zion', + 'Zoe', +]; diff --git a/src/locales/en/name/index.ts b/src/locales/en/name/index.ts index 39f195db94d..dcc3fef143a 100644 --- a/src/locales/en/name/index.ts +++ b/src/locales/en/name/index.ts @@ -5,10 +5,13 @@ import type { NameDefinitions } from '../../..'; import binary_gender from './binary_gender'; import female_first_name from './female_first_name'; +import female_middle_name from './female_middle_name'; import first_name from './first_name'; import gender from './gender'; import last_name from './last_name'; import male_first_name from './male_first_name'; +import male_middle_name from './male_middle_name'; +import middle_name from './middle_name'; import name_ from './name'; import prefix from './prefix'; import suffix from './suffix'; @@ -17,10 +20,13 @@ import title from './title'; const name: Partial = { binary_gender, female_first_name, + female_middle_name, first_name, gender, last_name, male_first_name, + male_middle_name, + middle_name, name: name_, prefix, suffix, diff --git a/src/locales/en/name/male_middle_name.ts b/src/locales/en/name/male_middle_name.ts new file mode 100644 index 00000000000..6bd3ac848ba --- /dev/null +++ b/src/locales/en/name/male_middle_name.ts @@ -0,0 +1,100 @@ +export default [ + 'Ace', + 'Aiden', + 'Alexander', + 'Ander', + 'Anthony', + 'Asher', + 'August', + 'Aziel', + 'Bear', + 'Beckham', + 'Benjamin', + 'Buddy', + 'Calvin', + 'Carter', + 'Charles', + 'Christopher', + 'Clyde', + 'Cooper', + 'Daniel', + 'David', + 'Dior', + 'Dylan', + 'Elijah', + 'Ellis', + 'Emerson', + 'Ethan', + 'Ezra', + 'Fletcher', + 'Flynn', + 'Gabriel', + 'Grayson', + 'Gus', + 'Hank', + 'Harrison', + 'Hendrix', + 'Henry', + 'Houston', + 'Hudson', + 'Hugh', + 'Isaac', + 'Jack', + 'Jackson', + 'Jacob', + 'Jakobe', + 'James', + 'Jaxon', + 'Jaxtyn', + 'Jayden', + 'John', + 'Joseph', + 'Josiah', + 'Jude', + 'Julian', + 'Karsyn', + 'Kenji', + 'Kobe', + 'Kylo', + 'Lennon', + 'Leo', + 'Levi', + 'Liam', + 'Lincoln', + 'Logan', + 'Louis', + 'Lucas', + 'Lucky', + 'Luke', + 'Mason', + 'Mateo', + 'Matthew', + 'Maverick', + 'Michael', + 'Monroe', + 'Nixon', + 'Ocean', + 'Oliver', + 'Otis', + 'Otto', + 'Owen', + 'Ozzy', + 'Parker', + 'Rocky', + 'Samuel', + 'Sebastian', + 'Sonny', + 'Teddy', + 'Theo', + 'Theodore', + 'Thomas', + 'Truett', + 'Walter', + 'Warren', + 'Watson', + 'William', + 'Wison', + 'Wyatt', + 'Ziggy', + 'Zyair', +]; diff --git a/src/locales/en/name/middle_name.ts b/src/locales/en/name/middle_name.ts new file mode 100644 index 00000000000..0f03c1535dc --- /dev/null +++ b/src/locales/en/name/middle_name.ts @@ -0,0 +1,64 @@ +export default [ + 'Addison', + 'Alex', + 'Anderson', + 'Angel', + 'Arden', + 'August', + 'Austin', + 'Avery', + 'Bailey', + 'Billie', + 'Blake', + 'Bowie', + 'Brooklyn', + 'Cameron', + 'Charlie', + 'Corey', + 'Dakota', + 'Drew', + 'Elliott', + 'Ellis', + 'Emerson', + 'Finley', + 'Gray', + 'Greer', + 'Harper', + 'Hayden', + 'Jaden', + 'James', + 'Jamie', + 'Jordan', + 'Jules', + 'Kai', + 'Kendall', + 'Kennedy', + 'Kyle', + 'Leslie', + 'Logan', + 'London', + 'Marlowe', + 'Micah', + 'Nico', + 'Noah', + 'North', + 'Parker', + 'Phoenix', + 'Quinn', + 'Reagan', + 'Reese', + 'Reign', + 'Riley', + 'River', + 'Robin', + 'Rory', + 'Rowan', + 'Ryan', + 'Sage', + 'Sasha', + 'Sawyer', + 'Shawn', + 'Shiloh', + 'Skyler', + 'Taylor', +]; diff --git a/test/name.spec.ts b/test/name.spec.ts index a8c0c986032..2b8e9f0a304 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -12,7 +12,7 @@ const seededRuns = [ noArgs: 'Hintz', }, middleName: { - noArgs: 'b', + noArgs: 'Owen', }, findName: { noArgs: 'Lorene Deckow', @@ -53,7 +53,7 @@ const seededRuns = [ noArgs: 'Gibson', }, middleName: { - noArgs: 'a', + noArgs: 'Kenji', }, findName: { noArgs: 'Marilyn Effertz', @@ -94,7 +94,7 @@ const seededRuns = [ noArgs: 'Ward', }, middleName: { - noArgs: 'c', + noArgs: 'Isla', }, findName: { noArgs: 'Darrel Sanford', @@ -188,16 +188,12 @@ describe('name', () => { expect(faker.definitions.name.female_first_name).toContain(name); }); - // TODO @Shinigami92 2022-01-30: There is a bug: https://github.com/faker-js/faker/issues/373 - it.todo( - 'should return a gender-specific first name when passed a string', - () => { - let name = faker.name.firstName('male'); - expect(faker.definitions.name.male_first_name).toContain(name); - name = faker.name.firstName('female'); - expect(faker.definitions.name.female_first_name).toContain(name); - } - ); + it('should return a gender-specific first name when passed a string', () => { + let name = faker.name.firstName('male'); + expect(faker.definitions.name.male_first_name).toContain(name); + name = faker.name.firstName('female'); + expect(faker.definitions.name.female_first_name).toContain(name); + }); }); describe('lastName()', () => { @@ -247,6 +243,17 @@ describe('name', () => { expect(middle_name.length).greaterThan(0); }); + it.todo('should return a middle name when passed en locale', () => { + faker.locale = 'en'; + + let name = faker.name.middleName(); + expect(faker.definitions.name.middle_name).toContain(name); + name = faker.name.middleName(0); + expect(faker.definitions.name.male_middle_name).toContain(name); + name = faker.name.middleName(1); + expect(faker.definitions.name.female_middle_name).toContain(name); + }); + it('should return a gender-specific middle name when passed a number', () => { faker.locale = 'uk'; @@ -256,7 +263,6 @@ describe('name', () => { expect(faker.definitions.name.female_middle_name).toContain(name); }); - // TODO @Shinigami92 2022-01-30: There is a bug: https://github.com/faker-js/faker/issues/373 it.todo( 'should return a gender-specific middle name when passed a string', () => { From 15d4e2e35ae6d1fe842e46c3e212cebc5f896173 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 21 Mar 2022 23:09:34 +0100 Subject: [PATCH 027/130] docs: add alternative CDN links (#636) --- README.md | 11 +++++++++++ docs/guide/index.md | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ba750a77cc2..6b1c3b1ba93 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,17 @@ const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com const randomPhoneNumber = faker.phone.phoneNumber(); // 938-672-1359 x418 ``` +#### Alternative CDN links + +**esm:** + +- https://esm.sh/@faker-js/faker +- https://cdn.jsdelivr.net/npm/@faker-js/faker/+esm + +**cjs:** + +- https://cdn.jsdelivr.net/npm/@faker-js/faker + ### TypeScript Support Since version `v6+` there is native TypeScript support. diff --git a/docs/guide/index.md b/docs/guide/index.md index fded3ac6c8d..61fe9a3dc61 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -71,7 +71,7 @@ const randomCard = faker.helpers.createCard(); // An object representing a rando Using the browser is great for experimenting 👍. However, due to all of the strings Faker uses to generate fake data, **Faker is a large package**. It's `> 5 MiB` minified. **Please avoid deploying Faker in your web app.** ::: -### Deno +### CDN/Deno ```js import { faker } from 'https://cdn.skypack.dev/@faker-js/faker'; @@ -85,6 +85,17 @@ const randomCard = faker.helpers.createCard(); // random contact card containing It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v6.0.0"`. Add `?dts` to import with type definitions: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v6.0.0?dts"`. ::: +#### Alternative CDN links + +**esm:** + +- https://esm.sh/@faker-js/faker +- https://cdn.jsdelivr.net/npm/@faker-js/faker/+esm + +**cjs:** + +- https://cdn.jsdelivr.net/npm/@faker-js/faker + ## Community If you have questions or need help, reach out to the community via [Discord](https://chat.fakerjs.dev) and [GitHub Discussions](https://github.com/faker-js/faker/discussions). From fbb3e7db5aa6c8e65d0b0260d9b8e8e3f5329909 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Tue, 22 Mar 2022 00:34:48 +0100 Subject: [PATCH 028/130] chore: partially activate strict mode (#651) --- tsconfig.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 9f2fe64c876..aea7ca439c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,15 @@ "outDir": "dist", "declaration": true, "esModuleInterop": true, - "allowJs": true + "allowJs": true, + "alwaysStrict": true, + // "strictNullChecks": true, + // "strictBindCallApply": true, + "strictFunctionTypes": true, + // "strictPropertyInitialization": true, + // "noImplicitAny": true, + // "noImplicitThis": true, + "useUnknownInCatchVariables": true }, "include": ["src/**/*"], "exclude": ["node_modules"] From 313c0596ead9dd9cf0052edbc0ceea9437ebd416 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Mar 2022 09:00:43 +0100 Subject: [PATCH 029/130] chore(deps): update vitest to ~0.7.7 (#652) --- package.json | 4 ++-- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 4446c6c2c23..301aa596b67 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.15.0", "@typescript-eslint/parser": "~5.15.0", - "@vitest/ui": "~0.7.6", + "@vitest/ui": "~0.7.7", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.6" + "vitest": "~0.7.7" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 802b1c3a596..4e7729a365b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.15.0 '@typescript-eslint/parser': ~5.15.0 - '@vitest/ui': ~0.7.6 + '@vitest/ui': ~0.7.7 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.6 + vitest: ~0.7.7 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.7.6 + '@vitest/ui': 0.7.7 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.6_@vitest+ui@0.7.6+c8@7.11.0 + vitest: 0.7.7_@vitest+ui@0.7.7+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.6: - resolution: {integrity: sha512-UX99oH1XM9XXi6Py26CbzlqLhG8kOXVB2n7nneoj1uU+C9mKCaVKX8eN4reRU49ntby9FAMAVq4uIkVcAMHIAA==} + /@vitest/ui/0.7.7: + resolution: {integrity: sha512-r+8w1AlUUWcHmAbNbm2wuhhtLqAL5EPtgE2MYCF3/7fjLJUkxRdox8fn/bwqAQGoPTRDOyhLdOZWlJUpk5VKcw==} dependencies: sirv: 2.0.2 dev: true @@ -4444,9 +4444,9 @@ packages: - stylus dev: true - /vitest/0.7.6_@vitest+ui@0.7.6+c8@7.11.0: - resolution: {integrity: sha512-fqk0cn0I2BUpzwLfeZ725JeXJ7WGwDtVcVBksQ6SdyjrBi6aex8t3w70TWgyLOXgylS7FJ8C9DRap4MMgpkqYw==} - engines: {node: '>=14.14.0'} + /vitest/0.7.7_@vitest+ui@0.7.7+c8@7.11.0: + resolution: {integrity: sha512-xU7BTB7T7GbcjFBdbZAAp/dIQUwn8bygI+cbw6Yq1oXj60oGRJ+nJ7AXvSOJyaHMTmglEoaqazyDGnCHJBXftw==} + engines: {node: '>=v14.19.1'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -4465,7 +4465,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.6 + '@vitest/ui': 0.7.7 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From 6e297670560fac9a6d904142bd18d303f23f2be4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Mar 2022 08:09:32 +0000 Subject: [PATCH 030/130] chore(deps): update typescript-eslint to ~5.16.0 (#653) Co-authored-by: Renovate Bot --- package.json | 4 +-- pnpm-lock.yaml | 76 +++++++++++++++++++++++++------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index 301aa596b67..98d30a4baa0 100644 --- a/package.json +++ b/package.json @@ -94,8 +94,8 @@ "@types/prettier": "~2.4.4", "@types/sanitize-html": "~2.6.2", "@types/validator": "~13.7.1", - "@typescript-eslint/eslint-plugin": "~5.15.0", - "@typescript-eslint/parser": "~5.15.0", + "@typescript-eslint/eslint-plugin": "~5.16.0", + "@typescript-eslint/parser": "~5.16.0", "@vitest/ui": "~0.7.7", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4e7729a365b..4bb506f1700 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ specifiers: '@types/prettier': ~2.4.4 '@types/sanitize-html': ~2.6.2 '@types/validator': ~13.7.1 - '@typescript-eslint/eslint-plugin': ~5.15.0 - '@typescript-eslint/parser': ~5.15.0 + '@typescript-eslint/eslint-plugin': ~5.16.0 + '@typescript-eslint/parser': ~5.16.0 '@vitest/ui': ~0.7.7 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 @@ -43,8 +43,8 @@ devDependencies: '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 '@types/validator': 13.7.1 - '@typescript-eslint/eslint-plugin': 5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28 - '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/eslint-plugin': 5.16.0_3fed250b11519414a4c7d52468dd6bf5 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 '@vitest/ui': 0.7.7 c8: 7.11.0 conventional-changelog-cli: 2.2.2 @@ -434,8 +434,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.15.0_f2c49ce7d0e93ebcfdb4b7d25b131b28: - resolution: {integrity: sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==} + /@typescript-eslint/eslint-plugin/5.16.0_3fed250b11519414a4c7d52468dd6bf5: + resolution: {integrity: sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -445,11 +445,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/type-utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 - debug: 4.3.3 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/type-utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + debug: 4.3.4 eslint: 8.11.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 @@ -461,8 +461,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==} + /@typescript-eslint/parser/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -471,26 +471,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 - debug: 4.3.3 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 + debug: 4.3.4 eslint: 8.11.0 typescript: 4.6.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.15.0: - resolution: {integrity: sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==} + /@typescript-eslint/scope-manager/5.16.0: + resolution: {integrity: sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/visitor-keys': 5.15.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/visitor-keys': 5.16.0 dev: true - /@typescript-eslint/type-utils/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==} + /@typescript-eslint/type-utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -499,7 +499,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.15.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 debug: 4.3.4 eslint: 8.11.0 tsutils: 3.21.0_typescript@4.6.2 @@ -508,13 +508,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.15.0: - resolution: {integrity: sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==} + /@typescript-eslint/types/5.16.0: + resolution: {integrity: sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.15.0_typescript@4.6.2: - resolution: {integrity: sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==} + /@typescript-eslint/typescript-estree/5.16.0_typescript@4.6.2: + resolution: {integrity: sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -522,8 +522,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/visitor-keys': 5.15.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/visitor-keys': 5.16.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -534,16 +534,16 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.15.0_eslint@8.11.0+typescript@4.6.2: - resolution: {integrity: sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==} + /@typescript-eslint/utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + resolution: {integrity: sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==} 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.9 - '@typescript-eslint/scope-manager': 5.15.0 - '@typescript-eslint/types': 5.15.0 - '@typescript-eslint/typescript-estree': 5.15.0_typescript@4.6.2 + '@typescript-eslint/scope-manager': 5.16.0 + '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 eslint: 8.11.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.11.0 @@ -552,11 +552,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.15.0: - resolution: {integrity: sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==} + /@typescript-eslint/visitor-keys/5.16.0: + resolution: {integrity: sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.15.0 + '@typescript-eslint/types': 5.16.0 eslint-visitor-keys: 3.3.0 dev: true From 3946df788fdf1e69848e9b6044fced29f52316f2 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Tue, 22 Mar 2022 20:38:53 +0100 Subject: [PATCH 031/130] ci: configure codecov patch threshold (#647) --- .github/.codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/.codecov.yml b/.github/.codecov.yml index d782656df33..21bd0ca39a9 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -11,3 +11,7 @@ coverage: default: target: 95% threshold: 2% + patch: + default: + target: 95% + threshold: 1% From 7f32614702f569d70a8a7744bd3aeb31279599fd Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 23 Mar 2022 08:11:00 +0100 Subject: [PATCH 032/130] docs: fix page meta (#659) --- docs/.vitepress/config.mjs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 60799a0eb4f..83f5b0fb700 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -62,27 +62,42 @@ export default defineConfig({ [ 'meta', { - property: 'og:description', + name: 'og:description', content: description, }, + ], + [ + 'meta', { name: 'twitter:description', content: description, }, + ], + [ + 'meta', { name: 'description', content: description, }, + ], + [ + 'meta', { - property: 'og:image', + name: 'og:image', content: image, }, + ], + [ + 'meta', { - property: 'twitter:image', + name: 'twitter:image', content: image, }, + ], + [ + 'meta', { - property: 'twitter:card', + name: 'twitter:card', content: 'summary_large_image', }, ], From a759c8707c2e3758e64e1c174c2de7aad51cd64b Mon Sep 17 00:00:00 2001 From: Daniel Bannert Date: Wed, 23 Mar 2022 09:06:00 +0100 Subject: [PATCH 033/130] fix: enable algolia search (#641) --- docs/.vitepress/config.mjs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 83f5b0fb700..8c15b49db9f 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -40,13 +40,10 @@ const sidebar = { ], }; -// grab from process.env once this is building on netlify const algolia = { - apiKey: '', - indexName: '', - searchParameters: { - facetFilters: [''], - }, + apiKey: process.env.API_KEY, + appId: process.env.APP_ID, + indexName: 'fakerjs', }; const description = @@ -111,7 +108,6 @@ export default defineConfig({ editLinkText: 'Suggest changes to this page', nav, sidebar, - // TODO 2022-03-06: https://github.com/faker-js/faker/issues/222 - // algolia, + algolia, }, }); From 3f3de78c83ae919fd44531ac7ae9caed885800d4 Mon Sep 17 00:00:00 2001 From: Jelle Hulter Date: Wed, 23 Mar 2022 09:29:48 +0100 Subject: [PATCH 034/130] fix: corrected the Costa Rican IBAN format (#646) --- src/iban.ts | 8 +++++-- test/finance_iban.spec.ts | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/iban.ts b/src/iban.ts index 3f10e91be2e..b608357ee93 100644 --- a/src/iban.ts +++ b/src/iban.ts @@ -206,8 +206,12 @@ export = { }, { country: 'CR', - total: 21, + total: 22, bban: [ + { + type: 'n', + count: 1, + }, { type: 'n', count: 3, @@ -217,7 +221,7 @@ export = { count: 14, }, ], - format: 'CRkk bbbc cccc cccc cccc c', + format: 'CRkk xbbb cccc cccc cccc cc', }, { country: 'HR', diff --git a/test/finance_iban.spec.ts b/test/finance_iban.spec.ts index 23768387d85..5c3fb9c9b6b 100644 --- a/test/finance_iban.spec.ts +++ b/test/finance_iban.spec.ts @@ -255,6 +255,50 @@ describe('finance_iban', () => { 'the result should be equal to 1' ).toBe(1); }); + + it('IBAN for Costa Rica is correct', () => { + // Costa Rica + // https://wise.com/us/iban/costa-rica + // Length 22 + // BBAN 1n,3n,14n + // CRkk xbbb cccc cccc cccc cccc cccc + // x = reserve digit + // b = National bank code (digits) + // c = Account number (digits) + + // example IBAN CR05 0152 0200 1026 2840 66 + + const iban = faker.finance.iban(false, 'CR'); + + expect(iban).satisfy(validator.isIBAN); + + const ibanFormated = iban.match(/.{1,4}/g).join(' '); + const bban = iban.substring(4) + iban.substring(0, 4); + + expect( + 22, + `CR IBAN would be 22 chars length, given is ${iban.length}` + ).toBe(iban.length); + + expect( + iban.substring(0, 2), + iban.substring(0, 2) + + "must start with 'CR' in CR IBAN " + + ibanFormated + ).to.eq('CR'); + + expect( + iban.substring(2, 22), + iban.substring(2, 22) + + ' must contains only digit in AZ IBAN ' + + ibanFormated + ).match(/^\d{20}$/); + + expect( + ibanLib.mod97(ibanLib.toDigitString(bban)), + 'the result should be equal to 1' + ).toBe(1); + }); }); } }); From e6438353dbcb89055ef4ddb5c7cc8318d3f7a0f1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 23 Mar 2022 12:54:47 +0100 Subject: [PATCH 035/130] docs: extract defaults from the comments if absent otherwise (#657) Co-authored-by: Daniel Bannert --- scripts/apidoc/signature.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index bfeb01e6cb6..926b5a7c38d 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -162,7 +162,8 @@ function analyzeParameter(parameter: ParameterReflection): { const name = parameter.name; const declarationName = name + (isOptional(parameter) ? '?' : ''); const type = parameter.type; - const defaultValue = parameter.defaultValue; + const commentDefault = extractDefaultFromComment(parameter.comment); + const defaultValue = parameter.defaultValue ?? commentDefault; let signatureText = ''; if (defaultValue) { @@ -200,6 +201,7 @@ function analyzeParameterOptions( return properties.map((property) => ({ name: `${name}.${property.name}${isOptional(property) ? '?' : ''}`, type: declarationTypeToText(property), + default: extractDefaultFromComment(property.comment), description: mdToHtml( toBlock(property.comment ?? property.signatures?.[0].comment) ), @@ -284,3 +286,25 @@ function signatureTypeToText(signature: SignatureReflection): string { .map((p) => `${p.name}: ${typeToText(p.type)}`) .join(', ')}) => ${typeToText(signature.type)}`; } + +/** + * Extracts and removed the parameter default from the comments. + * + * @param comment The comment to extract the default from. + * @returns The extracted default value. + */ +function extractDefaultFromComment(comment?: Comment): string { + if (!comment) { + return; + } + const text = comment.shortText; + if (!text || text.trim() === '') { + return; + } + const result = /(.*)[ \n]Defaults to `([^`]+)`./.exec(text); + if (!result) { + return; + } + comment.shortText = result[1]; + return result[2]; +} From 1b08de821588a1d5a2436c177c20d60a66e8a977 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 23 Mar 2022 14:41:33 +0100 Subject: [PATCH 036/130] docs: read (complex) defaults from implementation signature (#656) Co-authored-by: Shinigami Co-authored-by: Daniel Bannert --- scripts/apidoc.ts | 15 ++++ scripts/apidoc/parameterDefaults.ts | 130 ++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 scripts/apidoc/parameterDefaults.ts diff --git a/scripts/apidoc.ts b/scripts/apidoc.ts index cb4ed2a4e12..4ac4fbf9776 100644 --- a/scripts/apidoc.ts +++ b/scripts/apidoc.ts @@ -3,6 +3,11 @@ import * as TypeDoc from 'typedoc'; import { writeApiPagesIndex } from './apidoc/apiDocsWriter'; import { processDirectMethods } from './apidoc/directMethods'; import { processModuleMethods } from './apidoc/moduleMethods'; +import { + DefaultParameterAwareSerializer, + parameterDefaultReader, + patchProjectParameterDefaults, +} from './apidoc/parameterDefaults'; import type { PageIndex } from './apidoc/utils'; import { pathOutputDir } from './apidoc/utils'; @@ -15,6 +20,14 @@ async function build(): Promise { // If you want TypeDoc to load typedoc.json files //app.options.addReader(new TypeDoc.TypeDocReader()); + // Read parameter defaults + app.converter.on( + TypeDoc.Converter.EVENT_CREATE_DECLARATION, + parameterDefaultReader + ); + // Add to debug json output + app.serializer.addSerializer(new DefaultParameterAwareSerializer(undefined)); + app.bootstrap({ entryPoints: ['src/index.ts'], pretty: true, @@ -31,6 +44,8 @@ async function build(): Promise { await app.generateJson(project, pathOutputJson); console.log(pathOutputDir); + patchProjectParameterDefaults(project); + const modulesPages: PageIndex = []; modulesPages.push({ text: 'Localization', link: '/api/localization.html' }); modulesPages.push(...processModuleMethods(project)); diff --git a/scripts/apidoc/parameterDefaults.ts b/scripts/apidoc/parameterDefaults.ts new file mode 100644 index 00000000000..9342d7b21cf --- /dev/null +++ b/scripts/apidoc/parameterDefaults.ts @@ -0,0 +1,130 @@ +import type { + Context, + DeclarationReflection, + EventCallback, + JSONOutput, + ProjectReflection, + SignatureReflection, +} from 'typedoc'; +import { + Reflection, + ReflectionKind, + SerializerComponent, + TypeScript, +} from 'typedoc'; + +const reflectionKindFunctionOrMethod = + ReflectionKind.Function | ReflectionKind.Method; + +interface ParameterDefaultsAware extends Reflection { + implementationDefaultParameters: string[]; +} + +/** + * TypeDoc EventCallback for EVENT_CREATE_DECLARATION events that reads the default parameters from the implementation. + */ +export const parameterDefaultReader: EventCallback = ( + context: Context, + reflection: Reflection +): void => { + const symbol = context.project.getSymbolFromReflection(reflection); + if (!symbol) return; + + if ( + reflection.kindOf(reflectionKindFunctionOrMethod) && + symbol.declarations?.length + ) { + const lastDeclaration = symbol.declarations[symbol.declarations.length - 1]; + if (TypeScript.isFunctionLike(lastDeclaration)) { + (reflection as ParameterDefaultsAware).implementationDefaultParameters = + lastDeclaration.parameters.map((param) => + cleanParameterDefault(param.initializer?.getText()) + ); + } + } +}; + +/** + * Removes compile expressions that don't add any value for readers. + * + * @param value The default value to clean. + * @returns The cleaned default value. + */ +function cleanParameterDefault(value?: string): string { + if (value == null) { + return undefined; + } + // Strip type casts: "'foobar' as unknown as T" => "'foobar'" + return value.replace(/ as unknown as [A-Za-z<>]+/, ''); +} + +/** + * Serializer that adds the `implementationDefaultParameters` to the JSON output. + */ +export class DefaultParameterAwareSerializer extends SerializerComponent { + serializeGroup(instance: unknown): boolean { + return instance instanceof Reflection; + } + + supports(item: unknown): boolean { + return true; + } + + toObject(item: Reflection, obj?: object): Partial { + (obj as ParameterDefaultsAware).implementationDefaultParameters = ( + item as ParameterDefaultsAware + ).implementationDefaultParameters; + return obj; + } +} + +/** + * Replaces all methods' last signature's parameter's default value with the default value read from the implementation. + * + * @param project The project to patch. + */ +export function patchProjectParameterDefaults( + project: ProjectReflection +): void { + const functionOrMethods = project.getReflectionsByKind( + reflectionKindFunctionOrMethod + ) as DeclarationReflection[]; + for (const functionOrMethod of functionOrMethods) { + patchMethodParameterDefaults(functionOrMethod); + } +} + +/** + * Replaces the last signature's parameter's default value with the default value read from the implementation. + * + * @param method The method to patch. + */ +function patchMethodParameterDefaults(method: DeclarationReflection): void { + const signatures = method.signatures; + const signature = signatures[signatures.length - 1]; + const parameterDefaults = (method as unknown as ParameterDefaultsAware) + .implementationDefaultParameters; + if (parameterDefaults) { + patchSignatureParameterDefaults(signature, parameterDefaults); + } +} + +/** + * Replaces the given signature's parameter's default value with the given default values. + * + * @param signature The signature to patch. + * @param parameterDefaults The defaults to add. + */ +function patchSignatureParameterDefaults( + signature: SignatureReflection, + parameterDefaults: string[] +): void { + const signatureParameters = signature.parameters; + if (signatureParameters.length !== parameterDefaults.length) { + throw new Error('Unexpected parameter length mismatch'); + } + signatureParameters.forEach( + (param, index) => + (param.defaultValue = parameterDefaults[index] || param.defaultValue) + ); +} From 825a8c89a2a1390713ca27877eac9bd19a0c19be Mon Sep 17 00:00:00 2001 From: griest024 Date: Wed, 23 Mar 2022 18:10:41 -0400 Subject: [PATCH 037/130] ci: reduce diff coverage target (#663) --- .github/.codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/.codecov.yml b/.github/.codecov.yml index 21bd0ca39a9..1cd3212beed 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -13,5 +13,5 @@ coverage: threshold: 2% patch: default: - target: 95% + target: 40% threshold: 1% From 949835fc0dd946edca5d6ce8de901e87b9450356 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Thu, 24 Mar 2022 08:24:26 +0100 Subject: [PATCH 038/130] chore: drop fake usage in vehicle.ts (#275) --- src/vehicle.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/vehicle.ts b/src/vehicle.ts index 58fb63a14f2..e2678bee4d4 100644 --- a/src/vehicle.ts +++ b/src/vehicle.ts @@ -1,15 +1,10 @@ import type { Faker } from '.'; -import type { Fake } from './fake'; - -let fake: Fake['fake']; /** * Module to generate vehicle related entries. */ export class Vehicle { constructor(private readonly faker: Faker) { - fake = faker.fake; - // Bind `this` so namespaced is working correctly for (const name of Object.getOwnPropertyNames(Vehicle.prototype)) { if (name === 'constructor' || typeof this[name] !== 'function') { @@ -26,7 +21,7 @@ export class Vehicle { * faker.vehicle.vehicle() // 'BMW Explorer' */ vehicle(): string { - return fake('{{vehicle.manufacturer}} {{vehicle.model}}'); + return `${this.manufacturer()} ${this.model()}`; } /** @@ -98,7 +93,7 @@ export class Vehicle { * faker.vehicle.color() // 'red' */ color(): string { - return fake('{{commerce.color}}'); + return this.faker.commerce.color(); } /** From 91a1aaba954b7d172c3dd3346567078644b74189 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Thu, 24 Mar 2022 08:28:47 +0100 Subject: [PATCH 039/130] fix: accept dates as params for Date methods (#200) --- src/date.ts | 87 ++++++++-------- src/helpers.ts | 2 - test/date.spec.ts | 252 +++++++++++++++++++++------------------------- 3 files changed, 161 insertions(+), 180 deletions(-) diff --git a/src/date.ts b/src/date.ts index dcc2360091b..6c9b910065f 100644 --- a/src/date.ts +++ b/src/date.ts @@ -1,6 +1,32 @@ import type { Faker } from '.'; import type { DateEntryDefinition } from './definitions'; +/** + * Converts date passed as a string or Date to a Date object. If nothing passed, takes current date. + * + * @param date Date + */ +function toDate(date?: string | Date): Date { + if (date != null) { + return new Date(date instanceof Date ? date : Date.parse(date)); + } + + return new Date(); +} + +/** + * Converts date passed as a string or Date to milliseconds. If nothing passed, takes current date. + * + * @param date Date + */ +function toMilliseconds(date?: string | Date): number { + if (date != null) { + return date instanceof Date ? date.getTime() : Date.parse(date); + } + + return new Date().getTime(); +} + /** * Module to generate dates. */ @@ -28,12 +54,8 @@ export class _Date { * faker.date.past(10) // '2017-10-25T21:34:19.488Z' * faker.date.past(10, '2020-01-01T00:00:00.000Z') // '2017-08-18T02:59:12.350Z' */ - past(years?: number, refDate?: string): Date { - let date = new Date(); - if (typeof refDate !== 'undefined') { - date = new Date(Date.parse(refDate)); - } - + past(years?: number, refDate?: string | Date): Date { + const date = toDate(refDate); const range = { min: 1000, max: (years || 1) * 365 * 24 * 3600 * 1000, @@ -59,12 +81,8 @@ export class _Date { * faker.date.future(10) // '2030-11-23T09:38:28.710Z' * faker.date.future(10, '2020-01-01T00:00:00.000Z') // '2020-12-13T22:45:10.252Z' */ - future(years?: number, refDate?: string): Date { - let date = new Date(); - if (typeof refDate !== 'undefined') { - date = new Date(Date.parse(refDate)); - } - + future(years?: number, refDate?: string | Date): Date { + const date = toDate(refDate); const range = { min: 1000, max: (years || 1) * 365 * 24 * 3600 * 1000, @@ -86,13 +104,12 @@ export class _Date { * @example * faker.date.between('2020-01-01T00:00:00.000Z', '2030-01-01T00:00:00.000Z') // '2026-05-16T02:22:53.002Z' */ - between(from: string, to: string): Date { - const fromMilli = Date.parse(from); - const dateOffset = this.faker.datatype.number(Date.parse(to) - fromMilli); - - const newDate = new Date(fromMilli + dateOffset); + between(from: string | Date, to: string | Date): Date { + const fromMs = toMilliseconds(from); + const toMs = toMilliseconds(to); + const dateOffset = this.faker.datatype.number(toMs - fromMs); - return newDate; + return new Date(fromMs + dateOffset); } /** @@ -112,22 +129,18 @@ export class _Date { * faker.date.betweens('2020-01-01T00:00:00.000Z', '2030-01-01T00:00:00.000Z', 2) * // [ 2023-05-02T16:00:00.000Z, 2026-09-01T08:00:00.000Z ] */ - betweens(from: string, to: string, num?: number): Date[] { + betweens(from: string | Date, to: string | Date, num?: number): Date[] { if (typeof num === 'undefined') { num = 3; } - const newDates: Date[] = []; - let fromMilli = Date.parse(from); - const dateOffset = (Date.parse(to) - fromMilli) / (num + 1); - let lastDate: string | Date = from; + + const dates: Date[] = []; + for (let i = 0; i < num; i++) { - // TODO @Shinigami92 2022-01-11: It may be a bug that `lastDate` is passed to parse if it's a `Date` not a `string` - // @ts-expect-error - fromMilli = Date.parse(lastDate); - lastDate = new Date(fromMilli + dateOffset); - newDates.push(lastDate); + dates.push(this.between(from, to)); } - return newDates; + + return dates.sort((a, b) => a.getTime() - b.getTime()); } /** @@ -143,12 +156,8 @@ export class _Date { * faker.date.recent(10) // '2022-01-29T06:12:12.829Z' * faker.date.recent(10, '2020-01-01T00:00:00.000Z') // '2019-12-27T18:11:19.117Z' */ - recent(days?: number, refDate?: string): Date { - let date = new Date(); - if (typeof refDate !== 'undefined') { - date = new Date(Date.parse(refDate)); - } - + recent(days?: number, refDate?: string | Date): Date { + const date = toDate(refDate); const range = { min: 1000, max: (days || 1) * 24 * 3600 * 1000, @@ -174,12 +183,8 @@ export class _Date { * faker.date.soon(10) // '2022-02-11T05:14:39.138Z' * faker.date.soon(10, '2020-01-01T00:00:00.000Z') // '2020-01-01T02:40:44.990Z' */ - soon(days?: number, refDate?: string): Date { - let date = new Date(); - if (typeof refDate !== 'undefined') { - date = new Date(Date.parse(refDate)); - } - + soon(days?: number, refDate?: string | Date): Date { + const date = toDate(refDate); const range = { min: 1000, max: (days || 1) * 24 * 3600 * 1000, diff --git a/src/helpers.ts b/src/helpers.ts index ddf19ed905e..2ee9faf529f 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -594,8 +594,6 @@ export class Helpers { email: this.faker.internet.email(userName), dob: this.faker.date.past( 50, - // TODO @Shinigami92 2022-01-14: We may need to convert this to a string - // @ts-expect-error new Date('Sat Sep 20 1992 21:35:02 GMT+0200 (CEST)') ), phone: this.faker.phone.phoneNumber(), diff --git a/test/date.spec.ts b/test/date.spec.ts index a6af2cb5d00..1d6f8832892 100644 --- a/test/date.spec.ts +++ b/test/date.spec.ts @@ -5,50 +5,30 @@ const seededRuns = [ { seed: 42, expectations: { - past: [ - new Date('2020-10-08T00:10:58.041Z'), - new Date('2020-10-08T00:10:57.330Z'), - new Date('2017-05-26T15:26:24.637Z'), - new Date('2017-05-26T15:26:23.926Z'), - ], - future: [ - new Date('2021-07-08T10:07:33.381Z'), - new Date('2021-07-08T10:07:32.670Z'), - new Date('2024-11-19T18:52:06.785Z'), - new Date('2024-11-19T18:52:06.074Z'), - ], - between: [ - new Date('2021-03-15T19:30:57.091Z'), - new Date('2021-07-29T19:19:12.731Z'), - ], + past: { + noArgs: new Date('2020-10-08T00:10:58.041Z'), + ten: new Date('2017-05-26T15:26:24.637Z'), + }, + future: { + noArgs: new Date('2021-07-08T10:07:33.381Z'), + ten: new Date('2024-11-19T18:52:06.785Z'), + }, + between: new Date('2021-03-15T19:30:57.091Z'), betweens: [ - [ - new Date('2021-03-08T11:09:46.211Z'), - new Date('2021-03-23T05:10:16.500Z'), - new Date('2021-04-06T23:10:46.500Z'), - ], - [ - new Date('2021-03-08T11:09:45.500Z'), - new Date('2021-03-23T05:10:15.500Z'), - new Date('2021-04-06T23:10:45.500Z'), - ], - ], - recent: [ - new Date('2021-02-21T08:11:56.820Z'), - new Date('2021-02-21T08:11:56.109Z'), - ], - soon: [ - new Date('2021-03-13T23:15:38.042Z'), - new Date('2021-03-13T23:15:37.891Z'), + new Date('2021-03-15T19:30:57.091Z'), + new Date('2021-04-09T17:05:10.406Z'), + new Date('2021-04-18T19:23:52.973Z'), ], + recent: new Date('2021-02-21T08:11:56.820Z'), + soon: new Date('2021-03-13T23:15:38.042Z'), month: { - default: 'May', + noArgs: 'May', abbr: 'May', context: 'May', abbr_context: 'May', }, weekday: { - default: 'Tuesday', + noArgs: 'Tuesday', abbr: 'Tue', context: 'Tuesday', abbr_context: 'Tue', @@ -58,50 +38,30 @@ const seededRuns = [ { seed: 1337, expectations: { - past: [ - new Date('2020-11-18T01:49:04.785Z'), - new Date('2020-11-18T01:49:04.074Z'), - new Date('2018-07-11T07:47:33.089Z'), - new Date('2018-07-11T07:47:32.378Z'), - ], - future: [ - new Date('2021-05-28T08:29:26.637Z'), - new Date('2021-05-28T08:29:25.926Z'), - new Date('2023-10-06T02:30:58.333Z'), - new Date('2023-10-06T02:30:57.622Z'), - ], - between: [ - new Date('2021-03-09T04:11:24.667Z'), - new Date('2021-06-12T02:21:47.178Z'), - ], + past: { + noArgs: new Date('2020-11-18T01:49:04.785Z'), + ten: new Date('2018-07-11T07:47:33.089Z'), + }, + future: { + noArgs: new Date('2021-05-28T08:29:26.637Z'), + ten: new Date('2023-10-06T02:30:58.333Z'), + }, + between: new Date('2021-03-09T04:11:24.667Z'), betweens: [ - [ - new Date('2021-03-08T11:09:46.211Z'), - new Date('2021-03-23T05:10:16.500Z'), - new Date('2021-04-06T23:10:46.500Z'), - ], - [ - new Date('2021-03-08T11:09:45.500Z'), - new Date('2021-03-23T05:10:15.500Z'), - new Date('2021-04-06T23:10:45.500Z'), - ], - ], - recent: [ - new Date('2021-02-21T10:53:58.041Z'), - new Date('2021-02-21T10:53:57.330Z'), - ], - soon: [ - new Date('2021-03-13T20:33:36.821Z'), - new Date('2021-03-13T20:33:36.670Z'), + new Date('2021-03-03T01:51:22.512Z'), + new Date('2021-03-09T04:11:24.667Z'), + new Date('2021-03-26T18:53:00.564Z'), ], + recent: new Date('2021-02-21T10:53:58.041Z'), + soon: new Date('2021-03-13T20:33:36.821Z'), month: { - default: 'April', + noArgs: 'April', abbr: 'Apr', context: 'April', abbr_context: 'Apr', }, weekday: { - default: 'Monday', + noArgs: 'Monday', abbr: 'Mon', context: 'Monday', abbr_context: 'Mon', @@ -111,50 +71,30 @@ const seededRuns = [ { seed: 1211, expectations: { - past: [ - new Date('2020-03-19T19:19:04.071Z'), - new Date('2020-03-19T19:19:03.360Z'), - new Date('2011-11-12T14:47:19.955Z'), - new Date('2011-11-12T14:47:19.244Z'), - ], - future: [ - new Date('2022-01-26T14:59:27.351Z'), - new Date('2022-01-26T14:59:26.640Z'), - new Date('2030-06-03T19:31:11.467Z'), - new Date('2030-06-03T19:31:10.756Z'), - ], - between: [ - new Date('2021-04-17T11:58:13.327Z'), - new Date('2022-03-21T16:37:15.905Z'), - ], + past: { + noArgs: new Date('2020-03-19T19:19:04.071Z'), + ten: new Date('2011-11-12T14:47:19.955Z'), + }, + future: { + noArgs: new Date('2022-01-26T14:59:27.351Z'), + ten: new Date('2030-06-03T19:31:11.467Z'), + }, + between: new Date('2021-04-17T11:58:13.327Z'), betweens: [ - [ - new Date('2021-03-08T11:09:46.211Z'), - new Date('2021-03-23T05:10:16.500Z'), - new Date('2021-04-06T23:10:46.500Z'), - ], - [ - new Date('2021-03-08T11:09:45.500Z'), - new Date('2021-03-23T05:10:15.500Z'), - new Date('2021-04-06T23:10:45.500Z'), - ], - ], - recent: [ - new Date('2021-02-20T18:54:13.498Z'), - new Date('2021-02-20T18:54:12.787Z'), - ], - soon: [ - new Date('2021-03-14T12:33:21.364Z'), - new Date('2021-03-14T12:33:21.213Z'), + new Date('2021-03-20T19:08:07.621Z'), // done + new Date('2021-04-15T10:20:25.794Z'), + new Date('2021-04-17T11:58:13.327Z'), ], + recent: new Date('2021-02-20T18:54:13.498Z'), + soon: new Date('2021-03-14T12:33:21.364Z'), month: { - default: 'December', + noArgs: 'December', abbr: 'Dec', context: 'December', abbr_context: 'Dec', }, weekday: { - default: 'Saturday', + noArgs: 'Saturday', abbr: 'Sat', context: 'Saturday', abbr_context: 'Sat', @@ -178,7 +118,7 @@ describe('date', () => { const actual = faker.date.past(undefined, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.past[0]); + expect(actual).toEqual(expectations.past.noArgs); }); it('should return deterministic past value on given refDate of type date', () => { @@ -189,7 +129,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.past[1]); + expect(actual).toEqual(expectations.past.noArgs); }); it('should return deterministic past value on given years 10 and refDate of type string', () => { @@ -197,7 +137,7 @@ describe('date', () => { const actual = faker.date.past(10, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.past[2]); + expect(actual).toEqual(expectations.past.ten); }); it('should return deterministic past value on given years 10 and refDate of type date', () => { @@ -208,7 +148,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.past[3]); + expect(actual).toEqual(expectations.past.ten); }); }); @@ -221,7 +161,7 @@ describe('date', () => { '2021-02-21T17:09:15.711Z' ); - expect(actual).toEqual(expectations.future[0]); + expect(actual).toEqual(expectations.future.noArgs); }); it('should return deterministic future value on given refDate of type date', () => { @@ -232,7 +172,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.future[1]); + expect(actual).toEqual(expectations.future.noArgs); }); it('should return deterministic future value on given years 10 and refDate of type string', () => { @@ -240,7 +180,7 @@ describe('date', () => { const actual = faker.date.future(10, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.future[2]); + expect(actual).toEqual(expectations.future.ten); }); it('should return deterministic future value on given years 10 and refDate of type date', () => { @@ -251,7 +191,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.future[3]); + expect(actual).toEqual(expectations.future.ten); }); }); @@ -264,18 +204,18 @@ describe('date', () => { '2021-04-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.between[0]); + expect(actual).toEqual(expectations.between); }); it('should return deterministic value between given real dates', () => { faker.seed(seed); const actual = faker.date.between( - new Date('2021-02-21'), - new Date('2022-04-21') + new Date('2021-02-21T17:09:15.711Z'), + new Date('2021-04-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.between[1]); + expect(actual).toEqual(expectations.between); }); }); @@ -283,25 +223,23 @@ describe('date', () => { it('should return deterministic value betweens given string dates', () => { faker.seed(seed); - // TODO @Shinigami92 2022-01-27: This function doesn't respect seeding const actual = faker.date.betweens( '2021-02-21T17:09:15.711Z', '2021-04-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.betweens[0]); + expect(actual).toEqual(expectations.betweens); }); it('should return deterministic value betweens given dates', () => { faker.seed(seed); - // TODO @Shinigami92 2022-01-27: This function doesn't respect seeding const actual = faker.date.betweens( new Date('2021-02-21T17:09:15.711Z'), new Date('2021-04-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.betweens[1]); + expect(actual).toEqual(expectations.betweens); }); }); @@ -314,7 +252,7 @@ describe('date', () => { '2021-02-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.recent[0]); + expect(actual).toEqual(expectations.recent); }); it('should return deterministic value recent to given refDate of type date', () => { @@ -325,7 +263,7 @@ describe('date', () => { new Date('2021-02-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.recent[1]); + expect(actual).toEqual(expectations.recent); }); }); @@ -335,7 +273,7 @@ describe('date', () => { const actual = faker.date.soon(undefined, '2021-03-13T14:16:17.151Z'); - expect(actual).toEqual(expectations.soon[0]); + expect(actual).toEqual(expectations.soon); }); it('should return deterministic value soon to given refDate of type date', () => { @@ -346,7 +284,7 @@ describe('date', () => { new Date('2021-03-13T14:16:17.151Z') ); - expect(actual).toEqual(expectations.soon[1]); + expect(actual).toEqual(expectations.soon); }); }); @@ -356,7 +294,7 @@ describe('date', () => { const actual = faker.date.month(); - expect(actual).toEqual(expectations.month.default); + expect(actual).toEqual(expectations.month.noArgs); }); it('should return deterministic value month with abbr true', () => { @@ -390,7 +328,7 @@ describe('date', () => { const actual = faker.date.weekday(); - expect(actual).toEqual(expectations.weekday.default); + expect(actual).toEqual(expectations.weekday.noArgs); }); it('should return deterministic value weekday with abbr true', () => { @@ -479,7 +417,13 @@ describe('date', () => { it('should return a date 75 years after the date given', () => { const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - const date = faker.date.future(75, refDate.toISOString()); + let date = faker.date.future(75, refDate); + + // date should be after the date given, but before the current time + expect(date).greaterThan(refDate); + expect(date).lessThan(new Date()); + + date = faker.date.future(75, refDate.toISOString()); // date should be after the date given, but before the current time expect(date).greaterThan(refDate); @@ -492,7 +436,12 @@ describe('date', () => { const from = new Date(1990, 5, 7, 9, 11, 0, 0); const to = new Date(2000, 6, 8, 10, 12, 0, 0); - const date = faker.date.between(from, to); + let date = faker.date.between(from, to); + + expect(date).greaterThan(from); + expect(date).lessThan(to); + + date = faker.date.between(from.toISOString(), to.toISOString()); expect(date).greaterThan(from); expect(date).lessThan(to); @@ -504,7 +453,14 @@ describe('date', () => { const from = new Date(1990, 5, 7, 9, 11, 0, 0); const to = new Date(2000, 6, 8, 10, 12, 0, 0); - const dates = faker.date.betweens(from, to); + let dates = faker.date.betweens(from, to); + + expect(dates[0]).greaterThan(from); + expect(dates[0]).lessThan(to); + expect(dates[1]).greaterThan(dates[0]); + expect(dates[2]).greaterThan(dates[1]); + + dates = faker.date.betweens(from.toISOString(), to.toISOString()); expect(dates[0]).greaterThan(from); expect(dates[0]).lessThan(to); @@ -524,12 +480,23 @@ describe('date', () => { const days = 30; const refDate = new Date(2120, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - const date = faker.date.recent(days, refDate); - const lowerBound = new Date( refDate.getTime() - days * 24 * 60 * 60 * 1000 ); + let date = faker.date.recent(days, refDate); + + expect( + lowerBound, + '`recent()` date should not be further back than `n` days ago' + ).lessThanOrEqual(date); + expect( + date, + '`recent()` date should not be ahead of the starting date reference' + ).lessThanOrEqual(refDate); + + date = faker.date.recent(days, refDate.toISOString()); + expect( lowerBound, '`recent()` date should not be further back than `n` days ago' @@ -552,12 +519,23 @@ describe('date', () => { const days = 30; const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - const date = faker.date.soon(days, refDate); - const upperBound = new Date( refDate.getTime() + days * 24 * 60 * 60 * 1000 ); + let date = faker.date.soon(days, refDate); + + expect( + date, + '`soon()` date should not be further ahead than `n` days ago' + ).lessThanOrEqual(upperBound); + expect( + refDate, + '`soon()` date should not be behind the starting date reference' + ).lessThanOrEqual(date); + + date = faker.date.soon(days, refDate.toISOString()); + expect( date, '`soon()` date should not be further ahead than `n` days ago' From 9ce1551ab7c9cafc97e3d051f0632591e34eb3ce Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 24 Mar 2022 08:56:07 +0100 Subject: [PATCH 040/130] fix: normalize provider in finance.creditCardNumber (#662) --- src/finance.ts | 7 ++++--- test/finance.spec.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/finance.ts b/src/finance.ts index b71e63b2e5c..37f491fe3a1 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -249,7 +249,7 @@ export class Finance { /** * Generates a random credit card number. * - * @param provider The (lowercase) name of the provider or the format used to generate one. + * @param provider The name of the provider (case insensitive) or the format used to generate one. * * @example * faker.finance.creditCardNumber() // '4427163488668' @@ -259,8 +259,9 @@ export class Finance { creditCardNumber(provider = ''): string { let format: string; const localeFormat = this.faker.definitions.finance.credit_card; - if (provider in localeFormat) { - format = this.faker.random.arrayElement(localeFormat[provider]); + const normalizedProvider = provider.toLowerCase(); + if (normalizedProvider in localeFormat) { + format = this.faker.random.arrayElement(localeFormat[normalizedProvider]); } else if (provider.match(/#/)) { // The user chose an optional scheme format = provider; diff --git a/test/finance.spec.ts b/test/finance.spec.ts index d49e29a30f8..312f4fb50dd 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -384,6 +384,18 @@ describe('finance', () => { expect(luhnCheck(faker.finance.creditCardNumber())).toBeTruthy(); }); + it('should ignore case for provider', () => { + const seed = faker.seedValue; + + faker.seed(seed); + const actualNonLowerCase = faker.finance.creditCardNumber('ViSa'); + + faker.seed(seed); + const actualLowerCase = faker.finance.creditCardNumber('visa'); + + expect(actualNonLowerCase).toBe(actualLowerCase); + }); + it('should return a correct credit card number when issuer provided', () => { //TODO: implement checks for each format with regexp const visa = faker.finance.creditCardNumber('visa'); @@ -417,7 +429,7 @@ describe('finance', () => { expect(luhnCheck(instapayment)).toBeTruthy(); }); - it('should return custom formated strings', () => { + it('should return custom formatted strings', () => { let number = faker.finance.creditCardNumber('###-###-##L'); expect(number).match(/^\d{3}\-\d{3}\-\d{3}$/); expect(luhnCheck(number)).toBeTruthy(); From 301a6d2024816bf40f1091ccffe6bb81cb7ba7b0 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 24 Mar 2022 09:09:17 +0100 Subject: [PATCH 041/130] fix: fake is unable to return empty strings (#347) --- src/fake.ts | 4 ++++ test/fake.spec.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/fake.ts b/src/fake.ts index 726bf89695e..4261ebebbc2 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -116,6 +116,10 @@ export class Fake { // replace the found tag with the returned fake value res = str.replace('{{' + token + '}}', result); + if (res === '') { + return ''; + } + // return the response recursively until we are done finding all tags return this.fake(res); } diff --git a/test/fake.spec.ts b/test/fake.spec.ts index d1e18ac484a..a78940eab70 100644 --- a/test/fake.spec.ts +++ b/test/fake.spec.ts @@ -46,5 +46,9 @@ describe('fake', () => { Error('Invalid method: address.foo') ); }); + + it('should be able to return empty strings', () => { + expect(faker.fake('{{helpers.repeatString}}')).toBe(''); + }); }); }); From 7141cd7d8a2fd505d3338d13ca29fd1ab7a5dc80 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 24 Mar 2022 09:14:53 +0100 Subject: [PATCH 042/130] fix: datatype.datetime should use static boundaries (#343) --- src/datatype.ts | 4 +-- test/datatype.spec.ts | 70 ++++++++++++++++++++++++++++++------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/datatype.ts b/src/datatype.ts index 706ed60e906..5dc1793c8e2 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -130,11 +130,11 @@ export class Datatype { let max = typeof options === 'number' ? options : options?.max; if (typeof min === 'undefined' || min < minMax * -1) { - min = new Date().setFullYear(1990, 1, 1); + min = Date.UTC(1990, 0); } if (typeof max === 'undefined' || max > minMax) { - max = new Date().setFullYear(2100, 1, 1); + max = Date.UTC(2100, 0); } return new Date(this.faker.datatype.number({ min, max })); diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index 35ac512fd06..902cf9ba706 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -22,8 +22,11 @@ const seededRuns = [ withMinAndMaxAndPrecision: -0.4261, }, datetime: { - // TODO @Shinigami92 2022-01-29: We will fix the deterministic in #343 - noArgs: new Date('2092-03-22T16:55:38.644Z'), + noArgs: new Date('2031-03-14T21:33:22.114Z'), + number: new Date('1994-03-20T17:23:00.629Z'), + withMin: new Date('1801-04-11T15:13:06.330Z'), + withMax: new Date('1994-07-11T09:43:47.230Z'), + withMinMax: new Date('1689-09-09T08:39:09.444Z'), }, string: { noArgs: 'Cky2eiXX/J', @@ -91,8 +94,11 @@ const seededRuns = [ withMinAndMaxAndPrecision: -12.9153, }, datetime: { - // TODO @Shinigami92 2022-01-29: We will fix the deterministic in #343 - noArgs: new Date('2092-03-22T16:55:38.644Z'), + noArgs: new Date('2018-10-28T08:46:11.896Z'), + number: new Date('1992-12-13T04:13:59.232Z'), + withMin: new Date('1747-07-16T01:19:54.159Z'), + withMax: new Date('1993-03-02T00:10:04.335Z'), + withMinMax: new Date('1669-06-22T01:21:21.236Z'), }, string: { noArgs: '9U/4:SK$>6', @@ -160,8 +166,11 @@ const seededRuns = [ withMinAndMaxAndPrecision: 61.0658, }, datetime: { - // TODO @Shinigami92 2022-01-29: We will fix the deterministic in #343 - noArgs: new Date('2092-03-22T16:55:38.644Z'), + noArgs: new Date('2092-02-20T03:42:04.341Z'), + number: new Date('2000-06-14T02:54:42.082Z'), + withMin: new Date('2065-11-10T19:27:20.915Z'), + withMax: new Date('2001-03-20T11:14:25.251Z'), + withMinMax: new Date('1789-03-26T15:44:45.218Z'), }, string: { noArgs: 'wKti5-}$_/', @@ -230,17 +239,6 @@ describe('datatype', () => { for (const { seed, expectations } of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { - if (functionName === 'datetime') { - // TODO @Shinigami92 2022-01-29: We will fix the deterministic in #343 - it(`${functionName}()`, () => { - faker.seed(seed); - - const actual = faker.datatype.datetime(); - expect(actual).toBeTypeOf('object'); - }); - continue; - } - it(`${functionName}()`, () => { faker.seed(seed); @@ -335,10 +333,42 @@ describe('datatype', () => { }); }); - // TODO @ST-DDT 2022-01-29: #343 - describe.todo('datetime', () => { - it('should ... ', () => { + describe('datetime', () => { + it('should return a deterministic date when given a number', () => { faker.seed(seed); + + const actual = faker.datatype.datetime( + Date.parse('2001-04-03T23:21:10.773Z') + ); + expect(actual).toEqual(expectations.datetime.number); + }); + + it('should return a deterministic date when given a min date', () => { + faker.seed(seed); + + const actual = faker.datatype.datetime({ + min: Date.parse('1622-05-23T13:45:08.843Z'), + }); + expect(actual).toEqual(expectations.datetime.withMin); + }); + + it('should return a deterministic date when given a max date', () => { + faker.seed(seed); + + const actual = faker.datatype.datetime({ + max: Date.parse('2002-01-29T19:47:52.605Z'), + }); + expect(actual).toEqual(expectations.datetime.withMax); + }); + + it('should return a deterministic date when given a min and max date', () => { + faker.seed(seed); + + const actual = faker.datatype.datetime({ + min: Date.parse('1622-05-23T13:45:08.843Z'), + max: Date.parse('1802-01-29T19:47:52.605Z'), + }); + expect(actual).toEqual(expectations.datetime.withMinMax); }); }); From fe62c1953c1b5755151c6d7562614f89733a6de1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 24 Mar 2022 09:21:24 +0100 Subject: [PATCH 043/130] refactor: set seed directly (#563) --- src/datatype.ts | 9 +-------- src/faker.ts | 11 +++++++---- src/random.ts | 9 +-------- test/faker.spec.ts | 26 ++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 test/faker.spec.ts diff --git a/src/datatype.ts b/src/datatype.ts index 5dc1793c8e2..aa7139dd701 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -4,14 +4,7 @@ import type { Faker } from '.'; * Module to generate various primitive values and data types. */ export class Datatype { - constructor(private readonly faker: Faker, seed?: number | number[]) { - // Use a user provided seed if it is an array or number - if (Array.isArray(seed) && seed.length) { - this.faker.mersenne.seed_array(seed); - } else if (!Array.isArray(seed) && !isNaN(seed)) { - this.faker.mersenne.seed(seed); - } - + constructor(private readonly faker: Faker) { // Bind `this` so namespaced is working correctly for (const name of Object.getOwnPropertyNames(Datatype.prototype)) { if (name === 'constructor' || typeof this[name] !== 'function') { diff --git a/src/faker.ts b/src/faker.ts index 83f59a06259..572bbaf2338 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -129,10 +129,13 @@ export class Faker { }); } - seed(value?: number | number[]): void { - this.seedValue = value; - this.random = new Random(this, this.seedValue); - this.datatype = new Datatype(this, this.seedValue); + seed(seed?: number | number[]): void { + this.seedValue = seed; + if (Array.isArray(seed) && seed.length) { + this.mersenne.seed_array(seed); + } else if (!Array.isArray(seed) && !isNaN(seed)) { + this.mersenne.seed(seed); + } } /** diff --git a/src/random.ts b/src/random.ts index dd58c3ce821..b84a2ece614 100644 --- a/src/random.ts +++ b/src/random.ts @@ -18,14 +18,7 @@ function arrayRemove(arr: T[], values: T[]): T[] { * Generates random values of different kinds. Some methods are deprecated and have been moved to dedicated modules. */ export class Random { - constructor(private readonly faker: Faker, seed?: number | number[]) { - // Use a user provided seed if it is an array or number - if (Array.isArray(seed) && seed.length) { - this.faker.mersenne.seed_array(seed); - } else if (!Array.isArray(seed) && !isNaN(seed)) { - this.faker.mersenne.seed(seed); - } - + constructor(private readonly faker: Faker) { // Bind `this` so namespaced is working correctly for (const name of Object.getOwnPropertyNames(Random.prototype)) { if (name === 'constructor' || typeof this[name] !== 'function') { diff --git a/test/faker.spec.ts b/test/faker.spec.ts new file mode 100644 index 00000000000..54fa04aca58 --- /dev/null +++ b/test/faker.spec.ts @@ -0,0 +1,26 @@ +import { beforeEach, describe, expect, it } from 'vitest'; +import { faker } from '../src'; + +describe('faker', () => { + beforeEach(() => { + faker.locale = 'en'; + }); + + // This is only here for coverage + // The actual test is in mersenne.spec.ts + describe('seed()', () => { + it('seed(number)', () => { + faker.seed(1); + + const actual = faker.animal.cat(); + expect(actual).toBe('Korat'); + }); + + it('seed(number[])', () => { + faker.seed([1, 2, 3]); + + const actual = faker.animal.cat(); + expect(actual).toBe('Oriental'); + }); + }); +}); From d0a473f7ca6b525391ca8ab17e029335c66ed99e Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 24 Mar 2022 09:26:11 +0100 Subject: [PATCH 044/130] fix: solve various todos (#649) --- src/address.ts | 9 +-------- src/faker.ts | 2 -- src/internet.ts | 12 +++++++++++- src/lorem.ts | 13 ++----------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/address.ts b/src/address.ts index eff72f2f58c..ec137ad27c7 100644 --- a/src/address.ts +++ b/src/address.ts @@ -171,10 +171,6 @@ export class Address { return result; } - // - // TODO: change all these methods that accept a boolean to instead accept an options hash. - // - /** * Generates a random localized street address. * @@ -308,13 +304,10 @@ export class Address { /** * Returns a random localized state from this country. * - * @param useAbbr This parameter does nothing. - * * @example * faker.address.state() // 'Georgia' */ - // TODO @Shinigami92 2022-01-13: useAbbr not in use - state(useAbbr?: boolean): string { + state(): string { return this.faker.random.arrayElement(this.faker.definitions.address.state); } diff --git a/src/faker.ts b/src/faker.ts index 572bbaf2338..e2530f1642c 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -70,8 +70,6 @@ export class Faker { readonly finance = new Finance(this); readonly git: Git = new Git(this); readonly hacker: Hacker = new Hacker(this); - // TODO @Shinigami92 2022-01-12: iban was not used - // readonly iban = new (require('./iban'))(this); readonly image: Image = new Image(this); readonly internet: Internet = new Internet(this); readonly lorem: Lorem = new Lorem(this); diff --git a/src/internet.ts b/src/internet.ts index f80059f90ed..f247f06b4a9 100644 --- a/src/internet.ts +++ b/src/internet.ts @@ -203,8 +203,18 @@ export class Internet { * @example * faker.internet.ip() // '245.108.222.0' */ - // TODO @Shinigami92 2022-01-23: Add ipv4 alias ip(): string { + // TODO @Shinigami92 2022-03-21: We may want to return a IPv4 or IPv6 address here in a later major release + return this.ipv4(); + } + + /** + * Generates a random IPv4 address. + * + * @example + * faker.internet.ipv4() // '245.108.222.0' + */ + ipv4(): string { const randNum = () => { return this.faker.datatype.number(255).toFixed(0); }; diff --git a/src/lorem.ts b/src/lorem.ts index 296c88b50c0..4612fe2d1f6 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -64,21 +64,15 @@ export class Lorem { * Generates a space separated list of words beginning a capital letter and ending with a dot. * * @param wordCount The number of words, that should be in the sentence. Defaults to a random number between `3` and `10`. - * @param range Currently this parameter does nothing. * * @example * faker.lorem.sentence() // 'Voluptatum cupiditate suscipit autem eveniet aut dolorem aut officiis distinctio.' * faker.lorem.sentence(5) // 'Laborum voluptatem officiis est et.' */ - // TODO @Shinigami92 2022-01-11: `range` is not in use - sentence(wordCount?: number, range?: number): string { + sentence(wordCount?: number): string { if (typeof wordCount === 'undefined') { wordCount = this.faker.datatype.number({ min: 3, max: 10 }); } - // if (typeof range == 'undefined') { range = 7; } - - // strange issue with the node_min_test failing for capitalize, please fix and add faker.lorem.back - //return faker.lorem.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize(); const sentence = this.faker.lorem.words(wordCount); return sentence.charAt(0).toUpperCase() + sentence.slice(1) + '.'; @@ -174,8 +168,6 @@ export class Lorem { /** * Generates a random text based on a random lorem method. * - * @param times This parameter does nothing. - * * @example * faker.lorem.text() // 'Doloribus autem non quis vero quia.' * faker.lorem.text() @@ -185,8 +177,7 @@ export class Lorem { * // Iure nam officia optio cumque. * // Dolor tempora iusto.' */ - // TODO @Shinigami92 2022-01-11: `times` is not in use - text(times?: number): string { + text(): string { const loremMethods = [ 'lorem.word', 'lorem.words', From 7675abe5a62c8d44ecfd4a6f50bfb5fa50f40efa Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 24 Mar 2022 10:22:13 +0100 Subject: [PATCH 045/130] fix: name module gender (#644) --- src/index.ts | 2 + src/name.ts | 294 +++++++++++++++++++++---------------------- test/helpers.spec.ts | 12 +- test/name.spec.ts | 239 +++++++++++++++++++++++------------ 4 files changed, 308 insertions(+), 239 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0f4b71ba591..d1c2cb1d63f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,6 +27,8 @@ export type { WordDefinitions, } from './definitions'; export type { FakerOptions, UsableLocale, UsedLocales } from './faker'; +export { Gender } from './name'; +export type { GenderType } from './name'; export { Faker }; // since we are requiring the top level of faker, load all locales by default diff --git a/src/name.ts b/src/name.ts index 6b7275692eb..8fac27c4462 100644 --- a/src/name.ts +++ b/src/name.ts @@ -1,5 +1,83 @@ import type { Faker } from '.'; +export enum Gender { + female = 'female', + male = 'male', +} + +// TODO @Shinigami92 21-03-2022: Remove 0 and 1 in v7 +export type GenderType = 'female' | 'male' | 0 | 1; + +/** + * Normalize gender. + * + * @param gender Gender. + * @returns Normalized gender. + */ +function normalizeGender( + gender?: GenderType +): Exclude | undefined { + if (gender == null || typeof gender === 'string') { + // TODO @Shinigami92 21-03-2022: Cast can be removed when we set `strict: true` + return gender as Exclude; + } + + const normalizedGender = gender === 0 ? 'male' : 'female'; + + console.warn( + `Deprecation Warning: Please use '${normalizedGender}' for gender instead of ${gender}` + ); + + return normalizedGender; +} + +/** + * Select a definition based on given gender. + * + * @param faker Faker instance. + * @param gender Gender. + * @param param2 Definitions. + * @param param2.generic Non-gender definitions. + * @param param2.female Female definitions. + * @param param2.male Male definitions. + * @returns Definition based on given gender. + */ +function selectDefinition( + faker: Faker, + gender: GenderType | undefined, + // TODO christopher 21-03-2022: Remove fallback empty object when `strict: true` + { + generic, + female, + male, + }: { generic?: string[]; female?: string[]; male?: string[] } = {} +) { + const normalizedGender = normalizeGender(gender); + + let values: string[] | undefined; + switch (normalizedGender) { + case 'female': + values = female; + break; + case 'male': + values = male; + break; + default: + values = generic; + break; + } + + if (values == null) { + if (female != null && male != null) { + values = faker.random.arrayElement([female, male]); + } else { + values = generic; + } + } + + return faker.random.arrayElement(values); +} + /** * Module to generate people's names and titles. */ @@ -18,131 +96,66 @@ export class Name { * Returns a random first name. * * @param gender The optional gender to use. - * Can be either `'male'` (or `0`) or `'female'` (or `1`). + * Can be either `'female'` or `'male'`. * * @example * faker.name.firstName() // 'Antwan' * faker.name.firstName("female") // 'Victoria' - * faker.name.firstName(1) // 'Ashley' * faker.name.firstName("male") // 'Tom' - * faker.name.firstName(0) // 'Ismael' */ - firstName(gender?: string | number): string { - if ( - typeof this.faker.definitions.name.male_first_name !== 'undefined' && - typeof this.faker.definitions.name.female_first_name !== 'undefined' - ) { - // some locale datasets ( like ru ) have first_name split by gender. since the name.first_name field does not exist in these datasets, - // we must randomly pick a name from either gender array so faker.name.firstName will return the correct locale data ( and not fallback ) - - if (typeof gender === 'string') { - if (gender.toLowerCase() === 'male') { - gender = 0; - } else if (gender.toLowerCase() === 'female') { - gender = 1; - } - } - - if (typeof gender !== 'number') { - if (typeof this.faker.definitions.name.first_name === 'undefined') { - gender = this.faker.datatype.number(1); - } else { - // Fall back to non-gendered names if they exist and gender wasn't specified - return this.faker.random.arrayElement( - this.faker.definitions.name.first_name - ); - } - } - if (gender === 0) { - return this.faker.random.arrayElement( - this.faker.definitions.name.male_first_name - ); - } else { - return this.faker.random.arrayElement( - this.faker.definitions.name.female_first_name - ); - } - } + firstName(gender?: GenderType): string { + const { first_name, female_first_name, male_first_name } = + this.faker.definitions.name; - return this.faker.random.arrayElement( - this.faker.definitions.name.first_name - ); + return selectDefinition(this.faker, gender, { + generic: first_name, + female: female_first_name, + male: male_first_name, + }); } /** * Returns a random last name. * * @param gender The optional gender to use. - * Can be either `'male'` (or `0`) or `'female'` (or `1`). + * Can be either `'female'` or `'male'`. * * @example * faker.name.lastName() // 'Hauck' * faker.name.lastName("female") // 'Grady' - * faker.name.lastName(1) // 'Kshlerin' * faker.name.lastName("male") // 'Barton' - * faker.name.lastName(0) // 'Lockman' */ - lastName(gender?: string | number): string { - if ( - typeof this.faker.definitions.name.male_last_name !== 'undefined' && - typeof this.faker.definitions.name.female_last_name !== 'undefined' - ) { - // some locale datasets ( like ru ) have last_name split by gender. i have no idea how last names can have genders, but also i do not speak russian - // see above comment of firstName method - if (typeof gender !== 'number') { - gender = this.faker.datatype.number(1); - } - if (gender === 0) { - return this.faker.random.arrayElement( - this.faker.locales[this.faker.locale].name.male_last_name - ); - } else { - return this.faker.random.arrayElement( - this.faker.locales[this.faker.locale].name.female_last_name - ); - } - } + lastName(gender?: GenderType): string { + const { last_name, female_last_name, male_last_name } = + this.faker.definitions.name; - return this.faker.random.arrayElement( - this.faker.definitions.name.last_name - ); + return selectDefinition(this.faker, gender, { + generic: last_name, + female: female_last_name, + male: male_last_name, + }); } /** * Returns a random middle name. * * @param gender The optional gender to use. - * Can be either `'male'` (or `0`) or `'female'` (or `1`). + * Can be either `'female'` or `'male'`. * * @example * faker.name.middleName() // 'Доброславівна' * faker.name.middleName("female") // 'Анастасівна' - * faker.name.middleName(1) // 'Анатоліївна' * faker.name.middleName("male") // 'Вікторович' - * faker.name.middleName(0) // 'Стефанович' */ - middleName(gender?: string | number): string { - if ( - typeof this.faker.definitions.name.male_middle_name !== 'undefined' && - typeof this.faker.definitions.name.female_middle_name !== 'undefined' - ) { - if (typeof gender !== 'number') { - gender = this.faker.datatype.number(1); - } - if (gender === 0) { - return this.faker.random.arrayElement( - this.faker.definitions.name.male_middle_name - ); - } else { - return this.faker.random.arrayElement( - this.faker.definitions.name.female_middle_name - ); - } - } + middleName(gender?: GenderType): string { + const { middle_name, female_middle_name, male_middle_name } = + this.faker.definitions.name; - return this.faker.random.arrayElement( - this.faker.definitions.name.middle_name - ); + return selectDefinition(this.faker, gender, { + generic: middle_name, + female: female_middle_name, + male: male_middle_name, + }); } /** @@ -151,35 +164,29 @@ export class Name { * @param firstName The optional first name to use. If not specified a random one will be chosen. * @param lastName The optional last name to use. If not specified a random one will be chosen. * @param gender The optional gender to use. - * Can be either `'male'` (or `0`) or `'female'` (or `1`). + * Can be either `'female'` or `'male'`. * * @example * faker.name.findName() // 'Allen Brown' * faker.name.findName('Joann') // 'Joann Osinski' - * faker.name.findName('Marcella', '', 1) // 'Mrs. Marcella Huels' + * faker.name.findName('Marcella', '', 'female') // 'Mrs. Marcella Huels' * faker.name.findName(undefined, 'Beer') // 'Mr. Alfonso Beer' - * faker.name.findName(undefined, undefined, 0) // 'Fernando Schaefer' + * faker.name.findName(undefined, undefined, 'male') // 'Fernando Schaefer' */ - findName( - firstName?: string, - lastName?: string, - gender?: string | number - ): string { - const r = this.faker.datatype.number(8); + findName(firstName?: string, lastName?: string, gender?: GenderType): string { + const variant = this.faker.datatype.number(8); let prefix = ''; let suffix = ''; - // in particular locales first and last names split by gender, - // thus we keep consistency by passing 0 as male and 1 as female - - if (typeof gender !== 'number') { - gender = this.faker.datatype.number(1); - } + const normalizedGender: Exclude = + normalizeGender(gender) ?? + this.faker.random.arrayElement(['female', 'male']); - firstName = firstName || this.faker.name.firstName(gender); - lastName = lastName || this.faker.name.lastName(gender); + firstName = firstName || this.faker.name.firstName(normalizedGender); + lastName = lastName || this.faker.name.lastName(normalizedGender); - switch (r) { + switch (variant) { + // TODO christopher 21-03-2022: Add possibility to have a prefix together with a suffix case 0: prefix = this.faker.name.prefix(gender); if (prefix) { @@ -197,22 +204,6 @@ export class Name { return firstName + ' ' + lastName; } - /** - * Generates a random job title. - * - * @example - * faker.name.jobTitle() // 'Global Accounts Engineer' - */ - jobTitle(): string { - return ( - this.faker.name.jobDescriptor() + - ' ' + - this.faker.name.jobArea() + - ' ' + - this.faker.name.jobType() - ); - } - /** * Return a random gender. * @@ -227,44 +218,30 @@ export class Name { return this.faker.random.arrayElement( this.faker.definitions.name.binary_gender ); - } else { - return this.faker.random.arrayElement(this.faker.definitions.name.gender); } + + return this.faker.random.arrayElement(this.faker.definitions.name.gender); } /** * Returns a random name prefix. * * @param gender The optional gender to use. - * Can be either `'male'` (or `0`) or `'female'` (or `1`). + * Can be either `'female'` or `'male'`. * * @example * faker.name.prefix() // 'Miss' * faker.name.prefix('female') // 'Ms.' - * faker.name.prefix(1) // 'Dr.' * faker.name.prefix('male') // 'Mr.' - * faker.name.prefix(0) // 'Mr.' */ - prefix(gender?: string | number): string { - if ( - typeof this.faker.definitions.name.male_prefix !== 'undefined' && - typeof this.faker.definitions.name.female_prefix !== 'undefined' - ) { - if (typeof gender !== 'number') { - gender = this.faker.datatype.number(1); - } - if (gender === 0) { - return this.faker.random.arrayElement( - this.faker.locales[this.faker.locale].name.male_prefix - ); - } else { - return this.faker.random.arrayElement( - this.faker.locales[this.faker.locale].name.female_prefix - ); - } - } + prefix(gender?: GenderType): string { + const { prefix, female_prefix, male_prefix } = this.faker.definitions.name; - return this.faker.random.arrayElement(this.faker.definitions.name.prefix); + return selectDefinition(this.faker, gender, { + generic: prefix, + female: female_prefix, + male: male_prefix, + }); } /** @@ -274,6 +251,7 @@ export class Name { * faker.name.suffix() // 'DDS' */ suffix(): string { + // TODO christopher 21-03-2022: Add female_suffix and male_suffix return this.faker.random.arrayElement(this.faker.definitions.name.suffix); } @@ -297,6 +275,22 @@ export class Name { return descriptor + ' ' + level + ' ' + job; } + /** + * Generates a random job title. + * + * @example + * faker.name.jobTitle() // 'Global Accounts Engineer' + */ + jobTitle(): string { + return ( + this.faker.name.jobDescriptor() + + ' ' + + this.faker.name.jobArea() + + ' ' + + this.faker.name.jobType() + ); + } + /** * Generates a random job descriptor. * diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 64c12df5d7d..cbb541c169e 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -63,7 +63,7 @@ const seededRuns = [ name: 'Weissnat, Wintheiser and MacGyver', }, email: 'Isabel5@gmail.com', - name: 'Lorene Deckow', + name: 'Darnell Deckow', phone: '559.640.8661', posts: [ { @@ -138,7 +138,7 @@ const seededRuns = [ name: 'Langworth - Wyman', }, email: 'Isabel5@gmail.com', - name: 'Lorene Deckow', + name: 'Darnell Deckow', phone: '225-631-0293 x240', username: 'Moses_Satterfield', website: 'sparse-ottoman.biz', @@ -213,7 +213,7 @@ const seededRuns = [ name: 'Armstrong, Smitham and Renner', }, email: 'Darron.Larson@gmail.com', - name: 'Marilyn Effertz', + name: 'Eugene Effertz', phone: '818-698-6199 x848', posts: [ { @@ -287,7 +287,7 @@ const seededRuns = [ name: 'Daugherty - Connelly', }, email: 'Darron.Larson@gmail.com', - name: 'Marilyn Effertz', + name: 'Eugene Effertz', phone: '803.543.5573 x1428', username: 'Dudley.Littel', website: 'queasy-guide.info', @@ -362,7 +362,7 @@ const seededRuns = [ name: 'Jacobi and Sons', }, email: 'Marlen.Effertz35@gmail.com', - name: 'Darrel Sanford', + name: 'Henrietta Sanford', phone: '621-735-9398', posts: [ { @@ -436,7 +436,7 @@ const seededRuns = [ name: 'Fahey LLC', }, email: 'Marlen.Effertz35@gmail.com', - name: 'Darrel Sanford', + name: 'Henrietta Sanford', phone: '469.570.3390', username: 'Dangelo.Christiansen67', website: 'mild-hearth.org', diff --git a/test/name.spec.ts b/test/name.spec.ts index 2b8e9f0a304..7572b3d6ab1 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { faker } from '../src'; const seededRuns = [ @@ -12,10 +12,10 @@ const seededRuns = [ noArgs: 'Hintz', }, middleName: { - noArgs: 'Owen', + noArgs: 'Greer', }, findName: { - noArgs: 'Lorene Deckow', + noArgs: 'Darnell Deckow', }, jobTitle: { noArgs: 'Regional Data Representative', @@ -53,10 +53,10 @@ const seededRuns = [ noArgs: 'Gibson', }, middleName: { - noArgs: 'Kenji', + noArgs: 'Dakota', }, findName: { - noArgs: 'Marilyn Effertz', + noArgs: 'Eugene Effertz', }, jobTitle: { noArgs: 'Future Infrastructure Liaison', @@ -94,10 +94,10 @@ const seededRuns = [ noArgs: 'Ward', }, middleName: { - noArgs: 'Isla', + noArgs: 'Sawyer', }, findName: { - noArgs: 'Darrel Sanford', + noArgs: 'Henrietta Sanford', }, jobTitle: { noArgs: 'Chief Division Agent', @@ -147,6 +147,7 @@ const functionNames = [ describe('name', () => { afterEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); for (const { seed, expectations } of seededRuns) { @@ -172,6 +173,7 @@ describe('name', () => { describe('firstName()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a random first name', () => { @@ -182,23 +184,47 @@ describe('name', () => { }); it('should return a gender-specific first name when passed a number', () => { + const spy = vi.spyOn(console, 'warn'); + let name = faker.name.firstName(0); expect(faker.definitions.name.male_first_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'male' for gender instead of 0` + ); + name = faker.name.firstName(1); expect(faker.definitions.name.female_first_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'female' for gender instead of 1` + ); + + spy.mockRestore(); }); it('should return a gender-specific first name when passed a string', () => { - let name = faker.name.firstName('male'); - expect(faker.definitions.name.male_first_name).toContain(name); - name = faker.name.firstName('female'); + let name = faker.name.firstName('female'); expect(faker.definitions.name.female_first_name).toContain(name); + + name = faker.name.firstName('male'); + expect(faker.definitions.name.male_first_name).toContain(name); + }); + + it('should return a gender-specific first name when no gender-specific first name was defined', () => { + faker.locale = 'az'; + faker.localeFallback = 'az'; + + const name = faker.name.firstName(); + expect([ + ...faker.definitions.name.female_first_name, + ...faker.definitions.name.male_first_name, + ]).toContain(name); }); }); describe('lastName()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a random last name', () => { @@ -211,29 +237,38 @@ describe('name', () => { it('should return a gender-specific last name when passed a number', () => { faker.locale = 'az'; + const spy = vi.spyOn(console, 'warn'); + let name = faker.name.lastName(0); expect(faker.definitions.name.male_last_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'male' for gender instead of 0` + ); + name = faker.name.lastName(1); expect(faker.definitions.name.female_last_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'female' for gender instead of 1` + ); + + spy.mockRestore(); }); - // TODO @Shinigami92 2022-01-30: There is a bug: https://github.com/faker-js/faker/issues/373 - it.todo( - 'should return a gender-specific last name when passed a string', - () => { - faker.locale = 'az'; + it('should return a gender-specific last name when passed a string', () => { + faker.locale = 'az'; - let name = faker.name.lastName('male'); - expect(faker.definitions.name.male_last_name).toContain(name); - name = faker.name.lastName('female'); - expect(faker.definitions.name.female_last_name).toContain(name); - } - ); + let name = faker.name.lastName('female'); + expect(faker.definitions.name.female_last_name).toContain(name); + + name = faker.name.lastName('male'); + expect(faker.definitions.name.male_last_name).toContain(name); + }); }); describe('middleName()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a random middle name', () => { @@ -243,42 +278,54 @@ describe('name', () => { expect(middle_name.length).greaterThan(0); }); - it.todo('should return a middle name when passed en locale', () => { + it('should return a middle name when passed en locale', () => { faker.locale = 'en'; let name = faker.name.middleName(); expect(faker.definitions.name.middle_name).toContain(name); - name = faker.name.middleName(0); - expect(faker.definitions.name.male_middle_name).toContain(name); - name = faker.name.middleName(1); + + name = faker.name.middleName('female'); expect(faker.definitions.name.female_middle_name).toContain(name); + + name = faker.name.middleName('male'); + expect(faker.definitions.name.male_middle_name).toContain(name); }); it('should return a gender-specific middle name when passed a number', () => { + const spy = vi.spyOn(console, 'warn'); + faker.locale = 'uk'; let name = faker.name.middleName(0); expect(faker.definitions.name.male_middle_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'male' for gender instead of 0` + ); + name = faker.name.middleName(1); expect(faker.definitions.name.female_middle_name).toContain(name); + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'female' for gender instead of 1` + ); + + spy.mockRestore(); }); - it.todo( - 'should return a gender-specific middle name when passed a string', - () => { - faker.locale = 'uk'; + it('should return a gender-specific middle name when passed a string', () => { + faker.locale = 'uk'; + + let name = faker.name.middleName('female'); + expect(faker.definitions.name.female_middle_name).toContain(name); - let name = faker.name.middleName('male'); - expect(faker.definitions.name.male_middle_name).toContain(name); - name = faker.name.middleName('female'); - expect(faker.definitions.name.female_middle_name).toContain(name); - } - ); + name = faker.name.middleName('male'); + expect(faker.definitions.name.male_middle_name).toContain(name); + }); }); describe('findName()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a name with firstName and lastName', () => { @@ -288,24 +335,6 @@ describe('name', () => { expect(fullName).toContain(' '); }); - it('should return a male gender-specific name with firstName and lastName', () => { - faker.locale = 'mk'; - - const male_specific = [ - ...faker.definitions.name.male_prefix, - ...faker.definitions.name.male_first_name, - ...faker.definitions.name.male_last_name, - ...faker.definitions.name.suffix, - ]; - - const fullName = faker.name.findName(undefined, undefined, 0); - - const parts = fullName.split(' '); - for (const part of parts) { - expect(male_specific).toContain(part); - } - }); - it('should return a female gender-specific name with firstName and lastName', () => { faker.locale = 'mk'; @@ -316,7 +345,7 @@ describe('name', () => { ...faker.definitions.name.suffix, ]; - const fullName = faker.name.findName(undefined, undefined, 1); + const fullName = faker.name.findName(undefined, undefined, 'female'); const parts = fullName.split(' '); for (const part of parts) { @@ -324,17 +353,17 @@ describe('name', () => { } }); - it('should return a male gender-specific name with given firstName and lastName', () => { + it('should return a male gender-specific name with firstName and lastName', () => { faker.locale = 'mk'; const male_specific = [ ...faker.definitions.name.male_prefix, - 'firstName', - 'lastName', + ...faker.definitions.name.male_first_name, + ...faker.definitions.name.male_last_name, ...faker.definitions.name.suffix, ]; - const fullName = faker.name.findName('firstName', 'lastName', 0); + const fullName = faker.name.findName(undefined, undefined, 'male'); const parts = fullName.split(' '); for (const part of parts) { @@ -352,36 +381,41 @@ describe('name', () => { ...faker.definitions.name.suffix, ]; - const fullName = faker.name.findName('firstName', 'lastName', 1); + const fullName = faker.name.findName( + 'firstName', + 'lastName', + 'female' + ); const parts = fullName.split(' '); for (const part of parts) { expect(male_specific).toContain(part); } }); - }); - - describe('jobTitle()', () => { - beforeEach(() => { - faker.locale = 'en'; - }); - it('should return a job title consisting of a descriptor, area, and type', () => { - const jobTitle = faker.name.jobTitle(); + it('should return a male gender-specific name with given firstName and lastName', () => { + faker.locale = 'mk'; - expect(jobTitle).toBeTypeOf('string'); + const male_specific = [ + ...faker.definitions.name.male_prefix, + 'firstName', + 'lastName', + ...faker.definitions.name.suffix, + ]; - const [descriptor, level, job] = jobTitle.split(' '); + const fullName = faker.name.findName('firstName', 'lastName', 'male'); - expect(faker.definitions.name.title.descriptor).toContain(descriptor); - expect(faker.definitions.name.title.level).toContain(level); - expect(faker.definitions.name.title.job).toContain(job); + const parts = fullName.split(' '); + for (const part of parts) { + expect(male_specific).toContain(part); + } }); }); describe('gender()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a default gender', () => { @@ -402,6 +436,7 @@ describe('name', () => { describe('prefix()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a prefix', () => { @@ -411,17 +446,16 @@ describe('name', () => { expect(faker.definitions.name.prefix).toContain(prefix); }); - it('should return a male prefix', () => { + it('should return a female prefix with given string', () => { faker.locale = 'mk'; - const prefix = faker.name.prefix(0); + const prefix = faker.name.prefix('female'); expect(prefix).toBeTypeOf('string'); - expect(faker.definitions.name.male_prefix).toContain(prefix); + expect(faker.definitions.name.female_prefix).toContain(prefix); }); - // TODO @Shinigami92 2022-01-31: There is a bug: https://github.com/faker-js/faker/issues/373 - it.todo('should return a male prefix with given string', () => { + it('should return a male prefix with given string', () => { faker.locale = 'mk'; const prefix = faker.name.prefix('male'); @@ -430,29 +464,45 @@ describe('name', () => { expect(faker.definitions.name.male_prefix).toContain(prefix); }); - it('should return a female prefix', () => { + it('should return a male prefix with given number', () => { + const spy = vi.spyOn(console, 'warn'); + faker.locale = 'mk'; - const prefix = faker.name.prefix(1); + const prefix = faker.name.prefix(0); expect(prefix).toBeTypeOf('string'); - expect(faker.definitions.name.female_prefix).toContain(prefix); + expect(faker.definitions.name.male_prefix).toContain(prefix); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'male' for gender instead of 0` + ); + + spy.mockRestore(); }); - // TODO @Shinigami92 2022-01-31: There is a bug: https://github.com/faker-js/faker/issues/373 - it.todo('should return a female prefix with given string', () => { + it('should return a female prefix with given number', () => { + const spy = vi.spyOn(console, 'warn'); + faker.locale = 'mk'; - const prefix = faker.name.prefix('female'); + const prefix = faker.name.prefix(1); expect(prefix).toBeTypeOf('string'); expect(faker.definitions.name.female_prefix).toContain(prefix); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: Please use 'female' for gender instead of 1` + ); + + spy.mockRestore(); }); }); describe('suffix()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a suffix', () => { @@ -466,6 +516,7 @@ describe('name', () => { describe('title()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a title consisting of a descriptor, area, and type', () => { @@ -482,9 +533,29 @@ describe('name', () => { }); }); + describe('jobTitle()', () => { + beforeEach(() => { + faker.locale = 'en'; + faker.localeFallback = 'en'; + }); + + it('should return a job title consisting of a descriptor, area, and type', () => { + const jobTitle = faker.name.jobTitle(); + + expect(jobTitle).toBeTypeOf('string'); + + const [descriptor, level, job] = jobTitle.split(' '); + + expect(faker.definitions.name.title.descriptor).toContain(descriptor); + expect(faker.definitions.name.title.level).toContain(level); + expect(faker.definitions.name.title.job).toContain(job); + }); + }); + describe('jobDescriptor()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a descriptor', () => { @@ -499,6 +570,7 @@ describe('name', () => { describe('jobArea()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a level', () => { @@ -513,6 +585,7 @@ describe('name', () => { describe('jobType()', () => { beforeEach(() => { faker.locale = 'en'; + faker.localeFallback = 'en'; }); it('should return a job', () => { From 0924e852d300e012c80d74fb94b57168965827bf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Mar 2022 09:26:31 +0000 Subject: [PATCH 046/130] chore(deps): update vitest to ~0.7.10 (#665) Co-authored-by: Renovate Bot --- package.json | 4 ++-- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 98d30a4baa0..df7220d82ac 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.1", "@typescript-eslint/eslint-plugin": "~5.16.0", "@typescript-eslint/parser": "~5.16.0", - "@vitest/ui": "~0.7.7", + "@vitest/ui": "~0.7.10", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.7" + "vitest": "~0.7.10" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4bb506f1700..762fdb4216d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.1 '@typescript-eslint/eslint-plugin': ~5.16.0 '@typescript-eslint/parser': ~5.16.0 - '@vitest/ui': ~0.7.7 + '@vitest/ui': ~0.7.10 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.7 + vitest: ~0.7.10 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.1 '@typescript-eslint/eslint-plugin': 5.16.0_3fed250b11519414a4c7d52468dd6bf5 '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 - '@vitest/ui': 0.7.7 + '@vitest/ui': 0.7.10 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.7_@vitest+ui@0.7.7+c8@7.11.0 + vitest: 0.7.10_@vitest+ui@0.7.10+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.7: - resolution: {integrity: sha512-r+8w1AlUUWcHmAbNbm2wuhhtLqAL5EPtgE2MYCF3/7fjLJUkxRdox8fn/bwqAQGoPTRDOyhLdOZWlJUpk5VKcw==} + /@vitest/ui/0.7.10: + resolution: {integrity: sha512-nZzuPBdndCUhQCP/P0Yejk74vxRtlDs3WxnLxHWJkOTH5M6kYxpZKwfRn7jfonJNyqqJJzByeha/QNOJZoo8PQ==} dependencies: sirv: 2.0.2 dev: true @@ -4444,9 +4444,9 @@ packages: - stylus dev: true - /vitest/0.7.7_@vitest+ui@0.7.7+c8@7.11.0: - resolution: {integrity: sha512-xU7BTB7T7GbcjFBdbZAAp/dIQUwn8bygI+cbw6Yq1oXj60oGRJ+nJ7AXvSOJyaHMTmglEoaqazyDGnCHJBXftw==} - engines: {node: '>=v14.19.1'} + /vitest/0.7.10_@vitest+ui@0.7.10+c8@7.11.0: + resolution: {integrity: sha512-We5a7cnY2aUpX4tAO+w2KRhJiJ4FznfWjYKkqWoAqs4x4pKgyRsMJNZ7OSY/lFHOoRz3yv0mgwfVlZiRc0/mmA==} + engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -4465,7 +4465,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.7 + '@vitest/ui': 0.7.10 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From b7b2e4f8dbd40b6bb2678fb60ee95e198838d08a Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 24 Mar 2022 12:39:37 +0100 Subject: [PATCH 047/130] fix: only return word with desirable alpha characters (#654) --- src/random.ts | 34 ++++++++++++++++++++++--- test/random.spec.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++- test/system.spec.ts | 23 +++++++++-------- 3 files changed, 102 insertions(+), 15 deletions(-) diff --git a/src/random.ts b/src/random.ts index b84a2ece614..0658cdd56f3 100644 --- a/src/random.ts +++ b/src/random.ts @@ -242,7 +242,6 @@ export class Random { * @example * faker.random.word() // 'Seamless' */ - // TODO: have ability to return specific type of word? As in: noun, adjective, verb, etc word(): string { const wordMethods = [ 'commerce.department', @@ -278,9 +277,36 @@ export class Random { 'name.jobType', ]; - // randomly pick from the many faker methods that can generate words - const randomWordMethod = this.faker.random.arrayElement(wordMethods); - const result = this.faker.fake('{{' + randomWordMethod + '}}'); + const bannedChars = [ + '!', + '#', + '%', + '&', + '*', + ')', + '(', + '+', + '=', + '.', + '<', + '>', + '{', + '}', + '[', + ']', + ':', + ';', + "'", + '"', + '_', + '-', + ]; + let result: string; + do { + // randomly pick from the many faker methods that can generate words + const randomWordMethod = this.faker.random.arrayElement(wordMethods); + result = this.faker.fake('{{' + randomWordMethod + '}}'); + } while (bannedChars.some((char) => result.includes(char))); return this.faker.random.arrayElement(result.split(' ')); } diff --git a/test/random.spec.ts b/test/random.spec.ts index f43cc5003d2..ceb454ccdb2 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -1,5 +1,6 @@ -import { describe, expect, it, vi } from 'vitest'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; import { faker } from '../src'; +import { times } from './support/times'; describe('random', () => { describe('arrayElement', () => { @@ -78,15 +79,72 @@ describe('random', () => { }); describe('word', () => { + const bannedChars = [ + '!', + '#', + '%', + '&', + '*', + ')', + '(', + '+', + '=', + '.', + '<', + '>', + '{', + '}', + '[', + ']', + ':', + ';', + "'", + '"', + '_', + '-', + ]; + + beforeEach(() => { + faker.locale = 'en'; + }); + it('should return a random word', () => { const actual = faker.random.word(); expect(actual).toBeTruthy(); expect(actual).toBeTypeOf('string'); }); + + it.each(times(50))( + 'should only contain a word without undesirable non-alpha characters (run %i)', + () => { + const actual = faker.random.word(); + + expect(actual).not.satisfy((word: string) => + bannedChars.some((char) => word.includes(char)) + ); + } + ); + + it.each(times(50))( + 'should only contain a word without undesirable non-alpha characters, locale=zh_CN (run %i)', + () => { + faker.locale = 'zh_CN'; + + const actual = faker.random.word(); + + expect(actual).not.satisfy((word: string) => + bannedChars.some((char) => word.includes(char)) + ); + } + ); }); describe('words', () => { + beforeEach(() => { + faker.locale = 'en'; + }); + it('should return random words', () => { const actual = faker.random.words(); diff --git a/test/system.spec.ts b/test/system.spec.ts index 7c6e77609f3..b9d36edc31f 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -16,7 +16,7 @@ const seededRuns = [ fileExt: 'chm', directoryPath: '/opt/bin', // TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file. - filePath: '/opt/bin/directives_multi_byte_table.p10.m21', + filePath: '/opt/bin/directives_savings_computer.qwd.jade', semver: '3.7.9', }, }, @@ -39,8 +39,8 @@ const seededRuns = [ { seed: 1211, expectations: { - fileName: 'turnpike_cross_platform_handcrafted.mka', - commonFileName: 'turnpike_cross_platform_handcrafted.mp4v', + fileName: 'turnpike_supervisor_chicken.mka', + commonFileName: 'turnpike_supervisor_chicken.mp4v', mimeType: 'text/vnd.fmi.flexstor', commonFileType: 'application', commonFileExt: 'htm', @@ -98,18 +98,21 @@ describe('system', () => { it('should return common file types', () => { const fileExt = faker.system.commonFileExt(); const extList = [ - 'pdf', - 'mpeg', - 'wav', - 'png', - 'jpeg', 'gif', - 'mp4v', - 'mpeg', 'htm', + 'html', + 'jpeg', 'm2a', + 'm2v', + 'm3a', 'mp4', + 'mp4v', + 'mpeg', 'mpg', + 'pdf', + 'png', + 'shtml', + 'wav', ]; expect( From 7635dc9a63b24b681f88d4029573d0caf8e652b5 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 24 Mar 2022 17:57:18 +0100 Subject: [PATCH 048/130] test: remove todo for number conversion (#669) --- test/commerce.spec.ts | 6 ++---- test/finance.spec.ts | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/commerce.spec.ts b/test/commerce.spec.ts index a06f96ed909..3497aa9fdaf 100644 --- a/test/commerce.spec.ts +++ b/test/commerce.spec.ts @@ -121,8 +121,7 @@ describe('commerce', () => { const price = faker.commerce.price(); expect(price).toBeTruthy(); - - // TODO @Shinigami92 2022-01-20: I converted the price string to number to satisfy TS + expect(price).toBeTypeOf('string'); expect(+price).greaterThan(0); expect(+price).lessThanOrEqual(1000); }); @@ -154,8 +153,7 @@ describe('commerce', () => { const amount = faker.commerce.price(-200, -1); expect(amount).toBeTruthy(); - // TODO @Shinigami92 2022-01-20: I converted the price string to number to satisfy TS - expect(+amount === 0.0, 'the amount should equal 0').toBe(true); + expect(amount, 'the amount should equal 0').toBe('0'); }); it('should handle argument dec', () => { diff --git a/test/finance.spec.ts b/test/finance.spec.ts index 312f4fb50dd..77df6f6337e 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -205,6 +205,7 @@ describe('finance', () => { const amount = faker.finance.amount(); expect(amount).toBeTruthy(); + expect(amount).toBeTypeOf('string'); expect(+amount, 'the amount should be greater than 0').greaterThan(0); expect(+amount, 'the amount should be less than 1001').lessThan(1001); }); @@ -234,6 +235,7 @@ describe('finance', () => { const amount = faker.finance.amount(-200, -1); expect(amount).toBeTruthy(); + expect(amount).toBeTypeOf('string'); expect(+amount, 'the amount should be less than 0').lessThan(0); expect(+amount, 'the amount should be greater than -201').greaterThan( -201 From c1c60649ee554f81887ab618ae8b2e2bd5a27d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Fri, 25 Mar 2022 09:02:10 +0100 Subject: [PATCH 049/130] refactor: date accept number input (#670) --- src/date.ts | 47 +++++----- test/date.spec.ts | 213 +++++++++++++++++++++------------------------- 2 files changed, 116 insertions(+), 144 deletions(-) diff --git a/src/date.ts b/src/date.ts index 6c9b910065f..4a8e7827a65 100644 --- a/src/date.ts +++ b/src/date.ts @@ -2,29 +2,18 @@ import type { Faker } from '.'; import type { DateEntryDefinition } from './definitions'; /** - * Converts date passed as a string or Date to a Date object. If nothing passed, takes current date. + * Converts date passed as a string, number or Date to a Date object. + * If nothing or a non parseable value is passed, takes current date. * * @param date Date */ -function toDate(date?: string | Date): Date { - if (date != null) { - return new Date(date instanceof Date ? date : Date.parse(date)); +function toDate(date?: string | Date | number): Date { + date = new Date(date); + if (isNaN(date.valueOf())) { + date = new Date(); } - return new Date(); -} - -/** - * Converts date passed as a string or Date to milliseconds. If nothing passed, takes current date. - * - * @param date Date - */ -function toMilliseconds(date?: string | Date): number { - if (date != null) { - return date instanceof Date ? date.getTime() : Date.parse(date); - } - - return new Date().getTime(); + return date; } /** @@ -54,7 +43,7 @@ export class _Date { * faker.date.past(10) // '2017-10-25T21:34:19.488Z' * faker.date.past(10, '2020-01-01T00:00:00.000Z') // '2017-08-18T02:59:12.350Z' */ - past(years?: number, refDate?: string | Date): Date { + past(years?: number, refDate?: string | Date | number): Date { const date = toDate(refDate); const range = { min: 1000, @@ -81,7 +70,7 @@ export class _Date { * faker.date.future(10) // '2030-11-23T09:38:28.710Z' * faker.date.future(10, '2020-01-01T00:00:00.000Z') // '2020-12-13T22:45:10.252Z' */ - future(years?: number, refDate?: string | Date): Date { + future(years?: number, refDate?: string | Date | number): Date { const date = toDate(refDate); const range = { min: 1000, @@ -104,9 +93,9 @@ export class _Date { * @example * faker.date.between('2020-01-01T00:00:00.000Z', '2030-01-01T00:00:00.000Z') // '2026-05-16T02:22:53.002Z' */ - between(from: string | Date, to: string | Date): Date { - const fromMs = toMilliseconds(from); - const toMs = toMilliseconds(to); + between(from: string | Date | number, to: string | Date | number): Date { + const fromMs = toDate(from).getTime(); + const toMs = toDate(to).getTime(); const dateOffset = this.faker.datatype.number(toMs - fromMs); return new Date(fromMs + dateOffset); @@ -129,14 +118,18 @@ export class _Date { * faker.date.betweens('2020-01-01T00:00:00.000Z', '2030-01-01T00:00:00.000Z', 2) * // [ 2023-05-02T16:00:00.000Z, 2026-09-01T08:00:00.000Z ] */ - betweens(from: string | Date, to: string | Date, num?: number): Date[] { + betweens( + from: string | Date | number, + to: string | Date | number, + num?: number + ): Date[] { if (typeof num === 'undefined') { num = 3; } const dates: Date[] = []; - for (let i = 0; i < num; i++) { + while (dates.length < num) { dates.push(this.between(from, to)); } @@ -156,7 +149,7 @@ export class _Date { * faker.date.recent(10) // '2022-01-29T06:12:12.829Z' * faker.date.recent(10, '2020-01-01T00:00:00.000Z') // '2019-12-27T18:11:19.117Z' */ - recent(days?: number, refDate?: string | Date): Date { + recent(days?: number, refDate?: string | Date | number): Date { const date = toDate(refDate); const range = { min: 1000, @@ -183,7 +176,7 @@ export class _Date { * faker.date.soon(10) // '2022-02-11T05:14:39.138Z' * faker.date.soon(10, '2020-01-01T00:00:00.000Z') // '2020-01-01T02:40:44.990Z' */ - soon(days?: number, refDate?: string | Date): Date { + soon(days?: number, refDate?: string | Date | number): Date { const date = toDate(refDate); const range = { min: 1000, diff --git a/test/date.spec.ts b/test/date.spec.ts index 1d6f8832892..99141a89476 100644 --- a/test/date.spec.ts +++ b/test/date.spec.ts @@ -103,6 +103,12 @@ const seededRuns = [ }, ]; +const converterMap = [ + (d: Date) => d, + (d: Date) => d.toISOString(), + (d: Date) => d.valueOf(), +]; + const NON_SEEDED_BASED_RUN = 5; describe('date', () => { @@ -384,20 +390,18 @@ describe('date', () => { expect(date).lessThan(refDate); }); - it('should return a past date relative to given refDate', () => { - const refDate = new Date(); - refDate.setFullYear(refDate.getFullYear() + 5); - - let date = faker.date.past(5, refDate); - - expect(date).lessThan(refDate); - expect(date).greaterThan(new Date()); + it.each(converterMap)( + 'should return a past date relative to given refDate', + (converter) => { + const refDate = new Date(); + refDate.setFullYear(refDate.getFullYear() + 5); - date = faker.date.past(5, refDate.toISOString()); + const date = faker.date.past(5, converter(refDate)); - expect(date).lessThan(refDate); - expect(date).greaterThan(new Date()); - }); + expect(date).lessThan(refDate); + expect(date).greaterThan(new Date()); + } + ); }); describe('future()', () => { @@ -414,59 +418,50 @@ describe('date', () => { expect(date).greaterThan(refDate); // date should be after the date given }); - it('should return a date 75 years after the date given', () => { - const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) + it.each(converterMap)( + 'should return a date 75 years after the date given', + (converter) => { + const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - let date = faker.date.future(75, refDate); + const date = faker.date.future(75, converter(refDate)); - // date should be after the date given, but before the current time - expect(date).greaterThan(refDate); - expect(date).lessThan(new Date()); - - date = faker.date.future(75, refDate.toISOString()); - - // date should be after the date given, but before the current time - expect(date).greaterThan(refDate); - expect(date).lessThan(new Date()); - }); + // date should be after the date given, but before the current time + expect(date).greaterThan(refDate); + expect(date).lessThan(new Date()); + } + ); }); describe('between()', () => { - it('should return a random date between the dates given', () => { - const from = new Date(1990, 5, 7, 9, 11, 0, 0); - const to = new Date(2000, 6, 8, 10, 12, 0, 0); - - let date = faker.date.between(from, to); - - expect(date).greaterThan(from); - expect(date).lessThan(to); - - date = faker.date.between(from.toISOString(), to.toISOString()); - - expect(date).greaterThan(from); - expect(date).lessThan(to); - }); + it.each(converterMap)( + 'should return a random date between the dates given', + (converter) => { + const from = new Date(1990, 5, 7, 9, 11, 0, 0); + const to = new Date(2000, 6, 8, 10, 12, 0, 0); + + const date = faker.date.between(converter(from), converter(to)); + + expect(date).greaterThan(from); + expect(date).lessThan(to); + } + ); }); describe('betweens()', () => { - it('should return an array of 3 dates ( by default ) of sorted randoms dates between the dates given', () => { - const from = new Date(1990, 5, 7, 9, 11, 0, 0); - const to = new Date(2000, 6, 8, 10, 12, 0, 0); - - let dates = faker.date.betweens(from, to); - - expect(dates[0]).greaterThan(from); - expect(dates[0]).lessThan(to); - expect(dates[1]).greaterThan(dates[0]); - expect(dates[2]).greaterThan(dates[1]); - - dates = faker.date.betweens(from.toISOString(), to.toISOString()); - - expect(dates[0]).greaterThan(from); - expect(dates[0]).lessThan(to); - expect(dates[1]).greaterThan(dates[0]); - expect(dates[2]).greaterThan(dates[1]); - }); + it.each(converterMap)( + 'should return an array of 3 dates ( by default ) of sorted randoms dates between the dates given', + (converter) => { + const from = new Date(1990, 5, 7, 9, 11, 0, 0); + const to = new Date(2000, 6, 8, 10, 12, 0, 0); + + const dates = faker.date.betweens(converter(from), converter(to)); + + expect(dates[0]).greaterThan(from); + expect(dates[0]).lessThan(to); + expect(dates[1]).greaterThan(dates[0]); + expect(dates[2]).greaterThan(dates[1]); + } + ); }); describe('recent()', () => { @@ -476,36 +471,28 @@ describe('date', () => { expect(date).lessThanOrEqual(new Date()); }); - it('should return a date N days from the recent past, starting from refDate', () => { - const days = 30; - const refDate = new Date(2120, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - - const lowerBound = new Date( - refDate.getTime() - days * 24 * 60 * 60 * 1000 - ); - - let date = faker.date.recent(days, refDate); - - expect( - lowerBound, - '`recent()` date should not be further back than `n` days ago' - ).lessThanOrEqual(date); - expect( - date, - '`recent()` date should not be ahead of the starting date reference' - ).lessThanOrEqual(refDate); - - date = faker.date.recent(days, refDate.toISOString()); - - expect( - lowerBound, - '`recent()` date should not be further back than `n` days ago' - ).lessThanOrEqual(date); - expect( - date, - '`recent()` date should not be ahead of the starting date reference' - ).lessThanOrEqual(refDate); - }); + it.each(converterMap)( + 'should return a date N days from the recent past, starting from refDate', + (converter) => { + const days = 30; + const refDate = new Date(2120, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) + + const lowerBound = new Date( + refDate.getTime() - days * 24 * 60 * 60 * 1000 + ); + + const date = faker.date.recent(days, converter(refDate)); + + expect( + lowerBound, + '`recent()` date should not be further back than `n` days ago' + ).lessThanOrEqual(date); + expect( + date, + '`recent()` date should not be ahead of the starting date reference' + ).lessThanOrEqual(refDate); + } + ); }); describe('soon()', () => { @@ -515,36 +502,28 @@ describe('date', () => { expect(date).greaterThanOrEqual(new Date()); }); - it('should return a date N days from the recent future, starting from refDate', () => { - const days = 30; - const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) - - const upperBound = new Date( - refDate.getTime() + days * 24 * 60 * 60 * 1000 - ); - - let date = faker.date.soon(days, refDate); - - expect( - date, - '`soon()` date should not be further ahead than `n` days ago' - ).lessThanOrEqual(upperBound); - expect( - refDate, - '`soon()` date should not be behind the starting date reference' - ).lessThanOrEqual(date); - - date = faker.date.soon(days, refDate.toISOString()); - - expect( - date, - '`soon()` date should not be further ahead than `n` days ago' - ).lessThanOrEqual(upperBound); - expect( - refDate, - '`soon()` date should not be behind the starting date reference' - ).lessThanOrEqual(date); - }); + it.each(converterMap)( + 'should return a date N days from the recent future, starting from refDate', + (converter) => { + const days = 30; + const refDate = new Date(1880, 11, 9, 10, 0, 0, 0); // set the date beyond the usual calculation (to make sure this is working correctly) + + const upperBound = new Date( + refDate.getTime() + days * 24 * 60 * 60 * 1000 + ); + + const date = faker.date.soon(days, converter(refDate)); + + expect( + date, + '`soon()` date should not be further ahead than `n` days ago' + ).lessThanOrEqual(upperBound); + expect( + refDate, + '`soon()` date should not be behind the starting date reference' + ).lessThanOrEqual(date); + } + ); }); describe('month()', () => { From 3252c7ea0421ead864fd41f4239e1b80f22c29bf Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 25 Mar 2022 16:38:24 +0100 Subject: [PATCH 050/130] docs: convert to typescript (#658) --- docs/.vitepress/.gitignore | 2 +- docs/.vitepress/{config.mjs => config.ts} | 9 +++++---- docs/.vitepress/theme/components/{index.mjs => index.ts} | 0 docs/.vitepress/theme/components/vue.d.ts | 4 ++++ docs/.vitepress/theme/{index.mjs => index.ts} | 0 scripts/apidoc/apiDocsWriter.ts | 6 +++--- 6 files changed, 13 insertions(+), 8 deletions(-) rename docs/.vitepress/{config.mjs => config.ts} (90%) rename docs/.vitepress/theme/components/{index.mjs => index.ts} (100%) create mode 100644 docs/.vitepress/theme/components/vue.d.ts rename docs/.vitepress/theme/{index.mjs => index.ts} (100%) diff --git a/docs/.vitepress/.gitignore b/docs/.vitepress/.gitignore index 1af560a8a18..3b0c8abc1c9 100644 --- a/docs/.vitepress/.gitignore +++ b/docs/.vitepress/.gitignore @@ -1 +1 @@ -api-pages.mjs +api-pages.ts diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.ts similarity index 90% rename from docs/.vitepress/config.mjs rename to docs/.vitepress/config.ts index 8c15b49db9f..ade58400a77 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.ts @@ -1,7 +1,8 @@ +import type { DefaultTheme } from 'vitepress'; import { defineConfig } from 'vitepress'; -import { apiPages } from './api-pages.mjs'; +import { apiPages } from './api-pages'; -const nav = [ +const nav: DefaultTheme.NavItem[] = [ { text: 'Guide', link: '/guide/' }, { text: 'Ecosystem', @@ -14,7 +15,7 @@ const nav = [ // { text: 'Playground', link: '/playground/' }, ]; -const sidebar = { +const sidebar: DefaultTheme.MultiSideBarConfig = { '/': [ { text: 'Guide', @@ -40,7 +41,7 @@ const sidebar = { ], }; -const algolia = { +const algolia: DefaultTheme.AlgoliaSearchOptions = { apiKey: process.env.API_KEY, appId: process.env.APP_ID, indexName: 'fakerjs', diff --git a/docs/.vitepress/theme/components/index.mjs b/docs/.vitepress/theme/components/index.ts similarity index 100% rename from docs/.vitepress/theme/components/index.mjs rename to docs/.vitepress/theme/components/index.ts diff --git a/docs/.vitepress/theme/components/vue.d.ts b/docs/.vitepress/theme/components/vue.d.ts new file mode 100644 index 00000000000..939fef480bc --- /dev/null +++ b/docs/.vitepress/theme/components/vue.d.ts @@ -0,0 +1,4 @@ +declare module '*.vue' { + const component: any; + export default component; +} diff --git a/docs/.vitepress/theme/index.mjs b/docs/.vitepress/theme/index.ts similarity index 100% rename from docs/.vitepress/theme/index.mjs rename to docs/.vitepress/theme/index.ts diff --git a/scripts/apidoc/apiDocsWriter.ts b/scripts/apidoc/apiDocsWriter.ts index 1282ad4c96a..5d37585d5b4 100644 --- a/scripts/apidoc/apiDocsWriter.ts +++ b/scripts/apidoc/apiDocsWriter.ts @@ -7,7 +7,7 @@ import type { Method } from '../../docs/.vitepress/components/api-docs/method'; import type { PageIndex } from './utils'; import { pathDocsDir, pathOutputDir } from './utils'; -const pathDocsApiPages = resolve(pathDocsDir, '.vitepress', 'api-pages.mjs'); +const pathDocsApiPages = resolve(pathDocsDir, '.vitepress', 'api-pages.ts'); const scriptCommand = 'pnpm run generate:api-docs'; @@ -133,8 +133,8 @@ export const ${lowerModuleName}: Method[] = ${JSON.stringify( * @param pages The pages to write into the index. */ export function writeApiPagesIndex(pages: PageIndex): void { - // Write api-pages.mjs - console.log('Updating api-pages.mjs'); + // Write api-pages.ts + console.log('Updating api-pages.ts'); pages.sort((a, b) => a.text.localeCompare(b.text)); let apiPagesContent = ` // This file is automatically generated. From ba3c62fca76fe2dc9fd1c8c9292c5333bf2c10a7 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 25 Mar 2022 16:45:16 +0100 Subject: [PATCH 051/130] refactor: deprecate time.recent (#661) --- src/time.ts | 13 ++++++++++++- test/time.spec.ts | 46 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/time.ts b/src/time.ts index 2d376839a06..06a32021b6e 100644 --- a/src/time.ts +++ b/src/time.ts @@ -2,6 +2,8 @@ import type { LiteralUnion } from './faker'; /** * Module to generate time of dates in various formats. + * + * @deprecated You should stop using this module, as it will be removed in the future. */ export class Time { /** @@ -20,11 +22,20 @@ export class Time { * faker.time.recent('date') // 2022-03-01T20:35:47.402Z * faker.time.recent('wide') // '00:34:11 GMT+0100 (Central European Standard Time)' * faker.time.recent('unix') // 1643067231856 + * + * @deprecated You should stop using this function, as it will be removed in the future. Use the native `new Date()` with one of the wanted functions directly. */ recent( format: LiteralUnion<'abbr' | 'date' | 'wide' | 'unix'> = 'unix' ): string | number | Date { - // TODO ST-DDT 2022-03-01: Deprecate for removal - #557 + console.warn( + `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. + abbr => toLocaleTimeString() + wide => toTimeString() + unix => getTime() +` + ); + let date: string | number | Date = new Date(); switch (format) { diff --git a/test/time.spec.ts b/test/time.spec.ts index 1146bb083cf..90d4d2c4523 100644 --- a/test/time.spec.ts +++ b/test/time.spec.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { faker } from '../src'; const seededRuns = [ @@ -56,23 +56,67 @@ describe('time', () => { for (let i = 1; i <= NON_SEEDED_BASED_RUN; i++) { describe('recent()', () => { it('should return the recent timestamp in unix time format by default', () => { + const spy = vi.spyOn(console, 'warn'); + const date = faker.time.recent(); expect(date).toBeTypeOf('number'); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. + abbr => toLocaleTimeString() + wide => toTimeString() + unix => getTime() +` + ); + spy.mockRestore(); }); it('should return the recent timestamp in full time string format', () => { + const spy = vi.spyOn(console, 'warn'); + const date = faker.time.recent('wide'); expect(date).toBeTypeOf('string'); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. + abbr => toLocaleTimeString() + wide => toTimeString() + unix => getTime() +` + ); + spy.mockRestore(); }); it('should return the recent timestamp in abbreviated string format', () => { + const spy = vi.spyOn(console, 'warn'); + const date = faker.time.recent('abbr'); expect(date).toBeTypeOf('string'); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. + abbr => toLocaleTimeString() + wide => toTimeString() + unix => getTime() +` + ); + spy.mockRestore(); }); it('should return the recent timestamp in unix time format', () => { + const spy = vi.spyOn(console, 'warn'); + const date = faker.time.recent('unix'); expect(date).toBeTypeOf('number'); + + expect(spy).toHaveBeenCalledWith( + `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. + abbr => toLocaleTimeString() + wide => toTimeString() + unix => getTime() +` + ); + spy.mockRestore(); }); }); } From a299c22c375538112c52ee0ad69902c87496f78c Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 25 Mar 2022 16:51:36 +0100 Subject: [PATCH 052/130] refactor: use smart eqeqeq null checks (#650) --- scripts/apidoc/signature.ts | 5 +---- scripts/generateLocales.ts | 4 ++-- src/address.ts | 2 +- src/datatype.ts | 6 +++--- src/date.ts | 14 +++++--------- src/fake.ts | 4 ++-- src/faker.ts | 6 +++--- src/finance.ts | 3 +-- src/helpers.ts | 10 +++++----- src/image.ts | 4 ++-- src/image_providers/lorempixel.ts | 2 +- src/image_providers/unsplash.ts | 4 ++-- src/internet.ts | 2 +- src/lorem.ts | 15 ++++++--------- src/random.ts | 12 ++++++------ src/vendor/unique.ts | 4 ++-- test/finance.spec.ts | 5 +---- 17 files changed, 44 insertions(+), 58 deletions(-) diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 926b5a7c38d..31674c834a0 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -226,10 +226,7 @@ function typeToText(type_: Type, short = false): string { .sort() .join(' | '); case 'reference': - if ( - typeof type.typeArguments === 'undefined' || - !type.typeArguments.length - ) { + if (!type.typeArguments || !type.typeArguments.length) { return type.name; } else { return `${type.name}<${type.typeArguments diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index a402bc1e09c..2167caa93ed 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -60,7 +60,7 @@ function escapeField(module: string): string { } function containsAll(checked?: string[], expected?: string[]): boolean { - if (typeof expected === 'undefined' || typeof checked === 'undefined') { + if (expected == null || checked == null) { return true; } return expected.every((c) => checked.includes(c)); @@ -185,7 +185,7 @@ function generateRecursiveModuleIndexes( // Overwrite types of src/locales///index.ts for known DEFINITIONS if (depth === 1) { moduleFiles = DEFINITIONS[submodule]; - if (typeof moduleFiles === 'undefined') { + if (moduleFiles == null) { moduleDefinition = 'any'; } else { moduleDefinition = `${submodule.replace(/(^|_)([a-z])/g, (s) => diff --git a/src/address.ts b/src/address.ts index ec137ad27c7..f60377ee6a5 100644 --- a/src/address.ts +++ b/src/address.ts @@ -39,7 +39,7 @@ export class Address { */ zipCode(format?: string): string { // if zip format is not specified, use the zip format defined for the locale - if (typeof format === 'undefined') { + if (format == null) { const localeFormat = this.faker.definitions.address.postcode; if (typeof localeFormat === 'string') { format = localeFormat; diff --git a/src/datatype.ts b/src/datatype.ts index aa7139dd701..ad37c3daf5e 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -98,7 +98,7 @@ export class Datatype { for (const p in options) { opts[p] = options[p]; } - if (typeof opts.precision === 'undefined') { + if (opts.precision == null) { opts.precision = 0.01; } return this.faker.datatype.number(opts); @@ -122,11 +122,11 @@ export class Datatype { let min = typeof options === 'number' ? undefined : options?.min; let max = typeof options === 'number' ? options : options?.max; - if (typeof min === 'undefined' || min < minMax * -1) { + if (min == null || min < minMax * -1) { min = Date.UTC(1990, 0); } - if (typeof max === 'undefined' || max > minMax) { + if (max == null || max > minMax) { max = Date.UTC(2100, 0); } diff --git a/src/date.ts b/src/date.ts index 4a8e7827a65..c10a80f8fa2 100644 --- a/src/date.ts +++ b/src/date.ts @@ -121,12 +121,8 @@ export class _Date { betweens( from: string | Date | number, to: string | Date | number, - num?: number + num: number = 3 ): Date[] { - if (typeof num === 'undefined') { - num = 3; - } - const dates: Date[] = []; while (dates.length < num) { @@ -210,12 +206,12 @@ export class _Date { const source = this.faker.definitions.date.month; let type: keyof DateEntryDefinition; if (abbr) { - if (context && typeof source['abbr_context'] !== 'undefined') { + if (context && source['abbr_context'] != null) { type = 'abbr_context'; } else { type = 'abbr'; } - } else if (context && typeof source['wide_context'] !== 'undefined') { + } else if (context && source['wide_context'] != null) { type = 'wide_context'; } else { type = 'wide'; @@ -244,12 +240,12 @@ export class _Date { const source = this.faker.definitions.date.weekday; let type: keyof DateEntryDefinition; if (abbr) { - if (context && typeof source['abbr_context'] !== 'undefined') { + if (context && source['abbr_context'] != null) { type = 'abbr_context'; } else { type = 'abbr'; } - } else if (context && typeof source['wide_context'] !== 'undefined') { + } else if (context && source['wide_context'] != null) { type = 'wide_context'; } else { type = 'wide'; diff --git a/src/fake.ts b/src/fake.ts index 4261ebebbc2..40f16aa7a1a 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -81,11 +81,11 @@ export class Fake { // split the method into module and function const parts = method.split('.'); - if (typeof this.faker[parts[0]] === 'undefined') { + if (this.faker[parts[0]] == null) { throw new Error('Invalid module: ' + parts[0]); } - if (typeof this.faker[parts[0]][parts[1]] === 'undefined') { + if (this.faker[parts[0]][parts[1]] == null) { throw new Error('Invalid method: ' + parts[0] + '.' + parts[1]); } diff --git a/src/faker.ts b/src/faker.ts index e2530f1642c..d7ba3f80a44 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -96,7 +96,7 @@ export class Faker { // TODO @Shinigami92 2022-01-11: Find a way to load this even more dynamically // In a way so that we don't accidentally miss a definition Object.entries(DEFINITIONS).forEach(([t, v]) => { - if (typeof this.definitions[t] === 'undefined') { + if (this.definitions[t] == null) { this.definitions[t] = {}; } @@ -109,8 +109,8 @@ export class Faker { Object.defineProperty(this.definitions[t], p, { get: () => { if ( - typeof this.locales[this.locale][t] === 'undefined' || - typeof this.locales[this.locale][t][p] === 'undefined' + this.locales[this.locale][t] == null || + this.locales[this.locale][t][p] == null ) { // certain localization sets contain less data then others. // in the case of a missing definition, use the default localeFallback diff --git a/src/finance.ts b/src/finance.ts index 37f491fe3a1..10e0b85395d 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -90,8 +90,7 @@ export class Finance { */ mask(length?: number, parens?: boolean, ellipsis?: boolean): string { // set defaults - length = - length === 0 || !length || typeof length === 'undefined' ? 4 : length; + length = length || 4; parens = parens == null ? true : parens; ellipsis = ellipsis == null ? true : ellipsis; diff --git a/src/helpers.ts b/src/helpers.ts index 2ee9faf529f..286ecc41607 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -351,7 +351,7 @@ export class Helpers { let tmp: number; let repetitions: number; let token = string.match(RANGE_REP_REG); - while (token !== null) { + while (token != null) { min = parseInt(token[2]); max = parseInt(token[3]); // switch min and max @@ -369,7 +369,7 @@ export class Helpers { } // Deal with repeat `{num}` token = string.match(REP_REG); - while (token !== null) { + while (token != null) { repetitions = parseInt(token[2]); string = string.slice(0, token.index) + @@ -381,7 +381,7 @@ export class Helpers { //TODO: implement for letters e.g. [0-9a-zA-Z] etc. token = string.match(RANGE_REG); - while (token !== null) { + while (token != null) { min = parseInt(token[1]); // This time we are not capturing the char before `[]` max = parseInt(token[2]); // switch min and max @@ -412,7 +412,7 @@ export class Helpers { * faker.helpers.shuffle(['a', 'b', 'c']) // [ 'b', 'c', 'a' ] */ shuffle(o?: T[]): T[] { - if (typeof o === 'undefined' || o.length === 0) { + if (o == null || o.length === 0) { return o || []; } @@ -481,7 +481,7 @@ export class Helpers { string | ((substring: string, ...args: any[]) => string) > ): string { - if (typeof str === 'undefined') { + if (str == null) { return ''; } for (const p in data) { diff --git a/src/image.ts b/src/image.ts index 31f8d651d7a..e9ae6eb7bae 100644 --- a/src/image.ts +++ b/src/image.ts @@ -99,11 +99,11 @@ export class Image { width = width || 640; height = height || 480; let protocol = 'http://'; - if (typeof https !== 'undefined' && https === true) { + if (https === true) { protocol = 'https://'; } let url = `${protocol}placeimg.com/${width}/${height}`; - if (typeof category !== 'undefined') { + if (category != null) { url += '/' + category; } diff --git a/src/image_providers/lorempixel.ts b/src/image_providers/lorempixel.ts index e58aa30b844..310ba45a74b 100644 --- a/src/image_providers/lorempixel.ts +++ b/src/image_providers/lorempixel.ts @@ -66,7 +66,7 @@ export class Lorempixel { height = height || 480; let url = `https://lorempixel.com/${width}/${height}`; - if (typeof category !== 'undefined') { + if (category != null) { url += '/' + category; } diff --git a/src/image_providers/unsplash.ts b/src/image_providers/unsplash.ts index 47157eb20cf..dd8abd37f10 100644 --- a/src/image_providers/unsplash.ts +++ b/src/image_providers/unsplash.ts @@ -58,13 +58,13 @@ export class Unsplash { let url = 'https://source.unsplash.com'; - if (typeof category !== 'undefined') { + if (category != null) { url += '/category/' + category; } url += `/${width}x${height}`; - if (typeof keyword !== 'undefined') { + if (keyword != null) { const keywordFormat = /^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$/; if (keywordFormat.test(keyword)) { url += '?' + keyword; diff --git a/src/internet.ts b/src/internet.ts index f247f06b4a9..1ed6a837f52 100644 --- a/src/internet.ts +++ b/src/internet.ts @@ -375,7 +375,7 @@ export class Internet { prefix?: string ): string { len = len || 15; - if (typeof memorable === 'undefined') { + if (memorable == null) { memorable = false; } /* diff --git a/src/lorem.ts b/src/lorem.ts index 4612fe2d1f6..dee259f3d07 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -31,7 +31,7 @@ export class Lorem { word(length?: number): string { const hasRightLength = (word: string) => word.length === length; let properLengthWords: readonly string[]; - if (typeof length === 'undefined') { + if (length == null) { properLengthWords = this.faker.definitions.lorem.words; } else { properLengthWords = @@ -49,10 +49,7 @@ export class Lorem { * faker.lorem.words() // 'qui praesentium pariatur' * faker.lorem.words(10) // 'debitis consectetur voluptatem non doloremque ipsum autem totam eum ratione' */ - words(num?: number): string { - if (typeof num === 'undefined') { - num = 3; - } + words(num: number = 3): string { const words: string[] = []; for (let i = 0; i < num; i++) { words.push(this.faker.lorem.word()); @@ -70,7 +67,7 @@ export class Lorem { * faker.lorem.sentence(5) // 'Laborum voluptatem officiis est et.' */ sentence(wordCount?: number): string { - if (typeof wordCount === 'undefined') { + if (wordCount == null) { wordCount = this.faker.datatype.number({ min: 3, max: 10 }); } @@ -105,10 +102,10 @@ export class Lorem { * // Et perspiciatis ipsam omnis.' */ sentences(sentenceCount?: number, separator?: string): string { - if (typeof sentenceCount === 'undefined') { + if (sentenceCount == null) { sentenceCount = this.faker.datatype.number({ min: 2, max: 6 }); } - if (typeof separator === 'undefined') { + if (separator == null) { separator = ' '; } const sentences: string[] = []; @@ -208,7 +205,7 @@ export class Lorem { * // Voluptate aut aut.' */ lines(lineCount?: number): string { - if (typeof lineCount === 'undefined') { + if (lineCount == null) { lineCount = this.faker.datatype.number({ min: 1, max: 5 }); } return this.faker.lorem.sentences(lineCount, '\n'); diff --git a/src/random.ts b/src/random.ts index 0658cdd56f3..7e410b10067 100644 --- a/src/random.ts +++ b/src/random.ts @@ -322,7 +322,7 @@ export class Random { words(count?: number): string { const words: string[] = []; - if (typeof count === 'undefined') { + if (count == null) { count = this.faker.datatype.number({ min: 1, max: 3 }); } @@ -380,7 +380,7 @@ export class Random { | number | { count?: number; upcase?: boolean; bannedChars?: string[] } ): string { - if (typeof options === 'undefined') { + if (options == null) { options = { count: 1, }; @@ -388,14 +388,14 @@ export class Random { options = { count: options, }; - } else if (typeof options.count === 'undefined') { + } else if (options.count == null) { options.count = 1; } - if (typeof options.upcase === 'undefined') { + if (options.upcase == null) { options.upcase = false; } - if (typeof options.bannedChars === 'undefined') { + if (options.bannedChars == null) { options.bannedChars = []; } @@ -455,7 +455,7 @@ export class Random { count: number = 1, options: { bannedChars?: string[] } = {} ): string { - if (typeof options.bannedChars === 'undefined') { + if (options.bannedChars == null) { options.bannedChars = []; } diff --git a/src/vendor/unique.ts b/src/vendor/unique.ts index 0d6e6317ece..78d0fdfc13d 100644 --- a/src/vendor/unique.ts +++ b/src/vendor/unique.ts @@ -19,7 +19,7 @@ function defaultCompare( obj: Record, key: RecordKey ): 0 | -1 { - if (typeof obj[key] === 'undefined') { + if (obj[key] === undefined) { return -1; } return 0; @@ -71,7 +71,7 @@ export function exec RecordKey>( opts.currentIterations = 0; } - if (typeof opts.startTime === 'undefined') { + if (opts.startTime == null) { opts.startTime = new Date().getTime(); } diff --git a/test/finance.spec.ts b/test/finance.spec.ts index 77df6f6337e..f5d4521adc6 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -186,10 +186,7 @@ describe('finance', () => { it('should set a specified length', () => { let expected = faker.datatype.number(20); - expected = - expected === 0 || !expected || typeof expected === 'undefined' - ? 4 - : expected; + expected = expected || 4; const mask = faker.finance.mask(expected, false, false); //the length of mask picks 4 if the random number generator picks 0 From 11ebb0b0c85d73647df587991e46827981042bfd Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 25 Mar 2022 19:25:54 +0100 Subject: [PATCH 053/130] refactor: use number tuple as input for coordinate (#668) --- src/address.ts | 123 +++++++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 50 deletions(-) diff --git a/src/address.ts b/src/address.ts index f60377ee6a5..b177000362e 100644 --- a/src/address.ts +++ b/src/address.ts @@ -4,6 +4,75 @@ import type { Helpers } from './helpers'; let f: Fake['fake']; +/** + * Converts degrees to radians. + * + * @param degrees Degrees. + */ +function degreesToRadians(degrees: number): number { + return degrees * (Math.PI / 180.0); +} + +/** + * Converts radians to degrees. + * + * @param radians Radians. + */ +function radiansToDegrees(radians: number): number { + return radians * (180.0 / Math.PI); +} + +/** + * Converts kilometers to miles. + * + * @param miles Miles. + */ +function kilometersToMiles(miles: number): number { + return miles * 0.621371; +} + +/** + * Calculates coordinates with offset. + * + * @param coordinate Coordinate. + * @param bearing Bearing. + * @param distance Distance. + * @param isMetric Metric: true, Miles: false. + */ +function coordinateWithOffset( + coordinate: [number, number], + bearing: number, + distance: number, + isMetric: boolean +): number[] { + const R = 6378.137; // Radius of the Earth (http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html) + const d = isMetric ? distance : kilometersToMiles(distance); // Distance in km + + const lat1 = degreesToRadians(coordinate[0]); //Current lat point converted to radians + const lon1 = degreesToRadians(coordinate[1]); //Current long point converted to radians + + const lat2 = Math.asin( + Math.sin(lat1) * Math.cos(d / R) + + Math.cos(lat1) * Math.sin(d / R) * Math.cos(bearing) + ); + + let lon2 = + lon1 + + Math.atan2( + Math.sin(bearing) * Math.sin(d / R) * Math.cos(lat1), + Math.cos(d / R) - Math.sin(lat1) * Math.sin(lat2) + ); + + // Keep longitude in range [-180, 180] + if (lon2 > degreesToRadians(180)) { + lon2 = lon2 - degreesToRadians(360); + } else if (lon2 < degreesToRadians(-180)) { + lon2 = lon2 + degreesToRadians(360); + } + + return [radiansToDegrees(lat2), radiansToDegrees(lon2)]; +} + /** * Module to generate addresses and locations. */ @@ -448,63 +517,17 @@ export class Address { * faker.address.nearbyGPSCoordinate([33, -170]) // [ '33.0165', '-170.0636' ] * faker.address.nearbyGPSCoordinate([33, -170], 1000, true) // [ '37.9163', '-179.2408' ] */ - // TODO ST-DDT 2022-02-10: This should use either string or number coords. + // TODO ST-DDT 2022-02-10: Allow coordinate parameter to be [string, string]. nearbyGPSCoordinate( - coordinate?: number[], + coordinate?: [number, number], radius?: number, isMetric?: boolean - ): string[] { - // TODO ST-DDT 2022-02-10: Remove unused code. - function randomFloat(min: number, max: number): number { - return Math.random() * (max - min) + min; - } - function degreesToRadians(degrees: number): number { - return degrees * (Math.PI / 180.0); - } - function radiansToDegrees(radians: number): number { - return radians * (180.0 / Math.PI); - } - function kilometersToMiles(miles: number): number { - return miles * 0.621371; - } - function coordinateWithOffset( - coordinate: number[], - bearing: number, - distance: number, - isMetric: boolean - ): number[] { - const R = 6378.137; // Radius of the Earth (http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html) - const d = isMetric ? distance : kilometersToMiles(distance); // Distance in km - - const lat1 = degreesToRadians(coordinate[0]); //Current lat point converted to radians - const lon1 = degreesToRadians(coordinate[1]); //Current long point converted to radians - - const lat2 = Math.asin( - Math.sin(lat1) * Math.cos(d / R) + - Math.cos(lat1) * Math.sin(d / R) * Math.cos(bearing) - ); - - let lon2 = - lon1 + - Math.atan2( - Math.sin(bearing) * Math.sin(d / R) * Math.cos(lat1), - Math.cos(d / R) - Math.sin(lat1) * Math.sin(lat2) - ); - - // Keep longitude in range [-180, 180] - if (lon2 > degreesToRadians(180)) { - lon2 = lon2 - degreesToRadians(360); - } else if (lon2 < degreesToRadians(-180)) { - lon2 = lon2 + degreesToRadians(360); - } - - return [radiansToDegrees(lat2), radiansToDegrees(lon2)]; - } - + ): [string, string] { // If there is no coordinate, the best we can do is return a random GPS coordinate. if (coordinate === undefined) { return [this.faker.address.latitude(), this.faker.address.longitude()]; } + radius = radius || 10.0; isMetric = isMetric || false; From 9291b621d5e96826970c754172595ea922625b85 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 25 Mar 2022 19:34:39 +0100 Subject: [PATCH 054/130] docs: remove api methods section (#666) --- README.md | 334 +----------------------------------------------------- 1 file changed, 4 insertions(+), 330 deletions(-) diff --git a/README.md b/README.md index 6b1c3b1ba93..ac8c6807a6f 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ declare module '@faker-js/faker' { ## API -An in-depth overview of the API methods is available in the documentation. The API covers the following modules: +An in-depth overview of the API methods is available in the [documentation](https://fakerjs.dev/guide/). The API covers the following modules: | Module | Example | Output | | -------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -133,335 +133,9 @@ An in-depth overview of the API methods is available in the documentation. The A | System | `faker.system.directoryPath()` | C:\Documents\Newsletters\ | | Vehicle | `faker.vehicle.vehicle()` | 2011 Dodge Caravan | -### API Methods - -Faker provides many useful utility functions. - -- faker.address - - | API | Description | - | ------------------- | ------------------------------- | - | zipCode | Get fake zip code | - | zipCodeByState | Get fake zip code by state | - | city | Get fake city | - | cityPrefix | Get fake city prefix | - | citySuffix | Get fake city suffix | - | cityName | Get fake city name | - | streetName | Get fake street name | - | streetAddress | Get fake street address | - | streetSuffix | Get fake street suffix | - | streetPrefix | Get fake street prefix | - | secondaryAddress | Get fake secondary address | - | county | Get fake county | - | country | Get fake country | - | countryCode | Get fake country code | - | state | Get fake state | - | stateAbbr | Get fake state abbreviation | - | latitude | Get fake latitude | - | longitude | Get fake longitude | - | direction | Get fake direction | - | cardinalDirection | Get fake cardinal direction | - | ordinalDirection | Get fake ordinal direction | - | nearbyGPSCoordinate | Get fake near by gps coordinate | - | timeZone | Get fake timezone | - -- faker.animal - - | API | Description | - | ---------- | ------------------------ | - | dog | Get fake dog type | - | cat | Get fake cat type | - | snake | Get fake snake type | - | bear | Get fake bear type | - | lion | Get fake lion type | - | cetacean | Get fake cetacean type | - | horse | Get fake horse type | - | bird | Get fake bird type | - | cow | Get fake cow type | - | fish | Get fake fish type | - | crocodilia | Get fake crocodilia type | - | insect | Get fake insect type | - | rabbit | Get fake rabbit type | - -- faker.commerce - - | API | Description | - | ------------------ | ------------------------------ | - | color | Get fake color name | - | department | Get fake department name | - | productName | Get fake product name | - | price | Get fake price count | - | productAdjective | Get fake product adjective | - | productMaterial | Get fake product material data | - | product | Get fake product name | - | productDescription | Get fake product description | - -- faker.company - - | API | Description | - | --------------------- | ------------------------------------ | - | suffixes | Get fake company suffixes | - | companyName | Get fake company name | - | companySuffix | Get fake company suffix | - | bs | Get fake company business services | - | catchPhraseAdjective | Get fake product adjective | - | catchPhraseDescriptor | Get fake product material data | - | catchPhraseNoun | Get fake product name | - | bsAdjective | Get fake business services adjective | - | bsBuzz | Get fake business services buzz | - | bsNoun | Get fake business services noun | - -- faker.database - - | API | Description | - | --------- | --------------------------------- | - | column | Get fake database column name | - | type | Get fake database column datatype | - | collation | Get fake database collation | - | engine | Get fake database engine | - -- faker.datatype - - | API | Description | - | ----------- | ---------------------------------- | - | number | Generates a random number | - | float | Generates a random floating number | - | datetime | Generates a random datetime | - | string | Generates a random string | - | uuid | Generates a valid uuid | - | boolean | Generates a boolean | - | hexaDecimal | Generates a hexadecimal | - | json | Generates a valid json object | - | array | Generates an array | - -- faker.date - - | API | Description | - | -------- | -------------------------------------------------------------------------------------- | - | past | Get a date `N` years into the past | - | future | Get a date `N` years into the future | - | between | Get a random date between the dates given | - | betweens | Get an array of 3 dates ( by default ) of sorted randoms dates between the dates given | - | recent | Get a date `N` days from the recent past | - | soon | Get a date `N` days into the future | - | month | Generates a random value of date month | - | weekday | Generates a random value of date weekday | - -- faker.fake - -- faker.finance - - | API | Description | - | ---------------------- | ------------------------------------------------- | - | account | Generates a random finance account | - | accountName | Generates a random finance account name | - | routingNumber | Generates a random finance routing number | - | mask | Generates a random finance mask template | - | amount | Generates a random amount of transaction | - | transactionType | Generates a random transaction type | - | currencyCode | Generates a random currency code | - | currencyName | Generates a random currency name | - | currencySymbol | Generates a random currency symbol | - | bitcoinAddress | Generates a random bitcoin address | - | litecoinAddress | Generates a random litecoin address | - | creditCardNumber | Generates a random credit card number | - | creditCardCVV | Generates a random credit card CVV | - | ethereumAddress | Generates a random ethereum address (ETH address) | - | iban | Generates a random IBAN | - | bic | Generates a random BIC | - | transactionDescription | Generates a random transaction description | - -- faker.git - - | API | Description | - | ------------- | ---------------------------------------------------------------- | - | branch | Generates a random branch with hacker noun and verb | - | commitEntry | Generates a random commit entry with git commit message and sha | - | commitMessage | Generates a random commit message with hacker noun, adj and verb | - | commitSha | Generates a random commit SHA | - | shortSha | Generates a random short SHA | - -- faker.hacker - - | API | Description | - | ------------ | -------------------------------------- | - | abbreviation | Generates a random hacker abbreviation | - | adjective | Generates a random hacker adjective | - | noun | Generates a random hacker noun | - | verb | Generates a random hacker verb | - | ingverb | Generates a random hacker ingverb | - | phrase | Generates a random hacker phrase | - -- faker.helpers - - | API | Description | - | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | randomize | Get a random element from an array | - | slugify | Removes unwanted characters from URI string | - | replaceSymbolWithNumber | Parses string for a symbol and replace it with a random number from 1-10 | - | replaceSymbols | Parses string for symbols (numbers or letters) and replaces them appropriately (# will be replaced with number, ? with letter and \* will be replaced with number or letter) | - | replaceCreditCardSymbols | Replace symbols in a credit card schema including Luhn checksum | - | repeatString | String repeat helper, alternative to String.prototype.repeat | - | shuffle | Takes an array and randomizes it in place then returns it using the modern version of the Fisher-Yates algorithm | - | mustache | Generates a string with mustache {{ }} | - | createCard | Generates a human card | - | contextualCard | Generates a human contextual card | - | userCard | Generates a website user card | - | createTransaction | Generates a transaction | - -- faker.image - - | API | Description | - | ----------- | ---------------------------------------------- | - | image | Generates a random image | - | avatar | Generates a random avatar | - | imageUrl | Generates a random image url | - | abstract | Generates a random abstract image | - | animals | Generates a random animals image | - | business | Generates a random business image | - | cats | Generates a random cats image | - | city | Generates a random city image | - | food | Generates a random food image | - | nightlife | Generates a random nightlife image | - | fashion | Generates a random fashion image | - | people | Generates a random people image | - | nature | Generates a random nature image | - | sports | Generates a random sports image | - | technics | Generates a random technics image | - | transport | Generates a random transport image | - | dataUri | Generates a random data uri | - | lorempixel | Generates a random image url from lorempixel | - | unsplash | Generates a random image url from unsplash | - | lorempicsum | Generates a random image url from lorem picsum | - -- faker.internet - - | API | Description | - | ------------ | ---------------------------------------------------- | - | avatar | Generates a random avatar | - | email | Generates a random email | - | exampleEmail | Generates a random example email | - | userName | Generates a random user name | - | protocol | Generates a random internet protocol (http or https) | - | httpMethod | Generates a random http method | - | url | Generates a random url | - | domainName | Generates a random domain name | - | domainSuffix | Generates a random domain suffix | - | domainWord | Generates a random domain word | - | ip | Generates a random ip | - | ipv6 | Generates a random ipv6 | - | port | Generates a random port number | - | userAgent | Generates a random user agent | - | color | Generates a random hexadecimal color | - | mac | Generates a random mac address | - | password | Generates a random password | - -- faker.lorem - - | API | Description | - | ---------- | ----------------------------------- | - | word | Generates a random lorem word | - | words | Generates a random lorem words | - | sentence | Generates a random lorem sentence | - | slug | Generates a random lorem slug | - | sentences | Generates a random lorem sentences | - | paragraph | Generates a random lorem paragraph | - | paragraphs | Generates a random lorem paragraphs | - | text | Generates a random lorem text | - | lines | Generates a random lorem lines | - -- faker.mersenne - - | API | Description | - | ---------- | ---------------------------------------------- | - | rand | Generates a random mersenne rand | - | seed | Generates a random mersenne seed | - | seed_array | Generates a random datetime seed init by array | - -- faker.music - - | API | Description | - | ----- | ------------------------------ | - | genre | Generates a random music genre | - -- faker.name - - | API | Description | - | ------------- | ------------------------------------------------------------------------------------- | - | firstName | Generates a random human first name | - | lastName | Generates a random human last name | - | middleName | Generates a random human middle name | - | findName | Generates a random human first name and last name | - | jobTitle | Generates a random human job title, combination of jobDescriptor, jobArea and jobType | - | gender | Generates a random gender | - | prefix | Generates a random locale with gender specific name prefix | - | suffix | Generates a random locale with gender specific name suffix | - | title | Generates a random human title | - | jobDescriptor | Generates a random human job descriptor | - | jobArea | Generates a random human job area | - | jobType | Generates a random human job type | - -- faker.phone - - | API | Description | - | ----------------- | ------------------------------------------------------------------- | - | phoneNumber | Generates a random phone number | - | phoneNumberFormat | Generates a random phone number with requested format (Array index) | - | phoneFormats | Generates a random phone number format | - -- faker.random - - | API | Description | - | ------------- | --------------------------------------------------------------------------------- | - | arrayElement | Takes an array and returns a random element of the array | - | arrayElements | Takes an array and returns a subset with random elements of the array | - | objectElement | Takes an object and returns a random key or value | - | word | Generates a random word | - | words | Generate `N` random words, with `N` defaulting to a random number between 1 and 3 | - | locale | Generates a random locale | - | alpha | Generates lower/upper alphabetic characters | - | alphaNumeric | Generates alphanumeric characters | - -- faker.system - - | API | Description | - | -------------- | ----------------------------------------------------------- | - | fileName | Generates a random filenames without system path separators | - | commonFileName | Generates a random filenames without system path separators | - | mimeType | Generates a random mimetypes | - | commonFileType | Generates a random commonly used file type | - | commonFileExt | Generates a random commonly used file extension | - | fileType | Get any file type available as mime-type | - | fileExt | Generates a random file extension | - | directoryPath | Generates a random directory path | - | filePath | Generates a random unix fs file full path | - | semver | Generate semantic version | - -- faker.time - - | API | Description | - | ------ | ---------------------------------------- | - | recent | Get recent timestamp in Unix time format | - -- faker.unique - -- faker.vehicle - - | API | Description | - | ------------ | -------------------------------------------- | - | vehicle | Generates a random vehicle name | - | manufacturer | Generates a random vehicle manufacturer name | - | model | Generates a random vehicle model name | - | type | Generates a random vehicle type | - | fuel | Generates a random vehicle fuel type | - | vin | Generates a random vehicle vin number | - | color | Generates a random vehicle color | - | vrm | Generates a random vehicle vrm | - | bicycle | Generates a random bicycle type | - -### Faker.fake() - -Faker contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format. +### faker.fake() + +Faker contains a super useful generator method `faker.fake` for combining faker API methods using a mustache string format. **Example:** From e62fd15cc7b83cc314a22ad9b13cd68f222d4076 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 26 Mar 2022 00:07:57 +0100 Subject: [PATCH 055/130] test: fix flaky unique test coverage (#667) --- test/unique.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/unique.spec.ts b/test/unique.spec.ts index 483fe05e599..f222b7cea00 100644 --- a/test/unique.spec.ts +++ b/test/unique.spec.ts @@ -133,4 +133,21 @@ describe('unique', () => { }); expect(result).toBe('http'); }); + + it('no conflict', () => { + let i = 0; + const method = () => `no conflict: ${i++}`; + expect(faker.unique(method)).toBe('no conflict: 0'); + expect(faker.unique(method)).toBe('no conflict: 1'); + }); + + it('with conflict', () => { + const method = () => 'with conflict: 0'; + expect(faker.unique(method)).toBe('with conflict: 0'); + expect(() => + faker.unique(method, [], { + maxRetries: 1, + }) + ).toThrow(); + }); }); From 45b5bb6212f1ed3de9325e33468b27a7ea3facd1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 26 Mar 2022 12:39:58 +0100 Subject: [PATCH 056/130] chore(deps): update dependency typescript to ~4.6.3 (#675) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 66 +++++++++++++++++++++++++------------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index df7220d82ac..535fea58146 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "standard-version": "~9.3.2", "typedoc": "~0.22.13", "typedoc-plugin-missing-exports": "~0.22.6", - "typescript": "~4.6.2", + "typescript": "~4.6.3", "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 762fdb4216d..ba581417ea4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,7 +31,7 @@ specifiers: standard-version: ~9.3.2 typedoc: ~0.22.13 typedoc-plugin-missing-exports: ~0.22.6 - typescript: ~4.6.2 + typescript: ~4.6.3 validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 @@ -43,8 +43,8 @@ devDependencies: '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 '@types/validator': 13.7.1 - '@typescript-eslint/eslint-plugin': 5.16.0_3fed250b11519414a4c7d52468dd6bf5 - '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/eslint-plugin': 5.16.0_bc68a9cd5bf604202498b1a9faaf9387 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.3 '@vitest/ui': 0.7.10 c8: 7.11.0 conventional-changelog-cli: 2.2.2 @@ -61,14 +61,14 @@ devDependencies: npm-run-all: 4.1.5 picocolors: 1.0.0 prettier: 2.6.0 - prettier-plugin-organize-imports: 2.3.4_prettier@2.6.0+typescript@4.6.2 + prettier-plugin-organize-imports: 2.3.4_prettier@2.6.0+typescript@4.6.3 rimraf: 3.0.2 sanitize-html: 2.7.0 simple-git-hooks: 2.7.0 standard-version: 9.3.2 - typedoc: 0.22.13_typescript@4.6.2 + typedoc: 0.22.13_typescript@4.6.3 typedoc-plugin-missing-exports: 0.22.6_typedoc@0.22.13 - typescript: 4.6.2 + typescript: 4.6.3 validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 @@ -434,7 +434,7 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.16.0_3fed250b11519414a4c7d52468dd6bf5: + /@typescript-eslint/eslint-plugin/5.16.0_bc68a9cd5bf604202498b1a9faaf9387: resolution: {integrity: sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -445,23 +445,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.3 '@typescript-eslint/scope-manager': 5.16.0 - '@typescript-eslint/type-utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 - '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/type-utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.11.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 semver: 7.3.5 - tsutils: 3.21.0_typescript@4.6.2 - typescript: 4.6.2 + tsutils: 3.21.0_typescript@4.6.3 + typescript: 4.6.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.16.0_eslint@8.11.0+typescript@4.6.2: + /@typescript-eslint/parser/5.16.0_eslint@8.11.0+typescript@4.6.3: resolution: {integrity: sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -473,10 +473,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.16.0 '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 debug: 4.3.4 eslint: 8.11.0 - typescript: 4.6.2 + typescript: 4.6.3 transitivePeerDependencies: - supports-color dev: true @@ -489,7 +489,7 @@ packages: '@typescript-eslint/visitor-keys': 5.16.0 dev: true - /@typescript-eslint/type-utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + /@typescript-eslint/type-utils/5.16.0_eslint@8.11.0+typescript@4.6.3: resolution: {integrity: sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -499,11 +499,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.2 + '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.11.0 - tsutils: 3.21.0_typescript@4.6.2 - typescript: 4.6.2 + tsutils: 3.21.0_typescript@4.6.3 + typescript: 4.6.3 transitivePeerDependencies: - supports-color dev: true @@ -513,7 +513,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.16.0_typescript@4.6.2: + /@typescript-eslint/typescript-estree/5.16.0_typescript@4.6.3: resolution: {integrity: sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -528,13 +528,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.5 - tsutils: 3.21.0_typescript@4.6.2 - typescript: 4.6.2 + tsutils: 3.21.0_typescript@4.6.3 + typescript: 4.6.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.16.0_eslint@8.11.0+typescript@4.6.2: + /@typescript-eslint/utils/5.16.0_eslint@8.11.0+typescript@4.6.3: resolution: {integrity: sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -543,7 +543,7 @@ packages: '@types/json-schema': 7.0.9 '@typescript-eslint/scope-manager': 5.16.0 '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.2 + '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 eslint: 8.11.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.11.0 @@ -3557,14 +3557,14 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/2.3.4_prettier@2.6.0+typescript@4.6.2: + /prettier-plugin-organize-imports/2.3.4_prettier@2.6.0+typescript@4.6.3: resolution: {integrity: sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==} peerDependencies: prettier: '>=2.0' typescript: '>=2.9' dependencies: prettier: 2.6.0 - typescript: 4.6.2 + typescript: 4.6.3 dev: true /prettier/2.6.0: @@ -4227,14 +4227,14 @@ packages: resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==} dev: true - /tsutils/3.21.0_typescript@4.6.2: + /tsutils/3.21.0_typescript@4.6.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.6.2 + typescript: 4.6.3 dev: true /tunnel-agent/0.6.0: @@ -4293,10 +4293,10 @@ packages: peerDependencies: typedoc: 0.22.x dependencies: - typedoc: 0.22.13_typescript@4.6.2 + typedoc: 0.22.13_typescript@4.6.3 dev: true - /typedoc/0.22.13_typescript@4.6.2: + /typedoc/0.22.13_typescript@4.6.3: resolution: {integrity: sha512-NHNI7Dr6JHa/I3+c62gdRNXBIyX7P33O9TafGLd07ur3MqzcKgwTvpg18EtvCLHJyfeSthAtCLpM7WkStUmDuQ==} engines: {node: '>= 12.10.0'} hasBin: true @@ -4308,11 +4308,11 @@ packages: marked: 4.0.12 minimatch: 5.0.1 shiki: 0.10.1 - typescript: 4.6.2 + typescript: 4.6.3 dev: true - /typescript/4.6.2: - resolution: {integrity: sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==} + /typescript/4.6.3: + resolution: {integrity: sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==} engines: {node: '>=4.2.0'} hasBin: true dev: true From 2f61cfd18ae3bc2cc03ba56285eb87eb31db82eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 26 Mar 2022 12:46:18 +0100 Subject: [PATCH 057/130] chore(deps): update dependency prettier to v2.6.1 (#674) --- package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 535fea58146..76c4e3abc14 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "lint-staged": "~12.3.7", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", - "prettier": "2.6.0", + "prettier": "2.6.1", "prettier-plugin-organize-imports": "~2.3.4", "rimraf": "~3.0.2", "sanitize-html": "~2.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba581417ea4..bbd88fa3e67 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,7 +23,7 @@ specifiers: lint-staged: ~12.3.7 npm-run-all: ~4.1.5 picocolors: ~1.0.0 - prettier: 2.6.0 + prettier: 2.6.1 prettier-plugin-organize-imports: ~2.3.4 rimraf: ~3.0.2 sanitize-html: ~2.7.0 @@ -55,13 +55,13 @@ devDependencies: eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.11.0 eslint-plugin-jsdoc: 38.0.6_eslint@8.11.0 - eslint-plugin-prettier: 4.0.0_68edcf5670f37721baf5d2cac6124e4d + eslint-plugin-prettier: 4.0.0_e2923b5169e23c4db59b86a638c599a3 esno: 0.14.1 lint-staged: 12.3.7 npm-run-all: 4.1.5 picocolors: 1.0.0 - prettier: 2.6.0 - prettier-plugin-organize-imports: 2.3.4_prettier@2.6.0+typescript@4.6.3 + prettier: 2.6.1 + prettier-plugin-organize-imports: 2.3.4_prettier@2.6.1+typescript@4.6.3 rimraf: 3.0.2 sanitize-html: 2.7.0 simple-git-hooks: 2.7.0 @@ -1968,7 +1968,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.0.0_68edcf5670f37721baf5d2cac6124e4d: + /eslint-plugin-prettier/4.0.0_e2923b5169e23c4db59b86a638c599a3: resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} engines: {node: '>=6.0.0'} peerDependencies: @@ -1981,7 +1981,7 @@ packages: dependencies: eslint: 8.11.0 eslint-config-prettier: 8.5.0_eslint@8.11.0 - prettier: 2.6.0 + prettier: 2.6.1 prettier-linter-helpers: 1.0.0 dev: true @@ -3557,18 +3557,18 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/2.3.4_prettier@2.6.0+typescript@4.6.3: + /prettier-plugin-organize-imports/2.3.4_prettier@2.6.1+typescript@4.6.3: resolution: {integrity: sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==} peerDependencies: prettier: '>=2.0' typescript: '>=2.9' dependencies: - prettier: 2.6.0 + prettier: 2.6.1 typescript: 4.6.3 dev: true - /prettier/2.6.0: - resolution: {integrity: sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==} + /prettier/2.6.1: + resolution: {integrity: sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==} engines: {node: '>=10.13.0'} hasBin: true dev: true From 3aea453ed417b784270557204532337f0a6b9298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Sat, 26 Mar 2022 17:48:06 +0100 Subject: [PATCH 058/130] refactor(address.secondaryAddress): use local definition (#680) --- src/address.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/address.ts b/src/address.ts index b177000362e..5a130cb20a2 100644 --- a/src/address.ts +++ b/src/address.ts @@ -310,8 +310,9 @@ export class Address { */ secondaryAddress(): string { return this.Helpers.replaceSymbolWithNumber( - // TODO ST-DDT 2022-01-30: this.faker.definitions.address.secondary_address - this.faker.random.arrayElement(['Apt. ###', 'Suite ###']) + this.faker.random.arrayElement( + this.faker.definitions.address.secondary_address + ) ); } From 81740ff1946d02587e7b72a81f9a5c7f015474c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Sat, 26 Mar 2022 19:02:19 +0100 Subject: [PATCH 059/130] refactor: replace intern use of helper.randomize (#687) --- src/finance.ts | 6 ++++-- src/helpers.ts | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/finance.ts b/src/finance.ts index 10e0b85395d..25d44046158 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -49,7 +49,9 @@ export class Finance { */ accountName(): string { return [ - this.Helpers.randomize(this.faker.definitions.finance.account_type), + this.faker.random.arrayElement( + this.faker.definitions.finance.account_type + ), 'Account', ].join(' '); } @@ -160,7 +162,7 @@ export class Finance { * faker.finance.transactionType() // 'payment' */ transactionType(): string { - return this.Helpers.randomize( + return this.faker.random.arrayElement( this.faker.definitions.finance.transaction_type ); } diff --git a/src/helpers.ts b/src/helpers.ts index 286ecc41607..38e70c29869 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -680,7 +680,9 @@ export class Helpers { name: [this.faker.finance.accountName(), this.faker.finance.mask()].join( ' ' ), - type: this.randomize(this.faker.definitions.finance.transaction_type), + type: this.faker.random.arrayElement( + this.faker.definitions.finance.transaction_type + ), account: this.faker.finance.account(), }; } From 877ac76b2811c948c560fee4fa76908b142557d1 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sat, 26 Mar 2022 19:19:39 +0100 Subject: [PATCH 060/130] chore: replace substr with substring (#678) --- src/fake.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fake.ts b/src/fake.ts index 40f16aa7a1a..d8cc6ff7096 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -64,7 +64,7 @@ export class Fake { // extract method name from between the {{ }} that we found // for example: {{name.firstName}} - const token = str.substr(start + 2, end - start - 2); + const token = str.substring(start + 2, end); let method = token.replace('}}', '').replace('{{', ''); // console.log('method', method) From 2a49e8215a81ef284a2955f7f9a51d6f2bd76f5f Mon Sep 17 00:00:00 2001 From: Andrew Molchanov Date: Sun, 27 Mar 2022 14:13:55 +0300 Subject: [PATCH 061/130] fix: replaced placeimg.com on loremflickr.com (#692) --- src/image.ts | 96 ++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/image.ts b/src/image.ts index e9ae6eb7bae..fc8eaf153a5 100644 --- a/src/image.ts +++ b/src/image.ts @@ -35,9 +35,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.image() // 'http://placeimg.com/640/480/city' - * faker.image.image(1234, 2345) // 'http://placeimg.com/1234/2345/sports' - * faker.image.image(1234, 2345, true) // 'http://placeimg.com/1234/2345/nature?56789' + * faker.image.image() // 'http://loremflickr.com/640/480/city' + * faker.image.image(1234, 2345) // 'http://loremflickr.com/1234/2345/sports' + * faker.image.image(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nature?56789' */ image(width?: number, height?: number, randomize?: boolean): string { const categories = [ @@ -83,11 +83,11 @@ export class Image { * @param https When true, return a `https` url. Otherwise, return a `http` url. * * @example - * faker.image.imageUrl() // 'http://placeimg.com/640/480' - * faker.image.imageUrl(1234, 2345) // 'http://placeimg.com/1234/2345' - * faker.image.imageUrl(1234, 2345, 'cat') // 'http://placeimg.com/1234/2345/cat' - * faker.image.imageUrl(1234, 2345, 'cat', true) // 'http://placeimg.com/1234/2345/cat?6849' - * faker.image.imageUrl(1234, 2345, 'cat', true, true) // 'https://placeimg.com/1234/2345/cat?56789' + * faker.image.imageUrl() // 'http://loremflickr.com/640/480' + * faker.image.imageUrl(1234, 2345) // 'http://loremflickr.com/1234/2345' + * faker.image.imageUrl(1234, 2345, 'cat') // 'http://loremflickr.com/1234/2345/cat' + * faker.image.imageUrl(1234, 2345, 'cat', true) // 'http://loremflickr.com/1234/2345/cat?6849' + * faker.image.imageUrl(1234, 2345, 'cat', true, true) // 'https://loremflickr.com/1234/2345/cat?56789' */ imageUrl( width?: number, @@ -102,7 +102,7 @@ export class Image { if (https === true) { protocol = 'https://'; } - let url = `${protocol}placeimg.com/${width}/${height}`; + let url = `${protocol}loremflickr.com/${width}/${height}`; if (category != null) { url += '/' + category; } @@ -122,9 +122,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.abstract() // 'http://placeimg.com/640/480/abstract' - * faker.image.abstract(1234, 2345) // 'http://placeimg.com/1234/2345/abstract' - * faker.image.abstract(1234, 2345, true) // 'http://placeimg.com/1234/2345/abstract?56789' + * faker.image.abstract() // 'http://loremflickr.com/640/480/abstract' + * faker.image.abstract(1234, 2345) // 'http://loremflickr.com/1234/2345/abstract' + * faker.image.abstract(1234, 2345, true) // 'http://loremflickr.com/1234/2345/abstract?56789' */ abstract(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'abstract', randomize); @@ -138,9 +138,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.animals() // 'http://placeimg.com/640/480/animals' - * faker.image.animals(1234, 2345) // 'http://placeimg.com/1234/2345/animals' - * faker.image.animals(1234, 2345, true) // 'http://placeimg.com/1234/2345/animals?56789' + * faker.image.animals() // 'http://loremflickr.com/640/480/animals' + * faker.image.animals(1234, 2345) // 'http://loremflickr.com/1234/2345/animals' + * faker.image.animals(1234, 2345, true) // 'http://loremflickr.com/1234/2345/animals?56789' */ animals(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'animals', randomize); @@ -154,9 +154,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.business() // 'http://placeimg.com/640/480/business' - * faker.image.business(1234, 2345) // 'http://placeimg.com/1234/2345/business' - * faker.image.business(1234, 2345, true) // 'http://placeimg.com/1234/2345/business?56789' + * faker.image.business() // 'http://loremflickr.com/640/480/business' + * faker.image.business(1234, 2345) // 'http://loremflickr.com/1234/2345/business' + * faker.image.business(1234, 2345, true) // 'http://loremflickr.com/1234/2345/business?56789' */ business(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'business', randomize); @@ -170,9 +170,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.cats() // 'http://placeimg.com/640/480/cats' - * faker.image.cats(1234, 2345) // 'http://placeimg.com/1234/2345/cats' - * faker.image.cats(1234, 2345, true) // 'http://placeimg.com/1234/2345/cats?56789' + * faker.image.cats() // 'http://loremflickr.com/640/480/cats' + * faker.image.cats(1234, 2345) // 'http://loremflickr.com/1234/2345/cats' + * faker.image.cats(1234, 2345, true) // 'http://loremflickr.com/1234/2345/cats?56789' */ cats(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'cats', randomize); @@ -186,9 +186,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.city() // 'http://placeimg.com/640/480/city' - * faker.image.city(1234, 2345) // 'http://placeimg.com/1234/2345/city' - * faker.image.city(1234, 2345, true) // 'http://placeimg.com/1234/2345/city?56789' + * faker.image.city() // 'http://loremflickr.com/640/480/city' + * faker.image.city(1234, 2345) // 'http://loremflickr.com/1234/2345/city' + * faker.image.city(1234, 2345, true) // 'http://loremflickr.com/1234/2345/city?56789' */ city(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'city', randomize); @@ -202,9 +202,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.food() // 'http://placeimg.com/640/480/food' - * faker.image.food(1234, 2345) // 'http://placeimg.com/1234/2345/food' - * faker.image.food(1234, 2345, true) // 'http://placeimg.com/1234/2345/food?56789' + * faker.image.food() // 'http://loremflickr.com/640/480/food' + * faker.image.food(1234, 2345) // 'http://loremflickr.com/1234/2345/food' + * faker.image.food(1234, 2345, true) // 'http://loremflickr.com/1234/2345/food?56789' */ food(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'food', randomize); @@ -218,9 +218,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.nightlife() // 'http://placeimg.com/640/480/nightlife' - * faker.image.nightlife(1234, 2345) // 'http://placeimg.com/1234/2345/nightlife' - * faker.image.nightlife(1234, 2345, true) // 'http://placeimg.com/1234/2345/nightlife?56789' + * faker.image.nightlife() // 'http://loremflickr.com/640/480/nightlife' + * faker.image.nightlife(1234, 2345) // 'http://loremflickr.com/1234/2345/nightlife' + * faker.image.nightlife(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nightlife?56789' */ nightlife(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'nightlife', randomize); @@ -234,9 +234,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.fashion() // 'http://placeimg.com/640/480/fashion' - * faker.image.fashion(1234, 2345) // 'http://placeimg.com/1234/2345/fashion' - * faker.image.fashion(1234, 2345, true) // 'http://placeimg.com/1234/2345/fashion?56789' + * faker.image.fashion() // 'http://loremflickr.com/640/480/fashion' + * faker.image.fashion(1234, 2345) // 'http://loremflickr.com/1234/2345/fashion' + * faker.image.fashion(1234, 2345, true) // 'http://loremflickr.com/1234/2345/fashion?56789' */ fashion(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'fashion', randomize); @@ -250,9 +250,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.people() // 'http://placeimg.com/640/480/people' - * faker.image.people(1234, 2345) // 'http://placeimg.com/1234/2345/people' - * faker.image.people(1234, 2345, true) // 'http://placeimg.com/1234/2345/people?56789' + * faker.image.people() // 'http://loremflickr.com/640/480/people' + * faker.image.people(1234, 2345) // 'http://loremflickr.com/1234/2345/people' + * faker.image.people(1234, 2345, true) // 'http://loremflickr.com/1234/2345/people?56789' */ people(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'people', randomize); @@ -266,9 +266,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.nature() // 'http://placeimg.com/640/480/nature' - * faker.image.nature(1234, 2345) // 'http://placeimg.com/1234/2345/nature' - * faker.image.nature(1234, 2345, true) // 'http://placeimg.com/1234/2345/nature?56789' + * faker.image.nature() // 'http://loremflickr.com/640/480/nature' + * faker.image.nature(1234, 2345) // 'http://loremflickr.com/1234/2345/nature' + * faker.image.nature(1234, 2345, true) // 'http://loremflickr.com/1234/2345/nature?56789' */ nature(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'nature', randomize); @@ -282,9 +282,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.sports() // 'http://placeimg.com/640/480/sports' - * faker.image.sports(1234, 2345) // 'http://placeimg.com/1234/2345/sports' - * faker.image.sports(1234, 2345, true) // 'http://placeimg.com/1234/2345/sports?56789' + * faker.image.sports() // 'http://loremflickr.com/640/480/sports' + * faker.image.sports(1234, 2345) // 'http://loremflickr.com/1234/2345/sports' + * faker.image.sports(1234, 2345, true) // 'http://loremflickr.com/1234/2345/sports?56789' */ sports(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'sports', randomize); @@ -298,9 +298,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.technics() // 'http://placeimg.com/640/480/technics' - * faker.image.technics(1234, 2345) // 'http://placeimg.com/1234/2345/technics' - * faker.image.technics(1234, 2345, true) // 'http://placeimg.com/1234/2345/technics?56789' + * faker.image.technics() // 'http://loremflickr.com/640/480/technics' + * faker.image.technics(1234, 2345) // 'http://loremflickr.com/1234/2345/technics' + * faker.image.technics(1234, 2345, true) // 'http://loremflickr.com/1234/2345/technics?56789' */ technics(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'technics', randomize); @@ -314,9 +314,9 @@ export class Image { * @param randomize Whether to randomize the image or not. Defaults to `false`. * * @example - * faker.image.transport() // 'http://placeimg.com/640/480/transport' - * faker.image.transport(1234, 2345) // 'http://placeimg.com/1234/2345/transport' - * faker.image.transport(1234, 2345, true) // 'http://placeimg.com/1234/2345/transport?56789' + * faker.image.transport() // 'http://loremflickr.com/640/480/transport' + * faker.image.transport(1234, 2345) // 'http://loremflickr.com/1234/2345/transport' + * faker.image.transport(1234, 2345, true) // 'http://loremflickr.com/1234/2345/transport?56789' */ transport(width?: number, height?: number, randomize?: boolean): string { return this.faker.image.imageUrl(width, height, 'transport', randomize); From b778e2c55f681c89d4b07d9436672e21b0ac6b16 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 08:58:51 +0200 Subject: [PATCH 062/130] chore(deps): update devdependencies (#699) Co-authored-by: Renovate Bot --- package.json | 8 +- pnpm-lock.yaml | 224 ++++++++++++++++++++++++------------------------- 2 files changed, 116 insertions(+), 116 deletions(-) diff --git a/package.json b/package.json index 76c4e3abc14..ffa1469c21c 100644 --- a/package.json +++ b/package.json @@ -93,19 +93,19 @@ "@types/node": "~16.11.26", "@types/prettier": "~2.4.4", "@types/sanitize-html": "~2.6.2", - "@types/validator": "~13.7.1", + "@types/validator": "~13.7.2", "@typescript-eslint/eslint-plugin": "~5.16.0", "@typescript-eslint/parser": "~5.16.0", "@vitest/ui": "~0.7.10", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", - "esbuild": "~0.14.27", - "eslint": "~8.11.0", + "esbuild": "~0.14.28", + "eslint": "~8.12.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.0.6", + "eslint-plugin-jsdoc": "~38.1.1", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbd88fa3e67..bfc02bc22a6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,19 +5,19 @@ specifiers: '@types/node': ~16.11.26 '@types/prettier': ~2.4.4 '@types/sanitize-html': ~2.6.2 - '@types/validator': ~13.7.1 + '@types/validator': ~13.7.2 '@typescript-eslint/eslint-plugin': ~5.16.0 '@typescript-eslint/parser': ~5.16.0 '@vitest/ui': ~0.7.10 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 - esbuild: ~0.14.27 - eslint: ~8.11.0 + esbuild: ~0.14.28 + eslint: ~8.12.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.0.6 + eslint-plugin-jsdoc: ~38.1.1 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.7 @@ -42,20 +42,20 @@ devDependencies: '@types/node': 16.11.26 '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 - '@types/validator': 13.7.1 - '@typescript-eslint/eslint-plugin': 5.16.0_bc68a9cd5bf604202498b1a9faaf9387 - '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.3 + '@types/validator': 13.7.2 + '@typescript-eslint/eslint-plugin': 5.16.0_4df62b6e125e6f18efee2d013b4a9d80 + '@typescript-eslint/parser': 5.16.0_eslint@8.12.0+typescript@4.6.3 '@vitest/ui': 0.7.10 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 - esbuild: 0.14.27 - eslint: 8.11.0 - eslint-config-prettier: 8.5.0_eslint@8.11.0 + esbuild: 0.14.28 + eslint: 8.12.0 + eslint-config-prettier: 8.5.0_eslint@8.12.0 eslint-define-config: 1.3.0 - eslint-gitignore: 0.1.0_eslint@8.11.0 - eslint-plugin-jsdoc: 38.0.6_eslint@8.11.0 - eslint-plugin-prettier: 4.0.0_e2923b5169e23c4db59b86a638c599a3 + eslint-gitignore: 0.1.0_eslint@8.12.0 + eslint-plugin-jsdoc: 38.1.1_eslint@8.12.0 + eslint-plugin-prettier: 4.0.0_b253a92c95b42c3296c682f11cccb3bd esno: 0.14.1 lint-staged: 12.3.7 npm-run-all: 4.1.5 @@ -422,8 +422,8 @@ packages: resolution: {integrity: sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==} dev: true - /@types/validator/13.7.1: - resolution: {integrity: sha512-I6OUIZ5cYRk5lp14xSOAiXjWrfVoMZVjDuevBYgQDYzZIjsf2CAISpEcXOkFAtpAHbmWIDLcZObejqny/9xq5Q==} + /@types/validator/13.7.2: + resolution: {integrity: sha512-KFcchQ3h0OPQgFirBRPZr5F/sVjxZsOrQHedj3zi8AH3Zv/hOLx2OLR4hxR5HcfoU+33n69ZuOfzthKVdMoTiw==} dev: true /@types/yauzl/2.9.2: @@ -434,7 +434,7 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.16.0_bc68a9cd5bf604202498b1a9faaf9387: + /@typescript-eslint/eslint-plugin/5.16.0_4df62b6e125e6f18efee2d013b4a9d80: resolution: {integrity: sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -445,12 +445,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.16.0_eslint@8.11.0+typescript@4.6.3 + '@typescript-eslint/parser': 5.16.0_eslint@8.12.0+typescript@4.6.3 '@typescript-eslint/scope-manager': 5.16.0 - '@typescript-eslint/type-utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 - '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 + '@typescript-eslint/type-utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 debug: 4.3.4 - eslint: 8.11.0 + eslint: 8.12.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 @@ -461,7 +461,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.16.0_eslint@8.11.0+typescript@4.6.3: + /@typescript-eslint/parser/5.16.0_eslint@8.12.0+typescript@4.6.3: resolution: {integrity: sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -475,7 +475,7 @@ packages: '@typescript-eslint/types': 5.16.0 '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 debug: 4.3.4 - eslint: 8.11.0 + eslint: 8.12.0 typescript: 4.6.3 transitivePeerDependencies: - supports-color @@ -489,7 +489,7 @@ packages: '@typescript-eslint/visitor-keys': 5.16.0 dev: true - /@typescript-eslint/type-utils/5.16.0_eslint@8.11.0+typescript@4.6.3: + /@typescript-eslint/type-utils/5.16.0_eslint@8.12.0+typescript@4.6.3: resolution: {integrity: sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -499,9 +499,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 debug: 4.3.4 - eslint: 8.11.0 + eslint: 8.12.0 tsutils: 3.21.0_typescript@4.6.3 typescript: 4.6.3 transitivePeerDependencies: @@ -534,7 +534,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.16.0_eslint@8.11.0+typescript@4.6.3: + /@typescript-eslint/utils/5.16.0_eslint@8.12.0+typescript@4.6.3: resolution: {integrity: sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -544,9 +544,9 @@ packages: '@typescript-eslint/scope-manager': 5.16.0 '@typescript-eslint/types': 5.16.0 '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 - eslint: 8.11.0 + eslint: 8.12.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.11.0 + eslint-utils: 3.0.0_eslint@8.12.0 transitivePeerDependencies: - supports-color - typescript @@ -1684,8 +1684,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.14.27: - resolution: {integrity: sha512-LuEd4uPuj/16Y8j6kqy3Z2E9vNY9logfq8Tq+oTE2PZVuNs3M1kj5Qd4O95ee66yDGb3isaOCV7sOLDwtMfGaQ==} + /esbuild-android-64/0.14.28: + resolution: {integrity: sha512-A52C3zq+9tNwCqZ+4kVLBxnk/WnrYM8P2+QNvNE9B6d2OVPs214lp3g6UyO+dKDhUdefhfPCuwkP8j2A/+szNA==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1693,8 +1693,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.27: - resolution: {integrity: sha512-E8Ktwwa6vX8q7QeJmg8yepBYXaee50OdQS3BFtEHKrzbV45H4foMOeEE7uqdjGQZFBap5VAqo7pvjlyA92wznQ==} + /esbuild-android-arm64/0.14.28: + resolution: {integrity: sha512-sm0fDEGElZhMC3HLZeECI2juE4aG7uPfMBMqNUhy9CeX399Pz8rC6e78OXMXInGjSdEAwQmCOHmfsP7uv3Q8rA==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1702,8 +1702,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.27: - resolution: {integrity: sha512-czw/kXl/1ZdenPWfw9jDc5iuIYxqUxgQ/Q+hRd4/3udyGGVI31r29LCViN2bAJgGvQkqyLGVcG03PJPEXQ5i2g==} + /esbuild-darwin-64/0.14.28: + resolution: {integrity: sha512-nzDd7mQ44FvsFHtOafZdBgn3Li5SMsnMnoz1J2MM37xJmR3wGNTFph88KypjHgWqwbxCI7MXS1U+sN4qDeeW6Q==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1711,8 +1711,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.27: - resolution: {integrity: sha512-BEsv2U2U4o672oV8+xpXNxN9bgqRCtddQC6WBh4YhXKDcSZcdNh7+6nS+DM2vu7qWIWNA4JbRG24LUUYXysimQ==} + /esbuild-darwin-arm64/0.14.28: + resolution: {integrity: sha512-XEq/bLR/glsUl+uGrBimQzOVs/CmwI833fXUhP9xrLI3IJ+rKyrZ5IA8u+1crOEf1LoTn8tV+hInmX6rGjbScw==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1720,8 +1720,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.27: - resolution: {integrity: sha512-7FeiFPGBo+ga+kOkDxtPmdPZdayrSzsV9pmfHxcyLKxu+3oTcajeZlOO1y9HW+t5aFZPiv7czOHM4KNd0tNwCA==} + /esbuild-freebsd-64/0.14.28: + resolution: {integrity: sha512-rTKLgUj/HEcPeE5XZ7IZwWpFx7IWMfprN7QRk/TUJE1s1Ipb58esboIesUpjirJz/BwrgHq+FDG9ChAI8dZAtQ==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -1729,8 +1729,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.27: - resolution: {integrity: sha512-8CK3++foRZJluOWXpllG5zwAVlxtv36NpHfsbWS7TYlD8S+QruXltKlXToc/5ZNzBK++l6rvRKELu/puCLc7jA==} + /esbuild-freebsd-arm64/0.14.28: + resolution: {integrity: sha512-sBffxD1UMOsB7aWMoExmipycjcy3HJGwmqE4GQZUTZvdiH4GhjgUiVdtPyt7kSCdL40JqnWQJ4b1l8Y51oCF4Q==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -1738,8 +1738,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.27: - resolution: {integrity: sha512-qhNYIcT+EsYSBClZ5QhLzFzV5iVsP1YsITqblSaztr3+ZJUI+GoK8aXHyzKd7/CKKuK93cxEMJPpfi1dfsOfdw==} + /esbuild-linux-32/0.14.28: + resolution: {integrity: sha512-+Wxidh3fBEQ9kHcCsD4etlBTMb1n6QY2uXv3rFhVn88CY/JP782MhA57/ipLMY4kOLeSKEuFGN4rtjHuhmRMig==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -1747,8 +1747,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.27: - resolution: {integrity: sha512-ESjck9+EsHoTaKWlFKJpPZRN26uiav5gkI16RuI8WBxUdLrrAlYuYSndxxKgEn1csd968BX/8yQZATYf/9+/qg==} + /esbuild-linux-64/0.14.28: + resolution: {integrity: sha512-7+xgsC4LvR6cnzaBdiljNnPDjbkwzahogN+S9uy9AoYw7ZjPnnXc6sjQAVCbqGb7MEgrWdpa6u/Tao79i4lWxg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -1756,8 +1756,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.27: - resolution: {integrity: sha512-JnnmgUBdqLQO9hoNZQqNHFWlNpSX82vzB3rYuCJMhtkuaWQEmQz6Lec1UIxJdC38ifEghNTBsF9bbe8dFilnCw==} + /esbuild-linux-arm/0.14.28: + resolution: {integrity: sha512-L5isjmlLbh9E0WVllXiVETbScgMbth/+XkXQii1WwgO1RvLIfaGrVFz8d2n6EH/ImtgYxPYGx+OcvIKQBc91Rg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -1765,8 +1765,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.27: - resolution: {integrity: sha512-no6Mi17eV2tHlJnqBHRLekpZ2/VYx+NfGxKcBE/2xOMYwctsanCaXxw4zapvNrGE9X38vefVXLz6YCF8b1EHiQ==} + /esbuild-linux-arm64/0.14.28: + resolution: {integrity: sha512-EjRHgwg+kgXABzyoPGPOPg4d5wZqRnZ/ZAxBDzLY+i6DS8OUfTSlZHWIOZzU4XF7125WxRBg9ULbrFJBl+57Eg==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -1774,8 +1774,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.27: - resolution: {integrity: sha512-NolWP2uOvIJpbwpsDbwfeExZOY1bZNlWE/kVfkzLMsSgqeVcl5YMen/cedRe9mKnpfLli+i0uSp7N+fkKNU27A==} + /esbuild-linux-mips64le/0.14.28: + resolution: {integrity: sha512-krx9SSg7yfiUKk64EmjefOyiEF6nv2bRE4um/LiTaQ6Y/6FP4UF3/Ou/AxZVyR154uSRq63xejcAsmswXAYRsw==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -1783,8 +1783,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.27: - resolution: {integrity: sha512-/7dTjDvXMdRKmsSxKXeWyonuGgblnYDn0MI1xDC7J1VQXny8k1qgNp6VmrlsawwnsymSUUiThhkJsI+rx0taNA==} + /esbuild-linux-ppc64le/0.14.28: + resolution: {integrity: sha512-LD0Xxu9g+DNuhsEBV5QuVZ4uKVBMup0xPIruLweuAf9/mHXFnaCuNXUBF5t0DxKl7GQ5MSioKtnb92oMo+QXEw==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -1792,8 +1792,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.27: - resolution: {integrity: sha512-D+aFiUzOJG13RhrSmZgrcFaF4UUHpqj7XSKrIiCXIj1dkIkFqdrmqMSOtSs78dOtObWiOrFCDDzB24UyeEiNGg==} + /esbuild-linux-riscv64/0.14.28: + resolution: {integrity: sha512-L/DWfRh2P0vxq4Y+qieSNXKGdMg+e9Qe8jkbN2/8XSGYDTPzO2OcAxSujob4qIh7iSl+cknbXV+BvH0YFR0jbg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -1801,8 +1801,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.27: - resolution: {integrity: sha512-CD/D4tj0U4UQjELkdNlZhQ8nDHU5rBn6NGp47Hiz0Y7/akAY5i0oGadhEIg0WCY/HYVXFb3CsSPPwaKcTOW3bg==} + /esbuild-linux-s390x/0.14.28: + resolution: {integrity: sha512-rrgxmsbmL8QQknWGnAL9bGJRQYLOi2AzXy5OTwfhxnj9eqjo5mSVbJXjgiq5LPUAMQZGdPH5yaNK0obAXS81Zw==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -1810,8 +1810,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.27: - resolution: {integrity: sha512-h3mAld69SrO1VoaMpYl3a5FNdGRE/Nqc+E8VtHOag4tyBwhCQXxtvDDOAKOUQexBGca0IuR6UayQ4ntSX5ij1Q==} + /esbuild-netbsd-64/0.14.28: + resolution: {integrity: sha512-h8wntIyOR8/xMVVM6TvJxxWKh4AjmLK87IPKpuVi8Pq0kyk0RMA+eo4PFGk5j2XK0D7dj8PcSF5NSlP9kN/j0A==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -1822,11 +1822,11 @@ packages: /esbuild-node-loader/0.6.5: resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} dependencies: - esbuild: 0.14.27 + esbuild: 0.14.28 dev: true - /esbuild-openbsd-64/0.14.27: - resolution: {integrity: sha512-xwSje6qIZaDHXWoPpIgvL+7fC6WeubHHv18tusLYMwL+Z6bEa4Pbfs5IWDtQdHkArtfxEkIZz77944z8MgDxGw==} + /esbuild-openbsd-64/0.14.28: + resolution: {integrity: sha512-HBv18rVapbuDx52/fhZ/c/w6TXyaQAvRxiDDn5Hz/pBcwOs3cdd2WxeIKlWmDoqm2JMx5EVlq4IWgoaRX9mVkw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -1834,16 +1834,16 @@ packages: dev: true optional: true - /esbuild-register/3.3.2_esbuild@0.14.27: + /esbuild-register/3.3.2_esbuild@0.14.28: resolution: {integrity: sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==} peerDependencies: esbuild: '>=0.12 <1' dependencies: - esbuild: 0.14.27 + esbuild: 0.14.28 dev: true - /esbuild-sunos-64/0.14.27: - resolution: {integrity: sha512-/nBVpWIDjYiyMhuqIqbXXsxBc58cBVH9uztAOIfWShStxq9BNBik92oPQPJ57nzWXRNKQUEFWr4Q98utDWz7jg==} + /esbuild-sunos-64/0.14.28: + resolution: {integrity: sha512-zlIxePhZxKYheR2vBCgPVvTixgo/ozOfOMoP6RZj8dxzquU1NgeyhjkcRXucbLCtmoNJ+i4PtWwPZTLuDd3bGg==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -1851,8 +1851,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.27: - resolution: {integrity: sha512-Q9/zEjhZJ4trtWhFWIZvS/7RUzzi8rvkoaS9oiizkHTTKd8UxFwn/Mm2OywsAfYymgUYm8+y2b+BKTNEFxUekw==} + /esbuild-windows-32/0.14.28: + resolution: {integrity: sha512-am9DIJxXlld1BOAY/VlvBQHMUCPL7S3gB/lnXIY3M4ys0gfuRqPf4EvMwZMzYUbFKBY+/Qb8SRgPRRGhwnJ8Kg==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -1860,8 +1860,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.27: - resolution: {integrity: sha512-b3y3vTSl5aEhWHK66ngtiS/c6byLf6y/ZBvODH1YkBM+MGtVL6jN38FdHUsZasCz9gFwYs/lJMVY9u7GL6wfYg==} + /esbuild-windows-64/0.14.28: + resolution: {integrity: sha512-78PhySDnmRZlsPNp/W/5Fim8iivlBQQxfhBFIqR7xwvfDmCFUSByyMKP7LCHgNtb04yNdop8nJJkJaQ8Xnwgiw==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1869,8 +1869,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.27: - resolution: {integrity: sha512-I/reTxr6TFMcR5qbIkwRGvldMIaiBu2+MP0LlD7sOlNXrfqIl9uNjsuxFPGEG4IRomjfQ5q8WT+xlF/ySVkqKg==} + /esbuild-windows-arm64/0.14.28: + resolution: {integrity: sha512-VhXGBTo6HELD8zyHXynV6+L2jWx0zkKnGx4TmEdSBK7UVFACtOyfUqpToG0EtnYyRZ0HESBhzPSVpP781ovmvA==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -1878,32 +1878,32 @@ packages: dev: true optional: true - /esbuild/0.14.27: - resolution: {integrity: sha512-MZQt5SywZS3hA9fXnMhR22dv0oPGh6QtjJRIYbgL1AeqAoQZE+Qn5ppGYQAoHv/vq827flj4tIJ79Mrdiwk46Q==} + /esbuild/0.14.28: + resolution: {integrity: sha512-YLNprkCcMVKQ5sekmCKEQ3Obu/L7s6+iij38xNKyBeSmSsTWur4Ky/9zB3XIGT8SCJITG/bZwAR2l7YOAXch4Q==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.27 - esbuild-android-arm64: 0.14.27 - esbuild-darwin-64: 0.14.27 - esbuild-darwin-arm64: 0.14.27 - esbuild-freebsd-64: 0.14.27 - esbuild-freebsd-arm64: 0.14.27 - esbuild-linux-32: 0.14.27 - esbuild-linux-64: 0.14.27 - esbuild-linux-arm: 0.14.27 - esbuild-linux-arm64: 0.14.27 - esbuild-linux-mips64le: 0.14.27 - esbuild-linux-ppc64le: 0.14.27 - esbuild-linux-riscv64: 0.14.27 - esbuild-linux-s390x: 0.14.27 - esbuild-netbsd-64: 0.14.27 - esbuild-openbsd-64: 0.14.27 - esbuild-sunos-64: 0.14.27 - esbuild-windows-32: 0.14.27 - esbuild-windows-64: 0.14.27 - esbuild-windows-arm64: 0.14.27 + esbuild-android-64: 0.14.28 + esbuild-android-arm64: 0.14.28 + esbuild-darwin-64: 0.14.28 + esbuild-darwin-arm64: 0.14.28 + esbuild-freebsd-64: 0.14.28 + esbuild-freebsd-arm64: 0.14.28 + esbuild-linux-32: 0.14.28 + esbuild-linux-64: 0.14.28 + esbuild-linux-arm: 0.14.28 + esbuild-linux-arm64: 0.14.28 + esbuild-linux-mips64le: 0.14.28 + esbuild-linux-ppc64le: 0.14.28 + esbuild-linux-riscv64: 0.14.28 + esbuild-linux-s390x: 0.14.28 + esbuild-netbsd-64: 0.14.28 + esbuild-openbsd-64: 0.14.28 + esbuild-sunos-64: 0.14.28 + esbuild-windows-32: 0.14.28 + esbuild-windows-64: 0.14.28 + esbuild-windows-arm64: 0.14.28 dev: true /escalade/3.1.1: @@ -1921,13 +1921,13 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier/8.5.0_eslint@8.11.0: + /eslint-config-prettier/8.5.0_eslint@8.12.0: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.11.0 + eslint: 8.12.0 dev: true /eslint-define-config/1.3.0: @@ -1935,7 +1935,7 @@ packages: engines: {node: '>= 16.9.0', npm: '>= 7.0.0', pnpm: '>= 6.32.2'} dev: true - /eslint-gitignore/0.1.0_eslint@8.11.0: + /eslint-gitignore/0.1.0_eslint@8.12.0: resolution: {integrity: sha512-VFvY5Wyjuz5xXDC/NeONHzsh4YQNok2Gzg4SftAAuhkbrdHv5CChjfiFyLKhRlgOdCJr5kBquaLXHtuDBTW2/Q==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -1943,14 +1943,14 @@ packages: dependencies: array.prototype.flatmap: 1.2.5 debug: 4.3.3 - eslint: 8.11.0 + eslint: 8.12.0 fast-glob: 3.2.11 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-jsdoc/38.0.6_eslint@8.11.0: - resolution: {integrity: sha512-Wvh5ERLUL8zt2yLZ8LLgi8RuF2UkjDvD+ri1/i7yMpbfreK2S29B9b5JC7iBIoFR7KDaEWCLnUPHTqgwcXX1Sg==} + /eslint-plugin-jsdoc/38.1.1_eslint@8.12.0: + resolution: {integrity: sha512-8JEYNgLaqsclKZhKjpwsrv60uYTTTCW2lNvOs42mHBgEafNNGrZfLFhXweTbehFat0MRKYywaStwazq9sISwKg==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1959,7 +1959,7 @@ packages: comment-parser: 1.3.1 debug: 4.3.4 escape-string-regexp: 4.0.0 - eslint: 8.11.0 + eslint: 8.12.0 esquery: 1.4.0 regextras: 0.8.0 semver: 7.3.5 @@ -1968,7 +1968,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.0.0_e2923b5169e23c4db59b86a638c599a3: + /eslint-plugin-prettier/4.0.0_b253a92c95b42c3296c682f11cccb3bd: resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} engines: {node: '>=6.0.0'} peerDependencies: @@ -1979,8 +1979,8 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.11.0 - eslint-config-prettier: 8.5.0_eslint@8.11.0 + eslint: 8.12.0 + eslint-config-prettier: 8.5.0_eslint@8.12.0 prettier: 2.6.1 prettier-linter-helpers: 1.0.0 dev: true @@ -2001,13 +2001,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.11.0: + /eslint-utils/3.0.0_eslint@8.12.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.11.0 + eslint: 8.12.0 eslint-visitor-keys: 2.1.0 dev: true @@ -2021,8 +2021,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.11.0: - resolution: {integrity: sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==} + /eslint/8.12.0: + resolution: {integrity: sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: @@ -2031,11 +2031,11 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.3 + debug: 4.3.4 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.11.0 + eslint-utils: 3.0.0_eslint@8.12.0 eslint-visitor-keys: 3.3.0 espree: 9.3.1 esquery: 1.4.0 @@ -2070,9 +2070,9 @@ packages: hasBin: true dependencies: cross-spawn: 7.0.3 - esbuild: 0.14.27 + esbuild: 0.14.28 esbuild-node-loader: 0.6.5 - esbuild-register: 3.3.2_esbuild@0.14.27 + esbuild-register: 3.3.2_esbuild@0.14.28 import-meta-resolve: 1.1.1 dev: true @@ -4415,7 +4415,7 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.27 + esbuild: 0.14.28 postcss: 8.4.7 resolve: 1.22.0 rollup: 2.69.0 From 0884865531d7b5172ef87e1cac71ecf074daf68e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 09:59:43 +0200 Subject: [PATCH 063/130] chore(deps): update vitest to ~0.7.12 (#700) --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ffa1469c21c..1593e5fcb11 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/validator": "~13.7.2", "@typescript-eslint/eslint-plugin": "~5.16.0", "@typescript-eslint/parser": "~5.16.0", - "@vitest/ui": "~0.7.10", + "@vitest/ui": "~0.7.12", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.2", @@ -123,7 +123,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.10" + "vitest": "~0.7.12" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfc02bc22a6..90b11d1b79b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.2 '@typescript-eslint/eslint-plugin': ~5.16.0 '@typescript-eslint/parser': ~5.16.0 - '@vitest/ui': ~0.7.10 + '@vitest/ui': ~0.7.12 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.2 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.10 + vitest: ~0.7.12 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.2 '@typescript-eslint/eslint-plugin': 5.16.0_4df62b6e125e6f18efee2d013b4a9d80 '@typescript-eslint/parser': 5.16.0_eslint@8.12.0+typescript@4.6.3 - '@vitest/ui': 0.7.10 + '@vitest/ui': 0.7.12 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.2 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.10_@vitest+ui@0.7.10+c8@7.11.0 + vitest: 0.7.12_@vitest+ui@0.7.12+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.10: - resolution: {integrity: sha512-nZzuPBdndCUhQCP/P0Yejk74vxRtlDs3WxnLxHWJkOTH5M6kYxpZKwfRn7jfonJNyqqJJzByeha/QNOJZoo8PQ==} + /@vitest/ui/0.7.12: + resolution: {integrity: sha512-cBhfU5r4jB3oqkdj+5r3Qlsv/AAPLtx23RlT5RGceq/gSCS5r1hDaASUcyRyfc1sA+FuGxj6KJLs9JDsfgQiJQ==} dependencies: sirv: 2.0.2 dev: true @@ -4444,8 +4444,8 @@ packages: - stylus dev: true - /vitest/0.7.10_@vitest+ui@0.7.10+c8@7.11.0: - resolution: {integrity: sha512-We5a7cnY2aUpX4tAO+w2KRhJiJ4FznfWjYKkqWoAqs4x4pKgyRsMJNZ7OSY/lFHOoRz3yv0mgwfVlZiRc0/mmA==} + /vitest/0.7.12_@vitest+ui@0.7.12+c8@7.11.0: + resolution: {integrity: sha512-Q/UrBAhStPUeic++s+jnH6M0vsBhemTixAsAKvp6z8zN6K47tfZqob4XgpbViebDmYcmhlyREumVmrpUlyuXdA==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -4465,7 +4465,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.10 + '@vitest/ui': 0.7.12 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From 3e47440c21d05adadff860a6e1a72e947f73beae Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 28 Mar 2022 18:30:28 +0200 Subject: [PATCH 064/130] docs: mention template literals in fake docs (#701) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Leyla Jähnig <77127505+xDivisionByZerox@users.noreply.github.com> --- src/fake.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fake.ts b/src/fake.ts index d8cc6ff7096..854b708a568 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -17,7 +17,10 @@ export class Fake { /** * Generator method for combining faker methods based on string input. * - * This will check the given string for placeholders and replace them by calling the specified faker method. + * Note: If you just want to create a string on the fly, we recommend using string template literals instead. + * This method is useful if you wish to choose a random format from a non-executable source or persistent storage (json etc.). + * + * It checks the given string for placeholders and replace them by calling the specified faker method. * E.g. the input `Hi, my name is {{name.firstName}}!`, * will use the `faker.name.firstName()` method to resolve the placeholder. * It is also possible to combine static text with placeholders, From 814880b5b209d6f9c6ffb2c0ab5342c4c456b0b7 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Mon, 28 Mar 2022 18:39:26 +0200 Subject: [PATCH 065/130] refactor: drop usage of `fake` for internal calls (#703) --- src/git.ts | 16 ++++++------ src/lorem.ts | 22 +++++++++-------- src/random.ts | 67 +++++++++++++++++++++++++++------------------------ src/system.ts | 4 +-- 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/git.ts b/src/git.ts index b77b79cb988..6c82e48df4b 100644 --- a/src/git.ts +++ b/src/git.ts @@ -61,18 +61,17 @@ export class Git { */ commitEntry(options: { merge?: boolean } = {}): string { // TODO @Shinigami92 2022-01-11: We may want to make it configurable to use just `\n` instead of `\r\n` - let entry = 'commit {{git.commitSha}}\r\n'; + let entry = `commit ${this.commitSha()}\r\n`; if (options.merge || this.faker.datatype.number({ min: 0, max: 4 }) === 0) { - entry += 'Merge: {{git.shortSha}} {{git.shortSha}}\r\n'; + entry += `Merge: ${this.shortSha()}} ${this.shortSha()}\r\n`; } - entry += - 'Author: {{name.firstName}} {{name.lastName}} <{{internet.email}}>\r\n'; - entry += 'Date: ' + this.faker.date.recent().toString() + '\r\n'; - entry += '\r\n\xa0\xa0\xa0\xa0{{git.commitMessage}}\r\n'; + entry += `Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>\r\n`; + entry += `Date: ${this.faker.date.recent().toString()}\r\n`; + entry += `\r\n\xa0\xa0\xa0\xa0${this.commitMessage()}\r\n`; - return this.faker.fake(entry); + return entry; } /** @@ -82,8 +81,7 @@ export class Git { * faker.git.commitMessage() // 'reboot cross-platform driver' */ commitMessage(): string { - const format = '{{hacker.verb}} {{hacker.adjective}} {{hacker.noun}}'; - return this.faker.fake(format); + return `${this.faker.hacker.verb()} ${this.faker.hacker.adjective()} ${this.faker.hacker.noun()}`; } /** diff --git a/src/lorem.ts b/src/lorem.ts index dee259f3d07..39ce9d3f73f 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -175,17 +175,19 @@ export class Lorem { * // Dolor tempora iusto.' */ text(): string { - const loremMethods = [ - 'lorem.word', - 'lorem.words', - 'lorem.sentence', - 'lorem.sentences', - 'lorem.paragraph', - 'lorem.paragraphs', - 'lorem.lines', + const methods: Array = [ + 'word', + 'words', + 'sentence', + 'sentences', + 'paragraph', + 'paragraphs', + 'lines', ]; - const randomLoremMethod = this.faker.random.arrayElement(loremMethods); - return this.faker.fake(`{{${randomLoremMethod}}}`); + + const method = this.faker.random.arrayElement(methods); + + return `${this[method]()}`; } /** diff --git a/src/random.ts b/src/random.ts index 7e410b10067..fced36a31a1 100644 --- a/src/random.ts +++ b/src/random.ts @@ -244,37 +244,37 @@ export class Random { */ word(): string { const wordMethods = [ - 'commerce.department', - 'commerce.productName', - 'commerce.productAdjective', - 'commerce.productMaterial', - 'commerce.product', - 'commerce.color', - - 'company.catchPhraseAdjective', - 'company.catchPhraseDescriptor', - 'company.catchPhraseNoun', - 'company.bsAdjective', - 'company.bsBuzz', - 'company.bsNoun', - 'address.streetSuffix', - 'address.county', - 'address.country', - 'address.state', - - 'finance.accountName', - 'finance.transactionType', - 'finance.currencyName', - - 'hacker.noun', - 'hacker.verb', - 'hacker.adjective', - 'hacker.ingverb', - 'hacker.abbreviation', - - 'name.jobDescriptor', - 'name.jobArea', - 'name.jobType', + this.faker.commerce.department, + this.faker.commerce.productName, + this.faker.commerce.productAdjective, + this.faker.commerce.productMaterial, + this.faker.commerce.product, + this.faker.commerce.color, + + this.faker.company.catchPhraseAdjective, + this.faker.company.catchPhraseDescriptor, + this.faker.company.catchPhraseNoun, + this.faker.company.bsAdjective, + this.faker.company.bsBuzz, + this.faker.company.bsNoun, + this.faker.address.streetSuffix, + this.faker.address.county, + this.faker.address.country, + this.faker.address.state, + + this.faker.finance.accountName, + this.faker.finance.transactionType, + this.faker.finance.currencyName, + + this.faker.hacker.noun, + this.faker.hacker.verb, + this.faker.hacker.adjective, + this.faker.hacker.ingverb, + this.faker.hacker.abbreviation, + + this.faker.name.jobDescriptor, + this.faker.name.jobArea, + this.faker.name.jobType, ]; const bannedChars = [ @@ -302,11 +302,14 @@ export class Random { '-', ]; let result: string; + do { // randomly pick from the many faker methods that can generate words const randomWordMethod = this.faker.random.arrayElement(wordMethods); - result = this.faker.fake('{{' + randomWordMethod + '}}'); + + result = randomWordMethod(); } while (bannedChars.some((char) => result.includes(char))); + return this.faker.random.arrayElement(result.split(' ')); } diff --git a/src/system.ts b/src/system.ts index afaed741ceb..c6532ed2a47 100644 --- a/src/system.ts +++ b/src/system.ts @@ -178,9 +178,7 @@ export class System { * faker.system.filePath() // '/usr/local/src/money.rmp.dotx' */ filePath(): string { - return this.faker.fake( - '{{system.directoryPath}}/{{system.fileName}}.{{system.fileExt}}' - ); + return `${this.faker.system.directoryPath()}/${this.faker.system.fileName()}.${this.faker.system.fileExt()}`; } /** From 9fad09a71c1579009cb94b79e003c437a22f43a5 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 28 Mar 2022 18:48:35 +0200 Subject: [PATCH 066/130] test: fix all_functional tests (#609) --- test/all_functional.spec.ts | 88 +++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/test/all_functional.spec.ts b/test/all_functional.spec.ts index a61661611ee..548f06c582f 100644 --- a/test/all_functional.spec.ts +++ b/test/all_functional.spec.ts @@ -11,10 +11,6 @@ const IGNORED_MODULES = [ 'mersenne', ]; -const IGNORED_METHODS = { - system: ['directoryPath', 'filePath'], // these are TODOs -}; - function isTestableModule(mod: string) { return IGNORED_MODULES.indexOf(mod) === -1; } @@ -23,27 +19,45 @@ function isMethodOf(mod: string) { return (meth: string) => typeof faker[mod][meth] === 'function'; } -function isTestableMethod(mod: string) { - return (meth: string) => - !(mod in IGNORED_METHODS && IGNORED_METHODS[mod].indexOf(meth) >= 0); -} +const BROKEN_LOCALE_METHODS = { + // TODO ST-DDT 2022-03-28: these are TODOs (usually broken locale files) + address: { + cityPrefix: ['pt_BR', 'pt_PT'], + citySuffix: ['pt_PT'], + countryCode: ['he'], + state: ['az', 'cz', 'nb_NO', 'sk'], + stateAbbr: ['cz', 'sk'], + }, + company: { + companySuffix: ['az'], + }, + name: { + prefix: ['az', 'id_ID', 'ru'], + suffix: ['az', 'it', 'mk', 'pt_PT', 'ru'], + }, +}; -function both( - pred1: (meth: string) => boolean, - pred2: (meth: string) => boolean -): (meth: string) => boolean { - return (value) => pred1(value) && pred2(value); +function isWorkingLocaleForMethod( + mod: string, + meth: string, + locale: string +): boolean { + return (BROKEN_LOCALE_METHODS[mod]?.[meth] ?? []).indexOf(locale) === -1; } // Basic smoke tests to make sure each method is at least implemented and returns a value. function modulesList(): { [module: string]: string[] } { const modules = Object.keys(faker) + .sort() .filter(isTestableModule) .reduce((result, mod) => { - result[mod] = Object.keys(faker[mod]).filter( - both(isMethodOf(mod), isTestableMethod(mod)) - ); + const methods = Object.keys(faker[mod]).filter(isMethodOf(mod)); + if (methods.length) { + result[mod] = methods; + } else { + console.log(`Skipping ${mod} - No testable methods`); + } return result; }, {}); @@ -55,23 +69,29 @@ const modules = modulesList(); describe('functional tests', () => { for (const locale in faker.locales) { describe(locale, () => { - faker.locale = locale; Object.keys(modules).forEach((module) => { describe(module, () => { - // if there is nothing to test, create a dummy test so the test runner doesn't complain - if (Object.keys(modules[module]).length === 0) { - it.todo(`${module} was empty`); - } - modules[module].forEach((meth) => { - it(meth + '()', () => { + const testAssertion = () => { + faker.locale = locale; + // TODO ST-DDT 2022-03-28: Use random seed once there are no more failures + faker.seed(1); const result = faker[module][meth](); + if (meth === 'boolean') { expect(result).toBeTypeOf('boolean'); } else { expect(result).toBeTruthy(); } - }); + }; + + if (isWorkingLocaleForMethod(module, meth, locale)) { + it(meth + '()', testAssertion); + } else { + // TODO ST-DDT 2022-03-28: Remove once there are no more failures + // We expect a failure here to ensure we remove the exclusions when fixed + it.fails(meth + '()', testAssertion); + } }); }); }); @@ -82,26 +102,16 @@ describe('functional tests', () => { describe('faker.fake functional tests', () => { for (const locale in faker.locales) { describe(locale, () => { - faker.locale = locale; - faker.seed(1); Object.keys(modules).forEach((module) => { describe(module, () => { - // if there is nothing to test, create a dummy test so the test runner doesn't complain - if (Object.keys(modules[module]).length === 0) { - it.todo(`${module} was empty`); - } - modules[module].forEach((meth) => { it(meth + '()', () => { + faker.locale = locale; + // TODO ST-DDT 2022-03-28: Use random seed once there are no more failures + faker.seed(1); const result = faker.fake('{{' + module + '.' + meth + '}}'); - // just make sure any result is returned - // an undefined result usually means an error - expect(result).toBeDefined(); - // if (meth === 'boolean') { - // expect(result).toBeTypeOf('boolean'); - // } else { - // expect(result).toBeTruthy(); - // } + + expect(result).toBeTypeOf('string'); }); }); }); From 5ed963f1e4928eb2df36f230faf7f9d63b51bef1 Mon Sep 17 00:00:00 2001 From: Jason Papakostas Date: Mon, 28 Mar 2022 09:52:27 -0700 Subject: [PATCH 067/130] fix: force passed locales into faker constructor (#580) Co-authored-by: Shinigami92 --- src/faker.ts | 18 +++++++++++++++--- test/faker.spec.ts | 24 +++++++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/faker.ts b/src/faker.ts index d7ba3f80a44..142009e1049 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -36,7 +36,7 @@ export type UsableLocale = LiteralUnion; export type UsedLocales = Partial>; export interface FakerOptions { - locales?: UsedLocales; + locales: UsedLocales; locale?: UsableLocale; localeFallback?: UsableLocale; } @@ -81,8 +81,20 @@ export class Faker { readonly vehicle: Vehicle = new Vehicle(this); readonly word: Word = new Word(this); - constructor(opts: FakerOptions = {}) { - this.locales = this.locales || opts.locales || {}; + constructor(opts: FakerOptions) { + if (!opts) { + throw new Error( + 'Options with at least one entry in locales must be provided' + ); + } + + if (Object.keys(opts.locales ?? {}).length === 0) { + throw new Error( + 'At least one entry in locales must be provided in the locales parameter' + ); + } + + this.locales = opts.locales; this.locale = this.locale || opts.locale || 'en'; this.localeFallback = this.localeFallback || opts.localeFallback || 'en'; diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 54fa04aca58..283cf999e6a 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -1,11 +1,33 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker, Faker } from '../src'; describe('faker', () => { beforeEach(() => { faker.locale = 'en'; }); + it('should throw error if no options passed', () => { + expect( + () => + // @ts-expect-error: mission options + new Faker() + ).toThrow( + Error('Options with at least one entry in locales must be provided') + ); + }); + + it('should throw error if no locales passed', () => { + expect( + () => + // @ts-expect-error: missing locales + new Faker({}) + ).toThrow( + Error( + 'At least one entry in locales must be provided in the locales parameter' + ) + ); + }); + // This is only here for coverage // The actual test is in mersenne.spec.ts describe('seed()', () => { From 0f74908a5ac16d4a9b73d747a275a9399a131757 Mon Sep 17 00:00:00 2001 From: Mischa Spiegelmock Date: Mon, 28 Mar 2022 20:03:05 +0300 Subject: [PATCH 068/130] fix: use require/import export map in package.json (#697) --- package.json | 12 +++++------- scripts/bundle.ts | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1593e5fcb11..616524d4570 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "module": "dist/esm/index.mjs", "types": "index.d.ts", "typesVersions": { ">=4.0": { @@ -33,14 +33,12 @@ }, "exports": { ".": { - "node": "./dist/cjs/index.js", - "es2015": "./dist/esm/index.js", - "default": "./dist/esm/index.js" + "require": "./dist/cjs/index.js", + "import": "./dist/esm/index.mjs" }, "./locale/*": { - "node": "./dist/cjs/locale/*.js", - "es2015": "./dist/esm/locale/*.js", - "default": "./dist/esm/locale/*.js" + "require": "./dist/cjs/locale/*.js", + "import": "./dist/esm/locale/*.mjs" }, "./package.json": "./package.json" }, diff --git a/scripts/bundle.ts b/scripts/bundle.ts index 6d1b7b749ba..29c94102fcc 100644 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -53,4 +53,5 @@ buildSync({ splitting: true, format: 'esm', target: 'node12.20', + outExtension: { '.js': '.mjs' }, }); From 94c96ba0dd69cf20bff63bdc64b4790c752ebd5d Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 28 Mar 2022 19:09:40 +0200 Subject: [PATCH 069/130] chore: improve readability and type safety for loadDefinitions (#269) --- src/faker.ts | 49 ++++++++++++++++++++++------------------------ test/faker.spec.ts | 21 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/src/faker.ts b/src/faker.ts index 142009e1049..1ace8501ce9 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -102,41 +102,38 @@ export class Faker { } /** - * Load the definitions contained in the locales file for the given types + * Load the definitions contained in the locales file for the given types. + * + * Background: Certain localization sets contain less data then others. + * In the case of a missing definition, use the localeFallback's values + * to substitute the missing data. */ private loadDefinitions(): void { // TODO @Shinigami92 2022-01-11: Find a way to load this even more dynamically // In a way so that we don't accidentally miss a definition - Object.entries(DEFINITIONS).forEach(([t, v]) => { - if (this.definitions[t] == null) { - this.definitions[t] = {}; + for (const [moduleName, entryNames] of Object.entries(DEFINITIONS)) { + if (typeof entryNames === 'string') { + // For 'title' and 'separator' + Object.defineProperty(this.definitions, moduleName, { + get: (): unknown /* string */ => + this.locales[this.locale][moduleName] ?? + this.locales[this.localeFallback][moduleName], + }); + continue; } - if (typeof v === 'string') { - this.definitions[t] = v; - return; + if (this.definitions[moduleName] == null) { + this.definitions[moduleName] = {}; } - v.forEach((p) => { - Object.defineProperty(this.definitions[t], p, { - get: () => { - if ( - this.locales[this.locale][t] == null || - this.locales[this.locale][t][p] == null - ) { - // certain localization sets contain less data then others. - // in the case of a missing definition, use the default localeFallback - // to substitute the missing set data - // throw new Error('unknown property ' + d + p) - return this.locales[this.localeFallback][t][p]; - } else { - // return localized data - return this.locales[this.locale][t][p]; - } - }, + for (const entryName of entryNames) { + Object.defineProperty(this.definitions[moduleName], entryName, { + get: (): unknown => + this.locales[this.locale][moduleName]?.[entryName] ?? + this.locales[this.localeFallback][moduleName]?.[entryName], }); - }); - }); + } + } } seed(seed?: number | number[]): void { diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 283cf999e6a..24486b48f24 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -28,6 +28,27 @@ describe('faker', () => { ); }); + describe('title', () => { + it.each(Object.keys(faker.locales))('title (%s)', (locale) => { + faker.locale = locale; + expect(faker.definitions.title).toBe(faker.locales[locale].title); + }); + }); + + describe('separator', () => { + it.each(Object.keys(faker.locales))('separator (%s)', (locale) => { + faker.locale = locale; + expect(faker.definitions.separator).toBeTypeOf('string'); + }); + + it('separator (with fallback)', () => { + // Use a language that doesn't have a separator specified + expect(faker.locales['en_US'].separator).toBeUndefined(); + // Check that the fallback works + expect(faker.definitions.separator).toBe(faker.locales['en'].separator); + }); + }); + // This is only here for coverage // The actual test is in mersenne.spec.ts describe('seed()', () => { From 8ab5effbfac0c0f00afb20881e01e14ecb19e569 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 28 Mar 2022 19:18:54 +0200 Subject: [PATCH 070/130] chore: use a standardized deprecated function (#689) Co-authored-by: pkuczynski --- src/helpers.ts | 37 +++++++++++------ src/internal/deprecated.ts | 29 ++++++++++++++ src/name.ts | 82 +++++++++++++++++++++++++------------- src/random.ts | 55 ++++++++++++++++--------- src/time.ts | 14 +++---- test/helpers.spec.ts | 4 +- test/name.spec.ts | 16 ++++---- test/random.spec.ts | 2 +- test/time.spec.ts | 24 ++--------- tsconfig.json | 3 +- 10 files changed, 170 insertions(+), 96 deletions(-) create mode 100644 src/internal/deprecated.ts diff --git a/src/helpers.ts b/src/helpers.ts index 38e70c29869..6ed51ec5c1a 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { deprecated } from './internal/deprecated'; /** * A full card with various details. @@ -143,9 +144,12 @@ export class Helpers { randomize( array: ReadonlyArray = ['a', 'b', 'c'] as unknown as ReadonlyArray ): T { - console.warn( - 'Deprecation Warning: faker.helpers.randomize is now located in faker.random.arrayElement' - ); + deprecated({ + deprecated: 'faker.helpers.randomize()', + proposed: 'faker.random.arrayElement()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.random.arrayElement(array); } @@ -511,9 +515,12 @@ export class Helpers { * @deprecated If you need some specific object you should create your own method. */ createCard(): Card { - console.warn( - 'Deprecation Warning: If you need some specific object you should create your own method.' - ); + deprecated({ + deprecated: 'helpers.createCard()', + proposed: 'a self-build function', + since: 'v6.1.0', + until: 'v7.0.0', + }); return { name: this.faker.name.findName(), username: this.faker.internet.userName(), @@ -582,9 +589,12 @@ export class Helpers { * @deprecated If you need some specific object you should create your own method. */ contextualCard(): ContextualCard { - console.warn( - 'Deprecation Warning: If you need some specific object you should create your own method.' - ); + deprecated({ + deprecated: 'helpers.contextualCard()', + proposed: 'a self-build function', + since: 'v6.1.0', + until: 'v7.0.0', + }); const name = this.faker.name.firstName(); const userName = this.faker.internet.userName(name); return { @@ -631,9 +641,12 @@ export class Helpers { * @deprecated If you need some specific object you should create your own method. */ userCard(): UserCard { - console.warn( - 'Deprecation Warning: If you need some specific object you should create your own method.' - ); + deprecated({ + deprecated: 'helpers.userCard()', + proposed: 'a self-build function', + since: 'v6.1.0', + until: 'v7.0.0', + }); return { name: this.faker.name.findName(), username: this.faker.internet.userName(), diff --git a/src/internal/deprecated.ts b/src/internal/deprecated.ts new file mode 100644 index 00000000000..7f20c24fde5 --- /dev/null +++ b/src/internal/deprecated.ts @@ -0,0 +1,29 @@ +/* eslint-disable jsdoc/check-tag-names */ +/* eslint-disable jsdoc/require-param */ + +/** @internal */ +export interface DeprecatedOptions { + deprecated: string; + proposed?: string; + since?: string; + until?: string; +} + +/** @internal */ +export function deprecated(opts: DeprecatedOptions): void { + let message = `[@faker-js/faker]: ${opts.deprecated} is deprecated`; + + if (opts.since) { + message += ` since ${opts.since}`; + } + + if (opts.until) { + message += ` and will be removed in ${opts.until}`; + } + + if (opts.proposed) { + message += `. Please use ${opts.proposed} instead`; + } + + console.warn(message + '.'); +} diff --git a/src/name.ts b/src/name.ts index 8fac27c4462..a6dd4ea6439 100644 --- a/src/name.ts +++ b/src/name.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { deprecated } from './internal/deprecated'; export enum Gender { female = 'female', @@ -12,10 +13,12 @@ export type GenderType = 'female' | 'male' | 0 | 1; * Normalize gender. * * @param gender Gender. + * @param functionName Temporary parameter for deprecation message. * @returns Normalized gender. */ function normalizeGender( - gender?: GenderType + gender?: GenderType, + functionName?: string ): Exclude | undefined { if (gender == null || typeof gender === 'string') { // TODO @Shinigami92 21-03-2022: Cast can be removed when we set `strict: true` @@ -24,9 +27,12 @@ function normalizeGender( const normalizedGender = gender === 0 ? 'male' : 'female'; - console.warn( - `Deprecation Warning: Please use '${normalizedGender}' for gender instead of ${gender}` - ); + deprecated({ + deprecated: `name.${functionName}(number)`, + proposed: "'female' or 'male'", + since: 'v6.1.0', + until: 'v7.0.0', + }); return normalizedGender; } @@ -40,6 +46,7 @@ function normalizeGender( * @param param2.generic Non-gender definitions. * @param param2.female Female definitions. * @param param2.male Male definitions. + * @param functionName Temporary parameter for deprecation message. * @returns Definition based on given gender. */ function selectDefinition( @@ -50,9 +57,10 @@ function selectDefinition( generic, female, male, - }: { generic?: string[]; female?: string[]; male?: string[] } = {} + }: { generic?: string[]; female?: string[]; male?: string[] } = {}, + functionName?: string ) { - const normalizedGender = normalizeGender(gender); + const normalizedGender = normalizeGender(gender, functionName); let values: string[] | undefined; switch (normalizedGender) { @@ -107,11 +115,16 @@ export class Name { const { first_name, female_first_name, male_first_name } = this.faker.definitions.name; - return selectDefinition(this.faker, gender, { - generic: first_name, - female: female_first_name, - male: male_first_name, - }); + return selectDefinition( + this.faker, + gender, + { + generic: first_name, + female: female_first_name, + male: male_first_name, + }, + 'firstName' + ); } /** @@ -129,11 +142,16 @@ export class Name { const { last_name, female_last_name, male_last_name } = this.faker.definitions.name; - return selectDefinition(this.faker, gender, { - generic: last_name, - female: female_last_name, - male: male_last_name, - }); + return selectDefinition( + this.faker, + gender, + { + generic: last_name, + female: female_last_name, + male: male_last_name, + }, + 'lastName' + ); } /** @@ -151,11 +169,16 @@ export class Name { const { middle_name, female_middle_name, male_middle_name } = this.faker.definitions.name; - return selectDefinition(this.faker, gender, { - generic: middle_name, - female: female_middle_name, - male: male_middle_name, - }); + return selectDefinition( + this.faker, + gender, + { + generic: middle_name, + female: female_middle_name, + male: male_middle_name, + }, + 'middleName' + ); } /** @@ -179,7 +202,7 @@ export class Name { let suffix = ''; const normalizedGender: Exclude = - normalizeGender(gender) ?? + normalizeGender(gender, 'findName') ?? this.faker.random.arrayElement(['female', 'male']); firstName = firstName || this.faker.name.firstName(normalizedGender); @@ -237,11 +260,16 @@ export class Name { prefix(gender?: GenderType): string { const { prefix, female_prefix, male_prefix } = this.faker.definitions.name; - return selectDefinition(this.faker, gender, { - generic: prefix, - female: female_prefix, - male: male_prefix, - }); + return selectDefinition( + this.faker, + gender, + { + generic: prefix, + female: female_prefix, + male: male_prefix, + }, + 'prefix' + ); } /** diff --git a/src/random.ts b/src/random.ts index fced36a31a1..0a3b3c5ecaf 100644 --- a/src/random.ts +++ b/src/random.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { deprecated } from './internal/deprecated'; /** * Method to reduce array of characters. @@ -52,9 +53,12 @@ export class Random { number( options?: number | { min?: number; max?: number; precision?: number } ): number { - console.warn( - 'Deprecation Warning: faker.random.number is now located in faker.datatype.number' - ); + deprecated({ + deprecated: 'faker.random.number()', + proposed: 'faker.datatype.number()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.datatype.number(options); } @@ -81,9 +85,12 @@ export class Random { float( options?: number | { min?: number; max?: number; precision?: number } ): number { - console.warn( - 'Deprecation Warning: faker.random.float is now located in faker.datatype.float' - ); + deprecated({ + deprecated: 'faker.random.float()', + proposed: 'faker.datatype.float()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.datatype.float(options); } @@ -213,9 +220,12 @@ export class Random { * @deprecated */ uuid(): string { - console.warn( - 'Deprecation Warning: faker.random.uuid is now located in faker.datatype.uuid' - ); + deprecated({ + deprecated: 'faker.random.uuid()', + proposed: 'faker.datatype.uuid()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.datatype.uuid(); } @@ -230,9 +240,12 @@ export class Random { * @deprecated */ boolean(): boolean { - console.warn( - 'Deprecation Warning: faker.random.boolean is now located in faker.datatype.boolean' - ); + deprecated({ + deprecated: 'faker.random.boolean()', + proposed: 'faker.datatype.boolean()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.datatype.boolean(); } @@ -347,9 +360,12 @@ export class Random { * @deprecated */ image(): string { - console.warn( - 'Deprecation Warning: faker.random.image is now located in faker.image.image' - ); + deprecated({ + deprecated: 'faker.random.image()', + proposed: 'faker.image.image()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.image.image(); } @@ -533,9 +549,12 @@ export class Random { * @deprecated */ hexaDecimal(count?: number): string { - console.warn( - 'Deprecation Warning: faker.random.hexaDecimal is now located in faker.datatype.hexaDecimal' - ); + deprecated({ + deprecated: 'faker.random.hexaDecimal()', + proposed: 'faker.datatype.hexaDecimal()', + // since: 'v5.0.0', (?) + until: 'v7.0.0', + }); return this.faker.datatype.hexaDecimal(count); } } diff --git a/src/time.ts b/src/time.ts index 06a32021b6e..8eeaef421a4 100644 --- a/src/time.ts +++ b/src/time.ts @@ -1,4 +1,5 @@ import type { LiteralUnion } from './faker'; +import { deprecated } from './internal/deprecated'; /** * Module to generate time of dates in various formats. @@ -28,13 +29,12 @@ export class Time { recent( format: LiteralUnion<'abbr' | 'date' | 'wide' | 'unix'> = 'unix' ): string | number | Date { - console.warn( - `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. - abbr => toLocaleTimeString() - wide => toTimeString() - unix => getTime() -` - ); + deprecated({ + deprecated: 'faker.time.recent()', + proposed: 'native `new Date()` and call the function you want on it', + since: 'v6.1.0', + until: 'v7.0.0', + }); let date: string | number | Date = new Date(); diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index cbb541c169e..0be83f9888a 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -774,7 +774,7 @@ describe('helpers', () => { faker.helpers[functionName](); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.helpers.${functionName} is now located in faker.${newLocation}` + `[@faker-js/faker]: faker.helpers.${functionName}() is deprecated and will be removed in v7.0.0. Please use faker.${newLocation}() instead.` ); spy.mockRestore(); } @@ -791,7 +791,7 @@ describe('helpers', () => { faker.helpers[functionName](); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: If you need some specific object you should create your own method.` + `[@faker-js/faker]: helpers.${functionName}() is deprecated since v6.1.0 and will be removed in v7.0.0. Please use a self-build function instead.` ); spy.mockRestore(); } diff --git a/test/name.spec.ts b/test/name.spec.ts index 7572b3d6ab1..40f349553eb 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -189,13 +189,13 @@ describe('name', () => { let name = faker.name.firstName(0); expect(faker.definitions.name.male_first_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'male' for gender instead of 0` + "[@faker-js/faker]: name.firstName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); name = faker.name.firstName(1); expect(faker.definitions.name.female_first_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'female' for gender instead of 1` + "[@faker-js/faker]: name.firstName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); spy.mockRestore(); @@ -242,13 +242,13 @@ describe('name', () => { let name = faker.name.lastName(0); expect(faker.definitions.name.male_last_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'male' for gender instead of 0` + "[@faker-js/faker]: name.lastName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); name = faker.name.lastName(1); expect(faker.definitions.name.female_last_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'female' for gender instead of 1` + "[@faker-js/faker]: name.lastName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); spy.mockRestore(); @@ -299,13 +299,13 @@ describe('name', () => { let name = faker.name.middleName(0); expect(faker.definitions.name.male_middle_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'male' for gender instead of 0` + "[@faker-js/faker]: name.middleName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); name = faker.name.middleName(1); expect(faker.definitions.name.female_middle_name).toContain(name); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'female' for gender instead of 1` + "[@faker-js/faker]: name.middleName(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); spy.mockRestore(); @@ -475,7 +475,7 @@ describe('name', () => { expect(faker.definitions.name.male_prefix).toContain(prefix); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'male' for gender instead of 0` + "[@faker-js/faker]: name.prefix(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); spy.mockRestore(); @@ -492,7 +492,7 @@ describe('name', () => { expect(faker.definitions.name.female_prefix).toContain(prefix); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: Please use 'female' for gender instead of 1` + "[@faker-js/faker]: name.prefix(number) is deprecated since v6.1.0 and will be removed in v7.0.0. Please use 'female' or 'male' instead." ); spy.mockRestore(); diff --git a/test/random.spec.ts b/test/random.spec.ts index ceb454ccdb2..9e66f58ac1a 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -294,7 +294,7 @@ describe('random', () => { faker.random[functionName](); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.random.${functionName} is now located in faker.${newLocation}` + `[@faker-js/faker]: faker.random.${functionName}() is deprecated and will be removed in v7.0.0. Please use faker.${newLocation}() instead.` ); spy.mockRestore(); } diff --git a/test/time.spec.ts b/test/time.spec.ts index 90d4d2c4523..82c3fbae3af 100644 --- a/test/time.spec.ts +++ b/test/time.spec.ts @@ -62,11 +62,7 @@ describe('time', () => { expect(date).toBeTypeOf('number'); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. - abbr => toLocaleTimeString() - wide => toTimeString() - unix => getTime() -` + '[@faker-js/faker]: faker.time.recent() is deprecated since v6.1.0 and will be removed in v7.0.0. Please use native `new Date()` and call the function you want on it instead.' ); spy.mockRestore(); }); @@ -78,11 +74,7 @@ describe('time', () => { expect(date).toBeTypeOf('string'); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. - abbr => toLocaleTimeString() - wide => toTimeString() - unix => getTime() -` + '[@faker-js/faker]: faker.time.recent() is deprecated since v6.1.0 and will be removed in v7.0.0. Please use native `new Date()` and call the function you want on it instead.' ); spy.mockRestore(); }); @@ -94,11 +86,7 @@ describe('time', () => { expect(date).toBeTypeOf('string'); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. - abbr => toLocaleTimeString() - wide => toTimeString() - unix => getTime() -` + '[@faker-js/faker]: faker.time.recent() is deprecated since v6.1.0 and will be removed in v7.0.0. Please use native `new Date()` and call the function you want on it instead.' ); spy.mockRestore(); }); @@ -110,11 +98,7 @@ describe('time', () => { expect(date).toBeTypeOf('number'); expect(spy).toHaveBeenCalledWith( - `Deprecation Warning: faker.time.recent() is deprecated. Use the native \`new Date()\` and call the function you want on it. - abbr => toLocaleTimeString() - wide => toTimeString() - unix => getTime() -` + '[@faker-js/faker]: faker.time.recent() is deprecated since v6.1.0 and will be removed in v7.0.0. Please use native `new Date()` and call the function you want on it instead.' ); spy.mockRestore(); }); diff --git a/tsconfig.json b/tsconfig.json index aea7ca439c1..06a5489f6a5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,8 @@ // "strictPropertyInitialization": true, // "noImplicitAny": true, // "noImplicitThis": true, - "useUnknownInCatchVariables": true + "useUnknownInCatchVariables": true, + "stripInternal": true }, "include": ["src/**/*"], "exclude": ["node_modules"] From d2fc1e6b5ba55242d16b9b8a1e9f42c7b24957b0 Mon Sep 17 00:00:00 2001 From: Demi - Alvaro Martinez de Miguel Date: Mon, 28 Mar 2022 19:24:33 +0200 Subject: [PATCH 071/130] fix: Vehicle vin is always 17 characters long (#320) --- src/vehicle.ts | 2 +- test/vehicle.spec.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/vehicle.ts b/src/vehicle.ts index e2678bee4d4..979631bdddc 100644 --- a/src/vehicle.ts +++ b/src/vehicle.ts @@ -82,7 +82,7 @@ export class Vehicle { bannedChars, })}${this.faker.random.alphaNumeric(1, { bannedChars, - })}${this.faker.datatype.number({ min: 10000, max: 100000 })}` // return five digit # + })}${this.faker.datatype.number({ min: 10000, max: 99999 })}` // return five digit # .toUpperCase(); } diff --git a/test/vehicle.spec.ts b/test/vehicle.spec.ts index b52ccff6b74..28757e6b03a 100644 --- a/test/vehicle.spec.ts +++ b/test/vehicle.spec.ts @@ -24,7 +24,7 @@ const seededRuns = [ model: 'Colorado', type: 'Coupe', fuel: 'Electric', - vin: '8J579HF1A7MK33575', + vin: '8J579HF1A7MK33574', color: 'black', vrm: 'GO12HOL', bicycle: 'Cyclocross Bicycle', @@ -38,7 +38,7 @@ const seededRuns = [ model: '2', type: 'Wagon', fuel: 'Hybrid', - vin: 'XFWS74Z1N5S678768', + vin: 'XFWS74Z1N5S678767', color: 'azure', vrm: 'YL87FDZ', bicycle: 'Triathlon/Time Trial Bicycle', @@ -107,6 +107,15 @@ describe('vehicle', () => { }); }); + describe('vin()', () => { + it('returns valid vin number', () => { + const vin = faker.vehicle.vin(); + expect(vin).toMatch( + /^([A-HJ-NPR-Z0-9]{10}[A-HJ-NPR-Z0-9]{1}[A-HJ-NPR-Z0-9]{1}\d{5})$/ + ); + }); + }); + describe('model()', () => { it('should return random vehicle model', () => { const model = faker.vehicle.model(); From 8d1aefbda070265909cedb07af564ea143be74a7 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 28 Mar 2022 19:28:50 +0200 Subject: [PATCH 072/130] fix: fake behavior with special replacement patterns (#688) --- src/fake.ts | 22 ++++++++-------------- test/fake.spec.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/fake.ts b/src/fake.ts index 854b708a568..617708a6b33 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -46,32 +46,25 @@ export class Fake { * faker.fake('I flipped the coin an got: {{random.arrayElement(["heads", "tails"])}}') // 'I flipped the coin an got: tails' */ fake(str: string): string { - // setup default response as empty string - let res = ''; - // if incoming str parameter is not provided, return error message if (typeof str !== 'string' || str.length === 0) { throw new Error('string parameter is required!'); } // find first matching {{ and }} - const start = str.search('{{'); - const end = str.search('}}'); + const start = str.search(/{{[a-z]/); + const end = str.indexOf('}}', start); // if no {{ and }} is found, we are done if (start === -1 || end === -1) { return str; } - // console.log('attempting to parse', str); - // extract method name from between the {{ }} that we found // for example: {{name.firstName}} - const token = str.substring(start + 2, end); + const token = str.substring(start + 2, end + 2); let method = token.replace('}}', '').replace('{{', ''); - // console.log('method', method) - // extract method parameters const regExp = /\(([^)]+)\)/; const matches = regExp.exec(method); @@ -111,13 +104,14 @@ export class Fake { let result: string; if (typeof params === 'string' && params.length === 0) { - result = fn(); + result = String(fn()); } else { - result = fn(params); + result = String(fn(params)); } - // replace the found tag with the returned fake value - res = str.replace('{{' + token + '}}', result); + // Replace the found tag with the returned fake value + // We cannot use string.replace here because the result might contain evaluated characters + const res = str.substring(0, start) + result + str.substring(end + 2); if (res === '') { return ''; diff --git a/test/fake.spec.ts b/test/fake.spec.ts index a78940eab70..530d09d2861 100644 --- a/test/fake.spec.ts +++ b/test/fake.spec.ts @@ -50,5 +50,39 @@ describe('fake', () => { it('should be able to return empty strings', () => { expect(faker.fake('{{helpers.repeatString}}')).toBe(''); }); + + it('should be able to handle only {{ brackets', () => { + expect(faker.fake('{{hello')).toBe('{{hello'); + expect(faker.fake('hello{{')).toBe('hello{{'); + }); + + it('should be able to handle only }} brackets', () => { + expect(faker.fake('hello}}')).toBe('hello}}'); + expect(faker.fake('}}hello')).toBe('}}hello'); + }); + + it('should be able to handle reverted brackets', () => { + expect(faker.fake('}}hello{{')).toBe('}}hello{{'); + }); + + it('should be able to handle random }} brackets', () => { + expect(faker.fake('}}hello{{random.alpha}}')).toMatch(/^}}hello[a-z]$/); + }); + + it('should be able to handle connected brackets', () => { + expect(faker.fake('{{{random.alpha}}}')).toMatch(/^{[a-z]}$/); + }); + + it('should be able to handle empty brackets', () => { + expect(faker.fake('{{}}')).toBe('{{}}'); + }); + + it('should be able to handle special replacement patterns', () => { + (faker.random as any).special = () => '$&'; + + expect(faker.fake('{{random.special}}')).toBe('$&'); + + delete (faker.random as any).special; + }); }); }); From fe776fd8a2a26682d86841dc61997ccd8fa84753 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 17:37:09 +0000 Subject: [PATCH 073/130] chore(deps): update dependency eslint-plugin-jsdoc to ~38.1.3 (#705) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 616524d4570..159c9dd1149 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.1.1", + "eslint-plugin-jsdoc": "~38.1.3", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 90b11d1b79b..09271b82b17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ specifiers: eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.1.1 + eslint-plugin-jsdoc: ~38.1.3 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.7 @@ -54,7 +54,7 @@ devDependencies: eslint-config-prettier: 8.5.0_eslint@8.12.0 eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.12.0 - eslint-plugin-jsdoc: 38.1.1_eslint@8.12.0 + eslint-plugin-jsdoc: 38.1.3_eslint@8.12.0 eslint-plugin-prettier: 4.0.0_b253a92c95b42c3296c682f11cccb3bd esno: 0.14.1 lint-staged: 12.3.7 @@ -1949,8 +1949,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/38.1.1_eslint@8.12.0: - resolution: {integrity: sha512-8JEYNgLaqsclKZhKjpwsrv60uYTTTCW2lNvOs42mHBgEafNNGrZfLFhXweTbehFat0MRKYywaStwazq9sISwKg==} + /eslint-plugin-jsdoc/38.1.3_eslint@8.12.0: + resolution: {integrity: sha512-CJgBG1wzl2735rct2GpzS39lx4t0mlUiv9MvFndQKyqTVOGZLXeSkVNIE5inmg23T0EkCrS3AZ9dKbFAsK9ItA==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 From 689a7e2b2ed9b3baa6934c0213aa73e3dfaa1abb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 17:43:28 +0000 Subject: [PATCH 074/130] chore(deps): update typescript-eslint to ~5.17.0 (#706) Co-authored-by: Renovate Bot --- package.json | 4 +-- pnpm-lock.yaml | 72 +++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 159c9dd1149..511d2392685 100644 --- a/package.json +++ b/package.json @@ -92,8 +92,8 @@ "@types/prettier": "~2.4.4", "@types/sanitize-html": "~2.6.2", "@types/validator": "~13.7.2", - "@typescript-eslint/eslint-plugin": "~5.16.0", - "@typescript-eslint/parser": "~5.16.0", + "@typescript-eslint/eslint-plugin": "~5.17.0", + "@typescript-eslint/parser": "~5.17.0", "@vitest/ui": "~0.7.12", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09271b82b17..5084565566a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ specifiers: '@types/prettier': ~2.4.4 '@types/sanitize-html': ~2.6.2 '@types/validator': ~13.7.2 - '@typescript-eslint/eslint-plugin': ~5.16.0 - '@typescript-eslint/parser': ~5.16.0 + '@typescript-eslint/eslint-plugin': ~5.17.0 + '@typescript-eslint/parser': ~5.17.0 '@vitest/ui': ~0.7.12 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 @@ -43,8 +43,8 @@ devDependencies: '@types/prettier': 2.4.4 '@types/sanitize-html': 2.6.2 '@types/validator': 13.7.2 - '@typescript-eslint/eslint-plugin': 5.16.0_4df62b6e125e6f18efee2d013b4a9d80 - '@typescript-eslint/parser': 5.16.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/eslint-plugin': 5.17.0_689ff565753ecf7c3328c07fad067df5 + '@typescript-eslint/parser': 5.17.0_eslint@8.12.0+typescript@4.6.3 '@vitest/ui': 0.7.12 c8: 7.11.0 conventional-changelog-cli: 2.2.2 @@ -434,8 +434,8 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.16.0_4df62b6e125e6f18efee2d013b4a9d80: - resolution: {integrity: sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==} + /@typescript-eslint/eslint-plugin/5.17.0_689ff565753ecf7c3328c07fad067df5: + resolution: {integrity: sha512-qVstvQilEd89HJk3qcbKt/zZrfBZ+9h2ynpAGlWjWiizA7m/MtLT9RoX6gjtpE500vfIg8jogAkDzdCxbsFASQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -445,10 +445,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.16.0_eslint@8.12.0+typescript@4.6.3 - '@typescript-eslint/scope-manager': 5.16.0 - '@typescript-eslint/type-utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 - '@typescript-eslint/utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/parser': 5.17.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/scope-manager': 5.17.0 + '@typescript-eslint/type-utils': 5.17.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.17.0_eslint@8.12.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.12.0 functional-red-black-tree: 1.0.1 @@ -461,8 +461,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.16.0_eslint@8.12.0+typescript@4.6.3: - resolution: {integrity: sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==} + /@typescript-eslint/parser/5.17.0_eslint@8.12.0+typescript@4.6.3: + resolution: {integrity: sha512-aRzW9Jg5Rlj2t2/crzhA2f23SIYFlF9mchGudyP0uiD6SenIxzKoLjwzHbafgHn39dNV/TV7xwQkLfFTZlJ4ig==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -471,9 +471,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.16.0 - '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 + '@typescript-eslint/scope-manager': 5.17.0 + '@typescript-eslint/types': 5.17.0 + '@typescript-eslint/typescript-estree': 5.17.0_typescript@4.6.3 debug: 4.3.4 eslint: 8.12.0 typescript: 4.6.3 @@ -481,16 +481,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager/5.16.0: - resolution: {integrity: sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==} + /@typescript-eslint/scope-manager/5.17.0: + resolution: {integrity: sha512-062iCYQF/doQ9T2WWfJohQKKN1zmmXVfAcS3xaiialiw8ZUGy05Em6QVNYJGO34/sU1a7a+90U3dUNfqUDHr3w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/visitor-keys': 5.16.0 + '@typescript-eslint/types': 5.17.0 + '@typescript-eslint/visitor-keys': 5.17.0 dev: true - /@typescript-eslint/type-utils/5.16.0_eslint@8.12.0+typescript@4.6.3: - resolution: {integrity: sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==} + /@typescript-eslint/type-utils/5.17.0_eslint@8.12.0+typescript@4.6.3: + resolution: {integrity: sha512-3hU0RynUIlEuqMJA7dragb0/75gZmwNwFf/QJokWzPehTZousP/MNifVSgjxNcDCkM5HI2K22TjQWUmmHUINSg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -499,7 +499,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.16.0_eslint@8.12.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.17.0_eslint@8.12.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.12.0 tsutils: 3.21.0_typescript@4.6.3 @@ -508,13 +508,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types/5.16.0: - resolution: {integrity: sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==} + /@typescript-eslint/types/5.17.0: + resolution: {integrity: sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.16.0_typescript@4.6.3: - resolution: {integrity: sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==} + /@typescript-eslint/typescript-estree/5.17.0_typescript@4.6.3: + resolution: {integrity: sha512-X1gtjEcmM7Je+qJRhq7ZAAaNXYhTgqMkR10euC4Si6PIjb+kwEQHSxGazXUQXFyqfEXdkGf6JijUu5R0uceQzg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -522,8 +522,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/visitor-keys': 5.16.0 + '@typescript-eslint/types': 5.17.0 + '@typescript-eslint/visitor-keys': 5.17.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -534,16 +534,16 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.16.0_eslint@8.12.0+typescript@4.6.3: - resolution: {integrity: sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==} + /@typescript-eslint/utils/5.17.0_eslint@8.12.0+typescript@4.6.3: + resolution: {integrity: sha512-DVvndq1QoxQH+hFv+MUQHrrWZ7gQ5KcJzyjhzcqB1Y2Xes1UQQkTRPUfRpqhS8mhTWsSb2+iyvDW1Lef5DD7vA==} 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.9 - '@typescript-eslint/scope-manager': 5.16.0 - '@typescript-eslint/types': 5.16.0 - '@typescript-eslint/typescript-estree': 5.16.0_typescript@4.6.3 + '@typescript-eslint/scope-manager': 5.17.0 + '@typescript-eslint/types': 5.17.0 + '@typescript-eslint/typescript-estree': 5.17.0_typescript@4.6.3 eslint: 8.12.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.12.0 @@ -552,11 +552,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys/5.16.0: - resolution: {integrity: sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==} + /@typescript-eslint/visitor-keys/5.17.0: + resolution: {integrity: sha512-6K/zlc4OfCagUu7Am/BD5k8PSWQOgh34Nrv9Rxe2tBzlJ7uOeJ/h7ugCGDCeEZHT6k2CJBhbk9IsbkPI0uvUkA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.16.0 + '@typescript-eslint/types': 5.17.0 eslint-visitor-keys: 3.3.0 dev: true From 7d8171257cc5d7ff41ca4bb93b8ee6bfd65183c3 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 28 Mar 2022 19:53:22 +0200 Subject: [PATCH 075/130] release: 6.1.0 (#708) --- CHANGELOG.md | 38 ++++++ package.json | 2 +- pnpm-lock.yaml | 317 +++++++++++++++++++++++-------------------------- 3 files changed, 185 insertions(+), 172 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 128c15521ea..eed8d364e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,44 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [6.1.0](https://github.com/faker-js/faker/compare/v6.0.0-alpha.6...v6.1.0) (2022-03-28) + + +### Features + +* **types:** generate all locales index files with non-any types ([#494](https://github.com/faker-js/faker/issues/494)) ([b611ca1](https://github.com/faker-js/faker/commit/b611ca1c6f7d756f224a1a7b641e36b531d169be)) +* **types:** provide strong typing for locales 2 ([#398](https://github.com/faker-js/faker/issues/398)) ([419e9e2](https://github.com/faker-js/faker/commit/419e9e20a570b44909faf24c9019bf7f232ee7a9)) + + +### Bug Fixes + +* accept dates as params for Date methods ([#200](https://github.com/faker-js/faker/issues/200)) ([91a1aab](https://github.com/faker-js/faker/commit/91a1aaba954b7d172c3dd3346567078644b74189)) +* alphaNumeric all chars banned ([#550](https://github.com/faker-js/faker/issues/550)) ([c51fb15](https://github.com/faker-js/faker/commit/c51fb1570669284e14915916636de97b7f644e17)) +* corrected the Costa Rican IBAN format ([#646](https://github.com/faker-js/faker/issues/646)) ([3f3de78](https://github.com/faker-js/faker/commit/3f3de78c83ae919fd44531ac7ae9caed885800d4)) +* correcting the readme file ([#529](https://github.com/faker-js/faker/issues/529)) ([6c9dcdd](https://github.com/faker-js/faker/commit/6c9dcdd03050ef70554fc2bb6ccc0c883fd1edc9)) +* datatype.datetime should use static boundaries ([#343](https://github.com/faker-js/faker/issues/343)) ([7141cd7](https://github.com/faker-js/faker/commit/7141cd7d8a2fd505d3338d13ca29fd1ab7a5dc80)) +* enable algolia search ([#641](https://github.com/faker-js/faker/issues/641)) ([a759c87](https://github.com/faker-js/faker/commit/a759c8707c2e3758e64e1c174c2de7aad51cd64b)) +* fake behavior with special replacement patterns ([#688](https://github.com/faker-js/faker/issues/688)) ([8d1aefb](https://github.com/faker-js/faker/commit/8d1aefbda070265909cedb07af564ea143be74a7)) +* fake is unable to return empty strings ([#347](https://github.com/faker-js/faker/issues/347)) ([301a6d2](https://github.com/faker-js/faker/commit/301a6d2024816bf40f1091ccffe6bb81cb7ba7b0)) +* **finance:** update iso-3166-1 country codes for IBAN/BIC ([#168](https://github.com/faker-js/faker/issues/168)) ([6050d7a](https://github.com/faker-js/faker/commit/6050d7acbb991568cbdac7b0c16a088aef200abc)) +* fix bicycle_types files being named incorrectly ([#477](https://github.com/faker-js/faker/issues/477)) ([7a2a522](https://github.com/faker-js/faker/commit/7a2a522c181dc696f6e9b4767ca18d39bad4476d)) +* fix time.recent method signature ([#586](https://github.com/faker-js/faker/issues/586)) ([60d3cc5](https://github.com/faker-js/faker/commit/60d3cc519cd2cab061a23fbe09164d8b59e177ff)) +* fix unique method types ([#457](https://github.com/faker-js/faker/issues/457)) ([14df7d3](https://github.com/faker-js/faker/commit/14df7d3f70b54c4a153f5dcf111ef90575bbbe9e)) +* force passed locales into faker constructor ([#580](https://github.com/faker-js/faker/issues/580)) ([5ed963f](https://github.com/faker-js/faker/commit/5ed963f1e4928eb2df36f230faf7f9d63b51bef1)) +* handle missing or broken locales main index files ([#478](https://github.com/faker-js/faker/issues/478)) ([ff97431](https://github.com/faker-js/faker/commit/ff974319a63acbcbbb96cf1a67a48616de9fd9da)) +* mersenne rand invalid input argument ([#577](https://github.com/faker-js/faker/issues/577)) ([486c76e](https://github.com/faker-js/faker/commit/486c76e34f22cf1fd66fa2c99e605d52c7077760)) +* move el credit card information to the expected location ([#484](https://github.com/faker-js/faker/issues/484)) ([dcbd18e](https://github.com/faker-js/faker/commit/dcbd18e13ab53e837de17cec7b3f8e51ba479d0e)) +* name module gender ([#644](https://github.com/faker-js/faker/issues/644)) ([7675abe](https://github.com/faker-js/faker/commit/7675abe5a62c8d44ecfd4a6f50bfb5fa50f40efa)) +* normalize provider in finance.creditCardNumber ([#662](https://github.com/faker-js/faker/issues/662)) ([9ce1551](https://github.com/faker-js/faker/commit/9ce1551ab7c9cafc97e3d051f0632591e34eb3ce)) +* only return word with desirable alpha characters ([#654](https://github.com/faker-js/faker/issues/654)) ([b7b2e4f](https://github.com/faker-js/faker/commit/b7b2e4f8dbd40b6bb2678fb60ee95e198838d08a)) +* remove invalid aliases ([#488](https://github.com/faker-js/faker/issues/488)) ([58fbfe3](https://github.com/faker-js/faker/commit/58fbfe3835b0f27949e7eb262d246eb9d84bb870)) +* remove unreachable code finance ([#508](https://github.com/faker-js/faker/issues/508)) ([1bc622a](https://github.com/faker-js/faker/commit/1bc622a9499bf236052809610ecabe80f87de482)) +* replaced placeimg.com on loremflickr.com ([#692](https://github.com/faker-js/faker/issues/692)) ([2a49e82](https://github.com/faker-js/faker/commit/2a49e8215a81ef284a2955f7f9a51d6f2bd76f5f)) +* solve various todos ([#649](https://github.com/faker-js/faker/issues/649)) ([d0a473f](https://github.com/faker-js/faker/commit/d0a473f7ca6b525391ca8ab17e029335c66ed99e)) +* test random.alphaNumeric ([#517](https://github.com/faker-js/faker/issues/517)) ([41ec6f0](https://github.com/faker-js/faker/commit/41ec6f08784afc2a674568328a0ea2bfb033a411)) +* use require/import export map in package.json ([#697](https://github.com/faker-js/faker/issues/697)) ([0f74908](https://github.com/faker-js/faker/commit/0f74908a5ac16d4a9b73d747a275a9399a131757)) +* Vehicle vin is always 17 characters long ([#320](https://github.com/faker-js/faker/issues/320)) ([d2fc1e6](https://github.com/faker-js/faker/commit/d2fc1e6b5ba55242d16b9b8a1e9f42c7b24957b0)) + ## [6.0.0](https://github.com/faker-js/faker/compare/v6.0.0-beta.0...v6.0.0) (2022-03-15) diff --git a/package.json b/package.json index 511d2392685..93303dadb80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@faker-js/faker", - "version": "6.0.0", + "version": "6.1.0", "description": "Generate massive amounts of fake contextual data", "keywords": [ "faker", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5084565566a..2cce7b48ec1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -82,108 +82,108 @@ packages: '@algolia/autocomplete-shared': 1.5.2 dev: true - /@algolia/autocomplete-preset-algolia/1.5.2_algoliasearch@4.12.2: + /@algolia/autocomplete-preset-algolia/1.5.2_algoliasearch@4.13.0: resolution: {integrity: sha512-3MRYnYQFJyovANzSX2CToS6/5cfVjbLLqFsZTKcvF3abhQzxbqwwaMBlJtt620uBUOeMzhdfasKhCc40+RHiZw==} peerDependencies: '@algolia/client-search': ^4.9.1 algoliasearch: ^4.9.1 dependencies: '@algolia/autocomplete-shared': 1.5.2 - algoliasearch: 4.12.2 + algoliasearch: 4.13.0 dev: true /@algolia/autocomplete-shared/1.5.2: resolution: {integrity: sha512-ylQAYv5H0YKMfHgVWX0j0NmL8XBcAeeeVQUmppnnMtzDbDnca6CzhKj3Q8eF9cHCgcdTDdb5K+3aKyGWA0obug==} dev: true - /@algolia/cache-browser-local-storage/4.12.2: - resolution: {integrity: sha512-z8LjFsQc0B6h6LEE3pkUGM4ErVktn6bkFbhnYbTccjmFVQ+wXFJd/D63e0WtaC+hwRB1xq8uKhkz9oojEKEsGA==} + /@algolia/cache-browser-local-storage/4.13.0: + resolution: {integrity: sha512-nj1vHRZauTqP/bluwkRIgEADEimqojJgoTRCel5f6q8WCa9Y8QeI4bpDQP28FoeKnDRYa3J5CauDlN466jqRhg==} dependencies: - '@algolia/cache-common': 4.12.2 + '@algolia/cache-common': 4.13.0 dev: true - /@algolia/cache-common/4.12.2: - resolution: {integrity: sha512-r//r7MF0Na0HxD2BHnjWsDKuI72Z5UEf/Rb/8MC08XKBsjCwBihGxWxycjRcNGjNEIxJBsvRMIEOipcd9qD54g==} + /@algolia/cache-common/4.13.0: + resolution: {integrity: sha512-f9mdZjskCui/dA/fA/5a+6hZ7xnHaaZI5tM/Rw9X8rRB39SUlF/+o3P47onZ33n/AwkpSbi5QOyhs16wHd55kA==} dev: true - /@algolia/cache-in-memory/4.12.2: - resolution: {integrity: sha512-opWpbBUloP1fcTG3wBDnAfcoyNXW5GFDgGtLXrSANdfnelPKkr3O8j01ZTkRlPIuBDR0izGZG8MVWMDlTf71Bw==} + /@algolia/cache-in-memory/4.13.0: + resolution: {integrity: sha512-hHdc+ahPiMM92CQMljmObE75laYzNFYLrNOu0Q3/eyvubZZRtY2SUsEEgyUEyzXruNdzrkcDxFYa7YpWBJYHAg==} dependencies: - '@algolia/cache-common': 4.12.2 + '@algolia/cache-common': 4.13.0 dev: true - /@algolia/client-account/4.12.2: - resolution: {integrity: sha512-HZqEyeVVjzOlfoSUyc+7+ueEJmRgqSuC+hqQOGECYa5JVno4d8eRVuDAMOb87I2LOdg/WoFMcAtaaRq2gpfV/w==} + /@algolia/client-account/4.13.0: + resolution: {integrity: sha512-FzFqFt9b0g/LKszBDoEsW+dVBuUe1K3scp2Yf7q6pgHWM1WqyqUlARwVpLxqyc+LoyJkTxQftOKjyFUqddnPKA==} dependencies: - '@algolia/client-common': 4.12.2 - '@algolia/client-search': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/client-common': 4.13.0 + '@algolia/client-search': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true - /@algolia/client-analytics/4.12.2: - resolution: {integrity: sha512-7ktimzesu+vk3l+eG9w/nQh6/9AoIieCKmoiRIguKh6okGsaSBrcTHvUwIQEIiliqPuAFBk2M8eXYFqOZzwCZw==} + /@algolia/client-analytics/4.13.0: + resolution: {integrity: sha512-klmnoq2FIiiMHImkzOm+cGxqRLLu9CMHqFhbgSy9wtXZrqb8BBUIUE2VyBe7azzv1wKcxZV2RUyNOMpFqmnRZA==} dependencies: - '@algolia/client-common': 4.12.2 - '@algolia/client-search': 4.12.2 - '@algolia/requester-common': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/client-common': 4.13.0 + '@algolia/client-search': 4.13.0 + '@algolia/requester-common': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true - /@algolia/client-common/4.12.2: - resolution: {integrity: sha512-+dTicT1lklwOpeoiDspUoRSQYHhrr2IzllrX89/WuTPEBm2eww1xurqrSTQYC0MuVeX1s9/i4k34Q0ZnspypWg==} + /@algolia/client-common/4.13.0: + resolution: {integrity: sha512-GoXfTp0kVcbgfSXOjfrxx+slSipMqGO9WnNWgeMmru5Ra09MDjrcdunsiiuzF0wua6INbIpBQFTC2Mi5lUNqGA==} dependencies: - '@algolia/requester-common': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/requester-common': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true - /@algolia/client-personalization/4.12.2: - resolution: {integrity: sha512-JBW3vYFGIm5sAAy3cLUdmUCpmSAdreo5S1fERg7xgF6KyxGrwyy5BViTNWrOKG+av2yusk1wKydOYJ1Fbpbaxw==} + /@algolia/client-personalization/4.13.0: + resolution: {integrity: sha512-KneLz2WaehJmNfdr5yt2HQETpLaCYagRdWwIwkTqRVFCv4DxRQ2ChPVW9jeTj4YfAAhfzE6F8hn7wkQ/Jfj6ZA==} dependencies: - '@algolia/client-common': 4.12.2 - '@algolia/requester-common': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/client-common': 4.13.0 + '@algolia/requester-common': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true - /@algolia/client-search/4.12.2: - resolution: {integrity: sha512-JIqi14TgfEqAooNbSPBC1ZCk3Pnviqlaz9KofAqWBxSRTpPUFnU/XQCU5ihR0PC68SFVDnU/Y9cak/XotXPUeg==} + /@algolia/client-search/4.13.0: + resolution: {integrity: sha512-blgCKYbZh1NgJWzeGf+caKE32mo3j54NprOf0LZVCubQb3Kx37tk1Hc8SDs9bCAE8hUvf3cazMPIg7wscSxspA==} dependencies: - '@algolia/client-common': 4.12.2 - '@algolia/requester-common': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/client-common': 4.13.0 + '@algolia/requester-common': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true - /@algolia/logger-common/4.12.2: - resolution: {integrity: sha512-iOiJAymLjq137G7+8EQuUEkrgta0cZGMg6scp8s4hJ+X6k+6By4nyptdkCWYwKLsW/Xy927QcIhGlkWV78vQIQ==} + /@algolia/logger-common/4.13.0: + resolution: {integrity: sha512-8yqXk7rMtmQJ9wZiHOt/6d4/JDEg5VCk83gJ39I+X/pwUPzIsbKy9QiK4uJ3aJELKyoIiDT1hpYVt+5ia+94IA==} dev: true - /@algolia/logger-console/4.12.2: - resolution: {integrity: sha512-veuQZyTSqHoHJtr9mLMnYeal9Mee6hCie4eqY+645VbeOrgT9p/kCMbKg5GLJGoLPlXGu7C0XpHyUj5k7/NQyw==} + /@algolia/logger-console/4.13.0: + resolution: {integrity: sha512-YepRg7w2/87L0vSXRfMND6VJ5d6699sFJBRWzZPOlek2p5fLxxK7O0VncYuc/IbVHEgeApvgXx0WgCEa38GVuQ==} dependencies: - '@algolia/logger-common': 4.12.2 + '@algolia/logger-common': 4.13.0 dev: true - /@algolia/requester-browser-xhr/4.12.2: - resolution: {integrity: sha512-FpFdHNd81tS3zj6Glqd+lt+RV0ljPExKtx+QB+gani6HWZ9YlSCM+Zl82T4ibxN+hmkrMeAyT+TMzS0jiGhGyQ==} + /@algolia/requester-browser-xhr/4.13.0: + resolution: {integrity: sha512-Dj+bnoWR5MotrnjblzGKZ2kCdQi2cK/VzPURPnE616NU/il7Ypy6U6DLGZ/ZYz+tnwPa0yypNf21uqt84fOgrg==} dependencies: - '@algolia/requester-common': 4.12.2 + '@algolia/requester-common': 4.13.0 dev: true - /@algolia/requester-common/4.12.2: - resolution: {integrity: sha512-4szj/lvDQf/u8EyyRBBRZD1ZkKDyLBbckLj7meQDlnbfwnW1UpLwpB2l3XJ9wDmDSftGxUCeTl5oMFe4z9OEvQ==} + /@algolia/requester-common/4.13.0: + resolution: {integrity: sha512-BRTDj53ecK+gn7ugukDWOOcBRul59C4NblCHqj4Zm5msd5UnHFjd/sGX+RLOEoFMhetILAnmg6wMrRrQVac9vw==} dev: true - /@algolia/requester-node-http/4.12.2: - resolution: {integrity: sha512-UXfJNZt2KMwjBjiOa3cJ/PyoXWZa/F1vy6rdyG4xQeZDcLbqKP3O2b+bOJcGPmFbmdwBhtAyMVLt+hvAvAVfOw==} + /@algolia/requester-node-http/4.13.0: + resolution: {integrity: sha512-9b+3O4QFU4azLhGMrZAr/uZPydvzOR4aEZfSL8ZrpLZ7fbbqTO0S/5EVko+QIgglRAtVwxvf8UJ1wzTD2jvKxQ==} dependencies: - '@algolia/requester-common': 4.12.2 + '@algolia/requester-common': 4.13.0 dev: true - /@algolia/transporter/4.12.2: - resolution: {integrity: sha512-PUq79if4CukXsm27ymTQ3eD3juSvMcyJmt6mxCkSFE0zQRL4ert61HBlNH6S9y/quUVe3g7oggfHq3d5pdpqZA==} + /@algolia/transporter/4.13.0: + resolution: {integrity: sha512-8tSQYE+ykQENAdeZdofvtkOr5uJ9VcQSWgRhQ9h01AehtBIPAczk/b2CLrMsw5yQZziLs5cZ3pJ3478yI+urhA==} dependencies: - '@algolia/cache-common': 4.12.2 - '@algolia/logger-common': 4.12.2 - '@algolia/requester-common': 4.12.2 + '@algolia/cache-common': 4.13.0 + '@algolia/logger-common': 4.13.0 + '@algolia/requester-common': 4.13.0 dev: true /@babel/code-frame/7.16.7: @@ -207,8 +207,8 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser/7.17.3: - resolution: {integrity: sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==} + /@babel/parser/7.17.8: + resolution: {integrity: sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ==} engines: {node: '>=6.0.0'} hasBin: true dev: true @@ -232,7 +232,7 @@ packages: is-typedarray: 1.0.0 isstream: 0.1.2 json-stringify-safe: 5.0.1 - mime-types: 2.1.34 + mime-types: 2.1.35 performance-now: 2.1.0 qs: 6.5.3 safe-buffer: 5.2.1 @@ -272,9 +272,9 @@ packages: react-dom: '>= 16.8.0 < 18.0.0' dependencies: '@algolia/autocomplete-core': 1.5.2 - '@algolia/autocomplete-preset-algolia': 1.5.2_algoliasearch@4.12.2 + '@algolia/autocomplete-preset-algolia': 1.5.2_algoliasearch@4.13.0 '@docsearch/css': 3.0.0 - algoliasearch: 4.12.2 + algoliasearch: 4.13.0 transitivePeerDependencies: - '@algolia/client-search' dev: true @@ -295,7 +295,7 @@ packages: ajv: 6.12.6 debug: 4.3.4 espree: 9.3.1 - globals: 13.12.1 + globals: 13.13.0 ignore: 5.2.0 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -369,8 +369,8 @@ packages: resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} dev: true - /@types/json-schema/7.0.9: - resolution: {integrity: sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==} + /@types/json-schema/7.0.11: + resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true /@types/linkify-it/3.0.2: @@ -540,7 +540,7 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@types/json-schema': 7.0.9 + '@types/json-schema': 7.0.11 '@typescript-eslint/scope-manager': 5.17.0 '@typescript-eslint/types': 5.17.0 '@typescript-eslint/typescript-estree': 5.17.0_typescript@4.6.3 @@ -580,7 +580,7 @@ packages: /@vue/compiler-core/3.2.31: resolution: {integrity: sha512-aKno00qoA4o+V/kR6i/pE+aP+esng5siNAVQ422TkBNM6qA4veXiZbSe8OTXHXquEi/f6Akc+nLfB4JGfe4/WQ==} dependencies: - '@babel/parser': 7.17.3 + '@babel/parser': 7.17.8 '@vue/shared': 3.2.31 estree-walker: 2.0.2 source-map: 0.6.1 @@ -596,7 +596,7 @@ packages: /@vue/compiler-sfc/3.2.31: resolution: {integrity: sha512-748adc9msSPGzXgibHiO6T7RWgfnDcVQD+VVwYgSsyyY8Ans64tALHZANrKtOzvkwznV/F4H7OAod/jIlp/dkQ==} dependencies: - '@babel/parser': 7.17.3 + '@babel/parser': 7.17.8 '@vue/compiler-core': 3.2.31 '@vue/compiler-dom': 3.2.31 '@vue/compiler-ssr': 3.2.31 @@ -604,7 +604,7 @@ packages: '@vue/shared': 3.2.31 estree-walker: 2.0.2 magic-string: 0.25.9 - postcss: 8.4.7 + postcss: 8.4.12 source-map: 0.6.1 dev: true @@ -618,7 +618,7 @@ packages: /@vue/reactivity-transform/3.2.31: resolution: {integrity: sha512-uS4l4z/W7wXdI+Va5pgVxBJ345wyGFKvpPYtdSgvfJfX/x2Ymm6ophQlXXB6acqGHtXuBqNyyO3zVp9b1r0MOA==} dependencies: - '@babel/parser': 7.17.3 + '@babel/parser': 7.17.8 '@vue/compiler-core': 3.2.31 '@vue/shared': 3.2.31 estree-walker: 2.0.2 @@ -703,23 +703,23 @@ packages: uri-js: 4.4.1 dev: true - /algoliasearch/4.12.2: - resolution: {integrity: sha512-bn1P9+V415zeDQJtXn+1SwuwedEAv9/LJAxt8XwR6ygH/sMwaHSm2hpkz8wIbCBt/tKQ43TL672Kyxzv5PwGgQ==} + /algoliasearch/4.13.0: + resolution: {integrity: sha512-oHv4faI1Vl2s+YC0YquwkK/TsaJs79g2JFg5FDm2rKN12VItPTAeQ7hyJMHarOPPYuCnNC5kixbtcqvb21wchw==} dependencies: - '@algolia/cache-browser-local-storage': 4.12.2 - '@algolia/cache-common': 4.12.2 - '@algolia/cache-in-memory': 4.12.2 - '@algolia/client-account': 4.12.2 - '@algolia/client-analytics': 4.12.2 - '@algolia/client-common': 4.12.2 - '@algolia/client-personalization': 4.12.2 - '@algolia/client-search': 4.12.2 - '@algolia/logger-common': 4.12.2 - '@algolia/logger-console': 4.12.2 - '@algolia/requester-browser-xhr': 4.12.2 - '@algolia/requester-common': 4.12.2 - '@algolia/requester-node-http': 4.12.2 - '@algolia/transporter': 4.12.2 + '@algolia/cache-browser-local-storage': 4.13.0 + '@algolia/cache-common': 4.13.0 + '@algolia/cache-in-memory': 4.13.0 + '@algolia/client-account': 4.13.0 + '@algolia/client-analytics': 4.13.0 + '@algolia/client-common': 4.13.0 + '@algolia/client-personalization': 4.13.0 + '@algolia/client-search': 4.13.0 + '@algolia/logger-common': 4.13.0 + '@algolia/logger-console': 4.13.0 + '@algolia/requester-browser-xhr': 4.13.0 + '@algolia/requester-common': 4.13.0 + '@algolia/requester-node-http': 4.13.0 + '@algolia/transporter': 4.13.0 dev: true /ansi-colors/4.1.1: @@ -786,7 +786,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.19.1 + es-abstract: 1.19.2 dev: true /arrify/1.0.1: @@ -892,8 +892,8 @@ packages: ieee754: 1.2.1 dev: true - /builtins/4.0.0: - resolution: {integrity: sha512-qC0E2Dxgou1IHhvJSLwGDSTvokbRovU5zZFuDY6oY8Y2lF3nGt5Ad8YZK7GMtqzY84Wu7pXTPeHQeHcXSXsRhw==} + /builtins/4.1.0: + resolution: {integrity: sha512-1bPRZQtmKaO6h7qV1YHXNtr6nCK28k0Zo95KM4dXfILcZZwoHJBN1m3lfLv9LPkcOZlrSr+J1bzMaZFO98Yq0w==} dependencies: semver: 7.3.5 dev: true @@ -1383,8 +1383,8 @@ packages: cli-table3: 0.6.1 commander: 5.1.0 common-tags: 1.8.2 - dayjs: 1.10.8 - debug: 4.3.3_supports-color@8.1.1 + dayjs: 1.11.0 + debug: 4.3.4_supports-color@8.1.1 enquirer: 2.3.6 eventemitter2: 6.4.5 execa: 4.1.0 @@ -1399,7 +1399,7 @@ packages: listr2: 3.14.0_enquirer@2.3.6 lodash: 4.17.21 log-symbols: 4.1.0 - minimist: 1.2.5 + minimist: 1.2.6 ospath: 1.2.2 pretty-bytes: 5.6.0 proxy-from-env: 1.0.0 @@ -1427,8 +1427,8 @@ packages: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true - /dayjs/1.10.8: - resolution: {integrity: sha512-wbNwDfBHHur9UOzNUjeKUOJ0fCb0a52Wx0xInmQ7Y8FstyajiV1NmK1e00cxsr9YrE9r7yAChE0VvpuY5Rnlow==} + /dayjs/1.11.0: + resolution: {integrity: sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==} dev: true /debug/3.2.7: @@ -1437,33 +1437,8 @@ packages: ms: 2.1.3 dev: true - /debug/4.3.3: - resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - - /debug/4.3.3_supports-color@8.1.1: - resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - supports-color: 8.1.1 - dev: true - - /debug/4.3.3_supports-color@9.2.1: - resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + /debug/4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -1472,10 +1447,9 @@ packages: optional: true dependencies: ms: 2.1.2 - supports-color: 9.2.1 dev: true - /debug/4.3.4: + /debug/4.3.4_supports-color@8.1.1: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -1485,9 +1459,10 @@ packages: optional: true dependencies: ms: 2.1.2 + supports-color: 8.1.1 dev: true - /debug/4.3.4_supports-color@8.1.1: + /debug/4.3.4_supports-color@9.2.2: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -1497,7 +1472,7 @@ packages: optional: true dependencies: ms: 2.1.2 - supports-color: 8.1.1 + supports-color: 9.2.2 dev: true /decamelize-keys/1.1.0: @@ -1569,7 +1544,7 @@ packages: resolution: {integrity: sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==} dependencies: domelementtype: 2.2.0 - domhandler: 4.3.0 + domhandler: 4.3.1 entities: 2.2.0 dev: true @@ -1577,8 +1552,8 @@ packages: resolution: {integrity: sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==} dev: true - /domhandler/4.3.0: - resolution: {integrity: sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==} + /domhandler/4.3.1: + resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} engines: {node: '>= 4'} dependencies: domelementtype: 2.2.0 @@ -1589,7 +1564,7 @@ packages: dependencies: dom-serializer: 1.3.2 domelementtype: 2.2.0 - domhandler: 4.3.0 + domhandler: 4.3.1 dev: true /dot-prop/5.3.0: @@ -1649,8 +1624,8 @@ packages: is-arrayish: 0.2.1 dev: true - /es-abstract/1.19.1: - resolution: {integrity: sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==} + /es-abstract/1.19.2: + resolution: {integrity: sha512-gfSBJoZdlL2xRiOCy0g8gLMryhoe1TlimjzU99L/31Z8QEGIhVQI+EWwt5lT+AuU9SnorVupXFqqOGqGfsyO6w==} engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 @@ -1942,7 +1917,7 @@ packages: eslint: '>=6.7.0' dependencies: array.prototype.flatmap: 1.2.5 - debug: 4.3.3 + debug: 4.3.4 eslint: 8.12.0 fast-glob: 3.2.11 transitivePeerDependencies: @@ -2044,7 +2019,7 @@ packages: file-entry-cache: 6.0.1 functional-red-black-tree: 1.0.1 glob-parent: 6.0.2 - globals: 13.12.1 + globals: 13.13.0 ignore: 5.2.0 import-fresh: 3.3.0 imurmurhash: 0.1.4 @@ -2198,7 +2173,7 @@ packages: '@nodelib/fs.walk': 1.2.8 glob-parent: 5.1.2 merge2: 1.4.1 - micromatch: 4.0.4 + micromatch: 4.0.5 dev: true /fast-json-stable-stringify/2.1.0: @@ -2302,7 +2277,7 @@ packages: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 - mime-types: 2.1.34 + mime-types: 2.1.35 dev: true /fs-access/1.0.1: @@ -2469,8 +2444,8 @@ packages: ini: 2.0.0 dev: true - /globals/13.12.1: - resolution: {integrity: sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==} + /globals/13.13.0: + resolution: {integrity: sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -2497,12 +2472,12 @@ packages: engines: {node: '>=0.4.7'} hasBin: true dependencies: - minimist: 1.2.5 + minimist: 1.2.6 neo-async: 2.6.2 source-map: 0.6.1 wordwrap: 1.0.0 optionalDependencies: - uglify-js: 3.15.2 + uglify-js: 3.15.3 dev: true /hard-rejection/2.1.0: @@ -2562,7 +2537,7 @@ packages: resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==} dependencies: domelementtype: 2.2.0 - domhandler: 4.3.0 + domhandler: 4.3.1 domutils: 2.8.0 entities: 2.2.0 dev: true @@ -2606,7 +2581,7 @@ packages: /import-meta-resolve/1.1.1: resolution: {integrity: sha512-JiTuIvVyPaUg11eTrNDx5bgQ/yMKMZffc7YSjvQeSMXy58DO2SQ8BtAf3xteZvmzvjYh14wnqNjL8XVeDy2o9A==} dependencies: - builtins: 4.0.0 + builtins: 4.1.0 dev: true /imurmurhash/0.1.4: @@ -2951,16 +2926,16 @@ packages: cli-truncate: 3.1.0 colorette: 2.0.16 commander: 8.3.0 - debug: 4.3.3_supports-color@9.2.1 + debug: 4.3.4_supports-color@9.2.2 execa: 5.1.1 lilconfig: 2.0.4 - listr2: 4.0.4 - micromatch: 4.0.4 + listr2: 4.0.5 + micromatch: 4.0.5 normalize-path: 3.0.0 object-inspect: 1.12.0 pidtree: 0.5.0 string-argv: 0.3.1 - supports-color: 9.2.1 + supports-color: 9.2.2 yaml: 1.10.2 transitivePeerDependencies: - enquirer @@ -2981,13 +2956,13 @@ packages: log-update: 4.0.0 p-map: 4.0.0 rfdc: 1.3.0 - rxjs: 7.5.4 + rxjs: 7.5.5 through: 2.3.8 wrap-ansi: 7.0.0 dev: true - /listr2/4.0.4: - resolution: {integrity: sha512-vJOm5KD6uZXjSsrwajr+mNacIjf87gWvlBEltPWLbTkslUscWAzquyK4xfe9Zd4RDgO5nnwFyV06FC+uVR+5mg==} + /listr2/4.0.5: + resolution: {integrity: sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==} engines: {node: '>=12'} peerDependencies: enquirer: '>= 2.3.0 < 3' @@ -3000,7 +2975,7 @@ packages: log-update: 4.0.0 p-map: 4.0.0 rfdc: 1.3.0 - rxjs: 7.5.4 + rxjs: 7.5.5 through: 2.3.8 wrap-ansi: 7.0.0 dev: true @@ -3161,24 +3136,24 @@ packages: engines: {node: '>= 8'} dev: true - /micromatch/4.0.4: - resolution: {integrity: sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==} + /micromatch/4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} dependencies: braces: 3.0.2 picomatch: 2.3.1 dev: true - /mime-db/1.51.0: - resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==} + /mime-db/1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} dev: true - /mime-types/2.1.34: - resolution: {integrity: sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==} + /mime-types/2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: - mime-db: 1.51.0 + mime-db: 1.52.0 dev: true /mimic-fn/2.1.0: @@ -3213,8 +3188,8 @@ packages: kind-of: 6.0.3 dev: true - /minimist/1.2.5: - resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==} + /minimist/1.2.6: + resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} dev: true /modify-values/1.0.1: @@ -3235,8 +3210,8 @@ packages: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} dev: true - /nanoid/3.3.1: - resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} + /nanoid/3.3.2: + resolution: {integrity: sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -3532,11 +3507,11 @@ packages: engines: {node: '>=4'} dev: true - /postcss/8.4.7: - resolution: {integrity: sha512-L9Ye3r6hkkCeOETQX6iOaWZgjp3LL6Lpqm6EtgbKrgqGGteRMNb9vzBfRL96YOSu8o7x3MfIH9Mo5cPJFGrW6A==} + /postcss/8.4.12: + resolution: {integrity: sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.1 + nanoid: 3.3.2 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true @@ -3750,8 +3725,8 @@ packages: glob: 7.2.0 dev: true - /rollup/2.69.0: - resolution: {integrity: sha512-kjER91tHyek8gAkuz7+558vSnTQ+pITEok1P0aNOS45ZXyngaqPsXJmSel4QPQnJo7EJMjXUU1/GErWkWiKORg==} + /rollup/2.70.1: + resolution: {integrity: sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==} engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: @@ -3764,8 +3739,8 @@ packages: queue-microtask: 1.2.3 dev: true - /rxjs/7.5.4: - resolution: {integrity: sha512-h5M3Hk78r6wAheJF0a5YahB1yRQKCsZ4MsGdZ5O9ETbVtjPcScGfrMmoOq7EBsCRzd4BDkvDJ7ogP8Sz5tTFiQ==} + /rxjs/7.5.5: + resolution: {integrity: sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==} dependencies: tslib: 2.3.1 dev: true @@ -3790,7 +3765,7 @@ packages: htmlparser2: 6.1.0 is-plain-object: 5.0.0 parse-srcset: 1.0.2 - postcss: 8.4.7 + postcss: 8.4.12 dev: true /semver/5.7.1: @@ -4025,7 +4000,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.3 - es-abstract: 1.19.1 + es-abstract: 1.19.2 dev: true /string.prototype.trimend/1.0.4: @@ -4115,8 +4090,8 @@ packages: has-flag: 4.0.0 dev: true - /supports-color/9.2.1: - resolution: {integrity: sha512-Obv7ycoCTG51N7y175StI9BlAXrmgZrFhZOb0/PyjHBher/NmsdBgbbQ1Inhq+gIhz6+7Gb+jWF2Vqi7Mf1xnQ==} + /supports-color/9.2.2: + resolution: {integrity: sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==} engines: {node: '>=12'} dev: true @@ -4317,8 +4292,8 @@ packages: hasBin: true dev: true - /uglify-js/3.15.2: - resolution: {integrity: sha512-peeoTk3hSwYdoc9nrdiEJk+gx1ALCtTjdYuKSXMTDqq7n1W7dHPqWDdSi+BPL0ni2YMeHD7hKUSdbj3TZauY2A==} + /uglify-js/3.15.3: + resolution: {integrity: sha512-6iCVm2omGJbsu3JWac+p6kUiOpg3wFO2f8lIXjfEb8RrmLjzog1wTPMmwKB7swfzzqxj9YM+sGUM++u1qN4qJg==} engines: {node: '>=0.8.0'} hasBin: true requiresBuild: true @@ -4416,9 +4391,9 @@ packages: optional: true dependencies: esbuild: 0.14.28 - postcss: 8.4.7 + postcss: 8.4.12 resolve: 1.22.0 - rollup: 2.69.0 + rollup: 2.70.1 optionalDependencies: fsevents: 2.3.2 dev: true From 62dcfc9658e6d3ee23b9e674d10b9a229b026d0e Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 28 Mar 2022 23:10:17 +0200 Subject: [PATCH 076/130] release: 6.1.1 (#716) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Leyla Jähnig <77127505+xDivisionByZerox@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ package.json | 5 +++-- pnpm-lock.yaml | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed8d364e32..2454101957a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,15 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [6.1.1](https://github.com/faker-js/faker/compare/v6.1.0...v6.1.1) (2022-03-28) + +### Bug Fixes + +* forgot to run `pnpm run build` + ## [6.1.0](https://github.com/faker-js/faker/compare/v6.0.0-alpha.6...v6.1.0) (2022-03-28) +⚠**WARNING**: This build is broken due to missing build files. Please don't use this version! ### Features diff --git a/package.json b/package.json index 93303dadb80..7ac3d9bab92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@faker-js/faker", - "version": "6.1.0", + "version": "6.1.1", "description": "Generate massive amounts of fake contextual data", "keywords": [ "faker", @@ -72,7 +72,8 @@ "docs:test:e2e:ci": "run-s docs:build:ci docs:test:e2e:run", "docs:test:e2e:run": "run-p --race docs:serve \"cypress run\"", "docs:test:e2e:open": "run-p --race docs:serve \"cypress open\"", - "release": "standard-version" + "release": "standard-version", + "prepublishOnly": "pnpm run clean && pnpm install && pnpm run build" }, "simple-git-hooks": { "pre-commit": "npx lint-staged --concurrent false", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2cce7b48ec1..9d59e60ca87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,7 +48,7 @@ devDependencies: '@vitest/ui': 0.7.12 c8: 7.11.0 conventional-changelog-cli: 2.2.2 - cypress: 9.5.2 + cypress: 9.5.3 esbuild: 0.14.28 eslint: 8.12.0 eslint-config-prettier: 8.5.0_eslint@8.12.0 @@ -1361,8 +1361,8 @@ packages: resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==} dev: true - /cypress/9.5.2: - resolution: {integrity: sha512-gYiQYvJozMzDOriUV1rCt6CeRM/pRK4nhwGJj3nJQyX2BoUdTCVwp30xDMKc771HiNVhBtgj5o5/iBdVDVXQUg==} + /cypress/9.5.3: + resolution: {integrity: sha512-ItelIVmqMTnKYbo1JrErhsGgQGjWOxCpHT1TfMvwnIXKXN/OSlPjEK7rbCLYDZhejQL99PmUqul7XORI24Ik0A==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true From 928f5d3b9395bb8343df6b349ecb530fbf7566ea Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:50:50 +0200 Subject: [PATCH 077/130] chore(deps): update dependency cypress to ~9.5.3 (#720) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7ac3d9bab92..b998b42f958 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@vitest/ui": "~0.7.12", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", - "cypress": "~9.5.2", + "cypress": "~9.5.3", "esbuild": "~0.14.28", "eslint": "~8.12.0", "eslint-config-prettier": "~8.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9d59e60ca87..b953aca4d8d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ specifiers: '@vitest/ui': ~0.7.12 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 - cypress: ~9.5.2 + cypress: ~9.5.3 esbuild: ~0.14.28 eslint: ~8.12.0 eslint-config-prettier: ~8.5.0 From 6fd60823e27f7d797626341dcfe9ab336c13b92f Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Tue, 29 Mar 2022 09:17:29 +0200 Subject: [PATCH 078/130] docs: add jsdoc examples to faker.word (#717) --- src/word.ts | 56 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/src/word.ts b/src/word.ts index 4570e96492e..2b1e5e4f2c0 100644 --- a/src/word.ts +++ b/src/word.ts @@ -16,9 +16,13 @@ export class Word { /** * Returns an adjective of random or optionally specified length. - * If specified length is unresolvable, returns random adjective. * - * @param length The optional length of word to return. + * @param length Expected adjective length. If specified length is unresolvable, returns adjective of a random length. + * + * @example + * faker.word.adjective() // 'pungent' + * faker.word.adjective(5) // 'slimy' + * faker.word.adjective(100) // 'complete' */ adjective(length?: number): string { let wordList = this.faker.definitions.word.adjective; @@ -38,9 +42,13 @@ export class Word { /** * Returns an adverb of random or optionally specified length. - * If specified length is unresolvable, returns random adverb. * - * @param length The optional length of word to return. + * @param length Expected adverb length. If specified length is unresolvable, returns adverb of a random length. + * + * @example + * faker.word.adverb() // 'quarrelsomely' + * faker.word.adverb(5) // 'madly' + * faker.word.adverb(100) // 'sadly' */ adverb(length?: number): string { let wordList = this.faker.definitions.word.adverb; @@ -60,9 +68,13 @@ export class Word { /** * Returns a conjunction of random or optionally specified length. - * If specified length is unresolvable, returns random conjunction. * - * @param length The optional length of word to return. + * @param length Expected conjunction length. If specified length is unresolvable, returns conjunction of a random length. + * + * @example + * faker.word.conjunction() // 'in order that' + * faker.word.conjunction(5) // 'since' + * faker.word.conjunction(100) // 'as long as' */ conjunction(length?: number): string { let wordList = this.faker.definitions.word.conjunction; @@ -82,9 +94,13 @@ export class Word { /** * Returns an interjection of random or optionally specified length. - * If specified length is unresolvable, returns random interjection. * - * @param length The optional length of word to return. + * @param length Expected interjection length. If specified length is unresolvable, returns interjection of a random length. + * + * @example + * faker.word.interjection() // 'gah' + * faker.word.interjection(5) // 'fooey' + * faker.word.interjection(100) // 'yowza' */ interjection(length?: number): string { let wordList = this.faker.definitions.word.interjection; @@ -104,9 +120,13 @@ export class Word { /** * Returns a noun of random or optionally specified length. - * If specified length is unresolvable, returns random noun. * - * @param length The optional length of word to return. + * @param length Expected noun length. If specified length is unresolvable, returns noun of a random length. + * + * @example + * faker.word.noun() // 'external' + * faker.word.noun(5) // 'front' + * faker.word.noun(100) // 'care' */ noun(length?: number): string { let wordList = this.faker.definitions.word.noun; @@ -126,9 +146,13 @@ export class Word { /** * Returns a preposition of random or optionally specified length. - * If specified length is unresolvable, returns random preposition. * - * @param length The optional length of word to return. + * @param length Expected preposition length. If specified length is unresolvable, returns preposition of a random length. + * + * @example + * faker.word.preposition() // 'without' + * faker.word.preposition(5) // 'abaft' + * faker.word.preposition(100) // 'an' */ preposition(length?: number): string { let wordList = this.faker.definitions.word.preposition; @@ -148,9 +172,13 @@ export class Word { /** * Returns a verb of random or optionally specified length. - * If specified length is unresolvable, returns random verb. * - * @param length The optional length of word to return. + * @param length Expected verb length. If specified length is unresolvable, returns verb of a random length. + * + * @example + * faker.word.verb() // 'act' + * faker.word.verb(5) // 'tinge' + * faker.word.verb(100) // 'mess' */ verb(length?: number): string { let wordList = this.faker.definitions.word.verb; From 1bb0f25d058e6a9f7c1331252f33c80fa3039f61 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Tue, 29 Mar 2022 09:24:28 +0200 Subject: [PATCH 079/130] docs: update faker.fake documentation (#709) --- src/fake.ts | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/fake.ts b/src/fake.ts index 617708a6b33..b47755159b2 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -15,25 +15,35 @@ export class Fake { } /** - * Generator method for combining faker methods based on string input. + * Generator for combining faker methods based on a static string input. * - * Note: If you just want to create a string on the fly, we recommend using string template literals instead. - * This method is useful if you wish to choose a random format from a non-executable source or persistent storage (json etc.). + * Note: We recommend using string template literals instead of `fake()`, + * which are faster and strongly typed (if you are using TypeScript), + * e.g. ``const address = `${faker.address.zipCode()} ${faker.address.city()}`;`` * - * It checks the given string for placeholders and replace them by calling the specified faker method. - * E.g. the input `Hi, my name is {{name.firstName}}!`, - * will use the `faker.name.firstName()` method to resolve the placeholder. - * It is also possible to combine static text with placeholders, - * since only the parts inside the double braces `{{placeholder}}` are replaced. - * The replacement process is repeated until all placeholders have been replaced by static text. - * It is also possible to provide the called method with additional parameters by adding parentheses. - * This method will first attempt to parse the parameters as json, if that isn't possible it will use them as string. - * E.g. `You can call me at {{phone.phoneNumber(+!# !## #### #####!)}}.` - * Currently it isn't possible to set more than a single parameter this way. + * This method is useful if you have to build a random string from a static, non-executable source + * (e.g. string coming from a user, stored in a database or a file). * - * Please note that is NOT possible to use any non-faker methods or plain js script in there. + * It checks the given string for placeholders and replaces them by calling faker methods: * - * @param str The format string that will get interpolated. May not be empty. + * ```js + * const hello = faker.fake('Hi, my name is {{name.firstName}} {{name.lastName}}!') + * ``` + * + * This would use the `faker.name.firstName()` and `faker.name.lastName()` method to resolve the placeholders respectively. + * + * It is also possible to provide parameters. At first, they will be parsed as json, + * and if that isn't possible, we will fall back to string: + * + * ```js + * const message = faker.fake(`You can call me at {{phone.phoneNumber(+!# !## #### #####!)}}.') + * ``` + * + * Currently it is not possible to set more than a single parameter. + * + * It is also NOT possible to use any non-faker methods or plain javascript in such templates. + * + * @param str The template string that will get interpolated. Must not be empty. * * @see faker.helpers.mustache() to use custom functions for resolution. * From 2532eb9f5a6f73bbc1786ec91952f838d98fd72a Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Tue, 29 Mar 2022 18:16:41 +0200 Subject: [PATCH 080/130] fix: remove doubled extension in system.filePath (#300) --- src/system.ts | 5 +++-- test/system.spec.ts | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/system.ts b/src/system.ts index c6532ed2a47..c5b052c0a80 100644 --- a/src/system.ts +++ b/src/system.ts @@ -175,10 +175,11 @@ export class System { * Returns a file path. * * @example - * faker.system.filePath() // '/usr/local/src/money.rmp.dotx' + * faker.system.filePath() // '/usr/local/src/money.dotx' */ + // TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file. filePath(): string { - return `${this.faker.system.directoryPath()}/${this.faker.system.fileName()}.${this.faker.system.fileExt()}`; + return `${this.directoryPath()}/${this.fileName()}`; } /** diff --git a/test/system.spec.ts b/test/system.spec.ts index b9d36edc31f..e9eee5060ec 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -15,8 +15,7 @@ const seededRuns = [ fileType: 'image', fileExt: 'chm', directoryPath: '/opt/bin', - // TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file. - filePath: '/opt/bin/directives_savings_computer.qwd.jade', + filePath: '/opt/bin/directives_savings_computer.qwd', semver: '3.7.9', }, }, @@ -31,8 +30,7 @@ const seededRuns = [ fileType: 'font', fileExt: 'gxt', directoryPath: '/Library', - // TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file. - filePath: '/Library/bike_kiribati.kpr.ez3', + filePath: '/Library/bike_kiribati.kpr', semver: '2.5.1', }, }, @@ -47,8 +45,7 @@ const seededRuns = [ fileType: 'x-shader', fileExt: 'opml', directoryPath: '/var/log', - // TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file. - filePath: '/var/log/forward_frozen.swf.fcdt', + filePath: '/var/log/forward_frozen.swf', semver: '9.4.8', }, }, @@ -104,7 +101,6 @@ describe('system', () => { 'jpeg', 'm2a', 'm2v', - 'm3a', 'mp4', 'mp4v', 'mpeg', @@ -118,7 +114,7 @@ describe('system', () => { expect( extList, `generated common file ext should be one of [${extList.join( - ',' + ', ' )}]. Got "${fileExt}".` ).include(fileExt); }); From a37b1ef5176f346ef73c74c89e9e2c97235de7dd Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 29 Mar 2022 22:44:32 +0200 Subject: [PATCH 081/130] docs: fix lint warning (#727) --- scripts/apidoc/parameterDefaults.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/apidoc/parameterDefaults.ts b/scripts/apidoc/parameterDefaults.ts index 9342d7b21cf..5e10202c098 100644 --- a/scripts/apidoc/parameterDefaults.ts +++ b/scripts/apidoc/parameterDefaults.ts @@ -66,7 +66,7 @@ export class DefaultParameterAwareSerializer extends SerializerComponent Date: Wed, 30 Mar 2022 15:07:07 +0200 Subject: [PATCH 082/130] chore(deps): update vitest to ~0.8.0 (#731) --- package.json | 4 ++-- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b998b42f958..3e32907b66c 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "@types/validator": "~13.7.2", "@typescript-eslint/eslint-plugin": "~5.17.0", "@typescript-eslint/parser": "~5.17.0", - "@vitest/ui": "~0.7.12", + "@vitest/ui": "~0.8.0", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.3", @@ -122,7 +122,7 @@ "validator": "~13.7.0", "vite": "~2.8.6", "vitepress": "~0.22.3", - "vitest": "~0.7.12" + "vitest": "~0.8.0" }, "packageManager": "pnpm@6.32.3", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b953aca4d8d..838cb619c32 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.2 '@typescript-eslint/eslint-plugin': ~5.17.0 '@typescript-eslint/parser': ~5.17.0 - '@vitest/ui': ~0.7.12 + '@vitest/ui': ~0.8.0 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.3 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.8.6 vitepress: ~0.22.3 - vitest: ~0.7.12 + vitest: ~0.8.0 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.2 '@typescript-eslint/eslint-plugin': 5.17.0_689ff565753ecf7c3328c07fad067df5 '@typescript-eslint/parser': 5.17.0_eslint@8.12.0+typescript@4.6.3 - '@vitest/ui': 0.7.12 + '@vitest/ui': 0.8.0 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.3 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.8.6 vitepress: 0.22.3 - vitest: 0.7.12_@vitest+ui@0.7.12+c8@7.11.0 + vitest: 0.8.0_@vitest+ui@0.8.0+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.7.12: - resolution: {integrity: sha512-cBhfU5r4jB3oqkdj+5r3Qlsv/AAPLtx23RlT5RGceq/gSCS5r1hDaASUcyRyfc1sA+FuGxj6KJLs9JDsfgQiJQ==} + /@vitest/ui/0.8.0: + resolution: {integrity: sha512-eCrU2lvYTA1YAI3cBrmaHC1539X7r8HMF/bLUEdSJE+eb+fW78brXYJXS7bDywQsFg9TI592xZVpPlRg95dfZA==} dependencies: sirv: 2.0.2 dev: true @@ -4419,9 +4419,9 @@ packages: - stylus dev: true - /vitest/0.7.12_@vitest+ui@0.7.12+c8@7.11.0: - resolution: {integrity: sha512-Q/UrBAhStPUeic++s+jnH6M0vsBhemTixAsAKvp6z8zN6K47tfZqob4XgpbViebDmYcmhlyREumVmrpUlyuXdA==} - engines: {node: '>=v14.16.0'} + /vitest/0.8.0_@vitest+ui@0.8.0+c8@7.11.0: + resolution: {integrity: sha512-8m8OufAQWXlNpjm5dTe5Lc60zruguKJljunveueYrd4aoeXaQvggLX0SPmIW3G6PDtnBdNEynSi+6pibjnutQA==} + engines: {node: '>=v14.19.1'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -4440,7 +4440,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.7.12 + '@vitest/ui': 0.8.0 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From f285dc98cd50b94a38534e220ade7cdb1a4e69fe Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Thu, 31 Mar 2022 01:52:27 +0200 Subject: [PATCH 083/130] docs: add ts import example in readme (#719) --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index ac8c6807a6f..14461fabecd 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ pnpm install @faker-js/faker -D ```js const { faker } = require('@faker-js/faker'); + const randomName = faker.name.findName(); // Rowan Nikolaus const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz const randomPhoneNumber = faker.phone.phoneNumber(); // (279) 329-8663 x30233 @@ -95,6 +96,12 @@ In order to have faker working properly, you need to check if these `compilerOpt } ``` +And then simply import it like everything else: + +```ts +import { faker } from '@faker-js/faker'; +``` + If you want for whatever reason the versions prior to `v6`, you can use `@types/faker` and rebind the declarations to the `@faker-js/faker` package with a `faker.d.ts` file in your e.g. src folder. From 7c6d9f85607c91f6110376041f64eab84960ed44 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Mar 2022 09:50:06 +0200 Subject: [PATCH 084/130] chore(deps): update devdependencies (#730) Co-authored-by: Renovate Bot --- package.json | 6 +- pnpm-lock.yaml | 166 ++++++++++++++++++++++++------------------------- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/package.json b/package.json index 3e32907b66c..a944d549985 100644 --- a/package.json +++ b/package.json @@ -99,12 +99,12 @@ "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.3", - "esbuild": "~0.14.28", + "esbuild": "~0.14.29", "eslint": "~8.12.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.1.3", + "eslint-plugin-jsdoc": "~38.1.4", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.7", @@ -120,7 +120,7 @@ "typedoc-plugin-missing-exports": "~0.22.6", "typescript": "~4.6.3", "validator": "~13.7.0", - "vite": "~2.8.6", + "vite": "~2.9.0", "vitepress": "~0.22.3", "vitest": "~0.8.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 838cb619c32..0ad84b509fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,12 +12,12 @@ specifiers: c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.3 - esbuild: ~0.14.28 + esbuild: ~0.14.29 eslint: ~8.12.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.1.3 + eslint-plugin-jsdoc: ~38.1.4 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.7 @@ -33,7 +33,7 @@ specifiers: typedoc-plugin-missing-exports: ~0.22.6 typescript: ~4.6.3 validator: ~13.7.0 - vite: ~2.8.6 + vite: ~2.9.0 vitepress: ~0.22.3 vitest: ~0.8.0 @@ -49,12 +49,12 @@ devDependencies: c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.3 - esbuild: 0.14.28 + esbuild: 0.14.29 eslint: 8.12.0 eslint-config-prettier: 8.5.0_eslint@8.12.0 eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.12.0 - eslint-plugin-jsdoc: 38.1.3_eslint@8.12.0 + eslint-plugin-jsdoc: 38.1.4_eslint@8.12.0 eslint-plugin-prettier: 4.0.0_b253a92c95b42c3296c682f11cccb3bd esno: 0.14.1 lint-staged: 12.3.7 @@ -70,7 +70,7 @@ devDependencies: typedoc-plugin-missing-exports: 0.22.6_typedoc@0.22.13 typescript: 4.6.3 validator: 13.7.0 - vite: 2.8.6 + vite: 2.9.0 vitepress: 0.22.3 vitest: 0.8.0_@vitest+ui@0.8.0+c8@7.11.0 @@ -560,14 +560,14 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/2.2.4_vite@2.8.6+vue@3.2.31: + /@vitejs/plugin-vue/2.2.4_vite@2.9.0+vue@3.2.31: resolution: {integrity: sha512-ev9AOlp0ljCaDkFZF3JwC/pD2N4Hh+r5srl5JHM6BKg5+99jiiK0rE/XaRs3pVm1wzyKkjUy/StBSoXX5fFzcw==} engines: {node: '>=12.0.0'} peerDependencies: vite: ^2.5.10 vue: ^3.2.25 dependencies: - vite: 2.8.6 + vite: 2.9.0 vue: 3.2.31 dev: true @@ -1659,8 +1659,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.14.28: - resolution: {integrity: sha512-A52C3zq+9tNwCqZ+4kVLBxnk/WnrYM8P2+QNvNE9B6d2OVPs214lp3g6UyO+dKDhUdefhfPCuwkP8j2A/+szNA==} + /esbuild-android-64/0.14.29: + resolution: {integrity: sha512-tJuaN33SVZyiHxRaVTo1pwW+rn3qetJX/SRuc/83rrKYtyZG0XfsQ1ao1nEudIt9w37ZSNXR236xEfm2C43sbw==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1668,8 +1668,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.28: - resolution: {integrity: sha512-sm0fDEGElZhMC3HLZeECI2juE4aG7uPfMBMqNUhy9CeX399Pz8rC6e78OXMXInGjSdEAwQmCOHmfsP7uv3Q8rA==} + /esbuild-android-arm64/0.14.29: + resolution: {integrity: sha512-D74dCv6yYnMTlofVy1JKiLM5JdVSQd60/rQfJSDP9qvRAI0laPXIG/IXY1RG6jobmFMUfL38PbFnCqyI/6fPXg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1677,8 +1677,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.28: - resolution: {integrity: sha512-nzDd7mQ44FvsFHtOafZdBgn3Li5SMsnMnoz1J2MM37xJmR3wGNTFph88KypjHgWqwbxCI7MXS1U+sN4qDeeW6Q==} + /esbuild-darwin-64/0.14.29: + resolution: {integrity: sha512-+CJaRvfTkzs9t+CjGa0Oa28WoXa7EeLutQhxus+fFcu0MHhsBhlmeWHac3Cc/Sf/xPi1b2ccDFfzGYJCfV0RrA==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1686,8 +1686,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.28: - resolution: {integrity: sha512-XEq/bLR/glsUl+uGrBimQzOVs/CmwI833fXUhP9xrLI3IJ+rKyrZ5IA8u+1crOEf1LoTn8tV+hInmX6rGjbScw==} + /esbuild-darwin-arm64/0.14.29: + resolution: {integrity: sha512-5Wgz/+zK+8X2ZW7vIbwoZ613Vfr4A8HmIs1XdzRmdC1kG0n5EG5fvKk/jUxhNlrYPx1gSY7XadQ3l4xAManPSw==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1695,8 +1695,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.28: - resolution: {integrity: sha512-rTKLgUj/HEcPeE5XZ7IZwWpFx7IWMfprN7QRk/TUJE1s1Ipb58esboIesUpjirJz/BwrgHq+FDG9ChAI8dZAtQ==} + /esbuild-freebsd-64/0.14.29: + resolution: {integrity: sha512-VTfS7Bm9QA12JK1YXF8+WyYOfvD7WMpbArtDj6bGJ5Sy5xp01c/q70Arkn596aGcGj0TvQRplaaCIrfBG1Wdtg==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -1704,8 +1704,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.28: - resolution: {integrity: sha512-sBffxD1UMOsB7aWMoExmipycjcy3HJGwmqE4GQZUTZvdiH4GhjgUiVdtPyt7kSCdL40JqnWQJ4b1l8Y51oCF4Q==} + /esbuild-freebsd-arm64/0.14.29: + resolution: {integrity: sha512-WP5L4ejwLWWvd3Fo2J5mlXvG3zQHaw5N1KxFGnUc4+2ZFZknP0ST63i0IQhpJLgEJwnQpXv2uZlU1iWZjFqEIg==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -1713,8 +1713,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.28: - resolution: {integrity: sha512-+Wxidh3fBEQ9kHcCsD4etlBTMb1n6QY2uXv3rFhVn88CY/JP782MhA57/ipLMY4kOLeSKEuFGN4rtjHuhmRMig==} + /esbuild-linux-32/0.14.29: + resolution: {integrity: sha512-4myeOvFmQBWdI2U1dEBe2DCSpaZyjdQtmjUY11Zu2eQg4ynqLb8Y5mNjNU9UN063aVsCYYfbs8jbken/PjyidA==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -1722,8 +1722,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.28: - resolution: {integrity: sha512-7+xgsC4LvR6cnzaBdiljNnPDjbkwzahogN+S9uy9AoYw7ZjPnnXc6sjQAVCbqGb7MEgrWdpa6u/Tao79i4lWxg==} + /esbuild-linux-64/0.14.29: + resolution: {integrity: sha512-iaEuLhssReAKE7HMwxwFJFn7D/EXEs43fFy5CJeA4DGmU6JHh0qVJD2p/UP46DvUXLRKXsXw0i+kv5TdJ1w5pg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -1731,8 +1731,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.28: - resolution: {integrity: sha512-L5isjmlLbh9E0WVllXiVETbScgMbth/+XkXQii1WwgO1RvLIfaGrVFz8d2n6EH/ImtgYxPYGx+OcvIKQBc91Rg==} + /esbuild-linux-arm/0.14.29: + resolution: {integrity: sha512-OXa9D9QL1hwrAnYYAHt/cXAuSCmoSqYfTW/0CEY0LgJNyTxJKtqc5mlwjAZAvgyjmha0auS/sQ0bXfGf2wAokQ==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -1740,8 +1740,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.28: - resolution: {integrity: sha512-EjRHgwg+kgXABzyoPGPOPg4d5wZqRnZ/ZAxBDzLY+i6DS8OUfTSlZHWIOZzU4XF7125WxRBg9ULbrFJBl+57Eg==} + /esbuild-linux-arm64/0.14.29: + resolution: {integrity: sha512-KYf7s8wDfUy+kjKymW3twyGT14OABjGHRkm9gPJ0z4BuvqljfOOUbq9qT3JYFnZJHOgkr29atT//hcdD0Pi7Mw==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -1749,8 +1749,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.28: - resolution: {integrity: sha512-krx9SSg7yfiUKk64EmjefOyiEF6nv2bRE4um/LiTaQ6Y/6FP4UF3/Ou/AxZVyR154uSRq63xejcAsmswXAYRsw==} + /esbuild-linux-mips64le/0.14.29: + resolution: {integrity: sha512-05jPtWQMsZ1aMGfHOvnR5KrTvigPbU35BtuItSSWLI2sJu5VrM8Pr9Owym4wPvA4153DFcOJ1EPN/2ujcDt54g==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -1758,8 +1758,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.28: - resolution: {integrity: sha512-LD0Xxu9g+DNuhsEBV5QuVZ4uKVBMup0xPIruLweuAf9/mHXFnaCuNXUBF5t0DxKl7GQ5MSioKtnb92oMo+QXEw==} + /esbuild-linux-ppc64le/0.14.29: + resolution: {integrity: sha512-FYhBqn4Ir9xG+f6B5VIQVbRuM4S6qwy29dDNYFPoxLRnwTEKToIYIUESN1qHyUmIbfO0YB4phG2JDV2JDN9Kgw==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -1767,8 +1767,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.28: - resolution: {integrity: sha512-L/DWfRh2P0vxq4Y+qieSNXKGdMg+e9Qe8jkbN2/8XSGYDTPzO2OcAxSujob4qIh7iSl+cknbXV+BvH0YFR0jbg==} + /esbuild-linux-riscv64/0.14.29: + resolution: {integrity: sha512-eqZMqPehkb4nZcffnuOpXJQdGURGd6GXQ4ZsDHSWyIUaA+V4FpMBe+5zMPtXRD2N4BtyzVvnBko6K8IWWr36ew==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -1776,8 +1776,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.28: - resolution: {integrity: sha512-rrgxmsbmL8QQknWGnAL9bGJRQYLOi2AzXy5OTwfhxnj9eqjo5mSVbJXjgiq5LPUAMQZGdPH5yaNK0obAXS81Zw==} + /esbuild-linux-s390x/0.14.29: + resolution: {integrity: sha512-o7EYajF1rC/4ho7kpSG3gENVx0o2SsHm7cJ5fvewWB/TEczWU7teDgusGSujxCYcMottE3zqa423VTglNTYhjg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -1785,8 +1785,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.28: - resolution: {integrity: sha512-h8wntIyOR8/xMVVM6TvJxxWKh4AjmLK87IPKpuVi8Pq0kyk0RMA+eo4PFGk5j2XK0D7dj8PcSF5NSlP9kN/j0A==} + /esbuild-netbsd-64/0.14.29: + resolution: {integrity: sha512-/esN6tb6OBSot6+JxgeOZeBk6P8V/WdR3GKBFeFpSqhgw4wx7xWUqPrdx4XNpBVO7X4Ipw9SAqgBrWHlXfddww==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -1797,11 +1797,11 @@ packages: /esbuild-node-loader/0.6.5: resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} dependencies: - esbuild: 0.14.28 + esbuild: 0.14.29 dev: true - /esbuild-openbsd-64/0.14.28: - resolution: {integrity: sha512-HBv18rVapbuDx52/fhZ/c/w6TXyaQAvRxiDDn5Hz/pBcwOs3cdd2WxeIKlWmDoqm2JMx5EVlq4IWgoaRX9mVkw==} + /esbuild-openbsd-64/0.14.29: + resolution: {integrity: sha512-jUTdDzhEKrD0pLpjmk0UxwlfNJNg/D50vdwhrVcW/D26Vg0hVbthMfb19PJMatzclbK7cmgk1Nu0eNS+abzoHw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -1809,16 +1809,16 @@ packages: dev: true optional: true - /esbuild-register/3.3.2_esbuild@0.14.28: + /esbuild-register/3.3.2_esbuild@0.14.29: resolution: {integrity: sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==} peerDependencies: esbuild: '>=0.12 <1' dependencies: - esbuild: 0.14.28 + esbuild: 0.14.29 dev: true - /esbuild-sunos-64/0.14.28: - resolution: {integrity: sha512-zlIxePhZxKYheR2vBCgPVvTixgo/ozOfOMoP6RZj8dxzquU1NgeyhjkcRXucbLCtmoNJ+i4PtWwPZTLuDd3bGg==} + /esbuild-sunos-64/0.14.29: + resolution: {integrity: sha512-EfhQN/XO+TBHTbkxwsxwA7EfiTHFe+MNDfxcf0nj97moCppD9JHPq48MLtOaDcuvrTYOcrMdJVeqmmeQ7doTcg==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -1826,8 +1826,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.28: - resolution: {integrity: sha512-am9DIJxXlld1BOAY/VlvBQHMUCPL7S3gB/lnXIY3M4ys0gfuRqPf4EvMwZMzYUbFKBY+/Qb8SRgPRRGhwnJ8Kg==} + /esbuild-windows-32/0.14.29: + resolution: {integrity: sha512-uoyb0YAJ6uWH4PYuYjfGNjvgLlb5t6b3zIaGmpWPOjgpr1Nb3SJtQiK4YCPGhONgfg2v6DcJgSbOteuKXhwqAw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -1835,8 +1835,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.28: - resolution: {integrity: sha512-78PhySDnmRZlsPNp/W/5Fim8iivlBQQxfhBFIqR7xwvfDmCFUSByyMKP7LCHgNtb04yNdop8nJJkJaQ8Xnwgiw==} + /esbuild-windows-64/0.14.29: + resolution: {integrity: sha512-X9cW/Wl95QjsH8WUyr3NqbmfdU72jCp71cH3pwPvI4CgBM2IeOUDdbt6oIGljPu2bf5eGDIo8K3Y3vvXCCTd8A==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1844,8 +1844,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.28: - resolution: {integrity: sha512-VhXGBTo6HELD8zyHXynV6+L2jWx0zkKnGx4TmEdSBK7UVFACtOyfUqpToG0EtnYyRZ0HESBhzPSVpP781ovmvA==} + /esbuild-windows-arm64/0.14.29: + resolution: {integrity: sha512-+O/PI+68fbUZPpl3eXhqGHTGK7DjLcexNnyJqtLZXOFwoAjaXlS5UBCvVcR3o2va+AqZTj8o6URaz8D2K+yfQQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -1853,32 +1853,32 @@ packages: dev: true optional: true - /esbuild/0.14.28: - resolution: {integrity: sha512-YLNprkCcMVKQ5sekmCKEQ3Obu/L7s6+iij38xNKyBeSmSsTWur4Ky/9zB3XIGT8SCJITG/bZwAR2l7YOAXch4Q==} + /esbuild/0.14.29: + resolution: {integrity: sha512-SQS8cO8xFEqevYlrHt6exIhK853Me4nZ4aMW6ieysInLa0FMAL+AKs87HYNRtR2YWRcEIqoXAHh+Ytt5/66qpg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.28 - esbuild-android-arm64: 0.14.28 - esbuild-darwin-64: 0.14.28 - esbuild-darwin-arm64: 0.14.28 - esbuild-freebsd-64: 0.14.28 - esbuild-freebsd-arm64: 0.14.28 - esbuild-linux-32: 0.14.28 - esbuild-linux-64: 0.14.28 - esbuild-linux-arm: 0.14.28 - esbuild-linux-arm64: 0.14.28 - esbuild-linux-mips64le: 0.14.28 - esbuild-linux-ppc64le: 0.14.28 - esbuild-linux-riscv64: 0.14.28 - esbuild-linux-s390x: 0.14.28 - esbuild-netbsd-64: 0.14.28 - esbuild-openbsd-64: 0.14.28 - esbuild-sunos-64: 0.14.28 - esbuild-windows-32: 0.14.28 - esbuild-windows-64: 0.14.28 - esbuild-windows-arm64: 0.14.28 + esbuild-android-64: 0.14.29 + esbuild-android-arm64: 0.14.29 + esbuild-darwin-64: 0.14.29 + esbuild-darwin-arm64: 0.14.29 + esbuild-freebsd-64: 0.14.29 + esbuild-freebsd-arm64: 0.14.29 + esbuild-linux-32: 0.14.29 + esbuild-linux-64: 0.14.29 + esbuild-linux-arm: 0.14.29 + esbuild-linux-arm64: 0.14.29 + esbuild-linux-mips64le: 0.14.29 + esbuild-linux-ppc64le: 0.14.29 + esbuild-linux-riscv64: 0.14.29 + esbuild-linux-s390x: 0.14.29 + esbuild-netbsd-64: 0.14.29 + esbuild-openbsd-64: 0.14.29 + esbuild-sunos-64: 0.14.29 + esbuild-windows-32: 0.14.29 + esbuild-windows-64: 0.14.29 + esbuild-windows-arm64: 0.14.29 dev: true /escalade/3.1.1: @@ -1924,8 +1924,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/38.1.3_eslint@8.12.0: - resolution: {integrity: sha512-CJgBG1wzl2735rct2GpzS39lx4t0mlUiv9MvFndQKyqTVOGZLXeSkVNIE5inmg23T0EkCrS3AZ9dKbFAsK9ItA==} + /eslint-plugin-jsdoc/38.1.4_eslint@8.12.0: + resolution: {integrity: sha512-x4sG6oJ+wj7aOGXtTaUeA4EL6kkgGsaFyIf+237/cdSXmC5zKKROccZxNZVUkaXE5QEiBGi7pyRfWNZYf+2OFg==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -2045,9 +2045,9 @@ packages: hasBin: true dependencies: cross-spawn: 7.0.3 - esbuild: 0.14.28 + esbuild: 0.14.29 esbuild-node-loader: 0.6.5 - esbuild-register: 3.3.2_esbuild@0.14.28 + esbuild-register: 3.3.2_esbuild@0.14.29 import-meta-resolve: 1.1.1 dev: true @@ -4374,8 +4374,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite/2.8.6: - resolution: {integrity: sha512-e4H0QpludOVKkmOsRyqQ7LTcMUDF3mcgyNU4lmi0B5JUbe0ZxeBBl8VoZ8Y6Rfn9eFKYtdXNPcYK97ZwH+K2ug==} + /vite/2.9.0: + resolution: {integrity: sha512-5NAnNqzPmZzJvrswZGeTS2JHrBGIzIWJA2hBTTMYuoBVEMh0xwE0b5yyIXFxf7F07hrK4ugX2LJ7q6t7iIbd4Q==} engines: {node: '>=12.2.0'} hasBin: true peerDependencies: @@ -4390,7 +4390,7 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.28 + esbuild: 0.14.29 postcss: 8.4.12 resolve: 1.22.0 rollup: 2.70.1 @@ -4405,9 +4405,9 @@ packages: dependencies: '@docsearch/css': 3.0.0 '@docsearch/js': 3.0.0 - '@vitejs/plugin-vue': 2.2.4_vite@2.8.6+vue@3.2.31 + '@vitejs/plugin-vue': 2.2.4_vite@2.9.0+vue@3.2.31 prismjs: 1.27.0 - vite: 2.8.6 + vite: 2.9.0 vue: 3.2.31 transitivePeerDependencies: - '@algolia/client-search' @@ -4446,7 +4446,7 @@ packages: local-pkg: 0.4.1 tinypool: 0.1.2 tinyspy: 0.3.0 - vite: 2.8.6 + vite: 2.9.0 transitivePeerDependencies: - less - sass From 2e22845666939b5428f2ddf6ce22aeb6800acb21 Mon Sep 17 00:00:00 2001 From: Ken Powers Date: Thu, 31 Mar 2022 11:34:44 -0500 Subject: [PATCH 085/130] docs: Use valid UUID for example in README (#740) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 14461fabecd..1750d77eede 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ An in-depth overview of the API methods is available in the [documentation](http | Commerce | `faker.commerce.product()` | Polo t-shirt | | Company | `faker.company.companyName()` | Zboncak and Sons | | Database | `faker.database.engine()` | MyISAM | -| Datatype | `faker.datatype.uuid()` | 1oijf8-3iuhiu-21jddj-1092jf | +| Datatype | `faker.datatype.uuid()` | 7b16dd12-935e-4acc-8381-b1e457bf0176 | | Date | `faker.date.past()` | Sat Oct 20 2018 04:19:38 GMT-0700 (Pacific Daylight Time) | | Finance | `faker.finance.amount()` | ¥23400 (After setting locale) | | Git | `faker.git.commitMessage()` | feat: add products list page | From 58439edf1506c53f9f3b082b9b0f22ba7e8cccf4 Mon Sep 17 00:00:00 2001 From: wael Date: Thu, 31 Mar 2022 21:09:02 +0400 Subject: [PATCH 086/130] test: added a few test cases for Albania IBAN (#739) --- test/finance_iban.spec.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/finance_iban.spec.ts b/test/finance_iban.spec.ts index 5c3fb9c9b6b..b3087a6a3e9 100644 --- a/test/finance_iban.spec.ts +++ b/test/finance_iban.spec.ts @@ -299,6 +299,41 @@ describe('finance_iban', () => { 'the result should be equal to 1' ).toBe(1); }); + + it('IBAN for Albania is correct', () => { + // Albania + // https://wise.com/gb/iban/albania + // + // example Albania IBAN: AL64 0650 0752 4840 3787 O431 31W3 + // Length 28 + // BBAN 2c,26n + // AL + // Check digits 2 digits + // Bank code 3 digits + // Branch code 4 digits + // National check digit 1 digit + // Bank account number 16 digit + + const iban = faker.finance.iban(false, 'AL'); + const ibanFormated = iban.match(/.{1,4}/g).join(' '); + + expect(iban).satisfy(validator.isIBAN); + + expect( + 28, + `AL IBAN would be 28 chars length, given is ${iban.length}` + ).toBe(iban.length); + + expect( + 34, + `AL formatted IBAN would be 34 chars length, given is ${ibanFormated.length}` + ).toBe(ibanFormated.length); + + expect( + iban.substring(0, 2), + `First two character should be AL, given is ${iban.substring(0, 2)}` + ).toBe('AL'); + }); }); } }); From 0b350f929624a1247f35549c61148ec93e5f0c0a Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Thu, 31 Mar 2022 19:14:26 +0200 Subject: [PATCH 087/130] chore: move vendor to utils and update license notes (#738) --- LICENSE | 6 +- src/internet.ts | 2 +- src/mersenne.ts | 2 +- src/unique.ts | 4 +- src/utils/mersenne.ts | 320 ++++++++++++++++++++++++++ src/{vendor => utils}/unique.ts | 0 src/{vendor => utils}/user-agent.ts | 46 ++-- src/vendor/mersenne.ts | 342 ---------------------------- 8 files changed, 358 insertions(+), 364 deletions(-) create mode 100644 src/utils/mersenne.ts rename src/{vendor => utils}/unique.ts (100%) rename src/{vendor => utils}/user-agent.ts (85%) delete mode 100644 src/vendor/mersenne.ts diff --git a/LICENSE b/LICENSE index 6901562fcb1..0ebeaf84e27 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Faker - Copyright (c) 2022 -This software consists of voluntary contributions made by many individuals. +This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history available at https://github.com/faker-js/faker @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -=== +=== From: https://github.com/faker-js/faker/commit/a9f98046c7d5eeaabe12fc587024c06d683800b8 To: https://github.com/faker-js/faker/commit/29234378807c4141588861f69421bf20b5ac635e @@ -58,4 +58,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/internet.ts b/src/internet.ts index 1ed6a837f52..8961af9e8a3 100644 --- a/src/internet.ts +++ b/src/internet.ts @@ -1,5 +1,5 @@ import type { Faker } from '.'; -import * as random_ua from './vendor/user-agent'; +import * as random_ua from './utils/user-agent'; /** * Module to generate internet related entries. diff --git a/src/mersenne.ts b/src/mersenne.ts index 521456a1e89..d9044e54441 100644 --- a/src/mersenne.ts +++ b/src/mersenne.ts @@ -1,4 +1,4 @@ -import Gen from './vendor/mersenne'; +import Gen from './utils/mersenne'; /** * Module to generate seed based random numbers. diff --git a/src/unique.ts b/src/unique.ts index 718b3391fff..b19f6132dd5 100644 --- a/src/unique.ts +++ b/src/unique.ts @@ -1,5 +1,5 @@ -import type { RecordKey } from './vendor/unique'; -import * as uniqueExec from './vendor/unique'; +import type { RecordKey } from './utils/unique'; +import * as uniqueExec from './utils/unique'; /** * Module to generate unique entries. diff --git a/src/utils/mersenne.ts b/src/utils/mersenne.ts new file mode 100644 index 00000000000..5859f3ae671 --- /dev/null +++ b/src/utils/mersenne.ts @@ -0,0 +1,320 @@ +/** + * Copyright (c) 2022 Faker + * + * This is a version of the original source code migrated to TypeScript and + * modified by the Faker team. + * + * Check LICENSE for more details on copyright. + * + * ----------------------------------------------------------------------------- + * + * Copyright (c) 2006 Y. Okada + * + * This program is a JavaScript version of Mersenne Twister, with concealment + * and encapsulation in class, an almost straight conversion from the original + * program, mt19937ar.c, translated by Y. Okada on July 17, 2006, and modified + * a little at July 20, 2006, but there are not any substantial differences. + * + * In this program, procedure descriptions and comments of original source code + * were not removed. + * + * Lines commented with //c// were originally descriptions of c procedure. + * And a few following lines are appropriate JavaScript descriptions. + * + * Lines commented with /* and *\/ are original comments. + * Lines commented with // are additional comments in this JavaScript version. + * + * Before using this version, create at least one instance of + * MersenneTwister19937 class, and initialize the each state, given below + * in C comments, of all the instances. + * + * ----------------------------------------------------------------------------- + * + * A C-program for MT19937, with initialization improved 2002/1/26. + * Coded by Takuji Nishimura and Makoto Matsumoto. + * + * Before using, initialize the state by using init_genrand(seed) + * or init_by_array(init_key, key_length). + * + * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Any feedback is very welcome. + * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html + * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) + */ + +export default class MersenneTwister19937 { + private readonly N = 624; + private readonly M = 397; + private readonly MATRIX_A = 0x9908b0df; // constant vector a + private readonly UPPER_MASK = 0x80000000; // most significant w-r bits + private readonly LOWER_MASK = 0x7fffffff; // least significant r bits + private mt: number[] = new Array(this.N); // the array for the state vector + private mti = this.N + 1; // mti==N+1 means mt[N] is not initialized + + /** + * Returns a 32-bits unsigned integer from an operand to which applied a bit + * operator. + * + * @param n1 number to unsign + */ + private unsigned32(n1: number): number { + return n1 < 0 ? (n1 ^ this.UPPER_MASK) + this.UPPER_MASK : n1; + } + + /** + * Emulates lowerflow of a c 32-bits unsigned integer variable, instead of + * the operator -. These both arguments must be non-negative integers + * expressible using unsigned 32 bits. + * + * @param n1 dividend + * @param n2 divisor + */ + private subtraction32(n1: number, n2: number): number { + return n1 < n2 + ? this.unsigned32((0x100000000 - (n2 - n1)) & 0xffffffff) + : n1 - n2; + } + + /** + * Emulates overflow of a c 32-bits unsigned integer variable, instead of the operator +. + * these both arguments must be non-negative integers expressible using unsigned 32 bits. + * + * @param n1 number one for addition + * @param n2 number two for addition + */ + private addition32(n1: number, n2: number): number { + return this.unsigned32((n1 + n2) & 0xffffffff); + } + + /** + * Emulates overflow of a c 32-bits unsigned integer variable, instead of the operator *. + * These both arguments must be non-negative integers expressible using unsigned 32 bits. + * + * @param n1 number one for multiplication + * @param n2 number two for multiplication + */ + private multiplication32(n1: number, n2: number): number { + let sum = 0; + for (let i = 0; i < 32; ++i) { + if ((n1 >>> i) & 0x1) { + sum = this.addition32(sum, this.unsigned32(n2 << i)); + } + } + return sum; + } + + /** + * Initializes mt[N] with a seed. + * + * @param seed the seed to use + */ + initGenrand(seed: number): void { + this.mt[0] = this.unsigned32(seed & 0xffffffff); + for (this.mti = 1; this.mti < this.N; this.mti++) { + this.mt[this.mti] = + //(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); + this.addition32( + this.multiplication32( + 1812433253, + this.unsigned32( + this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30) + ) + ), + this.mti + ); + + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array mt[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + this.mt[this.mti] = this.unsigned32(this.mt[this.mti] & 0xffffffff); + } + } + + /** + * Initialize by an array with array-length. + * + * @param initKey is the array for initializing keys + * @param keyLength is its length + */ + initByArray(initKey: number[], keyLength: number): void { + this.initGenrand(19650218); + let i = 1; + let j = 0; + let k = this.N > keyLength ? this.N : keyLength; + for (; k; k--) { + // mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525)) + init_key[j] + j; + this.mt[i] = this.addition32( + this.addition32( + this.unsigned32( + this.mt[i] ^ + this.multiplication32( + this.unsigned32(this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)), + 1664525 + ) + ), + initKey[j] + ), + j + ); + // mt[i] &= 0xffffffff; for WORDSIZE > 32 machines + this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff); + i++; + j++; + if (i >= this.N) { + this.mt[0] = this.mt[this.N - 1]; + i = 1; + } + if (j >= keyLength) { + j = 0; + } + } + for (k = this.N - 1; k; k--) { + // mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941)) - i + this.mt[i] = this.subtraction32( + this.unsigned32( + this.mt[i] ^ + this.multiplication32( + this.unsigned32(this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)), + 1566083941 + ) + ), + i + ); + // mt[i] &= 0xffffffff; for WORDSIZE > 32 machines + this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff); + i++; + if (i >= this.N) { + this.mt[0] = this.mt[this.N - 1]; + i = 1; + } + } + this.mt[0] = 0x80000000; // MSB is 1; assuring non-zero initial array + } + + // moved outside of genrandInt32() by jwatte 2010-11-17; generate less garbage + private mag01 = [0x0, this.MATRIX_A]; + + /** + * Generates a random number on [0,2^32]-interval + */ + genrandInt32(): number { + let y: number; + + if (this.mti >= this.N) { + // generate N words at one time + let kk: number; + + // if initGenrand() has not been called a default initial seed is used + if (this.mti === this.N + 1) { + this.initGenrand(5489); + } + + for (kk = 0; kk < this.N - this.M; kk++) { + y = this.unsigned32( + (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK) + ); + + this.mt[kk] = this.unsigned32( + this.mt[kk + this.M] ^ (y >>> 1) ^ this.mag01[y & 0x1] + ); + } + + for (; kk < this.N - 1; kk++) { + y = this.unsigned32( + (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK) + ); + + this.mt[kk] = this.unsigned32( + this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ this.mag01[y & 0x1] + ); + } + + y = this.unsigned32( + (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK) + ); + + this.mt[this.N - 1] = this.unsigned32( + this.mt[this.M - 1] ^ (y >>> 1) ^ this.mag01[y & 0x1] + ); + + this.mti = 0; + } + + y = this.mt[this.mti++]; + + // Tempering + y = this.unsigned32(y ^ (y >>> 11)); + y = this.unsigned32(y ^ ((y << 7) & 0x9d2c5680)); + y = this.unsigned32(y ^ ((y << 15) & 0xefc60000)); + y = this.unsigned32(y ^ (y >>> 18)); + + return y; + } + + /** + * Generates a random number on [0,2^32]-interval + */ + genrandInt31(): number { + return this.genrandInt32() >>> 1; + } + + /** + * Generates a random number on [0,1]-real-interval + */ + genrandReal1(): number { + return this.genrandInt32() * (1.0 / 4294967295.0); // divided by 2^32-1 + } + + /** + * Generates a random number on [0,1)-real-interval + */ + genrandReal2(): number { + return this.genrandInt32() * (1.0 / 4294967296.0); // divided by 2^32 + } + + /** + * Generates a random number on (0,1)-real-interval + */ + genrandReal3(): number { + return (this.genrandInt32() + 0.5) * (1.0 / 4294967296.0); // divided by 2^32 + } + + /** + * Generates a random number on [0,1) with 53-bit resolution + */ + genrandRes53(): number { + const a = this.genrandInt32() >>> 5, + b = this.genrandInt32() >>> 6; + return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); + } + // These real versions are due to Isaku Wada, 2002/01/09 +} diff --git a/src/vendor/unique.ts b/src/utils/unique.ts similarity index 100% rename from src/vendor/unique.ts rename to src/utils/unique.ts diff --git a/src/vendor/user-agent.ts b/src/utils/user-agent.ts similarity index 85% rename from src/vendor/user-agent.ts rename to src/utils/user-agent.ts index 9218c6e51bb..7f7e8cbb9ce 100644 --- a/src/vendor/user-agent.ts +++ b/src/utils/user-agent.ts @@ -1,29 +1,45 @@ -/* +/** + * Copyright (c) 2022 Faker + * + * This is a version of the original code migrated to TypeScript and modified + * by the Faker team. + * + * Check LICENSE for more details about the copyright. + * + * ----------------------------------------------------------------------------- + * * Copyright (c) 2012-2014 Jeffrey Mealo * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and - * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the - * Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * - * ------------------------------------------------------------------------------------------------------------------------ + * ----------------------------------------------------------------------------- * - * Based loosely on Luka Pusic's PHP Script: http://360percents.com/posts/php-random-user-agent-generator/ + * Based loosely on Luka Pusic's PHP Script: + * http://360percents.com/posts/php-random-user-agent-generator/ * * The license for that script is as follows: * * "THE BEER-WARE LICENSE" (Revision 42): * - * wrote this file. As long as you retain this notice you can do whatever you want with this stuff. - * If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Luka Pusic + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Luka Pusic */ import type { Faker } from '..'; diff --git a/src/vendor/mersenne.ts b/src/vendor/mersenne.ts deleted file mode 100644 index 23e44f2cba8..00000000000 --- a/src/vendor/mersenne.ts +++ /dev/null @@ -1,342 +0,0 @@ -// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class, -// an almost straight conversion from the original program, mt19937ar.c, -// translated by y. okada on July 17, 2006. -// and modified a little at july 20, 2006, but there are not any substantial differences. -// in this program, procedure descriptions and comments of original source code were not removed. -// lines commented with //c// were originally descriptions of c procedure. and a few following lines are appropriate JavaScript descriptions. -// lines commented with /* and */ are original comments. -// lines commented with // are additional comments in this JavaScript version. -// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances. - -/* - * A C-program for MT19937, with initialization improved 2002/1/26. - * Coded by Takuji Nishimura and Makoto Matsumoto. - * - * Before using, initialize the state by using init_genrand(seed) - * or init_by_array(init_key, key_length). - * - * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Any feedback is very welcome. - * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html - * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) - */ - -export default class MersenneTwister19937 { - /* constants should be scoped inside the class */ - /* Period parameters */ - //c//#define N 624 - //c//#define M 397 - //c//#define MATRIX_A 0x9908b0dfUL /* constant vector a */ - //c//#define UPPER_MASK 0x80000000UL /* most significant w-r bits */ - //c//#define LOWER_MASK 0x7fffffffUL /* least significant r bits */ - private readonly N = 624; - private readonly M = 397; - private readonly MATRIX_A = 0x9908b0df; /* constant vector a */ - private readonly UPPER_MASK = 0x80000000; /* most significant w-r bits */ - private readonly LOWER_MASK = 0x7fffffff; /* least significant r bits */ - //c//static unsigned long mt[N]; /* the array for the state vector */ - //c//static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */ - private mt: number[] = new Array( - this.N - ); /* the array for the state vector */ - private mti = this.N + 1; /* mti==N+1 means mt[N] is not initialized */ - - /** - * Returns a 32-bits unsiged integer from an operand to which applied a bit operator. - * - * @param n1 number to unsign - */ - private unsigned32(n1: number): number { - // returns a 32-bits unsiged integer from an operand to which applied a bit operator. - return n1 < 0 ? (n1 ^ this.UPPER_MASK) + this.UPPER_MASK : n1; - } - - /** - * Emulates lowerflow of a c 32-bits unsiged integer variable, instead of the operator -. - * These both arguments must be non-negative integers expressible using unsigned 32 bits. - * - * @param n1 dividend - * @param n2 divisor - */ - private subtraction32(n1: number, n2: number): number { - return n1 < n2 - ? this.unsigned32((0x100000000 - (n2 - n1)) & 0xffffffff) - : n1 - n2; - } - - /** - * emulates overflow of a c 32-bits unsiged integer variable, instead of the operator +. - * these both arguments must be non-negative integers expressible using unsigned 32 bits. - * - * @param n1 number one for addition - * @param n2 number two for addition - */ - private addition32(n1: number, n2: number): number { - return this.unsigned32((n1 + n2) & 0xffffffff); - } - - /** - * Emulates overflow of a c 32-bits unsiged integer variable, instead of the operator *. - * These both arguments must be non-negative integers expressible using unsigned 32 bits. - * - * @param n1 number one for multiplication - * @param n2 number two for multiplication - */ - private multiplication32(n1: number, n2: number): number { - let sum = 0; - for (let i = 0; i < 32; ++i) { - if ((n1 >>> i) & 0x1) { - sum = this.addition32(sum, this.unsigned32(n2 << i)); - } - } - return sum; - } - - /** - * Initializes mt[N] with a seed. - * - * @param seed the seed to use - */ - //c//void init_genrand(unsigned long s) - initGenrand(seed: number): void { - //c//mt[0]= s & 0xffffffff; - this.mt[0] = this.unsigned32(seed & 0xffffffff); - for (this.mti = 1; this.mti < this.N; this.mti++) { - this.mt[this.mti] = - //c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); - this.addition32( - this.multiplication32( - 1812433253, - this.unsigned32( - this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30) - ) - ), - this.mti - ); - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - /* In the previous versions, MSBs of the seed affect */ - /* only MSBs of the array mt[]. */ - /* 2002/01/09 modified by Makoto Matsumoto */ - //c//mt[mti] &= 0xffffffff; - this.mt[this.mti] = this.unsigned32(this.mt[this.mti] & 0xffffffff); - /* for >32 bit machines */ - } - } - - /** - * Initialize by an array with array-length. - * - * @param initKey is the array for initializing keys - * @param keyLength is its length - */ - /* slight change for C++, 2004/2/26 */ - //c//void init_by_array(unsigned long init_key[], int key_length) - initByArray(initKey: number[], keyLength: number): void { - //c//init_genrand(19650218); - this.initGenrand(19650218); - let i = 1; - let j = 0; - let k = this.N > keyLength ? this.N : keyLength; - for (; k; k--) { - //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525)) - //c// + init_key[j] + j; /* non linear */ - this.mt[i] = this.addition32( - this.addition32( - this.unsigned32( - this.mt[i] ^ - this.multiplication32( - this.unsigned32(this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)), - 1664525 - ) - ), - initKey[j] - ), - j - ); - //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */ - this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff); - i++; - j++; - if (i >= this.N) { - this.mt[0] = this.mt[this.N - 1]; - i = 1; - } - if (j >= keyLength) { - j = 0; - } - } - for (k = this.N - 1; k; k--) { - //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941)) - //c//- i; /* non linear */ - this.mt[i] = this.subtraction32( - this.unsigned32( - this.mt[i] ^ - this.multiplication32( - this.unsigned32(this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)), - 1566083941 - ) - ), - i - ); - //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */ - this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff); - i++; - if (i >= this.N) { - this.mt[0] = this.mt[this.N - 1]; - i = 1; - } - } - this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */ - } - - /* moved outside of genrand_int32() by jwatte 2010-11-17; generate less garbage */ - private mag01 = [0x0, this.MATRIX_A]; - - /** - * Generates a random number on [0,2^32]-interval - */ - //c//unsigned long genrand_int32(void) - genrandInt32(): number { - //c//unsigned long y; - //c//static unsigned long mag01[2]={0x0UL, MATRIX_A}; - let y: number; - /* mag01[x] = x * MATRIX_A for x=0,1 */ - - if (this.mti >= this.N) { - /* generate N words at one time */ - //c//int kk; - let kk: number; - - if (this.mti === this.N + 1) { - /* if init_genrand() has not been called, */ - //c//init_genrand(5489); /* a default initial seed is used */ - this.initGenrand(5489); - } /* a default initial seed is used */ - - for (kk = 0; kk < this.N - this.M; kk++) { - //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK); - //c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1]; - y = this.unsigned32( - (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK) - ); - this.mt[kk] = this.unsigned32( - this.mt[kk + this.M] ^ (y >>> 1) ^ this.mag01[y & 0x1] - ); - } - for (; kk < this.N - 1; kk++) { - //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK); - //c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1]; - y = this.unsigned32( - (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK) - ); - this.mt[kk] = this.unsigned32( - this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ this.mag01[y & 0x1] - ); - } - //c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); - //c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1]; - y = this.unsigned32( - (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK) - ); - this.mt[this.N - 1] = this.unsigned32( - this.mt[this.M - 1] ^ (y >>> 1) ^ this.mag01[y & 0x1] - ); - this.mti = 0; - } - - y = this.mt[this.mti++]; - - /* Tempering */ - //c//y ^= (y >> 11); - //c//y ^= (y << 7) & 0x9d2c5680; - //c//y ^= (y << 15) & 0xefc60000; - //c//y ^= (y >> 18); - y = this.unsigned32(y ^ (y >>> 11)); - y = this.unsigned32(y ^ ((y << 7) & 0x9d2c5680)); - y = this.unsigned32(y ^ ((y << 15) & 0xefc60000)); - y = this.unsigned32(y ^ (y >>> 18)); - - return y; - } - - /** - * Generates a random number on [0,2^32]-interval - */ - //c//long genrand_int31(void) - genrandInt31(): number { - //c//return (genrand_int32()>>1); - return this.genrandInt32() >>> 1; - } - - /** - * Generates a random number on [0,1]-real-interval - */ - //c//double genrand_real1(void) - genrandReal1(): number { - //c//return genrand_int32()*(1.0/4294967295.0); - return this.genrandInt32() * (1.0 / 4294967295.0); - /* divided by 2^32-1 */ - } - - /** - * Generates a random number on [0,1)-real-interval - */ - //c//double genrand_real2(void) - genrandReal2(): number { - //c//return genrand_int32()*(1.0/4294967296.0); - return this.genrandInt32() * (1.0 / 4294967296.0); - /* divided by 2^32 */ - } - - /** - * Generates a random number on (0,1)-real-interval - */ - //c//double genrand_real3(void) - genrandReal3(): number { - //c//return ((genrand_int32()) + 0.5)*(1.0/4294967296.0); - return (this.genrandInt32() + 0.5) * (1.0 / 4294967296.0); - /* divided by 2^32 */ - } - - /** - * Generates a random number on [0,1) with 53-bit resolution - */ - //c//double genrand_res53(void) - genrandRes53(): number { - //c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6; - const a = this.genrandInt32() >>> 5, - b = this.genrandInt32() >>> 6; - return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); - } - /* These real versions are due to Isaku Wada, 2002/01/09 added */ -} From 03041201c21ad599bbe1874c375f4f41b94961ba Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Thu, 31 Mar 2022 19:48:24 +0200 Subject: [PATCH 088/130] fix: datatype.number when min = max + precision, throw when max > min (#664) --- src/address.ts | 4 ++-- src/datatype.ts | 34 +++++++++++------------------- src/random.ts | 8 ++++++-- test/address.spec.ts | 2 +- test/datatype.spec.ts | 23 +++++++++++++++------ test/system.spec.ts | 20 ++++++++++-------- test/word.spec.ts | 48 +++++++++++++++++++++---------------------- 7 files changed, 73 insertions(+), 66 deletions(-) diff --git a/src/address.ts b/src/address.ts index 5a130cb20a2..264b02817fc 100644 --- a/src/address.ts +++ b/src/address.ts @@ -407,8 +407,8 @@ export class Address { latitude(max: number = 90, min: number = -90, precision: number = 4): string { return this.faker.datatype .number({ - max: max, - min: min, + min, + max, precision: parseFloat((0.0).toPrecision(precision) + '1'), }) .toFixed(precision); diff --git a/src/datatype.ts b/src/datatype.ts index ad37c3daf5e..79b0b61c1c1 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -20,9 +20,11 @@ export class Datatype { * * @param options Maximum value or options object. * @param options.min Lower bound for generated number. Defaults to `0`. - * @param options.max Upper bound for generated number. Defaults to `99999`. + * @param options.max Upper bound for generated number. Defaults to `min + 99999`. * @param options.precision Precision of the generated number. Defaults to `1`. * + * @throws When options define `max < min` + * * @example * faker.datatype.number() // 55422 * faker.datatype.number(100) // 52 @@ -34,25 +36,14 @@ export class Datatype { number( options?: number | { min?: number; max?: number; precision?: number } ): number { - if (typeof options === 'number') { - options = { max: options }; - } + const opts = typeof options === 'number' ? { max: options } : options ?? {}; - options = options ?? {}; - - let max = 99999; - let min = 0; - let precision = 1; - if (typeof options.min === 'number') { - min = options.min; - } - - if (typeof options.max === 'number') { - max = options.max; - } + const min = typeof opts.min === 'number' ? opts.min : 0; + let max = typeof opts.max === 'number' ? opts.max : min + 99999; + const precision = typeof opts.precision === 'number' ? opts.precision : 1; - if (typeof options.precision === 'number') { - precision = options.precision; + if (max < min) { + throw new Error(`Max ${max} should be larger then min ${min}`); } // Make the range inclusive of the max value @@ -60,13 +51,12 @@ export class Datatype { max += precision; } - let randomNumber = Math.floor( + const randomNumber = Math.floor( this.faker.mersenne.rand(max / precision, min / precision) ); - // Workaround problem in Float point arithmetics for e.g. 6681493 / 0.01 - randomNumber = randomNumber / (1 / precision); - return randomNumber; + // Workaround problem in float point arithmetics for e.g. 6681493 / 0.01 + return randomNumber / (1 / precision); } /** diff --git a/src/random.ts b/src/random.ts index 0a3b3c5ecaf..f41a67fa36d 100644 --- a/src/random.ts +++ b/src/random.ts @@ -107,8 +107,12 @@ export class Random { arrayElement( array: ReadonlyArray = ['a', 'b', 'c'] as unknown as ReadonlyArray ): T { - const r = this.faker.datatype.number({ max: array.length - 1 }); - return array[r]; + const index = + array.length > 1 + ? this.faker.datatype.number({ max: array.length - 1 }) + : 0; + + return array[index]; } /** diff --git a/test/address.spec.ts b/test/address.spec.ts index 729d9190b0f..5929f4628cb 100644 --- a/test/address.spec.ts +++ b/test/address.spec.ts @@ -411,7 +411,7 @@ describe('address', () => { it('returns latitude with min and max and default precision', () => { for (let i = 0; i < 100; i++) { - const latitude = faker.address.latitude(-5, 5); + const latitude = faker.address.latitude(5, -5); expect(latitude).toBeTypeOf('string'); expect( diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index 902cf9ba706..e4d69fe69b2 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -8,7 +8,7 @@ const seededRuns = [ number: { noArgs: 37454, numbers: [2, 5, 6, 1, 5], - withMin: 37427, + withMin: 37412, withMinAndMax: -1, withMax: 26, withMinAndMaxAndPrecision: -0.43, @@ -16,7 +16,7 @@ const seededRuns = [ float: { noArgs: 37453.64, numbers: [37452, 79656, 95076, 18342, 73200], - withMin: 37427.37, + withMin: 37411.64, withMinAndMax: -0.43, withMax: 25.84, withMinAndMaxAndPrecision: -0.4261, @@ -80,7 +80,7 @@ const seededRuns = [ number: { noArgs: 26202, numbers: [1, 3, 1, 1, 1], - withMin: 26171, + withMin: 26160, withMinAndMax: -13, withMax: 18, withMinAndMaxAndPrecision: -12.92, @@ -88,7 +88,7 @@ const seededRuns = [ float: { noArgs: 26202.2, numbers: [26202, 56052, 15864, 21258, 27810], - withMin: 26171.21, + withMin: 26160.2, withMinAndMax: -12.92, withMax: 18.08, withMinAndMaxAndPrecision: -12.9153, @@ -152,7 +152,7 @@ const seededRuns = [ number: { noArgs: 92852, numbers: [6, 3, 6, 5, 1], - withMin: 92849, + withMin: 92810, withMinAndMax: 61, withMax: 64, withMinAndMaxAndPrecision: 61.07, @@ -160,7 +160,7 @@ const seededRuns = [ float: { noArgs: 92851.09, numbers: [92856, 45900, 89346, 77826, 22554], - withMin: 92848.09, + withMin: 92809.09, withMinAndMax: 61.07, withMax: 64.07, withMinAndMaxAndPrecision: 61.0658, @@ -288,6 +288,17 @@ describe('datatype', () => { }); expect(actual).toEqual(expectations.number.withMinAndMaxAndPrecision); }); + + it('should throw when min > max', () => { + const min = 10; + const max = 9; + + faker.seed(seed); + + expect(() => { + faker.datatype.number({ min, max }); + }).toThrowError(`Max ${max} should be larger then min ${min}`); + }); }); describe('float', () => { diff --git a/test/system.spec.ts b/test/system.spec.ts index e9eee5060ec..e3e7f692adf 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -7,45 +7,45 @@ const seededRuns = [ { seed: 42, expectations: { - fileName: 'mobile_application.wad', - commonFileName: 'mobile_application.gif', + fileName: 'mobile_fish.gif', + commonFileName: 'mobile_fish.mpe', mimeType: 'application/vnd.marlin.drm.license+xml', commonFileType: 'audio', commonFileExt: 'png', fileType: 'image', fileExt: 'chm', directoryPath: '/opt/bin', - filePath: '/opt/bin/directives_savings_computer.qwd', + filePath: '/opt/bin/directives_application_home.paw', semver: '3.7.9', }, }, { seed: 1337, expectations: { - fileName: 'delaware.vcg', - commonFileName: 'delaware.wav', + fileName: 'delaware.uvvt', + commonFileName: 'delaware.mp2', mimeType: 'application/vnd.dxr', commonFileType: 'audio', commonFileExt: 'wav', fileType: 'font', fileExt: 'gxt', directoryPath: '/Library', - filePath: '/Library/bike_kiribati.kpr', + filePath: '/Library/bike_interactive.qwt', semver: '2.5.1', }, }, { seed: 1211, expectations: { - fileName: 'turnpike_supervisor_chicken.mka', - commonFileName: 'turnpike_supervisor_chicken.mp4v', + fileName: 'turnpike_frozen_handcrafted.mka', + commonFileName: 'turnpike_frozen_handcrafted.mp4v', mimeType: 'text/vnd.fmi.flexstor', commonFileType: 'application', commonFileExt: 'htm', fileType: 'x-shader', fileExt: 'opml', directoryPath: '/var/log', - filePath: '/var/log/forward_frozen.swf', + filePath: '/var/log/forward_supervisor.swf', semver: '9.4.8', }, }, @@ -101,6 +101,8 @@ describe('system', () => { 'jpeg', 'm2a', 'm2v', + 'mp2', + 'mp3', 'mp4', 'mp4v', 'mpeg', diff --git a/test/word.spec.ts b/test/word.spec.ts index ac40c8a5e01..d236f564a0c 100644 --- a/test/word.spec.ts +++ b/test/word.spec.ts @@ -8,37 +8,37 @@ const seededRuns = [ adjective: { noArgs: 'harmonious', length10: 'gregarious', - length20: 'stable', + length20: 'harmonious', }, adverb: { noArgs: 'jealously', length10: 'generously', - length20: 'swiftly', + length20: 'jealously', }, conjunction: { noArgs: 'however', length10: 'as much as', - length20: 'since', + length20: 'however', }, interjection: { noArgs: 'yahoo', - length10: 'ack', - length20: 'ack', + length10: 'yahoo', + length20: 'yahoo', }, noun: { noArgs: 'gale', length10: 'exposition', - length20: 'shift', + length20: 'gale', }, preposition: { noArgs: 'concerning', length10: 'throughout', - length20: 'than', + length20: 'concerning', }, verb: { noArgs: 'function', length10: 'exasperate', - length20: 'shred', + length20: 'function', }, }, }, @@ -48,37 +48,37 @@ const seededRuns = [ adjective: { noArgs: 'fabulous', length10: 'enchanting', - length20: 'neat', + length20: 'fabulous', }, adverb: { noArgs: 'frankly', length10: 'enormously', - length20: 'overconfidently', + length20: 'frankly', }, conjunction: { noArgs: 'even if', length10: 'as long as', - length20: 'instead', + length20: 'even if', }, interjection: { noArgs: 'ew', - length10: 'yippee', - length20: 'yippee', + length10: 'ew', + length20: 'ew', }, noun: { noArgs: 'digit', length10: 'depressive', - length20: 'might', + length20: 'digit', }, preposition: { noArgs: 'barring', length10: 'concerning', - length20: 'midst', + length20: 'barring', }, verb: { noArgs: 'dispense', length10: 'demoralize', - length20: 'nearest', + length20: 'dispense', }, }, }, @@ -88,37 +88,37 @@ const seededRuns = [ adjective: { noArgs: 'verifiable', length10: 'unfinished', - length20: 'joyous', + length20: 'verifiable', }, adverb: { noArgs: 'viciously', length10: 'unbearably', - length20: 'loudly', + length20: 'viciously', }, conjunction: { noArgs: 'whereas', length10: 'as soon as', - length20: 'in addition', + length20: 'whereas', }, interjection: { noArgs: 'er', - length10: 'gah', - length20: 'gah', + length10: 'er', + length20: 'er', }, noun: { noArgs: 'trick', length10: 'trafficker', - length20: 'infection', + length20: 'trick', }, preposition: { noArgs: 'upon', length10: 'underneath', - length20: 'for', + length20: 'upon', }, verb: { noArgs: 'trick', length10: 'trampoline', - length20: 'intercede', + length20: 'trick', }, }, }, From 48dcec18136e437dc537f0a58f30379a8ce531e8 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Thu, 31 Mar 2022 20:26:34 +0200 Subject: [PATCH 089/130] docs: about (#673) --- docs/.vitepress/config.ts | 43 +++++++++-- docs/about/announcements.md | 7 ++ .../announcements/2022-01-14.md} | 2 +- docs/about/team.md | 9 +++ docs/about/team/TeamMember.ts | 7 ++ docs/about/team/TeamMember.vue | 76 ++++++++++++++++++ docs/about/team/TeamPage.vue | 60 +++++++++++++++ docs/about/team/members.json | 77 +++++++++++++++++++ netlify.toml | 7 ++ 9 files changed, 279 insertions(+), 9 deletions(-) create mode 100644 docs/about/announcements.md rename docs/{update.md => about/announcements/2022-01-14.md} (98%) create mode 100644 docs/about/team.md create mode 100644 docs/about/team/TeamMember.ts create mode 100644 docs/about/team/TeamMember.vue create mode 100644 docs/about/team/TeamPage.vue create mode 100644 docs/about/team/members.json diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index ade58400a77..01394b84290 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -4,26 +4,53 @@ import { apiPages } from './api-pages'; const nav: DefaultTheme.NavItem[] = [ { text: 'Guide', link: '/guide/' }, + // { text: 'Playground', link: '/playground/' }, { text: 'Ecosystem', items: [ - { text: 'Discord', link: 'https://chat.fakerjs.dev' }, - { text: 'StackBlitz', link: 'https://fakerjs.dev/new' }, - { text: 'Twitter', link: 'https://twitter.com/faker_js' }, + { text: 'Discord ', link: 'https://chat.fakerjs.dev' }, + { text: 'StackBlitz ', link: 'https://fakerjs.dev/new' }, + { text: 'Twitter ', link: 'https://twitter.com/faker_js' }, + ], + }, + { + text: 'About', + items: [ + { + text: 'Announcements', + link: '/about/announcements', + }, + { + text: 'Team', + link: '/about/team', + }, ], }, - // { text: 'Playground', link: '/playground/' }, ]; const sidebar: DefaultTheme.MultiSideBarConfig = { - '/': [ + '/about': [ { - text: 'Guide', + text: 'About', children: [ { - text: 'Recent Statement and FAQs', - link: '/update.html', + text: 'Announcements', + link: '/about/announcements', + children: [ + { text: '2022-01-14', link: '/about/announcements/2022-01-14' }, + ], + }, + { + text: 'Team', + link: '/about/team', }, + ], + }, + ], + '/': [ + { + text: 'Guide', + children: [ { text: 'Getting Started', link: '/guide/', diff --git a/docs/about/announcements.md b/docs/about/announcements.md new file mode 100644 index 00000000000..9f00c334bbd --- /dev/null +++ b/docs/about/announcements.md @@ -0,0 +1,7 @@ +--- +editLink: false +--- + +# Announcements + +- [2022-01-14 - An update from the Faker team](./announcements/2022-01-14) diff --git a/docs/update.md b/docs/about/announcements/2022-01-14.md similarity index 98% rename from docs/update.md rename to docs/about/announcements/2022-01-14.md index 0cf210c6dc2..517f111210f 100644 --- a/docs/update.md +++ b/docs/about/announcements/2022-01-14.md @@ -68,7 +68,7 @@ He gave us permission to re-use his work to create **[fakerjs.dev](https://faker 9. Done a TON of issue triage and many, many PR reviews. -
64 pull requests were opened. 34 were merged. 44 issues were opened. 25 were closed.
+
64 pull requests were opened. 34 were merged. 44 issues were opened. 25 were closed.
10. We've gotten in contact with the [Open Collective](https://opencollective.com) and discussed a transition plan for the project. diff --git a/docs/about/team.md b/docs/about/team.md new file mode 100644 index 00000000000..9013ee90db6 --- /dev/null +++ b/docs/about/team.md @@ -0,0 +1,9 @@ +--- +title: Team +--- + + + + diff --git a/docs/about/team/TeamMember.ts b/docs/about/team/TeamMember.ts new file mode 100644 index 00000000000..01fe3771296 --- /dev/null +++ b/docs/about/team/TeamMember.ts @@ -0,0 +1,7 @@ +export interface Member { + readonly name: string; + readonly github: string; + readonly gitlab?: string; + readonly twitter?: string; + readonly roles: readonly string[]; +} diff --git a/docs/about/team/TeamMember.vue b/docs/about/team/TeamMember.vue new file mode 100644 index 00000000000..03514a1f1f0 --- /dev/null +++ b/docs/about/team/TeamMember.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/docs/about/team/TeamPage.vue b/docs/about/team/TeamPage.vue new file mode 100644 index 00000000000..99801f17eba --- /dev/null +++ b/docs/about/team/TeamPage.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/docs/about/team/members.json b/docs/about/team/members.json new file mode 100644 index 00000000000..31018175204 --- /dev/null +++ b/docs/about/team/members.json @@ -0,0 +1,77 @@ +{ + "core": [ + { + "name": "Christopher Quadflieg", + "github": "Shinigami92", + "twitter": "Shini_92", + "roles": ["Code Maintainer"] + }, + { + "name": "Damien Retzinger", + "github": "damienwebdev", + "twitter": "damienwebdev", + "roles": ["Advisor"] + }, + { + "name": "Daniel Bannert", + "github": "prisis", + "twitter": "_prisis_", + "roles": ["Organization Owner"] + }, + { + "name": "Daniel Theuke", + "github": "ST-DDT", + "roles": ["Code Maintainer", "Docs Automation"] + }, + { + "name": "Erica Clark", + "github": "clarkerican", + "twitter": "clarkerican", + "roles": [] + }, + { + "name": "griest", + "github": "griest024", + "gitlab": "griest", + "roles": ["Code Reviewer"] + }, + { + "name": "Jessica Sachs", + "github": "JessicaSachs", + "twitter": "_JessicaSachs", + "roles": ["Press Officer"] + } + ], + "contributors": [ + { + "name": "Eric Cheng", + "github": "import-brain", + "roles": ["Triage", "Contributor"] + }, + { + "name": "Leyla Jähnig", + "github": "xDivisionByZerox", + "roles": ["Contributor"] + }, + { + "name": "Piotr Kuczynski", + "github": "pkuczynski", + "twitter": "PiotrKuczynski", + "roles": ["Contributor"] + } + ], + "previous": [ + { + "name": "Mateus Dadalto", + "github": "MateusDadalto", + "twitter": "MateusD", + "roles": [] + }, + { + "name": "Mo Mahallawy", + "github": "mmahalwy", + "twitter": "mmahalwy", + "roles": [] + } + ] +} diff --git a/netlify.toml b/netlify.toml index e876aa7274a..1095db518c2 100644 --- a/netlify.toml +++ b/netlify.toml @@ -20,3 +20,10 @@ to = "https://stackblitz.com/edit/faker-js-demo?file=index.ts" status = 301 force = true + +# Redirect old update page to new announcement section +[[redirects]] + from = "/update.html" + to = "https://fakerjs.dev/about/announcements/2022-01-14.html" + status = 301 + force = true From c3be3b1945248ed422342b046ad765d252bbac05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Thu, 31 Mar 2022 22:42:37 +0200 Subject: [PATCH 090/130] feat: FakerError (#718) --- src/errors/faker-error.ts | 4 ++++ src/fake.ts | 7 ++++--- src/faker.ts | 5 +++-- src/finance.ts | 3 ++- src/index.ts | 1 + src/mersenne.ts | 7 +++++-- src/random.ts | 3 ++- src/utils/unique.ts | 4 +++- test/fake.spec.ts | 7 ++++--- test/faker.spec.ts | 7 +++++-- test/finance.spec.ts | 5 ++++- test/mersenne.spec.ts | 7 +++++-- test/unique.spec.ts | 11 +++++++++++ 13 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 src/errors/faker-error.ts diff --git a/src/errors/faker-error.ts b/src/errors/faker-error.ts new file mode 100644 index 00000000000..e38bdf470fb --- /dev/null +++ b/src/errors/faker-error.ts @@ -0,0 +1,4 @@ +/** + * An error instance that will be thrown by faker. + */ +export class FakerError extends Error {} diff --git a/src/fake.ts b/src/fake.ts index b47755159b2..d478d01e4e1 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { FakerError } from './errors/faker-error'; /** * Generator method for combining faker methods based on string input. @@ -58,7 +59,7 @@ export class Fake { fake(str: string): string { // if incoming str parameter is not provided, return error message if (typeof str !== 'string' || str.length === 0) { - throw new Error('string parameter is required!'); + throw new FakerError('string parameter is required!'); } // find first matching {{ and }} @@ -88,11 +89,11 @@ export class Fake { const parts = method.split('.'); if (this.faker[parts[0]] == null) { - throw new Error('Invalid module: ' + parts[0]); + throw new FakerError('Invalid module: ' + parts[0]); } if (this.faker[parts[0]][parts[1]] == null) { - throw new Error('Invalid method: ' + parts[0] + '.' + parts[1]); + throw new FakerError('Invalid method: ' + parts[0] + '.' + parts[1]); } // assign the function from the module.function namespace diff --git a/src/faker.ts b/src/faker.ts index 1ace8501ce9..de5c0c426eb 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -7,6 +7,7 @@ import { Datatype } from './datatype'; import { _Date } from './date'; import type { LocaleDefinition } from './definitions'; import { DEFINITIONS } from './definitions'; +import { FakerError } from './errors/faker-error'; import { Fake } from './fake'; import { Finance } from './finance'; import { Git } from './git'; @@ -83,13 +84,13 @@ export class Faker { constructor(opts: FakerOptions) { if (!opts) { - throw new Error( + throw new FakerError( 'Options with at least one entry in locales must be provided' ); } if (Object.keys(opts.locales ?? {}).length === 0) { - throw new Error( + throw new FakerError( 'At least one entry in locales must be provided in the locales parameter' ); } diff --git a/src/finance.ts b/src/finance.ts index 25d44046158..ea71391dd18 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { FakerError } from './errors/faker-error'; import type { Helpers } from './helpers'; import ibanLib from './iban'; @@ -329,7 +330,7 @@ export class Finance { } if (!ibanFormat) { - throw new Error('Country code ' + countryCode + ' not supported.'); + throw new FakerError('Country code ' + countryCode + ' not supported.'); } let s = ''; diff --git a/src/index.ts b/src/index.ts index d1c2cb1d63f..984833f5625 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,6 +26,7 @@ export type { VehicleDefinitions, WordDefinitions, } from './definitions'; +export { FakerError } from './errors/faker-error'; export type { FakerOptions, UsableLocale, UsedLocales } from './faker'; export { Gender } from './name'; export type { GenderType } from './name'; diff --git a/src/mersenne.ts b/src/mersenne.ts index d9044e54441..21f52f6c0ef 100644 --- a/src/mersenne.ts +++ b/src/mersenne.ts @@ -1,3 +1,4 @@ +import { FakerError } from './errors/faker-error'; import Gen from './utils/mersenne'; /** @@ -46,7 +47,9 @@ export class Mersenne { */ seed(S: number): void { if (typeof S !== 'number') { - throw new Error('seed(S) must take numeric argument; is ' + typeof S); + throw new FakerError( + 'seed(S) must take numeric argument; is ' + typeof S + ); } this.gen.initGenrand(S); @@ -60,7 +63,7 @@ export class Mersenne { */ seed_array(A: number[]): void { if (typeof A !== 'object') { - throw new Error( + throw new FakerError( 'seed_array(A) must take array of numbers; is ' + typeof A ); } diff --git a/src/random.ts b/src/random.ts index f41a67fa36d..20d54f5b16b 100644 --- a/src/random.ts +++ b/src/random.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { FakerError } from './errors/faker-error'; import { deprecated } from './internal/deprecated'; /** @@ -527,7 +528,7 @@ export class Random { } if (charsArray.length === 0) { - throw new Error( + throw new FakerError( 'Unable to generate string, because all possible characters are banned.' ); } diff --git a/src/utils/unique.ts b/src/utils/unique.ts index 78d0fdfc13d..2679b3d86d5 100644 --- a/src/utils/unique.ts +++ b/src/utils/unique.ts @@ -1,3 +1,5 @@ +import { FakerError } from '../errors/faker-error'; + export type RecordKey = string | number | symbol; // global results store @@ -41,7 +43,7 @@ function errorMessage( now - opts.startTime, 'ms' ); - throw new Error( + throw new FakerError( code + ' for uniqueness check \n\nMay not be able to generate any more unique values with current settings. \nTry adjusting maxTime or maxRetries parameters for faker.unique()' ); diff --git a/test/fake.spec.ts b/test/fake.spec.ts index 530d09d2861..bf6a2509fca 100644 --- a/test/fake.spec.ts +++ b/test/fake.spec.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; describe('fake', () => { describe('fake()', () => { @@ -32,18 +33,18 @@ describe('fake', () => { expect(() => // @ts-expect-error: The parameter is required faker.fake() - ).toThrowError(Error('string parameter is required!')); + ).toThrowError(new FakerError('string parameter is required!')); }); it('does not allow invalid module name', () => { expect(() => faker.fake('{{foo.bar}}')).toThrowError( - Error('Invalid module: foo') + new FakerError('Invalid module: foo') ); }); it('does not allow invalid method name', () => { expect(() => faker.fake('{{address.foo}}')).toThrowError( - Error('Invalid method: address.foo') + new FakerError('Invalid method: address.foo') ); }); diff --git a/test/faker.spec.ts b/test/faker.spec.ts index 24486b48f24..983a31bd9b4 100644 --- a/test/faker.spec.ts +++ b/test/faker.spec.ts @@ -1,5 +1,6 @@ import { beforeEach, describe, expect, it } from 'vitest'; import { faker, Faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; describe('faker', () => { beforeEach(() => { @@ -12,7 +13,9 @@ describe('faker', () => { // @ts-expect-error: mission options new Faker() ).toThrow( - Error('Options with at least one entry in locales must be provided') + new FakerError( + 'Options with at least one entry in locales must be provided' + ) ); }); @@ -22,7 +25,7 @@ describe('faker', () => { // @ts-expect-error: missing locales new Faker({}) ).toThrow( - Error( + new FakerError( 'At least one entry in locales must be provided in the locales parameter' ) ); diff --git a/test/finance.spec.ts b/test/finance.spec.ts index f5d4521adc6..ce529fe2951 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -1,5 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; import ibanLib from '../src/iban'; import { luhnCheck } from './support/luhnCheck'; @@ -490,7 +491,9 @@ describe('finance', () => { expect(() => faker.finance.iban(false, unsupportedCountryCode) ).toThrowError( - Error(`Country code ${unsupportedCountryCode} not supported.`) + new FakerError( + `Country code ${unsupportedCountryCode} not supported.` + ) ) ); }); diff --git a/test/mersenne.spec.ts b/test/mersenne.spec.ts index e7ca6198966..642731b2488 100644 --- a/test/mersenne.spec.ts +++ b/test/mersenne.spec.ts @@ -1,4 +1,5 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; +import { FakerError } from '../src/errors/faker-error'; import { Mersenne } from '../src/mersenne'; type SeededRun = { @@ -181,7 +182,9 @@ describe('mersenne twister', () => { // @ts-expect-error: non-integer error 'abc' ) - ).toThrowError(Error('seed(S) must take numeric argument; is string')); + ).toThrowError( + new FakerError('seed(S) must take numeric argument; is string') + ); }); it('should throw an error when attempting to seed() a non-integer', () => { @@ -191,7 +194,7 @@ describe('mersenne twister', () => { 'abc' ) ).toThrowError( - Error('seed_array(A) must take array of numbers; is string') + new FakerError('seed_array(A) must take array of numbers; is string') ); }); }); diff --git a/test/unique.spec.ts b/test/unique.spec.ts index f222b7cea00..fab12ba7002 100644 --- a/test/unique.spec.ts +++ b/test/unique.spec.ts @@ -1,5 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; const seededRuns = [ { @@ -120,6 +121,16 @@ describe('unique', () => { }); }).toThrowError(/^Exceeded maxRetries:/); }); + + it('should throw a FakerError instance on error', () => { + expect(() => { + faker.unique(faker.internet.protocol, [], { + maxTime: 5000, + maxRetries: 5, + exclude: ['https', 'http'], + }); + }).toThrowError(FakerError); + }); }); } }); From caa5f162933915d60750c7fcc2fde2eb9dcb1c90 Mon Sep 17 00:00:00 2001 From: Kirill Fedorenko <75907973+rimakan@users.noreply.github.com> Date: Fri, 1 Apr 2022 17:04:11 +0300 Subject: [PATCH 091/130] chore: removed outcommented dead code in commerce.ts (#745) --- src/commerce.ts | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/commerce.ts b/src/commerce.ts index 741a4a5ff2a..79c485b2333 100644 --- a/src/commerce.ts +++ b/src/commerce.ts @@ -89,34 +89,6 @@ export class Commerce { ); } - // TODO @Shinigami92 2022-01-12: unimplemented member functions - - /* - categories (num) { - var categories = []; - - do { - var category = this.faker.random.arrayElement(this.faker.definitions.commerce.department); - if(categories.indexOf(category) === -1) { - categories.push(category); - } - } while(categories.length < num); - - return categories; - }; - - */ - /* - mergeCategories (categories) { - var separator = this.faker.definitions.separator || " &"; - // TODO: find undefined here - categories = categories || this.faker.definitions.commerce.categories; - var commaSeparated = categories.slice(0, -1).join(', '); - - return [commaSeparated, categories[categories.length - 1]].join(separator + " "); - }; - */ - /** * Returns an adjective describing a product. * From bc7bd571d8d6c70b046a3bda23c61c527ddb1d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Fri, 1 Apr 2022 16:10:47 +0200 Subject: [PATCH 092/130] fix: deterministic results for address.nearbyGPSCoordinate (#737) --- src/address.ts | 8 +++++++- test/address.spec.ts | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/address.ts b/src/address.ts index 264b02817fc..a6f54ccae22 100644 --- a/src/address.ts +++ b/src/address.ts @@ -538,7 +538,13 @@ export class Address { // This approach will likely result in a higher density of points near the center. const randomCoord = coordinateWithOffset( coordinate, - degreesToRadians(Math.random() * 360.0), + degreesToRadians( + this.faker.datatype.number({ + min: 0, + max: 360, + precision: 1e-4, + }) + ), radius, isMetric ); diff --git a/test/address.spec.ts b/test/address.spec.ts index 5929f4628cb..1b9877619d9 100644 --- a/test/address.spec.ts +++ b/test/address.spec.ts @@ -29,6 +29,7 @@ const seededRuns = [ cardinalDirection: 'East', cardinalDirectionAbbr: 'E', timeZone: 'Europe/Amsterdam', + nearbyGpsCoordinates: ['-0.0394', '0.0396'], }, }, { @@ -58,6 +59,7 @@ const seededRuns = [ cardinalDirection: 'East', cardinalDirectionAbbr: 'E', timeZone: 'Africa/Casablanca', + nearbyGpsCoordinates: ['-0.0042', '0.0557'], }, }, { @@ -87,6 +89,7 @@ const seededRuns = [ cardinalDirection: 'West', cardinalDirectionAbbr: 'W', timeZone: 'Asia/Magadan', + nearbyGpsCoordinates: ['0.0503', '-0.0242'], }, }, ]; @@ -333,6 +336,17 @@ describe('address', () => { expect(timeZone).toEqual(expectations.timeZone); }); }); + + describe('nearbyGPSCoordinate()', () => { + it('returns expected coordinates', () => { + faker.seed(seed); + + // this input is required for all expected results for this function + const coordsInput: [number, number] = [0, 0]; + const coords = faker.address.nearbyGPSCoordinate(coordsInput); + expect(coords).toEqual(expectations.nearbyGpsCoordinates); + }); + }); }); } From 184e669c0f9d20616c9b6200f814b5b184b2d6bb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 14:21:51 +0000 Subject: [PATCH 093/130] chore(deps): update dependency vite to ~2.9.1 (#741) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index a944d549985..a291a30c9f8 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "typedoc-plugin-missing-exports": "~0.22.6", "typescript": "~4.6.3", "validator": "~13.7.0", - "vite": "~2.9.0", + "vite": "~2.9.1", "vitepress": "~0.22.3", "vitest": "~0.8.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ad84b509fc..c62140d06f3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,7 +33,7 @@ specifiers: typedoc-plugin-missing-exports: ~0.22.6 typescript: ~4.6.3 validator: ~13.7.0 - vite: ~2.9.0 + vite: ~2.9.1 vitepress: ~0.22.3 vitest: ~0.8.0 @@ -70,7 +70,7 @@ devDependencies: typedoc-plugin-missing-exports: 0.22.6_typedoc@0.22.13 typescript: 4.6.3 validator: 13.7.0 - vite: 2.9.0 + vite: 2.9.1 vitepress: 0.22.3 vitest: 0.8.0_@vitest+ui@0.8.0+c8@7.11.0 @@ -560,14 +560,14 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/2.2.4_vite@2.9.0+vue@3.2.31: + /@vitejs/plugin-vue/2.2.4_vite@2.9.1+vue@3.2.31: resolution: {integrity: sha512-ev9AOlp0ljCaDkFZF3JwC/pD2N4Hh+r5srl5JHM6BKg5+99jiiK0rE/XaRs3pVm1wzyKkjUy/StBSoXX5fFzcw==} engines: {node: '>=12.0.0'} peerDependencies: vite: ^2.5.10 vue: ^3.2.25 dependencies: - vite: 2.9.0 + vite: 2.9.1 vue: 3.2.31 dev: true @@ -4374,8 +4374,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite/2.9.0: - resolution: {integrity: sha512-5NAnNqzPmZzJvrswZGeTS2JHrBGIzIWJA2hBTTMYuoBVEMh0xwE0b5yyIXFxf7F07hrK4ugX2LJ7q6t7iIbd4Q==} + /vite/2.9.1: + resolution: {integrity: sha512-vSlsSdOYGcYEJfkQ/NeLXgnRv5zZfpAsdztkIrs7AZHV8RCMZQkwjo4DS5BnrYTqoWqLoUe1Cah4aVO4oNNqCQ==} engines: {node: '>=12.2.0'} hasBin: true peerDependencies: @@ -4405,9 +4405,9 @@ packages: dependencies: '@docsearch/css': 3.0.0 '@docsearch/js': 3.0.0 - '@vitejs/plugin-vue': 2.2.4_vite@2.9.0+vue@3.2.31 + '@vitejs/plugin-vue': 2.2.4_vite@2.9.1+vue@3.2.31 prismjs: 1.27.0 - vite: 2.9.0 + vite: 2.9.1 vue: 3.2.31 transitivePeerDependencies: - '@algolia/client-search' @@ -4446,7 +4446,7 @@ packages: local-pkg: 0.4.1 tinypool: 0.1.2 tinyspy: 0.3.0 - vite: 2.9.0 + vite: 2.9.1 transitivePeerDependencies: - less - sass From 6e6a878a2e7021631ca7558ce199f70ac63a5b32 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 16:29:49 +0200 Subject: [PATCH 094/130] chore(deps): update pnpm to v6.32.4 (#742) Co-authored-by: Renovate Bot --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a291a30c9f8..960b0ccc44a 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "vitepress": "~0.22.3", "vitest": "~0.8.0" }, - "packageManager": "pnpm@6.32.3", + "packageManager": "pnpm@6.32.4", "engines": { "node": ">=14.0.0", "npm": ">=7.0.0" From a55d6176eeefde49784e8e3b9a4f88a6ba3d5925 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Fri, 1 Apr 2022 16:35:44 +0200 Subject: [PATCH 095/130] chore: update codeowners file (#671) --- .github/CODEOWNERS | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3cb46b54643..26aa1f94a70 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,20 +1,20 @@ # These owners will be the default owners for everything in the repo. -# Unless a later match takes precedence, @faker-js/maintainers will +# Unless a later match takes precedence, @faker-js/maintainers will # be requested for review when someone opens a pull request. -* @faker-js/maintainers +* @faker-js/maintainers # ================================================ # Docs owners ... # ================================================ -/docs/ @faker-js/maintainers-docs -netlify.toml @faker-js/maintainers-docs -README.md @faker-js/maintainers-docs @faker-js/maintainers -CONTRIBUTING.md @faker-js/maintainers-docs +/docs/ @faker-js/maintainers-docs @faker-js/maintainers +netlify.toml @faker-js/maintainers-docs @faker-js/maintainers +README.md @faker-js/maintainers-docs @faker-js/maintainers +CONTRIBUTING.md @faker-js/maintainers-docs @faker-js/maintainers # ================================================ # CODEOWNERS owners ... # ================================================ -/.github/CODEOWNERS @faker-js/maintainers +/.github/CODEOWNERS @faker-js/maintainers From 802998bb0856e96a712177c9c70148a9e48c6812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:00:25 +0200 Subject: [PATCH 096/130] refactor(address): drop local references of faker modules (#748) --- src/address.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/address.ts b/src/address.ts index a6f54ccae22..d8dfbbbb2ee 100644 --- a/src/address.ts +++ b/src/address.ts @@ -1,8 +1,4 @@ import type { Faker } from '.'; -import type { Fake } from './fake'; -import type { Helpers } from './helpers'; - -let f: Fake['fake']; /** * Converts degrees to radians. @@ -77,12 +73,7 @@ function coordinateWithOffset( * Module to generate addresses and locations. */ export class Address { - readonly Helpers: Helpers; - constructor(private readonly faker: Faker) { - f = this.faker.fake; - this.Helpers = this.faker.helpers; - // Bind `this` so namespaced is working correctly for (const name of Object.getOwnPropertyNames(Address.prototype)) { if (name === 'constructor' || typeof this[name] !== 'function') { @@ -116,7 +107,7 @@ export class Address { format = this.faker.random.arrayElement(localeFormat); } } - return this.Helpers.replaceSymbols(format); + return this.faker.helpers.replaceSymbols(format); } /** @@ -177,7 +168,7 @@ export class Address { format = this.faker.datatype.number(formats.length - 1); } - return f(formats[format]); + return this.faker.fake(formats[format]); } /** @@ -256,19 +247,19 @@ export class Address { switch (this.faker.datatype.number(2)) { case 0: address = - this.Helpers.replaceSymbolWithNumber('#####') + + this.faker.helpers.replaceSymbolWithNumber('#####') + ' ' + this.faker.address.streetName(); break; case 1: address = - this.Helpers.replaceSymbolWithNumber('####') + + this.faker.helpers.replaceSymbolWithNumber('####') + ' ' + this.faker.address.streetName(); break; case 2: address = - this.Helpers.replaceSymbolWithNumber('###') + + this.faker.helpers.replaceSymbolWithNumber('###') + ' ' + this.faker.address.streetName(); break; @@ -309,7 +300,7 @@ export class Address { * faker.address.secondaryAddress() // 'Apt. 861' */ secondaryAddress(): string { - return this.Helpers.replaceSymbolWithNumber( + return this.faker.helpers.replaceSymbolWithNumber( this.faker.random.arrayElement( this.faker.definitions.address.secondary_address ) From 0f517eabe8906c01763b0b3e63a3eecfb8ad47e6 Mon Sep 17 00:00:00 2001 From: Sergey Gavshin Date: Sat, 2 Apr 2022 00:05:00 +0700 Subject: [PATCH 097/130] chore: downgrade min npm version from 7 to 6 (#744) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 960b0ccc44a..514b58385a3 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,6 @@ "packageManager": "pnpm@6.32.4", "engines": { "node": ">=14.0.0", - "npm": ">=7.0.0" + "npm": ">=6.0.0" } } From fb22bb1b2c0a87f73e87aab2c712047065da1e89 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 1 Apr 2022 19:19:24 +0200 Subject: [PATCH 098/130] chore: remove useless fallback to undefined (#749) --- src/faker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/faker.ts b/src/faker.ts index de5c0c426eb..7b74d58c9ac 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -96,8 +96,8 @@ export class Faker { } this.locales = opts.locales; - this.locale = this.locale || opts.locale || 'en'; - this.localeFallback = this.localeFallback || opts.localeFallback || 'en'; + this.locale = opts.locale || 'en'; + this.localeFallback = opts.localeFallback || 'en'; this.loadDefinitions(); } From 290b1b6085fe7420d180f27639390cbcb164bdd6 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 1 Apr 2022 21:24:45 +0200 Subject: [PATCH 099/130] chore: remove invalid country code files (#752) --- src/definitions/address.ts | 4 +- src/locales/fa/address/country_code.ts | 252 ------------------ src/locales/fa/address/index.ts | 2 - src/locales/he/address/country_code.ts | 1 - .../he/address/country_code_alpha_3.ts | 252 ------------------ src/locales/he/address/index.ts | 4 - test/all_functional.spec.ts | 1 - 7 files changed, 2 insertions(+), 514 deletions(-) delete mode 100644 src/locales/fa/address/country_code.ts delete mode 100644 src/locales/he/address/country_code.ts delete mode 100644 src/locales/he/address/country_code_alpha_3.ts diff --git a/src/definitions/address.ts b/src/definitions/address.ts index a5bf2d1c861..d34bc0bd74f 100644 --- a/src/definitions/address.ts +++ b/src/definitions/address.ts @@ -72,11 +72,11 @@ export interface AddressDefinitions { secondary_address: string[]; /** - * The ISO-3166-1 ALPHA-2 country codes + * The ISO-3166-1 ALPHA-2 country codes related to this locale. */ country_code: string[]; /** - * The ISO-3166-1 ALPHA-3 country codes + * The ISO-3166-1 ALPHA-3 country codes related to this locale. */ country_code_alpha_3: string[]; diff --git a/src/locales/fa/address/country_code.ts b/src/locales/fa/address/country_code.ts deleted file mode 100644 index 8aa39c2ffaa..00000000000 --- a/src/locales/fa/address/country_code.ts +++ /dev/null @@ -1,252 +0,0 @@ -export default [ - 'AD', - 'AE', - 'AF', - 'AG', - 'AI', - 'AL', - 'AM', - 'AO', - 'AQ', - 'AR', - 'AS', - 'AT', - 'AU', - 'AW', - 'AX', - 'AZ', - 'BA', - 'BB', - 'BD', - 'BE', - 'BF', - 'BG', - 'BH', - 'BI', - 'BJ', - 'BL', - 'BM', - 'BN', - 'BO', - 'BQ', - 'BQ', - 'BR', - 'BS', - 'BT', - 'BV', - 'BW', - 'BY', - 'BZ', - 'CA', - 'CC', - 'CD', - 'CF', - 'CG', - 'CH', - 'CI', - 'CK', - 'CL', - 'CM', - 'CN', - 'CO', - 'CR', - 'CU', - 'CV', - 'CW', - 'CX', - 'CY', - 'CZ', - 'DE', - 'DJ', - 'DK', - 'DM', - 'DO', - 'DZ', - 'EC', - 'EE', - 'EG', - 'EH', - 'ER', - 'ES', - 'ET', - 'FI', - 'FJ', - 'FK', - 'FM', - 'FO', - 'FR', - 'GA', - 'GB', - 'GD', - 'GE', - 'GF', - 'GG', - 'GH', - 'GI', - 'GL', - 'GM', - 'GN', - 'GP', - 'GQ', - 'GR', - 'GS', - 'GT', - 'GU', - 'GW', - 'GY', - 'HK', - 'HM', - 'HN', - 'HR', - 'HT', - 'HU', - 'ID', - 'IE', - 'IL', - 'IM', - 'IN', - 'IO', - 'IQ', - 'IR', - 'IS', - 'IT', - 'JE', - 'JM', - 'JO', - 'JP', - 'KE', - 'KG', - 'KH', - 'KI', - 'KM', - 'KN', - 'KP', - 'KR', - 'KW', - 'KY', - 'KZ', - 'LA', - 'LB', - 'LC', - 'LI', - 'LK', - 'LR', - 'LS', - 'LT', - 'LU', - 'LV', - 'LY', - 'MA', - 'MC', - 'MD', - 'ME', - 'MF', - 'MG', - 'MH', - 'MK', - 'ML', - 'MM', - 'MN', - 'MO', - 'MP', - 'MQ', - 'MR', - 'MS', - 'MT', - 'MU', - 'MV', - 'MW', - 'MX', - 'MY', - 'MZ', - 'NA', - 'NC', - 'NE', - 'NF', - 'NG', - 'NI', - 'NL', - 'NO', - 'NP', - 'NR', - 'NU', - 'NZ', - 'OM', - 'PA', - 'PE', - 'PF', - 'PG', - 'PH', - 'PK', - 'PL', - 'PM', - 'PN', - 'PR', - 'PS', - 'PT', - 'PW', - 'PY', - 'QA', - 'RE', - 'RO', - 'RS', - 'RU', - 'RW', - 'SA', - 'SB', - 'SC', - 'SD', - 'SE', - 'SG', - 'SH', - 'SI', - 'SJ', - 'SK', - 'SL', - 'SM', - 'SN', - 'SO', - 'SR', - 'SS', - 'ST', - 'SV', - 'SX', - 'SY', - 'SZ', - 'TC', - 'TD', - 'TF', - 'TG', - 'TH', - 'TJ', - 'TK', - 'TL', - 'TM', - 'TN', - 'TO', - 'TR', - 'TT', - 'TV', - 'TW', - 'TZ', - 'UA', - 'UG', - 'UM', - 'US', - 'UY', - 'UZ', - 'VA', - 'VC', - 'VE', - 'VG', - 'VI', - 'VN', - 'VU', - 'WF', - 'WS', - 'YE', - 'YT', - 'ZA', - 'ZM', - 'ZW', -]; diff --git a/src/locales/fa/address/index.ts b/src/locales/fa/address/index.ts index 1db7305e731..64b49f9847b 100644 --- a/src/locales/fa/address/index.ts +++ b/src/locales/fa/address/index.ts @@ -9,7 +9,6 @@ import city_name from './city_name'; import city_prefix from './city_prefix'; import city_suffix from './city_suffix'; import country from './country'; -import country_code from './country_code'; import default_country from './default_country'; import direction from './direction'; import postcode from './postcode'; @@ -27,7 +26,6 @@ const address = { city_prefix, city_suffix, country, - country_code, default_country, direction, postcode, diff --git a/src/locales/he/address/country_code.ts b/src/locales/he/address/country_code.ts deleted file mode 100644 index 1c4f017e663..00000000000 --- a/src/locales/he/address/country_code.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['']; diff --git a/src/locales/he/address/country_code_alpha_3.ts b/src/locales/he/address/country_code_alpha_3.ts deleted file mode 100644 index 20708d640bd..00000000000 --- a/src/locales/he/address/country_code_alpha_3.ts +++ /dev/null @@ -1,252 +0,0 @@ -export default [ - 'BGD', - 'BEL', - 'BFA', - 'BGR', - 'BIH', - 'BRB', - 'WLF', - 'BLM', - 'BMU', - 'BRN', - 'BOL', - 'BHR', - 'BDI', - 'BEN', - 'BTN', - 'JAM', - 'BVT', - 'BWA', - 'WSM', - 'BES', - 'BRA', - 'BHS', - 'JEY', - 'BLR', - 'BLZ', - 'RUS', - 'RWA', - 'SRB', - 'TLS', - 'REU', - 'TKM', - 'TJK', - 'ROU', - 'TKL', - 'GNB', - 'GUM', - 'GTM', - 'SGS', - 'GRC', - 'GNQ', - 'GLP', - 'JPN', - 'GUY', - 'GGY', - 'GUF', - 'GEO', - 'GRD', - 'GBR', - 'GAB', - 'SLV', - 'GIN', - 'GMB', - 'GRL', - 'GIB', - 'GHA', - 'OMN', - 'TUN', - 'JOR', - 'HRV', - 'HTI', - 'HUN', - 'HKG', - 'HND', - 'HMD', - 'VEN', - 'PRI', - 'PSE', - 'PLW', - 'PRT', - 'SJM', - 'PRY', - 'IRQ', - 'PAN', - 'PYF', - 'PNG', - 'PER', - 'PAK', - 'PHL', - 'PCN', - 'POL', - 'SPM', - 'ZMB', - 'ESH', - 'EST', - 'EGY', - 'ZAF', - 'ECU', - 'ITA', - 'VNM', - 'SLB', - 'ETH', - 'SOM', - 'ZWE', - 'SAU', - 'ESP', - 'ERI', - 'MNE', - 'MDA', - 'MDG', - 'MAF', - 'MAR', - 'MCO', - 'UZB', - 'MMR', - 'MLI', - 'MAC', - 'MNG', - 'MHL', - 'MKD', - 'MUS', - 'MLT', - 'MWI', - 'MDV', - 'MTQ', - 'MNP', - 'MSR', - 'MRT', - 'IMN', - 'UGA', - 'TZA', - 'MYS', - 'MEX', - 'ISR', - 'FRA', - 'IOT', - 'SHN', - 'FIN', - 'FJI', - 'FLK', - 'FSM', - 'FRO', - 'NIC', - 'NLD', - 'NOR', - 'NAM', - 'VUT', - 'NCL', - 'NER', - 'NFK', - 'NGA', - 'NZL', - 'NPL', - 'NRU', - 'NIU', - 'COK', - 'XKX', - 'CIV', - 'CHE', - 'COL', - 'CHN', - 'CMR', - 'CHL', - 'CCK', - 'CAN', - 'COG', - 'CAF', - 'COD', - 'CZE', - 'CYP', - 'CXR', - 'CRI', - 'CUW', - 'CPV', - 'CUB', - 'SWZ', - 'SYR', - 'SXM', - 'KGZ', - 'KEN', - 'SSD', - 'SUR', - 'KIR', - 'KHM', - 'KNA', - 'COM', - 'STP', - 'SVK', - 'KOR', - 'SVN', - 'PRK', - 'KWT', - 'SEN', - 'SMR', - 'SLE', - 'SYC', - 'KAZ', - 'CYM', - 'SGP', - 'SWE', - 'SDN', - 'DOM', - 'DMA', - 'DJI', - 'DNK', - 'VGB', - 'DEU', - 'YEM', - 'DZA', - 'USA', - 'URY', - 'MYT', - 'UMI', - 'LBN', - 'LCA', - 'LAO', - 'TUV', - 'TWN', - 'TTO', - 'TUR', - 'LKA', - 'LIE', - 'LVA', - 'TON', - 'LTU', - 'LUX', - 'LBR', - 'LSO', - 'THA', - 'ATF', - 'TGO', - 'TCD', - 'TCA', - 'LBY', - 'VAT', - 'VCT', - 'ARE', - 'AND', - 'ATG', - 'AFG', - 'AIA', - 'VIR', - 'ISL', - 'IRN', - 'ARM', - 'ALB', - 'AGO', - 'ATA', - 'ASM', - 'ARG', - 'AUS', - 'AUT', - 'ABW', - 'IND', - 'ALA', - 'AZE', - 'IRL', - 'IDN', - 'UKR', - 'QAT', - 'MOZ', -]; diff --git a/src/locales/he/address/index.ts b/src/locales/he/address/index.ts index b5c5cf38310..04ed969dd15 100644 --- a/src/locales/he/address/index.ts +++ b/src/locales/he/address/index.ts @@ -8,8 +8,6 @@ import city from './city'; import city_prefix from './city_prefix'; import city_suffix from './city_suffix'; import country from './country'; -import country_code from './country_code'; -import country_code_alpha_3 from './country_code_alpha_3'; import county from './county'; import default_country from './default_country'; import direction from './direction'; @@ -30,8 +28,6 @@ const address = { city_prefix, city_suffix, country, - country_code, - country_code_alpha_3, county, default_country, direction, diff --git a/test/all_functional.spec.ts b/test/all_functional.spec.ts index 548f06c582f..a307e1fc43b 100644 --- a/test/all_functional.spec.ts +++ b/test/all_functional.spec.ts @@ -24,7 +24,6 @@ const BROKEN_LOCALE_METHODS = { address: { cityPrefix: ['pt_BR', 'pt_PT'], citySuffix: ['pt_PT'], - countryCode: ['he'], state: ['az', 'cz', 'nb_NO', 'sk'], stateAbbr: ['cz', 'sk'], }, From 492f390f621657c05538ceb6d8b9b5c8783b8d1f Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 2 Apr 2022 13:06:11 +0200 Subject: [PATCH 100/130] chore: fix warning in helpers replaceCreditCardSymbols (#755) --- src/helpers.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 6ed51ec5c1a..051de5eaca5 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -273,7 +273,6 @@ export class Helpers { * faker.helpers.replaceCreditCardSymbols() // '6453-4876-8626-8995-3779' * faker.helpers.replaceCreditCardSymbols('1234-[4-9]-##!!-L') // '1234-9-5298-2' */ - replaceCreditCardSymbols( string: string = '6453-####-####-####-###L', symbol: string = '#' @@ -304,9 +303,7 @@ export class Helpers { .split('') .map((num) => parseInt(num)); const checkNum = getCheckBit(numberList); - // TODO @Shinigami92 2022-01-11: I assume this should be converted to string - // @ts-expect-error - return string.replace('L', checkNum); + return string.replace('L', String(checkNum)); } /** From f520968e4621c2830c2314f9a59cd1b071f58169 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 2 Apr 2022 13:11:21 +0200 Subject: [PATCH 101/130] test: add a general country iban test (#746) --- test/finance_iban.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/finance_iban.spec.ts b/test/finance_iban.spec.ts index b3087a6a3e9..6caaa1a2c23 100644 --- a/test/finance_iban.spec.ts +++ b/test/finance_iban.spec.ts @@ -9,6 +9,20 @@ describe('finance_iban', () => { // Create and log-back the seed for debug purposes faker.seed(Math.ceil(Math.random() * 1_000_000_000)); + describe('generic IBAN country checks', () => { + it.each( + faker.finance.ibanLib.formats.map( + (entry) => entry.country as string + ) as string[] + )('%s', (country) => { + expect(country).toMatch(/^[A-Z]{2}$/); + const actual = faker.finance.iban(true, country); + + expect(actual).toMatch(new RegExp(`^${country}`)); + expect(actual).satisfy(validator.isIBAN); + }); + }); + describe(`random seeded tests for seed ${JSON.stringify( faker.seedValue )}`, () => { From 4a7760b35305521f31c6a07c22659ab488c44f9a Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 2 Apr 2022 22:02:23 +0200 Subject: [PATCH 102/130] chore: add updateLocaleFileHook to generateLocales (#756) --- scripts/generateLocales.ts | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index 2167caa93ed..f4c1f50d50a 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -1,3 +1,17 @@ +/** + * This file contains a script that can be used to update the following files: + * + * - `src/locale/.ts` + * - `src/locales//index.ts` + * - `src/locales///index.ts` + * - `src/docs/api/localization.md` + * + * If you wish to edit all/specific locale data files you can do so using the + * `updateLocaleFileHook()` method. + * Please remember to not commit your temporary update code. + * + * Run this script using `pnpm run generate:locales` + */ import { lstatSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; import { resolve } from 'node:path'; import type { Options } from 'prettier'; @@ -176,6 +190,7 @@ function generateRecursiveModuleIndexes( submodules = removeIndexTs(submodules); for (const submodule of submodules) { const pathModule = resolve(path, submodule); + updateLocaleFile(pathModule); // Only process sub folders recursively if (lstatSync(pathModule).isDirectory()) { let moduleDefinition = @@ -207,6 +222,41 @@ function generateRecursiveModuleIndexes( } } +/** + * Intermediate helper function to allow selectively updating locale data files. + * Use the `updateLocaleFileHook()` method to temporarily add your custom per file processing/update logic. + * + * @param filePath The full file path to the file. + */ +function updateLocaleFile(filePath: string): void { + if (lstatSync(filePath).isFile()) { + const pathParts = filePath + .substring(pathLocales.length + 1, filePath.length - 3) + .split(/[\\\/]/); + const locale = pathParts[0]; + pathParts.splice(0, 1); + updateLocaleFileHook(filePath, locale, pathParts); + } +} + +/** + * Use this hook method to selectively update locale data files (not for index.ts files). + * This method is intended to be temporarily overwritten for one-time updates. + * + * @param filePath The full file path to the file. + * @param locale The locale for that file. + * @param localePath The locale path parts (after the locale). + */ +function updateLocaleFileHook( + filePath: string, + locale: string, + localePath: string[] +): void { + if (filePath === 'never') { + console.log(filePath + ' <-> ' + locale + ' @ ' + localePath.join(' -> ')); + } +} + // Start of actual logic const locales = readdirSync(pathLocales); From a946435d6f5bbb9552aa4cc4226174e5f94db49a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Apr 2022 12:56:23 +0200 Subject: [PATCH 103/130] chore(deps): update devdependencies (#762) --- package.json | 4 +- pnpm-lock.yaml | 148 ++++++++++++++++++++++++------------------------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 514b58385a3..51403e949a3 100644 --- a/package.json +++ b/package.json @@ -99,12 +99,12 @@ "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.3", - "esbuild": "~0.14.29", + "esbuild": "~0.14.30", "eslint": "~8.12.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", "eslint-gitignore": "~0.1.0", - "eslint-plugin-jsdoc": "~38.1.4", + "eslint-plugin-jsdoc": "~38.1.6", "eslint-plugin-prettier": "~4.0.0", "esno": "~0.14.1", "lint-staged": "~12.3.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c62140d06f3..6ff0625a523 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,12 +12,12 @@ specifiers: c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.3 - esbuild: ~0.14.29 + esbuild: ~0.14.30 eslint: ~8.12.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 eslint-gitignore: ~0.1.0 - eslint-plugin-jsdoc: ~38.1.4 + eslint-plugin-jsdoc: ~38.1.6 eslint-plugin-prettier: ~4.0.0 esno: ~0.14.1 lint-staged: ~12.3.7 @@ -49,12 +49,12 @@ devDependencies: c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.3 - esbuild: 0.14.29 + esbuild: 0.14.30 eslint: 8.12.0 eslint-config-prettier: 8.5.0_eslint@8.12.0 eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.12.0 - eslint-plugin-jsdoc: 38.1.4_eslint@8.12.0 + eslint-plugin-jsdoc: 38.1.6_eslint@8.12.0 eslint-plugin-prettier: 4.0.0_b253a92c95b42c3296c682f11cccb3bd esno: 0.14.1 lint-staged: 12.3.7 @@ -1659,8 +1659,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.14.29: - resolution: {integrity: sha512-tJuaN33SVZyiHxRaVTo1pwW+rn3qetJX/SRuc/83rrKYtyZG0XfsQ1ao1nEudIt9w37ZSNXR236xEfm2C43sbw==} + /esbuild-android-64/0.14.30: + resolution: {integrity: sha512-vdJ7t8A8msPfKpYUGUV/KaTQRiZ0vDa2XSTlzXVkGGVHLKPeb85PBUtYJcEgw3htW3IdX5i1t1IMdQCwJJgNAg==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1668,8 +1668,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.29: - resolution: {integrity: sha512-D74dCv6yYnMTlofVy1JKiLM5JdVSQd60/rQfJSDP9qvRAI0laPXIG/IXY1RG6jobmFMUfL38PbFnCqyI/6fPXg==} + /esbuild-android-arm64/0.14.30: + resolution: {integrity: sha512-BdgGfxeA5hBQNErLr7BWJUA8xjflEfyaARICy8e0OJYNSAwDbEzOf8LyiKWSrDcgV129mWhi3VpbNQvOIDEHcg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1677,8 +1677,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.29: - resolution: {integrity: sha512-+CJaRvfTkzs9t+CjGa0Oa28WoXa7EeLutQhxus+fFcu0MHhsBhlmeWHac3Cc/Sf/xPi1b2ccDFfzGYJCfV0RrA==} + /esbuild-darwin-64/0.14.30: + resolution: {integrity: sha512-VRaOXMMrsG5n53pl4qFZQdXy2+E0NoLP/QH3aDUI0+bQP+ZHDmbINKcDy2IX7GVFI9kqPS18iJNAs5a6/G2LZg==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1686,8 +1686,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.29: - resolution: {integrity: sha512-5Wgz/+zK+8X2ZW7vIbwoZ613Vfr4A8HmIs1XdzRmdC1kG0n5EG5fvKk/jUxhNlrYPx1gSY7XadQ3l4xAManPSw==} + /esbuild-darwin-arm64/0.14.30: + resolution: {integrity: sha512-qDez+fHMOrO9Oc9qjt/x+sy09RJVh62kik5tVybKRLmezeV4qczM9/sAYY57YN0aWLdHbcCj2YqJUWYJNsgKnw==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1695,8 +1695,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.29: - resolution: {integrity: sha512-VTfS7Bm9QA12JK1YXF8+WyYOfvD7WMpbArtDj6bGJ5Sy5xp01c/q70Arkn596aGcGj0TvQRplaaCIrfBG1Wdtg==} + /esbuild-freebsd-64/0.14.30: + resolution: {integrity: sha512-mec1jENcImVVagddZlGWsdAUwBnzR5cgnhzCxv+9fSMxKbx1uZYLLUAnLPp8m/i934zrumR1xGjJ5VoWdPlI2w==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -1704,8 +1704,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.29: - resolution: {integrity: sha512-WP5L4ejwLWWvd3Fo2J5mlXvG3zQHaw5N1KxFGnUc4+2ZFZknP0ST63i0IQhpJLgEJwnQpXv2uZlU1iWZjFqEIg==} + /esbuild-freebsd-arm64/0.14.30: + resolution: {integrity: sha512-cpjbTs6Iok/AfeB0JgTzyUJTMStC1SQULmany5nHx6S4GTkSgaAHuJzZO0GcVWqghI4e0YL/bjXAhN5Mn6feNw==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -1713,8 +1713,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.29: - resolution: {integrity: sha512-4myeOvFmQBWdI2U1dEBe2DCSpaZyjdQtmjUY11Zu2eQg4ynqLb8Y5mNjNU9UN063aVsCYYfbs8jbken/PjyidA==} + /esbuild-linux-32/0.14.30: + resolution: {integrity: sha512-liIONVT4F2kZmOMwtwASqZ8WkIjb5HHBR9HUffdHiuotSTF3CyZO+EJf+Og+SYYuuVIvt0qHNSFjBA/iSESteQ==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -1722,8 +1722,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.29: - resolution: {integrity: sha512-iaEuLhssReAKE7HMwxwFJFn7D/EXEs43fFy5CJeA4DGmU6JHh0qVJD2p/UP46DvUXLRKXsXw0i+kv5TdJ1w5pg==} + /esbuild-linux-64/0.14.30: + resolution: {integrity: sha512-LUnpzoMpRqFON5En4qEj6NWiyH6a1K+Y2qYNKrCy5qPTjDoG/EWeqMz69n8Uv7pRuvDKl3FNGJ1dufTrA5i0sw==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -1731,8 +1731,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.29: - resolution: {integrity: sha512-OXa9D9QL1hwrAnYYAHt/cXAuSCmoSqYfTW/0CEY0LgJNyTxJKtqc5mlwjAZAvgyjmha0auS/sQ0bXfGf2wAokQ==} + /esbuild-linux-arm/0.14.30: + resolution: {integrity: sha512-97T+bbXnpqf7mfIG49UR7ZSJFGgvc22byn74qw3Kx2GDCBSQoVFjyWuKOHGXp8nXk3XYrdFF+mQ8yQ7aNsgQvg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -1740,8 +1740,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.29: - resolution: {integrity: sha512-KYf7s8wDfUy+kjKymW3twyGT14OABjGHRkm9gPJ0z4BuvqljfOOUbq9qT3JYFnZJHOgkr29atT//hcdD0Pi7Mw==} + /esbuild-linux-arm64/0.14.30: + resolution: {integrity: sha512-DHZHn6FK5q/KL0fpNT/0jE38Nnyk2rXxKE9WENi95EXtqfOLPgE8tzjTZQNgpr61R95QX4ymQU26ni3IZk8buQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -1749,8 +1749,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.29: - resolution: {integrity: sha512-05jPtWQMsZ1aMGfHOvnR5KrTvigPbU35BtuItSSWLI2sJu5VrM8Pr9Owym4wPvA4153DFcOJ1EPN/2ujcDt54g==} + /esbuild-linux-mips64le/0.14.30: + resolution: {integrity: sha512-fLUzTFZ7uknC0aPTk7/lM7NmaG/9ZqE3SaHEphcaM009SZK/mDOvZugWi1ss6WGNhk13dUrhkfHcc4FSb9hYhg==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -1758,8 +1758,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.29: - resolution: {integrity: sha512-FYhBqn4Ir9xG+f6B5VIQVbRuM4S6qwy29dDNYFPoxLRnwTEKToIYIUESN1qHyUmIbfO0YB4phG2JDV2JDN9Kgw==} + /esbuild-linux-ppc64le/0.14.30: + resolution: {integrity: sha512-2Oudm2WEfj0dNU9bzIl5L/LrsMEmHWsOsYgJJqu8fDyUDgER+J1d33qz3cUdjsJk7gAENayIxDSpsuCszx0w3A==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -1767,8 +1767,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.29: - resolution: {integrity: sha512-eqZMqPehkb4nZcffnuOpXJQdGURGd6GXQ4ZsDHSWyIUaA+V4FpMBe+5zMPtXRD2N4BtyzVvnBko6K8IWWr36ew==} + /esbuild-linux-riscv64/0.14.30: + resolution: {integrity: sha512-RPMucPW47rV4t2jlelaE948iCRtbZf5RhifxSwzlpM1Mqdyu99MMNK0w4jFreGTmLN+oGomxIOxD6n+2E/XqHw==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -1776,8 +1776,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.29: - resolution: {integrity: sha512-o7EYajF1rC/4ho7kpSG3gENVx0o2SsHm7cJ5fvewWB/TEczWU7teDgusGSujxCYcMottE3zqa423VTglNTYhjg==} + /esbuild-linux-s390x/0.14.30: + resolution: {integrity: sha512-OZ68r7ok6qO7hdwrwQn2p5jbIRRcUcVaAykB7e0uCA0ODwfeGunILM6phJtq2Oz4dlEEFvd+tSuma3paQKwt+A==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -1785,8 +1785,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.29: - resolution: {integrity: sha512-/esN6tb6OBSot6+JxgeOZeBk6P8V/WdR3GKBFeFpSqhgw4wx7xWUqPrdx4XNpBVO7X4Ipw9SAqgBrWHlXfddww==} + /esbuild-netbsd-64/0.14.30: + resolution: {integrity: sha512-iyejQUKn0TzpPkufq8pSCxOg9NheycQbMbPCmjefTe9wYuUlBt1TcHvdoJnYbQzsAhAh1BNq+s0ycRsIJFZzaQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -1797,11 +1797,11 @@ packages: /esbuild-node-loader/0.6.5: resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} dependencies: - esbuild: 0.14.29 + esbuild: 0.14.30 dev: true - /esbuild-openbsd-64/0.14.29: - resolution: {integrity: sha512-jUTdDzhEKrD0pLpjmk0UxwlfNJNg/D50vdwhrVcW/D26Vg0hVbthMfb19PJMatzclbK7cmgk1Nu0eNS+abzoHw==} + /esbuild-openbsd-64/0.14.30: + resolution: {integrity: sha512-UyK1MTMcy4j5fH260fsE1o6MVgWNhb62eCK2yCKCRazZv8Nqdc2WiP9ygjWidmEdCDS+A6MuVp9ozk9uoQtQpA==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -1809,16 +1809,16 @@ packages: dev: true optional: true - /esbuild-register/3.3.2_esbuild@0.14.29: + /esbuild-register/3.3.2_esbuild@0.14.30: resolution: {integrity: sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==} peerDependencies: esbuild: '>=0.12 <1' dependencies: - esbuild: 0.14.29 + esbuild: 0.14.30 dev: true - /esbuild-sunos-64/0.14.29: - resolution: {integrity: sha512-EfhQN/XO+TBHTbkxwsxwA7EfiTHFe+MNDfxcf0nj97moCppD9JHPq48MLtOaDcuvrTYOcrMdJVeqmmeQ7doTcg==} + /esbuild-sunos-64/0.14.30: + resolution: {integrity: sha512-aQRtRTNKHB4YuG+xXATe5AoRTNY48IJg5vjE8ElxfmjO9+KdX7MHFkTLhlKevCD6rNANtB3qOlSIeAiXTwHNqw==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -1826,8 +1826,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.29: - resolution: {integrity: sha512-uoyb0YAJ6uWH4PYuYjfGNjvgLlb5t6b3zIaGmpWPOjgpr1Nb3SJtQiK4YCPGhONgfg2v6DcJgSbOteuKXhwqAw==} + /esbuild-windows-32/0.14.30: + resolution: {integrity: sha512-9/fb1tPtpacMqxAXp3fGHowUDg/l9dVch5hKmCLEZC6PdGljh6h372zMdJwYfH0Bd5CCPT0Wx95uycBLJiqpXA==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -1835,8 +1835,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.29: - resolution: {integrity: sha512-X9cW/Wl95QjsH8WUyr3NqbmfdU72jCp71cH3pwPvI4CgBM2IeOUDdbt6oIGljPu2bf5eGDIo8K3Y3vvXCCTd8A==} + /esbuild-windows-64/0.14.30: + resolution: {integrity: sha512-DHgITeUhPAnN9I5O6QBa1GVyPOhiYCn4S4TtQr7sO4+X0LNyqnlmA1M0qmGkUdDC1QQfjI8uQ4G/whdWb2pWIQ==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1844,8 +1844,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.29: - resolution: {integrity: sha512-+O/PI+68fbUZPpl3eXhqGHTGK7DjLcexNnyJqtLZXOFwoAjaXlS5UBCvVcR3o2va+AqZTj8o6URaz8D2K+yfQQ==} + /esbuild-windows-arm64/0.14.30: + resolution: {integrity: sha512-F1kLyQH7zSgjh5eLxogGZN7C9+KNs9m+s7Q6WZoMmCWT/6j998zlaoECHyM8izJRRfsvw2eZlEa1jO6/IOU1AQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -1853,32 +1853,32 @@ packages: dev: true optional: true - /esbuild/0.14.29: - resolution: {integrity: sha512-SQS8cO8xFEqevYlrHt6exIhK853Me4nZ4aMW6ieysInLa0FMAL+AKs87HYNRtR2YWRcEIqoXAHh+Ytt5/66qpg==} + /esbuild/0.14.30: + resolution: {integrity: sha512-wCecQSBkIjp2xjuXY+wcXS/PpOQo9rFh4NAKPh4Pm9f3fuLcnxkR0rDzA+mYP88FtXIUcXUyYmaIgfrzRl55jA==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.29 - esbuild-android-arm64: 0.14.29 - esbuild-darwin-64: 0.14.29 - esbuild-darwin-arm64: 0.14.29 - esbuild-freebsd-64: 0.14.29 - esbuild-freebsd-arm64: 0.14.29 - esbuild-linux-32: 0.14.29 - esbuild-linux-64: 0.14.29 - esbuild-linux-arm: 0.14.29 - esbuild-linux-arm64: 0.14.29 - esbuild-linux-mips64le: 0.14.29 - esbuild-linux-ppc64le: 0.14.29 - esbuild-linux-riscv64: 0.14.29 - esbuild-linux-s390x: 0.14.29 - esbuild-netbsd-64: 0.14.29 - esbuild-openbsd-64: 0.14.29 - esbuild-sunos-64: 0.14.29 - esbuild-windows-32: 0.14.29 - esbuild-windows-64: 0.14.29 - esbuild-windows-arm64: 0.14.29 + esbuild-android-64: 0.14.30 + esbuild-android-arm64: 0.14.30 + esbuild-darwin-64: 0.14.30 + esbuild-darwin-arm64: 0.14.30 + esbuild-freebsd-64: 0.14.30 + esbuild-freebsd-arm64: 0.14.30 + esbuild-linux-32: 0.14.30 + esbuild-linux-64: 0.14.30 + esbuild-linux-arm: 0.14.30 + esbuild-linux-arm64: 0.14.30 + esbuild-linux-mips64le: 0.14.30 + esbuild-linux-ppc64le: 0.14.30 + esbuild-linux-riscv64: 0.14.30 + esbuild-linux-s390x: 0.14.30 + esbuild-netbsd-64: 0.14.30 + esbuild-openbsd-64: 0.14.30 + esbuild-sunos-64: 0.14.30 + esbuild-windows-32: 0.14.30 + esbuild-windows-64: 0.14.30 + esbuild-windows-arm64: 0.14.30 dev: true /escalade/3.1.1: @@ -1924,8 +1924,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc/38.1.4_eslint@8.12.0: - resolution: {integrity: sha512-x4sG6oJ+wj7aOGXtTaUeA4EL6kkgGsaFyIf+237/cdSXmC5zKKROccZxNZVUkaXE5QEiBGi7pyRfWNZYf+2OFg==} + /eslint-plugin-jsdoc/38.1.6_eslint@8.12.0: + resolution: {integrity: sha512-n4s95oYlg0L43Bs8C0dkzIldxYf8pLCutC/tCbjIdF7VDiobuzPI+HZn9Q0BvgOvgPNgh5n7CSStql25HUG4Tw==} engines: {node: ^12 || ^14 || ^16 || ^17} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -2045,9 +2045,9 @@ packages: hasBin: true dependencies: cross-spawn: 7.0.3 - esbuild: 0.14.29 + esbuild: 0.14.30 esbuild-node-loader: 0.6.5 - esbuild-register: 3.3.2_esbuild@0.14.29 + esbuild-register: 3.3.2_esbuild@0.14.30 import-meta-resolve: 1.1.1 dev: true @@ -4390,7 +4390,7 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.29 + esbuild: 0.14.30 postcss: 8.4.12 resolve: 1.22.0 rollup: 2.70.1 From 0757d48f6e36a2faa6847b2d4138cc16b0538eff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Apr 2022 14:09:28 +0200 Subject: [PATCH 104/130] chore(deps): update dependency prettier to v2.6.2 (#761) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 51403e949a3..982a1fbc900 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "lint-staged": "~12.3.7", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", - "prettier": "2.6.1", + "prettier": "2.6.2", "prettier-plugin-organize-imports": "~2.3.4", "rimraf": "~3.0.2", "sanitize-html": "~2.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6ff0625a523..c16249b788d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,7 +23,7 @@ specifiers: lint-staged: ~12.3.7 npm-run-all: ~4.1.5 picocolors: ~1.0.0 - prettier: 2.6.1 + prettier: 2.6.2 prettier-plugin-organize-imports: ~2.3.4 rimraf: ~3.0.2 sanitize-html: ~2.7.0 @@ -55,13 +55,13 @@ devDependencies: eslint-define-config: 1.3.0 eslint-gitignore: 0.1.0_eslint@8.12.0 eslint-plugin-jsdoc: 38.1.6_eslint@8.12.0 - eslint-plugin-prettier: 4.0.0_b253a92c95b42c3296c682f11cccb3bd + eslint-plugin-prettier: 4.0.0_f2c91d0f54113167d2bd9214a5ab5a36 esno: 0.14.1 lint-staged: 12.3.7 npm-run-all: 4.1.5 picocolors: 1.0.0 - prettier: 2.6.1 - prettier-plugin-organize-imports: 2.3.4_prettier@2.6.1+typescript@4.6.3 + prettier: 2.6.2 + prettier-plugin-organize-imports: 2.3.4_prettier@2.6.2+typescript@4.6.3 rimraf: 3.0.2 sanitize-html: 2.7.0 simple-git-hooks: 2.7.0 @@ -1943,7 +1943,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.0.0_b253a92c95b42c3296c682f11cccb3bd: + /eslint-plugin-prettier/4.0.0_f2c91d0f54113167d2bd9214a5ab5a36: resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} engines: {node: '>=6.0.0'} peerDependencies: @@ -1956,7 +1956,7 @@ packages: dependencies: eslint: 8.12.0 eslint-config-prettier: 8.5.0_eslint@8.12.0 - prettier: 2.6.1 + prettier: 2.6.2 prettier-linter-helpers: 1.0.0 dev: true @@ -3532,18 +3532,18 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/2.3.4_prettier@2.6.1+typescript@4.6.3: + /prettier-plugin-organize-imports/2.3.4_prettier@2.6.2+typescript@4.6.3: resolution: {integrity: sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==} peerDependencies: prettier: '>=2.0' typescript: '>=2.9' dependencies: - prettier: 2.6.1 + prettier: 2.6.2 typescript: 4.6.3 dev: true - /prettier/2.6.1: - resolution: {integrity: sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==} + /prettier/2.6.2: + resolution: {integrity: sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==} engines: {node: '>=10.13.0'} hasBin: true dev: true From 77115d4d13d3ed6b4ead76d3d28e9c989b80c4d6 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Sun, 3 Apr 2022 08:16:21 -0400 Subject: [PATCH 105/130] chore: remove issue-labeling.yml (#763) --- .github/workflows/issue-labeling.yml | 32 ---------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/issue-labeling.yml diff --git a/.github/workflows/issue-labeling.yml b/.github/workflows/issue-labeling.yml deleted file mode 100644 index ea66bbd2799..00000000000 --- a/.github/workflows/issue-labeling.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Issue Labeling - -on: - issues: - types: [labeled] - -jobs: - reply-labeled: - runs-on: ubuntu-latest - steps: - - name: contribution welcome - # If the issue is labeled with 'help wanted', a comment will be posted - if: github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v3 - with: - actions: 'welcome, remove-labels' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - body: | - Hello @${{ github.event.issue.user.login }}. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it! - labels: 'pending triage' - - - name: remove pending - # If the issue is given either the 'enhancement' or 'bug' label, the 'pending triage' label will be removed - # Issues without the label 'pending triage' are filtered with the third part of the condition, since the label does not have to be removed - if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false) - uses: actions-cool/issues-helper@v3 - with: - actions: 'remove-labels' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: 'pending triage' From b40121e9102b9e8bde1d99689bd2fd3f61f8b767 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Sun, 3 Apr 2022 14:44:55 +0200 Subject: [PATCH 106/130] refactor: rename hexaDecimal to hexadecimal (#764) --- src/datatype.ts | 25 ++++++++++++++++++++++++ src/finance.ts | 2 +- src/random.ts | 11 ++++++----- test/datatype.spec.ts | 44 +++++++++++++++++++++++++++++++++---------- test/random.spec.ts | 2 +- 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/src/datatype.ts b/src/datatype.ts index 79b0b61c1c1..50bcb17fda8 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -1,4 +1,5 @@ import type { Faker } from '.'; +import { deprecated } from './internal/deprecated'; /** * Module to generate various primitive values and data types. @@ -185,11 +186,35 @@ export class Datatype { * * @param length Length of the generated number. Defaults to `1`. * + * @see faker.datatype.hexadecimal() + * * @example * faker.datatype.hexaDecimal() // '0xb' * faker.datatype.hexaDecimal(10) // '0xaE13F044fb' + * + * @deprecated */ hexaDecimal(length = 1): string { + deprecated({ + deprecated: 'faker.datatype.hexaDecimal()', + proposed: 'faker.datatype.hexadecimal()', + since: 'v6.1.2', + until: 'v7.0.0', + }); + + return this.hexadecimal(length); + } + + /** + * Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number. + * + * @param length Length of the generated number. Defaults to `1`. + * + * @example + * faker.datatype.hexadecimal() // '0xb' + * faker.datatype.hexadecimal(10) // '0xaE13F044fb' + */ + hexadecimal(length = 1): string { let wholeString = ''; for (let i = 0; i < length; i++) { diff --git a/src/finance.ts b/src/finance.ts index ea71391dd18..5581ad4eac4 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -298,7 +298,7 @@ export class Finance { * faker.finance.ethereumAddress() // '0xf03dfeecbafc5147241cc4c4ca20b3c9dfd04c4a' */ ethereumAddress(): string { - const address = this.faker.datatype.hexaDecimal(40).toLowerCase(); + const address = this.faker.datatype.hexadecimal(40).toLowerCase(); return address; } diff --git a/src/random.ts b/src/random.ts index 20d54f5b16b..a653472f7f8 100644 --- a/src/random.ts +++ b/src/random.ts @@ -545,21 +545,22 @@ export class Random { * * @param count Length of the generated number. Defaults to `1`. * - * @see faker.datatype.hexaDecimal() + * @see faker.datatype.hexadecimal() * * @example - * faker.datatype.hexaDecimal() // '0xb' - * faker.datatype.hexaDecimal(10) // '0xaE13F044fb' + * faker.random.hexaDecimal() // '0xb' + * faker.random.hexaDecimal(10) // '0xaE13F044fb' * * @deprecated */ hexaDecimal(count?: number): string { deprecated({ deprecated: 'faker.random.hexaDecimal()', - proposed: 'faker.datatype.hexaDecimal()', + proposed: 'faker.datatype.hexadecimal()', // since: 'v5.0.0', (?) until: 'v7.0.0', }); - return this.faker.datatype.hexaDecimal(count); + + return this.faker.datatype.hexadecimal(count); } } diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index e4d69fe69b2..8c7d572a9ac 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { faker } from '../src'; const seededRuns = [ @@ -38,7 +38,7 @@ const seededRuns = [ boolean: { noArgs: false, }, - hexaDecimal: { + hexadecimal: { noArgs: '0x8', length: '0x8BE4ABdd39321aD7d3fe01FfCE404F4d6db0906bd8', }, @@ -110,7 +110,7 @@ const seededRuns = [ boolean: { noArgs: false, }, - hexaDecimal: { + hexadecimal: { noArgs: '0x5', length: '0x5c346ba075bd57F5A62B82d72AF39CBBB07a98cbA8', }, @@ -182,7 +182,7 @@ const seededRuns = [ boolean: { noArgs: true, }, - hexaDecimal: { + hexadecimal: { noArgs: '0xE', length: '0xEaDB42F0e3f4A973fAB0AeefCE96DFCF49cD438dF9', }, @@ -229,7 +229,7 @@ const functionNames = [ 'string', 'uuid', 'boolean', - 'hexaDecimal', + 'hexadecimal', 'json', 'array', 'bigInt', @@ -392,12 +392,12 @@ describe('datatype', () => { }); }); - describe('hexaDecimal', () => { + describe('hexadecimal', () => { it('should return a deterministic hex of given length', () => { faker.seed(seed); - const actual = faker.datatype.hexaDecimal(42); - expect(actual).toEqual(expectations.hexaDecimal.length); + const actual = faker.datatype.hexadecimal(42); + expect(actual).toEqual(expectations.hexadecimal.length); }); }); @@ -629,14 +629,38 @@ describe('datatype', () => { }); describe('hexaDecimal', () => { + it('should display deprecated message', () => { + const spy = vi.spyOn(console, 'warn'); + + faker.datatype.hexaDecimal(); + + expect(spy).toHaveBeenCalledWith( + '[@faker-js/faker]: faker.datatype.hexaDecimal() is deprecated since v6.1.2 and will be removed in v7.0.0. Please use faker.datatype.hexadecimal() instead.' + ); + + spy.mockRestore(); + }); + + it('should display call hexadecimal()', () => { + const spy = vi.spyOn(faker.datatype, 'hexadecimal'); + + faker.datatype.hexaDecimal(10); + + expect(spy).toHaveBeenCalledWith(10); + + spy.mockRestore(); + }); + }); + + describe('hexadecimal', () => { it('generates single hex character when no additional argument was provided', () => { - const hex = faker.datatype.hexaDecimal(); + const hex = faker.datatype.hexadecimal(); expect(hex).match(/^(0x)[0-9a-f]{1}$/i); expect(hex.substring(2)).toHaveLength(1); }); it('generates a random hex string', () => { - const hex = faker.datatype.hexaDecimal(5); + const hex = faker.datatype.hexadecimal(5); expect(hex).match(/^(0x)[0-9a-f]+$/i); expect(hex.substring(2)).toHaveLength(5); }); diff --git a/test/random.spec.ts b/test/random.spec.ts index 9e66f58ac1a..c0885b2ddd6 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -285,7 +285,7 @@ describe('random', () => { ['uuid', 'datatype.uuid'], ['boolean', 'datatype.boolean'], ['image', 'image.image'], - ['hexaDecimal', 'datatype.hexaDecimal'], + ['hexaDecimal', 'datatype.hexadecimal'], ])( 'should warn user that function random.%s is deprecated', (functionName, newLocation) => { From 52ad16ebe424cfe1acf7be1e98c9671baf8d1576 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 3 Apr 2022 15:57:40 +0200 Subject: [PATCH 107/130] test: check that system.filePath() generates file extensions (#765) --- test/system.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/system.spec.ts b/test/system.spec.ts index e3e7f692adf..de7d0390dff 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -2,7 +2,6 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; -// TODO @prisis 2022-01-31: Add multiple seed based expectations. const seededRuns = [ { seed: 42, @@ -235,12 +234,16 @@ describe('system', () => { describe('filePath()', () => { it('should return unix fs file full path', () => { const filePath = faker.system.filePath(); + const parts = filePath.split('/'); expect( filePath.startsWith('/'), 'generated filePath should start with /' ).toBeTruthy(); - // TODO @prisis 2022-01-26: Add test to validate if the path has ext on the end. + expect( + parts[parts.length - 1], + 'generated filePath should have a file extension' + ).toMatch(/^\w+\.\w+$/); }); }); From 214a77b437aaff1282248a6ee14fd227d5e42c42 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 3 Apr 2022 16:03:12 +0200 Subject: [PATCH 108/130] chore: address zipCodeByState fix types (#760) --- src/address.ts | 13 ++++++------- src/definitions/address.ts | 5 +---- src/locales/ar/address/index.ts | 2 -- src/locales/ar/address/postcode_by_state.ts | 1 - src/locales/en/address/index.ts | 2 -- src/locales/en/address/postcode_by_state.ts | 1 - src/locales/he/address/index.ts | 2 -- src/locales/he/address/postcode_by_state.ts | 1 - src/locales/ur/address/index.ts | 2 -- src/locales/ur/address/postcode_by_state.ts | 1 - test/address.spec.ts | 6 +++--- 11 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 src/locales/ar/address/postcode_by_state.ts delete mode 100644 src/locales/en/address/postcode_by_state.ts delete mode 100644 src/locales/he/address/postcode_by_state.ts delete mode 100644 src/locales/ur/address/postcode_by_state.ts diff --git a/src/address.ts b/src/address.ts index d8dfbbbb2ee..246f4d9b455 100644 --- a/src/address.ts +++ b/src/address.ts @@ -84,8 +84,8 @@ export class Address { } /** - * Generates random zipcode from specified format. If format is not specified, the - * locale's zip format is used. + * Generates random zip code from specified format. If format is not specified, + * the locale's zip format is used. * * @param format The optional format used to generate the the zip code. * By default, a random format is used from the locale zip formats. @@ -111,7 +111,7 @@ export class Address { } /** - * Generates random zipcode from state abbreviation. If state abbreviation is + * Generates random zip code from state abbreviation. If state abbreviation is * not specified, a random zip code is generated according to the locale's zip format. * Only works for locales with postcode_by_state definition. If a locale does not * have a postcode_by_state definition, a random zip code is generated according @@ -123,11 +123,10 @@ export class Address { * fakerUS.address.zipCodeByState("AK") // '99595' * fakerUS.address.zipCodeByState("??") // '47683-9880' */ - zipCodeByState(state: string): string | number { - const zipRange = this.faker.definitions.address.postcode_by_state[state]; + zipCodeByState(state: string): string { + const zipRange = this.faker.definitions.address.postcode_by_state?.[state]; if (zipRange) { - // TODO ST-DDT 2022-02-10: Fix types - return this.faker.datatype.number(zipRange); + return String(this.faker.datatype.number(zipRange)); } return this.faker.address.zipCode(); } diff --git a/src/definitions/address.ts b/src/definitions/address.ts index d34bc0bd74f..24f9b7cc81d 100644 --- a/src/definitions/address.ts +++ b/src/definitions/address.ts @@ -7,10 +7,7 @@ export interface AddressDefinitions { /** * Postcodes patterns by state */ - // TODO ST-DDT 2022-01-31: address.zipCodeByState() expects only { [state: string]: { min: number; max: number } } - postcode_by_state: - | string[] - | { [state: string]: { min: number; max: number } }; + postcode_by_state: { [state: string]: { min: number; max: number } }; /** * Postcodes patterns (Fake-Pattern | Fake-Pattern[]). */ diff --git a/src/locales/ar/address/index.ts b/src/locales/ar/address/index.ts index 4506fbc8c84..7789c0e5f5b 100644 --- a/src/locales/ar/address/index.ts +++ b/src/locales/ar/address/index.ts @@ -9,7 +9,6 @@ import city_name from './city_name'; import country from './country'; import default_country from './default_country'; import postcode from './postcode'; -import postcode_by_state from './postcode_by_state'; import secondary_address from './secondary_address'; import state from './state'; import street_address from './street_address'; @@ -23,7 +22,6 @@ const address = { country, default_country, postcode, - postcode_by_state, secondary_address, state, street_address, diff --git a/src/locales/ar/address/postcode_by_state.ts b/src/locales/ar/address/postcode_by_state.ts deleted file mode 100644 index 4433f068b5e..00000000000 --- a/src/locales/ar/address/postcode_by_state.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['#####', '#####-####']; diff --git a/src/locales/en/address/index.ts b/src/locales/en/address/index.ts index efb55311d33..78cb3ec842c 100644 --- a/src/locales/en/address/index.ts +++ b/src/locales/en/address/index.ts @@ -16,7 +16,6 @@ import default_country from './default_country'; import direction from './direction'; import direction_abbr from './direction_abbr'; import postcode from './postcode'; -import postcode_by_state from './postcode_by_state'; import secondary_address from './secondary_address'; import state from './state'; import state_abbr from './state_abbr'; @@ -39,7 +38,6 @@ const address = { direction, direction_abbr, postcode, - postcode_by_state, secondary_address, state, state_abbr, diff --git a/src/locales/en/address/postcode_by_state.ts b/src/locales/en/address/postcode_by_state.ts deleted file mode 100644 index 4433f068b5e..00000000000 --- a/src/locales/en/address/postcode_by_state.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['#####', '#####-####']; diff --git a/src/locales/he/address/index.ts b/src/locales/he/address/index.ts index 04ed969dd15..bcf2af271c3 100644 --- a/src/locales/he/address/index.ts +++ b/src/locales/he/address/index.ts @@ -13,7 +13,6 @@ import default_country from './default_country'; import direction from './direction'; import direction_abbr from './direction_abbr'; import postcode from './postcode'; -import postcode_by_state from './postcode_by_state'; import secondary_address from './secondary_address'; import state from './state'; import state_abbr from './state_abbr'; @@ -33,7 +32,6 @@ const address = { direction, direction_abbr, postcode, - postcode_by_state, secondary_address, state, state_abbr, diff --git a/src/locales/he/address/postcode_by_state.ts b/src/locales/he/address/postcode_by_state.ts deleted file mode 100644 index 2850dba4057..00000000000 --- a/src/locales/he/address/postcode_by_state.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['#####', '#######']; diff --git a/src/locales/ur/address/index.ts b/src/locales/ur/address/index.ts index 312e90271ab..a04af9074df 100644 --- a/src/locales/ur/address/index.ts +++ b/src/locales/ur/address/index.ts @@ -12,7 +12,6 @@ import country from './country'; import default_country from './default_country'; import direction from './direction'; import postcode from './postcode'; -import postcode_by_state from './postcode_by_state'; import secondary_address from './secondary_address'; import state from './state'; import state_abbr from './state_abbr'; @@ -30,7 +29,6 @@ const address = { default_country, direction, postcode, - postcode_by_state, secondary_address, state, state_abbr, diff --git a/src/locales/ur/address/postcode_by_state.ts b/src/locales/ur/address/postcode_by_state.ts deleted file mode 100644 index db2bcfedae5..00000000000 --- a/src/locales/ur/address/postcode_by_state.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['#####']; diff --git a/test/address.spec.ts b/test/address.spec.ts index 1b9877619d9..f7ee4cacb8c 100644 --- a/test/address.spec.ts +++ b/test/address.spec.ts @@ -395,15 +395,15 @@ describe('address', () => { faker.locale = 'en_US'; const states = ['IL', 'GA', 'WA']; - const zipCode1 = faker.address.zipCodeByState(states[0]); + const zipCode1 = +faker.address.zipCodeByState(states[0]); expect(zipCode1).greaterThanOrEqual(60001); expect(zipCode1).lessThanOrEqual(62999); - const zipCode2 = faker.address.zipCodeByState(states[1]); + const zipCode2 = +faker.address.zipCodeByState(states[1]); expect(zipCode2).greaterThanOrEqual(30001); expect(zipCode2).lessThanOrEqual(31999); - const zipCode3 = faker.address.zipCodeByState(states[2]); + const zipCode3 = +faker.address.zipCodeByState(states[2]); expect(zipCode3).greaterThanOrEqual(98001); expect(zipCode3).lessThanOrEqual(99403); }); From 6096cb4d5645f4af803b6f550ecb0f64d8942778 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 3 Apr 2022 17:36:59 +0200 Subject: [PATCH 109/130] chore: deprecate name.title() in favor of name.jobTitle() (#766) --- src/name.ts | 31 ++++++++++++------------------- test/name.spec.ts | 23 ++++++++++++++++++++++- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/name.ts b/src/name.ts index a6dd4ea6439..9ac270b323f 100644 --- a/src/name.ts +++ b/src/name.ts @@ -284,23 +284,22 @@ export class Name { } /** - * Generates a random title. + * Generates a random job title. * * @example * faker.name.title() // 'International Integration Manager' + * + * @deprecated */ title(): string { - const descriptor = this.faker.random.arrayElement( - this.faker.definitions.name.title.descriptor - ); - const level = this.faker.random.arrayElement( - this.faker.definitions.name.title.level - ); - const job = this.faker.random.arrayElement( - this.faker.definitions.name.title.job - ); - - return descriptor + ' ' + level + ' ' + job; + deprecated({ + deprecated: 'faker.name.title()', + proposed: 'faker.name.jobTitle()', + since: 'v6.1.2', + until: 'v7.0.0', + }); + + return this.jobTitle(); } /** @@ -310,13 +309,7 @@ export class Name { * faker.name.jobTitle() // 'Global Accounts Engineer' */ jobTitle(): string { - return ( - this.faker.name.jobDescriptor() + - ' ' + - this.faker.name.jobArea() + - ' ' + - this.faker.name.jobType() - ); + return this.jobDescriptor() + ' ' + this.jobArea() + ' ' + this.jobType(); } /** diff --git a/test/name.spec.ts b/test/name.spec.ts index 40f349553eb..97ac7fbacb3 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -519,6 +519,28 @@ describe('name', () => { faker.localeFallback = 'en'; }); + it('should display deprecated message', () => { + const spy = vi.spyOn(console, 'warn'); + + faker.name.title(); + + expect(spy).toHaveBeenCalledWith( + '[@faker-js/faker]: faker.name.title() is deprecated since v6.1.2 and will be removed in v7.0.0. Please use faker.name.jobTitle() instead.' + ); + + spy.mockRestore(); + }); + + it('should call jobTitle()', () => { + const spy = vi.spyOn(faker.name, 'jobTitle'); + + faker.name.title(); + + expect(spy).toHaveBeenCalledWith(); + + spy.mockRestore(); + }); + it('should return a title consisting of a descriptor, area, and type', () => { const title = faker.name.title(); @@ -526,7 +548,6 @@ describe('name', () => { const [descriptor, level, job] = title.split(' '); - // TODO @Shinigami92 2022-01-31: jobTitle and title are the same expect(faker.definitions.name.title.descriptor).toContain(descriptor); expect(faker.definitions.name.title.level).toContain(level); expect(faker.definitions.name.title.job).toContain(job); From 9e03bcff3aaad13afbfae99fb1df046c2f227c2c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 08:41:24 +0200 Subject: [PATCH 110/130] chore(deps): update vitest to ~0.8.4 (#769) Co-authored-by: Renovate Bot --- package.json | 4 ++-- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 982a1fbc900..3c4d8cf491e 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "@types/validator": "~13.7.2", "@typescript-eslint/eslint-plugin": "~5.17.0", "@typescript-eslint/parser": "~5.17.0", - "@vitest/ui": "~0.8.0", + "@vitest/ui": "~0.8.4", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.3", @@ -122,7 +122,7 @@ "validator": "~13.7.0", "vite": "~2.9.1", "vitepress": "~0.22.3", - "vitest": "~0.8.0" + "vitest": "~0.8.4" }, "packageManager": "pnpm@6.32.4", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c16249b788d..63c0e62e145 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ specifiers: '@types/validator': ~13.7.2 '@typescript-eslint/eslint-plugin': ~5.17.0 '@typescript-eslint/parser': ~5.17.0 - '@vitest/ui': ~0.8.0 + '@vitest/ui': ~0.8.4 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.3 @@ -35,7 +35,7 @@ specifiers: validator: ~13.7.0 vite: ~2.9.1 vitepress: ~0.22.3 - vitest: ~0.8.0 + vitest: ~0.8.4 devDependencies: '@types/markdown-it': 12.2.3 @@ -45,7 +45,7 @@ devDependencies: '@types/validator': 13.7.2 '@typescript-eslint/eslint-plugin': 5.17.0_689ff565753ecf7c3328c07fad067df5 '@typescript-eslint/parser': 5.17.0_eslint@8.12.0+typescript@4.6.3 - '@vitest/ui': 0.8.0 + '@vitest/ui': 0.8.4 c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.3 @@ -72,7 +72,7 @@ devDependencies: validator: 13.7.0 vite: 2.9.1 vitepress: 0.22.3 - vitest: 0.8.0_@vitest+ui@0.8.0+c8@7.11.0 + vitest: 0.8.4_@vitest+ui@0.8.4+c8@7.11.0 packages: @@ -571,8 +571,8 @@ packages: vue: 3.2.31 dev: true - /@vitest/ui/0.8.0: - resolution: {integrity: sha512-eCrU2lvYTA1YAI3cBrmaHC1539X7r8HMF/bLUEdSJE+eb+fW78brXYJXS7bDywQsFg9TI592xZVpPlRg95dfZA==} + /@vitest/ui/0.8.4: + resolution: {integrity: sha512-ipbw8XyS6jt+H1d2gCjuc6PBr1clCk/NyfbkgDhFXkBYK0ST5H192ZDq4sx3nqOat2oPH0/OyQsb1FlX7DBG3A==} dependencies: sirv: 2.0.2 dev: true @@ -4419,9 +4419,9 @@ packages: - stylus dev: true - /vitest/0.8.0_@vitest+ui@0.8.0+c8@7.11.0: - resolution: {integrity: sha512-8m8OufAQWXlNpjm5dTe5Lc60zruguKJljunveueYrd4aoeXaQvggLX0SPmIW3G6PDtnBdNEynSi+6pibjnutQA==} - engines: {node: '>=v14.19.1'} + /vitest/0.8.4_@vitest+ui@0.8.4+c8@7.11.0: + resolution: {integrity: sha512-1OoAG1+VYkzp4WLCVQFRJX/OKk70rsMIM5H23crfc1wSEnJvHlxgQBS1HPpV/VYmjC8bIInKWhnB4Gaw32MnyQ==} + engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -4440,7 +4440,7 @@ packages: dependencies: '@types/chai': 4.3.0 '@types/chai-subset': 1.3.3 - '@vitest/ui': 0.8.0 + '@vitest/ui': 0.8.4 c8: 7.11.0 chai: 4.3.6 local-pkg: 0.4.1 From 8b545b4e72e0d00f93d51f8de876103bedebff03 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 4 Apr 2022 16:47:03 +0200 Subject: [PATCH 111/130] chore: fix mustache type warning and add some tests (#753) --- src/helpers.ts | 17 +++++++-------- test/helpers.spec.ts | 49 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 051de5eaca5..f302ac46c12 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -477,22 +477,19 @@ export class Helpers { */ mustache( str: string | undefined, - data: Record< - string, - string | ((substring: string, ...args: any[]) => string) - > + data: Record[1]> ): string { if (str == null) { return ''; } for (const p in data) { const re = new RegExp('{{' + p + '}}', 'g'); - str = str.replace( - re, - // TODO @Shinigami92 2022-01-14: Try to improve the type or maybe use `if` - // @ts-expect-error - data[p] - ); + const value = data[p]; + if (typeof value === 'string') { + str = str.replace(re, value); + } else { + str = str.replace(re, value); + } } return str; } diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 0be83f9888a..cf817ae5800 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -724,11 +724,50 @@ describe('helpers', () => { }); describe('mustache()', () => { - it('returns empty string with no arguments', () => { - expect( - // @ts-expect-error - faker.helpers.mustache() - ).toBe(''); + it('returns empty string with no template input', () => { + expect(faker.helpers.mustache(undefined, {})).toBe(''); + }); + + it('returns empty string with empty template input', () => { + expect(faker.helpers.mustache('', {})).toBe(''); + }); + + it('supports string replace values', () => { + const actual = faker.helpers.mustache('1{{value}}3', { value: '2' }); + + expect(actual).toBe('123'); + }); + + it('supports function replace values faker values', () => { + const actual = faker.helpers.mustache('1{{value}}3', { + value: faker.datatype.string(2), + }); + + expect(actual).toHaveLength(4); + }); + + it('supports function replace values faker function', () => { + const actual = faker.helpers.mustache('1{{value}}3', { + value: () => faker.datatype.string(3), + }); + + expect(actual).toHaveLength(5); + }); + + it('supports function replace values no args', () => { + const actual = faker.helpers.mustache('1{{value}}3', { + value: () => '7', + }); + + expect(actual).toBe('173'); + }); + + it('supports function replace values with args', () => { + const actual = faker.helpers.mustache('1{{value}}3', { + value: (key) => String(key.length), + }); + + expect(actual).toBe('193'); }); }); From fb1b87e2249798c6257cb5383f73a15022f438f0 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 4 Apr 2022 17:01:18 +0200 Subject: [PATCH 112/130] fix: random word fails on undefined (#771) --- src/random.ts | 2 +- test/system.spec.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/random.ts b/src/random.ts index a653472f7f8..448cf4f8696 100644 --- a/src/random.ts +++ b/src/random.ts @@ -326,7 +326,7 @@ export class Random { const randomWordMethod = this.faker.random.arrayElement(wordMethods); result = randomWordMethod(); - } while (bannedChars.some((char) => result.includes(char))); + } while (!result || bannedChars.some((char) => result.includes(char))); return this.faker.random.arrayElement(result.split(' ')); } diff --git a/test/system.spec.ts b/test/system.spec.ts index de7d0390dff..26b5730fbdb 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -268,4 +268,19 @@ describe('system', () => { }); } }); + + describe('extra tests', () => { + describe('commonFileName()', () => { + afterEach(() => { + faker.locale = 'en'; + }); + + it('#770', () => { + faker.seed(5423027051750305); + faker.setLocale('sk'); + faker.system.commonFileName('xml'); + faker.system.commonFileName('xml'); + }); + }); + }); }); From 01cd0573e9cdc3a8d3c78e2bbcffd8dff1b97081 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 15:06:40 +0000 Subject: [PATCH 113/130] chore(deps): update dependency esbuild to ~0.14.31 (#772) Co-authored-by: Renovate Bot --- package.json | 2 +- pnpm-lock.yaml | 140 ++++++++++++++++++++++++------------------------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index 3c4d8cf491e..010443555dc 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", "cypress": "~9.5.3", - "esbuild": "~0.14.30", + "esbuild": "~0.14.31", "eslint": "~8.12.0", "eslint-config-prettier": "~8.5.0", "eslint-define-config": "~1.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63c0e62e145..f8922fabf99 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ specifiers: c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 cypress: ~9.5.3 - esbuild: ~0.14.30 + esbuild: ~0.14.31 eslint: ~8.12.0 eslint-config-prettier: ~8.5.0 eslint-define-config: ~1.3.0 @@ -49,7 +49,7 @@ devDependencies: c8: 7.11.0 conventional-changelog-cli: 2.2.2 cypress: 9.5.3 - esbuild: 0.14.30 + esbuild: 0.14.31 eslint: 8.12.0 eslint-config-prettier: 8.5.0_eslint@8.12.0 eslint-define-config: 1.3.0 @@ -1659,8 +1659,8 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-android-64/0.14.30: - resolution: {integrity: sha512-vdJ7t8A8msPfKpYUGUV/KaTQRiZ0vDa2XSTlzXVkGGVHLKPeb85PBUtYJcEgw3htW3IdX5i1t1IMdQCwJJgNAg==} + /esbuild-android-64/0.14.31: + resolution: {integrity: sha512-MYkuJ91w07nGmr4EouejOZK2j/f5TCnsKxY8vRr2+wpKKfHD1LTJK28VbZa+y1+AL7v1V9G98ezTUwsV3CmXNw==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -1668,8 +1668,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.30: - resolution: {integrity: sha512-BdgGfxeA5hBQNErLr7BWJUA8xjflEfyaARICy8e0OJYNSAwDbEzOf8LyiKWSrDcgV129mWhi3VpbNQvOIDEHcg==} + /esbuild-android-arm64/0.14.31: + resolution: {integrity: sha512-0rkH/35s7ZVcsw6nS0IAkR0dekSbjZGWdlOAf3jV0lGoPqqw0x6/TmaV9w7DQgUERTH1ApmPlpAMU4kVkCq9Jg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -1677,8 +1677,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.30: - resolution: {integrity: sha512-VRaOXMMrsG5n53pl4qFZQdXy2+E0NoLP/QH3aDUI0+bQP+ZHDmbINKcDy2IX7GVFI9kqPS18iJNAs5a6/G2LZg==} + /esbuild-darwin-64/0.14.31: + resolution: {integrity: sha512-kP6xPZHxtJa36Hb0jC05L3VzQSZBW2f3bpnQS20czXTRGEmM2GDiYpGdI5g2QYaw6vC4PYXjnigq8usd9g9jnQ==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -1686,8 +1686,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.30: - resolution: {integrity: sha512-qDez+fHMOrO9Oc9qjt/x+sy09RJVh62kik5tVybKRLmezeV4qczM9/sAYY57YN0aWLdHbcCj2YqJUWYJNsgKnw==} + /esbuild-darwin-arm64/0.14.31: + resolution: {integrity: sha512-1ZMog4hkNsdBGtDDtsftUqX6S9N52gEx4vX5aVehsSptgoBFIar1XrPiBTQty7YNH+bJasTpSVaZQgElCVvPKQ==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -1695,8 +1695,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.30: - resolution: {integrity: sha512-mec1jENcImVVagddZlGWsdAUwBnzR5cgnhzCxv+9fSMxKbx1uZYLLUAnLPp8m/i934zrumR1xGjJ5VoWdPlI2w==} + /esbuild-freebsd-64/0.14.31: + resolution: {integrity: sha512-Zo0BYj7QpVFWoUpkv6Ng0RO2eJ4zk/WDaHMO88+jr5HuYmxsOre0imgwaZVPquTuJnCvL1G48BFucJ3tFflSeQ==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -1704,8 +1704,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.30: - resolution: {integrity: sha512-cpjbTs6Iok/AfeB0JgTzyUJTMStC1SQULmany5nHx6S4GTkSgaAHuJzZO0GcVWqghI4e0YL/bjXAhN5Mn6feNw==} + /esbuild-freebsd-arm64/0.14.31: + resolution: {integrity: sha512-t85bS6jbRpmdjr4pdr/FY/fpx8lo1vv9S7BAs2EsXKJQhRDMIiC3QW+k2acYJoRuqirlvJcJVFQGCq/PfyC1kA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -1713,8 +1713,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.30: - resolution: {integrity: sha512-liIONVT4F2kZmOMwtwASqZ8WkIjb5HHBR9HUffdHiuotSTF3CyZO+EJf+Og+SYYuuVIvt0qHNSFjBA/iSESteQ==} + /esbuild-linux-32/0.14.31: + resolution: {integrity: sha512-XYtOk/GodSkv+UOYVwryGpGPuFnszsMvRMKq6cIUfFfdssHuKDsU9IZveyCG44J106J39ABenQ5EetbYtVJHUw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -1722,8 +1722,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.30: - resolution: {integrity: sha512-LUnpzoMpRqFON5En4qEj6NWiyH6a1K+Y2qYNKrCy5qPTjDoG/EWeqMz69n8Uv7pRuvDKl3FNGJ1dufTrA5i0sw==} + /esbuild-linux-64/0.14.31: + resolution: {integrity: sha512-Zf9CZxAxaXWHLqCg/QZ/hs0RU0XV3IBxV+ENQzy00S4QOTnZAvSLgPciILHHrVJ0lPIlb4XzAqlLM5y6iI2LIw==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -1731,8 +1731,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.30: - resolution: {integrity: sha512-97T+bbXnpqf7mfIG49UR7ZSJFGgvc22byn74qw3Kx2GDCBSQoVFjyWuKOHGXp8nXk3XYrdFF+mQ8yQ7aNsgQvg==} + /esbuild-linux-arm/0.14.31: + resolution: {integrity: sha512-RpiaeHPRlgCCDskxoyIsI49BhcDtZ4cl8+SLffizDm0yMNWP538SUg0ezQ2TTOPj3/svaGIbkRDwYtAon0Sjkg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -1740,8 +1740,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.30: - resolution: {integrity: sha512-DHZHn6FK5q/KL0fpNT/0jE38Nnyk2rXxKE9WENi95EXtqfOLPgE8tzjTZQNgpr61R95QX4ymQU26ni3IZk8buQ==} + /esbuild-linux-arm64/0.14.31: + resolution: {integrity: sha512-V/H0tv+xpQ9IOHM+o85oCKNNidIEc5CcnDWl0V+hPd2F03dqdbFkWPBGphx8rD4JSQn6UefUQ1iH7y1qIzO8Fw==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -1749,8 +1749,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.30: - resolution: {integrity: sha512-fLUzTFZ7uknC0aPTk7/lM7NmaG/9ZqE3SaHEphcaM009SZK/mDOvZugWi1ss6WGNhk13dUrhkfHcc4FSb9hYhg==} + /esbuild-linux-mips64le/0.14.31: + resolution: {integrity: sha512-9/oBfAckInRuUg6AEgdCLLn6KJ6UOJDOLmUinTsReVSg6AfV6wxYQJq9iQM2idRogP7GUpomJ+bvCdWXpotQRQ==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -1758,8 +1758,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.30: - resolution: {integrity: sha512-2Oudm2WEfj0dNU9bzIl5L/LrsMEmHWsOsYgJJqu8fDyUDgER+J1d33qz3cUdjsJk7gAENayIxDSpsuCszx0w3A==} + /esbuild-linux-ppc64le/0.14.31: + resolution: {integrity: sha512-NMcb14Pg+8q8raGkzor9/R3vQwKzgxE3694BtO2SDLBwJuL2C1dQ1ZtM1t7ZvArQBgT8RiZVxb0/3fD+qGNk7g==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -1767,8 +1767,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.30: - resolution: {integrity: sha512-RPMucPW47rV4t2jlelaE948iCRtbZf5RhifxSwzlpM1Mqdyu99MMNK0w4jFreGTmLN+oGomxIOxD6n+2E/XqHw==} + /esbuild-linux-riscv64/0.14.31: + resolution: {integrity: sha512-l13yvmsVfawAnoYfcpuvml+nTlrOmtdceXYufSkXl2DOb0JKcuR6ARlAzuQCDcpo49SOJy1cCxpwlOIsUQBfzA==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -1776,8 +1776,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.30: - resolution: {integrity: sha512-OZ68r7ok6qO7hdwrwQn2p5jbIRRcUcVaAykB7e0uCA0ODwfeGunILM6phJtq2Oz4dlEEFvd+tSuma3paQKwt+A==} + /esbuild-linux-s390x/0.14.31: + resolution: {integrity: sha512-GIwV9mY3koYja9MCSkKLk1P7rj+MkPV0UsGsZ575hEcIBrXeKN9jBi6X/bxDDPEN/SUAH35cJhBNrZU4x9lEfg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -1785,8 +1785,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.30: - resolution: {integrity: sha512-iyejQUKn0TzpPkufq8pSCxOg9NheycQbMbPCmjefTe9wYuUlBt1TcHvdoJnYbQzsAhAh1BNq+s0ycRsIJFZzaQ==} + /esbuild-netbsd-64/0.14.31: + resolution: {integrity: sha512-bJ+pyLvKQm+Obp5k7/Wk8e9Gdkls56F1aiI3uptoIfOIUqsZImH7pDyTrSufwqsFp62kO9LRuwXnjDwQtPyhFQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -1797,11 +1797,11 @@ packages: /esbuild-node-loader/0.6.5: resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} dependencies: - esbuild: 0.14.30 + esbuild: 0.14.31 dev: true - /esbuild-openbsd-64/0.14.30: - resolution: {integrity: sha512-UyK1MTMcy4j5fH260fsE1o6MVgWNhb62eCK2yCKCRazZv8Nqdc2WiP9ygjWidmEdCDS+A6MuVp9ozk9uoQtQpA==} + /esbuild-openbsd-64/0.14.31: + resolution: {integrity: sha512-NRAAPPca05H9j9Xab0kVXK0V6/pyZGGy8d2Y8KS0BMwWEydlD4KCJDmH8/7bWCKYLRGOOCE9/GPBJyPWHFW3sg==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -1809,16 +1809,16 @@ packages: dev: true optional: true - /esbuild-register/3.3.2_esbuild@0.14.30: + /esbuild-register/3.3.2_esbuild@0.14.31: resolution: {integrity: sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==} peerDependencies: esbuild: '>=0.12 <1' dependencies: - esbuild: 0.14.30 + esbuild: 0.14.31 dev: true - /esbuild-sunos-64/0.14.30: - resolution: {integrity: sha512-aQRtRTNKHB4YuG+xXATe5AoRTNY48IJg5vjE8ElxfmjO9+KdX7MHFkTLhlKevCD6rNANtB3qOlSIeAiXTwHNqw==} + /esbuild-sunos-64/0.14.31: + resolution: {integrity: sha512-9uA+V8w9Eehu4ldb95lPWdgCMcMO5HH6pXmfkk5usn3JsSZxKdLKsXB4hYgP80wscZvVYXJl2G+KNxsUTfPhZw==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -1826,8 +1826,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.30: - resolution: {integrity: sha512-9/fb1tPtpacMqxAXp3fGHowUDg/l9dVch5hKmCLEZC6PdGljh6h372zMdJwYfH0Bd5CCPT0Wx95uycBLJiqpXA==} + /esbuild-windows-32/0.14.31: + resolution: {integrity: sha512-VGdncQTqoxD9q3v/dk0Yugbmx2FzOkcs0OemBYc1X9KXOLQYH0uQbLJIckZdZOC3J+JKSExbYFrzYCOwWPuNyA==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -1835,8 +1835,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.30: - resolution: {integrity: sha512-DHgITeUhPAnN9I5O6QBa1GVyPOhiYCn4S4TtQr7sO4+X0LNyqnlmA1M0qmGkUdDC1QQfjI8uQ4G/whdWb2pWIQ==} + /esbuild-windows-64/0.14.31: + resolution: {integrity: sha512-v/2ye5zBqpmCzi3bLCagStbNQlnOsY7WtMrD2Q0xZxeSIXONxji15KYtVee5o7nw4lXWbQSS1BL8G6BBMvtq4A==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1844,8 +1844,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.30: - resolution: {integrity: sha512-F1kLyQH7zSgjh5eLxogGZN7C9+KNs9m+s7Q6WZoMmCWT/6j998zlaoECHyM8izJRRfsvw2eZlEa1jO6/IOU1AQ==} + /esbuild-windows-arm64/0.14.31: + resolution: {integrity: sha512-RXeU42FJoG1sriNHg73h4S+5B7L/gw+8T7U9u8IWqSSEbY6fZvBh4uofugiU1szUDqqP00GHwZ09WgYe3lGZiw==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -1853,32 +1853,32 @@ packages: dev: true optional: true - /esbuild/0.14.30: - resolution: {integrity: sha512-wCecQSBkIjp2xjuXY+wcXS/PpOQo9rFh4NAKPh4Pm9f3fuLcnxkR0rDzA+mYP88FtXIUcXUyYmaIgfrzRl55jA==} + /esbuild/0.14.31: + resolution: {integrity: sha512-QA0fUM13+JZzcvg1bdrhi7wo8Lr5IRHA9ypNn2znqxGqb66dSK6pAh01TjyBOhzZGazPQJZ1K26VrCAQJ715qA==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.30 - esbuild-android-arm64: 0.14.30 - esbuild-darwin-64: 0.14.30 - esbuild-darwin-arm64: 0.14.30 - esbuild-freebsd-64: 0.14.30 - esbuild-freebsd-arm64: 0.14.30 - esbuild-linux-32: 0.14.30 - esbuild-linux-64: 0.14.30 - esbuild-linux-arm: 0.14.30 - esbuild-linux-arm64: 0.14.30 - esbuild-linux-mips64le: 0.14.30 - esbuild-linux-ppc64le: 0.14.30 - esbuild-linux-riscv64: 0.14.30 - esbuild-linux-s390x: 0.14.30 - esbuild-netbsd-64: 0.14.30 - esbuild-openbsd-64: 0.14.30 - esbuild-sunos-64: 0.14.30 - esbuild-windows-32: 0.14.30 - esbuild-windows-64: 0.14.30 - esbuild-windows-arm64: 0.14.30 + esbuild-android-64: 0.14.31 + esbuild-android-arm64: 0.14.31 + esbuild-darwin-64: 0.14.31 + esbuild-darwin-arm64: 0.14.31 + esbuild-freebsd-64: 0.14.31 + esbuild-freebsd-arm64: 0.14.31 + esbuild-linux-32: 0.14.31 + esbuild-linux-64: 0.14.31 + esbuild-linux-arm: 0.14.31 + esbuild-linux-arm64: 0.14.31 + esbuild-linux-mips64le: 0.14.31 + esbuild-linux-ppc64le: 0.14.31 + esbuild-linux-riscv64: 0.14.31 + esbuild-linux-s390x: 0.14.31 + esbuild-netbsd-64: 0.14.31 + esbuild-openbsd-64: 0.14.31 + esbuild-sunos-64: 0.14.31 + esbuild-windows-32: 0.14.31 + esbuild-windows-64: 0.14.31 + esbuild-windows-arm64: 0.14.31 dev: true /escalade/3.1.1: @@ -2045,9 +2045,9 @@ packages: hasBin: true dependencies: cross-spawn: 7.0.3 - esbuild: 0.14.30 + esbuild: 0.14.31 esbuild-node-loader: 0.6.5 - esbuild-register: 3.3.2_esbuild@0.14.30 + esbuild-register: 3.3.2_esbuild@0.14.31 import-meta-resolve: 1.1.1 dev: true @@ -4390,7 +4390,7 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.30 + esbuild: 0.14.31 postcss: 8.4.12 resolve: 1.22.0 rollup: 2.70.1 From 845c6db884939074394fc43f736cdaeb9bdcd12c Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 4 Apr 2022 17:11:52 +0200 Subject: [PATCH 114/130] refactor: remove inconsistent defaults from internet.password() (#767) --- src/internet.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/internet.ts b/src/internet.ts index 8961af9e8a3..7615607f546 100644 --- a/src/internet.ts +++ b/src/internet.ts @@ -358,7 +358,8 @@ export class Internet { * * @param len The length of the password to generate. Defaults to `15`. * @param memorable Whether the generated password should be memorable. Defaults to `false`. - * @param pattern The pattern that all chars should match should match. Defaults to `/\w/`. + * @param pattern The pattern that all chars should match should match. + * This option will be ignored, if `memorable` is `true`. Defaults to `/\w/`. * @param prefix The prefix to use. Defaults to `''`. * * @example @@ -369,15 +370,11 @@ export class Internet { * faker.internet.password(20, true, /[A-Z]/, 'Hello ') // 'Hello IREOXTDWPERQSB' */ password( - len?: number, - memorable?: boolean, - pattern?: RegExp, - prefix?: string + len: number = 15, + memorable: boolean = false, + pattern: RegExp = /\w/, + prefix: string = '' ): string { - len = len || 15; - if (memorable == null) { - memorable = false; - } /* * password-generator ( function ) * Copyright(c) 2011-2013 Bermi Ferrer @@ -386,12 +383,11 @@ export class Internet { const vowel = /[aeiouAEIOU]$/; const consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/; const _password = ( - length = 10, - memorable = true, - pattern = /\w/, - prefix = '' + length: number, + memorable: boolean, + pattern: RegExp, + prefix: string ): string => { - let char: string; if (prefix.length >= length) { return prefix; } @@ -403,14 +399,14 @@ export class Internet { } } const n = this.faker.datatype.number(94) + 33; - char = String.fromCharCode(n); + let char = String.fromCharCode(n); if (memorable) { char = char.toLowerCase(); } if (!char.match(pattern)) { return _password(length, memorable, pattern, prefix); } - return _password(length, memorable, pattern, '' + prefix + char); + return _password(length, memorable, pattern, prefix + char); }; return _password(len, memorable, pattern, prefix); } From 8f40d2b1a6044467b5ec23a0f6aaf46cfca6c9a1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 4 Apr 2022 17:36:18 +0200 Subject: [PATCH 115/130] test: fix random alpha and alphaNumeric tests assumptions (#774) --- test/random.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/random.spec.ts b/test/random.spec.ts index c0885b2ddd6..79dbf18d5ef 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -187,12 +187,12 @@ describe('random', () => { it('should return lowercase letter when no upcase option provided', () => { const actual = faker.random.alpha(); - expect(actual).match(/[a-z]/); + expect(actual).match(/^[a-z]$/); }); it('should return uppercase when upcase option is true', () => { const actual = faker.random.alpha({ upcase: true }); - expect(actual).match(/[A-Z]/); + expect(actual).match(/^[A-Z]$/); }); it('should generate many random letters', () => { @@ -208,7 +208,7 @@ describe('random', () => { }); expect(actual).toHaveLength(5); - expect(actual).match(/[b-oq-z]/); + expect(actual).match(/^[b-oq-z]{5}$/); }); it('should be able handle mistake in banned characters array', () => { @@ -218,7 +218,7 @@ describe('random', () => { }); expect(alphaText).toHaveLength(5); - expect(alphaText).match(/[b-oq-z]/); + expect(alphaText).match(/^[b-oq-z]{5}$/); }); }); @@ -265,7 +265,7 @@ describe('random', () => { }); expect(alphaText).toHaveLength(5); - expect(alphaText).match(/[b-oq-z]/); + expect(alphaText).match(/^[0-9b-oq-z]{5}$/); }); it('should throw if all possible characters being banned', () => { From b34ef465fb23829e4f07f3ffbba4203737f74b08 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 4 Apr 2022 17:45:42 +0200 Subject: [PATCH 116/130] chore(release): 6.1.2 (#773) --- CHANGELOG.md | 15 +++++++++++++++ package.json | 2 +- pnpm-lock.yaml | 32 +++++++++++++++++--------------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2454101957a..ce48536fc27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [6.1.2](https://github.com/faker-js/faker/compare/v6.1.1...v6.1.2) (2022-04-04) + + +### Features + +* FakerError ([#718](https://github.com/faker-js/faker/issues/718)) ([c3be3b1](https://github.com/faker-js/faker/commit/c3be3b1945248ed422342b046ad765d252bbac05)) + + +### Bug Fixes + +* datatype.number when min = max + precision, throw when max > min ([#664](https://github.com/faker-js/faker/issues/664)) ([0304120](https://github.com/faker-js/faker/commit/03041201c21ad599bbe1874c375f4f41b94961ba)) +* deterministic results for address.nearbyGPSCoordinate ([#737](https://github.com/faker-js/faker/issues/737)) ([bc7bd57](https://github.com/faker-js/faker/commit/bc7bd571d8d6c70b046a3bda23c61c527ddb1d4a)) +* random word fails on undefined ([#771](https://github.com/faker-js/faker/issues/771)) ([fb1b87e](https://github.com/faker-js/faker/commit/fb1b87e2249798c6257cb5383f73a15022f438f0)) +* remove doubled extension in system.filePath ([#300](https://github.com/faker-js/faker/issues/300)) ([2532eb9](https://github.com/faker-js/faker/commit/2532eb9f5a6f73bbc1786ec91952f838d98fd72a)) + ## [6.1.1](https://github.com/faker-js/faker/compare/v6.1.0...v6.1.1) (2022-03-28) ### Bug Fixes diff --git a/package.json b/package.json index 010443555dc..54aec8f7778 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@faker-js/faker", - "version": "6.1.1", + "version": "6.1.2", "description": "Generate massive amounts of fake contextual data", "keywords": [ "faker", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f8922fabf99..f5f7f0f075c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -256,7 +256,7 @@ packages: resolution: {integrity: sha512-j3tUJWlgW3slYqzGB8fm7y05kh2qqrIK1dZOXHeMUm/5gdKE85fiz/ltfCPMDFb/MXF+bLZChJXSMzqY0Ck30Q==} dependencies: '@docsearch/react': 3.0.0 - preact: 10.6.6 + preact: 10.7.0 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -560,8 +560,8 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/2.2.4_vite@2.9.1+vue@3.2.31: - resolution: {integrity: sha512-ev9AOlp0ljCaDkFZF3JwC/pD2N4Hh+r5srl5JHM6BKg5+99jiiK0rE/XaRs3pVm1wzyKkjUy/StBSoXX5fFzcw==} + /@vitejs/plugin-vue/2.3.1_vite@2.9.1+vue@3.2.31: + resolution: {integrity: sha512-YNzBt8+jt6bSwpt7LP890U1UcTOIZZxfpE5WOJ638PNxSEKOqAi0+FSKS0nVeukfdZ0Ai/H7AFd6k3hayfGZqQ==} engines: {node: '>=12.0.0'} peerDependencies: vite: ^2.5.10 @@ -1639,7 +1639,7 @@ packages: is-callable: 1.2.4 is-negative-zero: 2.0.2 is-regex: 1.1.4 - is-shared-array-buffer: 1.0.1 + is-shared-array-buffer: 1.0.2 is-string: 1.0.7 is-weakref: 1.0.2 object-inspect: 1.12.0 @@ -2701,8 +2701,8 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-number-object/1.0.6: - resolution: {integrity: sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==} + /is-number-object/1.0.7: + resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} engines: {node: '>= 0.4'} dependencies: has-tostringtag: 1.0.0 @@ -2741,8 +2741,10 @@ packages: has-tostringtag: 1.0.0 dev: true - /is-shared-array-buffer/1.0.1: - resolution: {integrity: sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==} + /is-shared-array-buffer/1.0.2: + resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} + dependencies: + call-bind: 1.0.2 dev: true /is-stream/2.0.1: @@ -3516,8 +3518,8 @@ packages: source-map-js: 1.0.2 dev: true - /preact/10.6.6: - resolution: {integrity: sha512-dgxpTFV2vs4vizwKohYKkk7g7rmp1wOOcfd4Tz3IB3Wi+ivZzsn/SpeKJhRENSE+n8sUfsAl4S3HiCVT923ABw==} + /preact/10.7.0: + resolution: {integrity: sha512-9MEURwzNMKpAil/t6+wabDIJI6oG6GnwypYxiJDvQnW+fHDTt51PYuLZ1QUM31hFr7sDaj9qTaShAF9VIxuxGQ==} dev: true /prelude-ls/1.2.1: @@ -4157,8 +4159,8 @@ packages: engines: {node: '>=14.0.0'} dev: true - /tinyspy/0.3.0: - resolution: {integrity: sha512-c5uFHqtUp74R2DJE3/Efg0mH5xicmgziaQXMm/LvuuZn3RdpADH32aEGDRyCzObXT1DNfwDMqRQ/Drh1MlO12g==} + /tinyspy/0.3.1: + resolution: {integrity: sha512-XXD1NYn5HciffxgxlHmOzq45tTNKRtPHss5go1ZAQmX9LLBIszXLG+NEpnD0shS2F2OMcQ9VSk7IswEeViCrbw==} engines: {node: '>=14.0.0'} dev: true @@ -4405,7 +4407,7 @@ packages: dependencies: '@docsearch/css': 3.0.0 '@docsearch/js': 3.0.0 - '@vitejs/plugin-vue': 2.2.4_vite@2.9.1+vue@3.2.31 + '@vitejs/plugin-vue': 2.3.1_vite@2.9.1+vue@3.2.31 prismjs: 1.27.0 vite: 2.9.1 vue: 3.2.31 @@ -4445,7 +4447,7 @@ packages: chai: 4.3.6 local-pkg: 0.4.1 tinypool: 0.1.2 - tinyspy: 0.3.0 + tinyspy: 0.3.1 vite: 2.9.1 transitivePeerDependencies: - less @@ -4476,7 +4478,7 @@ packages: dependencies: is-bigint: 1.0.4 is-boolean-object: 1.1.2 - is-number-object: 1.0.6 + is-number-object: 1.0.7 is-string: 1.0.7 is-symbol: 1.0.4 dev: true From f22b93a0d6fc08e122b67c2a7dd010ee81d67be4 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 5 Apr 2022 11:14:18 -0400 Subject: [PATCH 117/130] feat: add some en locale product names (#686) --- src/locales/en/commerce/product_name.ts | 8 ++++++++ test/commerce.spec.ts | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/locales/en/commerce/product_name.ts b/src/locales/en/commerce/product_name.ts index 9658530e97c..8c52af68d1d 100644 --- a/src/locales/en/commerce/product_name.ts +++ b/src/locales/en/commerce/product_name.ts @@ -2,24 +2,32 @@ export default { adjective: [ 'Small', 'Ergonomic', + 'Electronic', 'Rustic', 'Intelligent', 'Gorgeous', 'Incredible', + 'Elegant', 'Fantastic', 'Practical', + 'Modern', + 'Recycled', 'Sleek', + 'Bespoke', 'Awesome', 'Generic', 'Handcrafted', 'Handmade', + 'Oriental', 'Licensed', + 'Luxurious', 'Refined', 'Unbranded', 'Tasty', ], material: [ 'Steel', + 'Bronze', 'Wooden', 'Concrete', 'Plastic', diff --git a/test/commerce.spec.ts b/test/commerce.spec.ts index 3497aa9fdaf..64c7d7b324d 100644 --- a/test/commerce.spec.ts +++ b/test/commerce.spec.ts @@ -10,7 +10,7 @@ const seededRuns = [ productName: 'Fantastic Soft Sausages', price: '375.00', productAdjective: 'Fantastic', - productMaterial: 'Cotton', + productMaterial: 'Plastic', product: 'Pants', productDescription: 'The Apollotech B340 is an affordable wireless mouse with reliable connectivity, 12 months battery life and modern design', @@ -21,9 +21,9 @@ const seededRuns = [ expectations: { color: 'black', department: 'Computers', - productName: 'Gorgeous Rubber Keyboard', + productName: 'Incredible Granite Keyboard', price: '263.00', - productAdjective: 'Gorgeous', + productAdjective: 'Incredible', productMaterial: 'Concrete', product: 'Ball', productDescription: @@ -35,7 +35,7 @@ const seededRuns = [ expectations: { color: 'azure', department: 'Automotive', - productName: 'Unbranded Granite Salad', + productName: 'Unbranded Cotton Salad', price: '929.00', productAdjective: 'Unbranded', productMaterial: 'Frozen', From 955ea43c2b885feb276a670babe859cb3ecc87d2 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 5 Apr 2022 11:18:36 -0400 Subject: [PATCH 118/130] feat: add some en locale city prefixes and suffixes (#685) --- src/locales/en/address/city_prefix.ts | 11 ++++++++++- src/locales/en/address/city_suffix.ts | 5 +++++ test/address.spec.ts | 12 ++++++------ test/helpers.spec.ts | 8 ++++---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/locales/en/address/city_prefix.ts b/src/locales/en/address/city_prefix.ts index 6a87806239a..1b76009ea9f 100644 --- a/src/locales/en/address/city_prefix.ts +++ b/src/locales/en/address/city_prefix.ts @@ -1 +1,10 @@ -export default ['North', 'East', 'West', 'South', 'New', 'Lake', 'Port']; +export default [ + 'North', + 'East', + 'West', + 'South', + 'New', + 'Lake', + 'Port', + 'Fort', +]; diff --git a/src/locales/en/address/city_suffix.ts b/src/locales/en/address/city_suffix.ts index 24ed8b3849d..40769ad5421 100644 --- a/src/locales/en/address/city_suffix.ts +++ b/src/locales/en/address/city_suffix.ts @@ -5,17 +5,22 @@ export default [ 'ville', 'berg', 'burgh', + 'boro', 'borough', 'bury', 'view', 'port', 'mouth', 'stad', + 'stead', 'furt', 'chester', + 'cester', 'mouth', 'fort', + 'field', 'haven', 'side', 'shire', + 'worth', ]; diff --git a/test/address.spec.ts b/test/address.spec.ts index f7ee4cacb8c..8007714568a 100644 --- a/test/address.spec.ts +++ b/test/address.spec.ts @@ -5,7 +5,7 @@ const seededRuns = [ { seed: 42, expectations: { - city: 'Lake Valentine', + city: 'Port Valentine', cityPrefix: 'West', citySuffix: 'bury', cityName: 'Gulfport', @@ -35,9 +35,9 @@ const seededRuns = [ { seed: 1337, expectations: { - city: 'South Carmelo', - cityPrefix: 'East', - citySuffix: 'berg', + city: 'New Carmelo', + cityPrefix: 'West', + citySuffix: 'boro', cityName: 'Dubuque', streetName: 'Carmelo Forks', streetPrefix: 'a', @@ -66,8 +66,8 @@ const seededRuns = [ seed: 1211, expectations: { city: 'La Crosse', - cityPrefix: 'Port', - citySuffix: 'side', + cityPrefix: 'Fort', + citySuffix: 'shire', cityName: 'Urbana', streetName: 'Trantow Via', streetPrefix: 'c', diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index cf817ae5800..9f81e20191f 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -44,7 +44,7 @@ const seededRuns = [ }, ], address: { - city: 'Leopoldbury', + city: 'Leopoldview', country: 'Aruba', geo: { lat: '51.3317', @@ -123,7 +123,7 @@ const seededRuns = [ }, userCard: { address: { - city: 'North Wainochester', + city: 'North Wainomouth', geo: { lat: '4.4562', lng: '-177.4562', @@ -396,7 +396,7 @@ const seededRuns = [ }, contextualCard: { address: { - city: 'Susieville', + city: 'Susieberg', geo: { lat: '-88.0651', lng: '-37.2858', @@ -421,7 +421,7 @@ const seededRuns = [ }, userCard: { address: { - city: 'Reingerfort', + city: 'Reingerfield', geo: { lat: '73.0714', lng: '-108.2073', From b3a9abcf487372f53eece207099f3f645f9b9c8f Mon Sep 17 00:00:00 2001 From: wael Date: Tue, 5 Apr 2022 19:22:39 +0400 Subject: [PATCH 119/130] feat: add more arabic names dataset (#655) --- src/locales/ar/name/female_first_name.ts | 13 +++++++++++++ src/locales/ar/name/index.ts | 6 ++++++ src/locales/ar/name/male_first_name.ts | 12 ++++++++++++ src/locales/ar/name/suffix.ts | 1 + 4 files changed, 32 insertions(+) create mode 100644 src/locales/ar/name/female_first_name.ts create mode 100644 src/locales/ar/name/male_first_name.ts create mode 100644 src/locales/ar/name/suffix.ts diff --git a/src/locales/ar/name/female_first_name.ts b/src/locales/ar/name/female_first_name.ts new file mode 100644 index 00000000000..85d256def40 --- /dev/null +++ b/src/locales/ar/name/female_first_name.ts @@ -0,0 +1,13 @@ +export default [ + 'فاطمه', + 'خلود', + 'عوضية', + 'عنود', + 'عنود', + 'نوف', + 'ريم', + 'اروي', + 'براءة', + 'بتول', + 'بلسم', +]; diff --git a/src/locales/ar/name/index.ts b/src/locales/ar/name/index.ts index 77b4c2eb216..b8cd692accc 100644 --- a/src/locales/ar/name/index.ts +++ b/src/locales/ar/name/index.ts @@ -3,17 +3,23 @@ * Run 'pnpm run generate:locales' to update. */ import type { NameDefinitions } from '../../..'; +import female_first_name from './female_first_name'; import first_name from './first_name'; import last_name from './last_name'; +import male_first_name from './male_first_name'; import name_ from './name'; import prefix from './prefix'; +import suffix from './suffix'; import title from './title'; const name: Partial = { + female_first_name, first_name, last_name, + male_first_name, name: name_, prefix, + suffix, title, }; diff --git a/src/locales/ar/name/male_first_name.ts b/src/locales/ar/name/male_first_name.ts new file mode 100644 index 00000000000..d8652135b13 --- /dev/null +++ b/src/locales/ar/name/male_first_name.ts @@ -0,0 +1,12 @@ +export default [ + 'محمد', + 'أحمد', + 'حسن', + 'خالد', + 'محسن', + 'على', + 'ابراهيم', + 'كمال', + 'عبد الله', + 'مصعب', +]; diff --git a/src/locales/ar/name/suffix.ts b/src/locales/ar/name/suffix.ts new file mode 100644 index 00000000000..eebfcb859b6 --- /dev/null +++ b/src/locales/ar/name/suffix.ts @@ -0,0 +1 @@ +export default ['المحترم', 'المبجل', 'حفظه الله', 'الموقر']; From acaedb30d2ff47c8597d08db5bf03f487bfcb153 Mon Sep 17 00:00:00 2001 From: hyesung oh Date: Wed, 6 Apr 2022 00:36:15 +0900 Subject: [PATCH 120/130] feat: append more korean dataset and delete wrong dataset (#573) --- src/locales/ko/address/city_name.ts | 7 +++++++ src/locales/ko/address/street_root.ts | 5 ++--- src/locales/ko/name/first_name.ts | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/locales/ko/address/city_name.ts b/src/locales/ko/address/city_name.ts index 044e6bb3ffd..c90b09c02e3 100644 --- a/src/locales/ko/address/city_name.ts +++ b/src/locales/ko/address/city_name.ts @@ -27,4 +27,11 @@ export default [ '부평', '강화', '수성', + '수원', + '속초', + '전주', + '목포', + '분당', + '안양', + '시흥', ]; diff --git a/src/locales/ko/address/street_root.ts b/src/locales/ko/address/street_root.ts index ac2d95da299..a1c055f3578 100644 --- a/src/locales/ko/address/street_root.ts +++ b/src/locales/ko/address/street_root.ts @@ -6,18 +6,15 @@ export default [ '잠실', '면목', '주안', - '안양', '중', '정왕', '구로', '신월', '연산', - '부평', '창', '만수', '중계', '검단', - '시흥', '상도', '방배', '장유', @@ -27,4 +24,6 @@ export default [ '행신', '대명', '동탄', + '판교', + '연무', ]; diff --git a/src/locales/ko/name/first_name.ts b/src/locales/ko/name/first_name.ts index e48d0e31e63..c968e4915e1 100644 --- a/src/locales/ko/name/first_name.ts +++ b/src/locales/ko/name/first_name.ts @@ -3013,4 +3013,5 @@ export default [ '형건', '경륜', '민광', + '슬희', ]; From 6214425d92a2d34268283bace19a02d6f1d9924e Mon Sep 17 00:00:00 2001 From: Bharat D Bhadresha Date: Tue, 5 Apr 2022 21:13:40 +0530 Subject: [PATCH 121/130] feat: add Lastname - Bhadresha, Jangid, Suthar (#243) --- src/locales/en_IND/name/last_name.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/locales/en_IND/name/last_name.ts b/src/locales/en_IND/name/last_name.ts index f636a5c68ff..01913363868 100644 --- a/src/locales/en_IND/name/last_name.ts +++ b/src/locales/en_IND/name/last_name.ts @@ -13,6 +13,7 @@ export default [ 'Bharadwaj', 'Bhat', 'Butt', + 'Bhadresha', 'Bhattacharya', 'Bhattathiri', 'Chaturvedi', @@ -36,6 +37,7 @@ export default [ 'Iyer', 'Iyengar', 'Jain', + 'Jangid', 'Jha', 'Johar', 'Joshi', @@ -80,6 +82,7 @@ export default [ 'Singh', 'Sinha', 'Somayaji', + 'Suthar', 'Tagore', 'Talwar', 'Tandon', From 307c2d20c6cafef55a10fb424e5683c0d018cc55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Tue, 5 Apr 2022 18:16:41 +0200 Subject: [PATCH 122/130] refactor(helpers.shuffle): remove unused default value (#698) --- src/helpers.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index f302ac46c12..e451eaab130 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -417,11 +417,9 @@ export class Helpers { return o || []; } - // TODO ST-DDT 2022-02-06: This default will never be taken!? - o = o || (['a', 'b', 'c'] as unknown as T[]); - for (let x: T, j: number, i = o.length - 1; i > 0; --i) { - j = this.faker.datatype.number(i); - x = o[i]; + for (let i = o.length - 1; i > 0; --i) { + const j = this.faker.datatype.number(i); + const x = o[i]; o[i] = o[j]; o[j] = x; } From ccb58a177f2c311130b85b7a7c2efe0e0402d886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= <77127505+xDivisionByZerox@users.noreply.github.com> Date: Tue, 5 Apr 2022 18:54:19 +0200 Subject: [PATCH 123/130] refactor(address.countryCode): signature (#588) --- src/address.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/address.ts b/src/address.ts index 246f4d9b455..f7ceeddc297 100644 --- a/src/address.ts +++ b/src/address.ts @@ -340,25 +340,12 @@ export class Address { * faker.address.countryCode() // 'SJ' * faker.address.countryCode('alpha-2') // 'GA' * faker.address.countryCode('alpha-3') // 'TJK' - * faker.address.countryCode('unsupported') // 'DJ' */ - // TODO ST-DDT 2022-02-10: Limit the parameter to the two values. - countryCode(alphaCode: string = 'alpha-2'): string { - if (alphaCode === 'alpha-2') { - return this.faker.random.arrayElement( - this.faker.definitions.address.country_code - ); - } + countryCode(alphaCode: 'alpha-2' | 'alpha-3' = 'alpha-2'): string { + const key: keyof typeof this.faker.definitions.address = + alphaCode === 'alpha-3' ? 'country_code_alpha_3' : 'country_code'; - if (alphaCode === 'alpha-3') { - return this.faker.random.arrayElement( - this.faker.definitions.address.country_code_alpha_3 - ); - } - - return this.faker.random.arrayElement( - this.faker.definitions.address.country_code - ); + return this.faker.random.arrayElement(this.faker.definitions.address[key]); } /** From 2c93fa3d7f280e8acf2e7193620bcff1f4cacd31 Mon Sep 17 00:00:00 2001 From: doughlass <38209263+doughlass@users.noreply.github.com> Date: Tue, 5 Apr 2022 22:02:55 +0100 Subject: [PATCH 124/130] chore: additional domain suffixes added for GB locale (#253) --- src/locales/en_GB/internet/domain_suffix.ts | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/locales/en_GB/internet/domain_suffix.ts b/src/locales/en_GB/internet/domain_suffix.ts index 4ef54a67512..d6de8904c55 100644 --- a/src/locales/en_GB/internet/domain_suffix.ts +++ b/src/locales/en_GB/internet/domain_suffix.ts @@ -1 +1,21 @@ -export default ['co.uk', 'com', 'biz', 'info', 'name']; +export default [ + 'ac.uk', + 'biz', + 'co', + 'co.uk', + 'com', + 'cymru', + 'gov.uk', + 'info', + 'london', + 'ltd.uk', + 'me.uk', + 'name', + 'nhs.uk', + 'org.uk', + 'plc.uk', + 'sch.uk', + 'scot', + 'uk', + 'wales', +]; From 28f49466eb9d76a6a96ed34a8d463ecb030bdf79 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 5 Apr 2022 23:14:26 +0200 Subject: [PATCH 125/130] chore: simplify lorem.sentences() (#784) --- src/lorem.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lorem.ts b/src/lorem.ts index 39ce9d3f73f..9a4f9e04ae8 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -101,13 +101,10 @@ export class Lorem { * // 'Et rerum a unde tempora magnam sit nisi. * // Et perspiciatis ipsam omnis.' */ - sentences(sentenceCount?: number, separator?: string): string { + sentences(sentenceCount?: number, separator: string = ' '): string { if (sentenceCount == null) { sentenceCount = this.faker.datatype.number({ min: 2, max: 6 }); } - if (separator == null) { - separator = ' '; - } const sentences: string[] = []; for (sentenceCount; sentenceCount > 0; sentenceCount--) { sentences.push(this.faker.lorem.sentence()); From 6a2d8fce89e0b46f7b9693a7b1f697c108e8af04 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 5 Apr 2022 23:25:45 +0200 Subject: [PATCH 126/130] fix: use `\n` as default separator for lorem.paragraphs() (#783) --- src/lorem.ts | 5 ++--- test/lorem.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lorem.ts b/src/lorem.ts index 9a4f9e04ae8..a605aa2f743 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -131,7 +131,7 @@ export class Lorem { * Generates the given number of paragraphs. * * @param paragraphCount The number of paragraphs to generate. Defaults to `3`. - * @param separator The separator to use. Defaults to `'\n \r'`. + * @param separator The separator to use. Defaults to `'\n'`. * * @example * faker.lorem.paragraphs() @@ -150,8 +150,7 @@ export class Lorem { * // '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.' */ - // TODO ST-DDT 2022-02-09: The separator looks odd. - paragraphs(paragraphCount: number = 3, separator: string = '\n \r'): string { + paragraphs(paragraphCount: number = 3, separator: string = '\n'): string { const paragraphs: string[] = []; for (paragraphCount; paragraphCount > 0; paragraphCount--) { paragraphs.push(this.faker.lorem.paragraph()); diff --git a/test/lorem.spec.ts b/test/lorem.spec.ts index 2ceb670f3b6..1f2dbc5b22f 100644 --- a/test/lorem.spec.ts +++ b/test/lorem.spec.ts @@ -19,7 +19,7 @@ const seededRuns = [ 'Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat.', 'Alias sit asperiores sit. Corporis laborum cupiditate consequatur et voluptatem nostrum. Laborum in eos quae nostrum aut consequatur. Blanditiis sunt repellendus et. Eum sint voluptatibus deserunt. Quae eos est soluta ipsum qui.', 'Hic earum delectus. Consequatur eum corporis perferendis aspernatur incidunt nobis. Odio nobis quia est.', - ].join('\n \r'), + ].join('\n'), text: 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', lines: [ 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', @@ -42,7 +42,7 @@ const seededRuns = [ 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur.', 'Esse vel qui occaecati omnis quis. Voluptatum quis et libero. Et odio dolor qui velit qui. Eveniet provident non fugiat.', 'A a aut nihil. Quas eligendi excepturi eligendi perferendis quo minus et asperiores. Neque blanditiis consequuntur esse autem harum eligendi aut. Cum consequatur pariatur. Omnis temporibus sapiente.', - ].join('\n \r'), + ].join('\n'), text: 'natus nesciunt non', lines: [ 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem.', @@ -66,7 +66,7 @@ const seededRuns = [ 'Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut.', 'In ullam quia impedit. Occaecati repudiandae ut maiores pariatur enim. Deserunt voluptatem in enim in quia.', 'Ut eligendi tempora eos ipsa cumque nulla. Quidem et sed voluptate et quia. Nulla esse in similique deleniti beatae eaque.', - ].join('\n \r'), + ].join('\n'), text: [ 'Omnis tempora magni repellat eaque tempore nesciunt nobis non voluptas.', 'Ex neque eligendi placeat vel perferendis.', @@ -320,7 +320,7 @@ describe('lorem', () => { expect(actual).toBeTypeOf('string'); expect(actual[actual.length - 1]).toBe('.'); - const paragraphs = actual.split('\n \r'); + const paragraphs = actual.split('\n'); expect(paragraphs).toHaveLength(paragraphCount); }); From b04dc914eec44ec3c5ae760976b616ce1d2584e1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 5 Apr 2022 23:35:01 +0200 Subject: [PATCH 127/130] feat: use street address templates from locales (#754) --- src/address.ts | 45 +++++++++------------ src/definitions/address.ts | 22 ++++++++++ src/locales/ar/address/street_address.ts | 5 ++- src/locales/az/address/street_address.ts | 5 ++- src/locales/cz/address/street_address.ts | 5 ++- src/locales/de/address/street_address.ts | 5 ++- src/locales/de_AT/address/street_address.ts | 5 ++- src/locales/en/address/street_address.ts | 5 ++- src/locales/en_GH/address/street_address.ts | 5 ++- src/locales/es/address/street_address.ts | 8 ++-- src/locales/es_MX/address/street_address.ts | 8 ++-- src/locales/fa/address/street_address.ts | 8 ++-- src/locales/fr/address/street_address.ts | 5 ++- src/locales/fr_BE/address/street_address.ts | 5 ++- src/locales/ge/address/street_address.ts | 5 ++- src/locales/he/address/street_address.ts | 5 ++- src/locales/hr/address/street_address.ts | 5 ++- src/locales/hy/address/street_address.ts | 5 ++- src/locales/id_ID/address/street_address.ts | 5 ++- src/locales/it/address/street_address.ts | 8 ++-- src/locales/lv/address/street_address.ts | 8 ++-- src/locales/mk/address/street_address.ts | 5 ++- src/locales/nb_NO/address/street_address.ts | 5 ++- src/locales/nl/address/street_address.ts | 5 ++- src/locales/nl_BE/address/street_address.ts | 5 ++- src/locales/pl/address/street_address.ts | 5 ++- src/locales/pt_PT/address/street_address.ts | 5 ++- src/locales/ro/address/street_address.ts | 5 ++- src/locales/ru/address/street_address.ts | 5 ++- src/locales/sk/address/street_address.ts | 5 ++- src/locales/sv/address/street_address.ts | 5 ++- src/locales/tr/address/street_address.ts | 5 ++- src/locales/uk/address/street_address.ts | 5 ++- src/locales/ur/address/street_address.ts | 5 ++- src/locales/zh_CN/address/street_address.ts | 5 ++- src/locales/zh_TW/address/street_address.ts | 5 ++- 36 files changed, 178 insertions(+), 74 deletions(-) diff --git a/src/address.ts b/src/address.ts index f7ceeddc297..5c862f5c59f 100644 --- a/src/address.ts +++ b/src/address.ts @@ -206,6 +206,20 @@ export class Address { ); } + /** + * Generates a random building number. + * + * @example + * faker.address.buildingNumber() // '379' + */ + buildingNumber(): string { + const format = this.faker.random.arrayElement( + this.faker.definitions.address.building_number + ); + + return this.faker.helpers.replaceSymbolWithNumber(format); + } + /** * Generates a random localized street name. * @@ -242,30 +256,10 @@ export class Address { * faker.address.streetAddress(false) // '34830 Erdman Hollow' */ streetAddress(useFullAddress: boolean = false): string { - let address = ''; - switch (this.faker.datatype.number(2)) { - case 0: - address = - this.faker.helpers.replaceSymbolWithNumber('#####') + - ' ' + - this.faker.address.streetName(); - break; - case 1: - address = - this.faker.helpers.replaceSymbolWithNumber('####') + - ' ' + - this.faker.address.streetName(); - break; - case 2: - address = - this.faker.helpers.replaceSymbolWithNumber('###') + - ' ' + - this.faker.address.streetName(); - break; - } - return useFullAddress - ? address + ' ' + this.faker.address.secondaryAddress() - : address; + const formats = this.faker.definitions.address.street_address; + const format = formats[useFullAddress ? 'full' : 'normal']; + + return this.faker.fake(format); } /** @@ -293,7 +287,8 @@ export class Address { } /** - * Generates a random localized secondary address. + * Generates a random localized secondary address. This refers to a specific location at a given address + * such as an apartment or room number. * * @example * faker.address.secondaryAddress() // 'Apt. 861' diff --git a/src/definitions/address.ts b/src/definitions/address.ts index 24f9b7cc81d..c5d5409f926 100644 --- a/src/definitions/address.ts +++ b/src/definitions/address.ts @@ -54,6 +54,11 @@ export interface AddressDefinitions { */ direction_abbr: string[]; + /** + * The pattern used to generate building numbers. + */ + building_number: string[]; + /** * Common street prefixes */ @@ -63,6 +68,20 @@ export interface AddressDefinitions { */ street_suffix: string[]; + /** + * The pattern used to generate street addresses. + */ + street_address: { + /** + * The fake pattern to generate only the street address. + */ + normal: string; + /** + * The fake pattern to generate the full street address including the secondary address. + */ + full: string; + }; + /** * The address "inside" an address/e.g. an apartment or office. */ @@ -100,9 +119,12 @@ export const ADDRESS = allOf()( 'direction_abbr', 'direction', + 'building_number', + 'street_prefix', 'street_suffix', + 'street_address', 'secondary_address', 'country_code', diff --git a/src/locales/ar/address/street_address.ts b/src/locales/ar/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/ar/address/street_address.ts +++ b/src/locales/ar/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/az/address/street_address.ts b/src/locales/az/address/street_address.ts index a6c7cff8a2d..73037a5c55f 100644 --- a/src/locales/az/address/street_address.ts +++ b/src/locales/az/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}, #{building_number}']; +export default { + normal: '{{address.streetName}}, {{address.buildingNumber}}', + full: '{{address.streetName}}, {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/cz/address/street_address.ts b/src/locales/cz/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/cz/address/street_address.ts +++ b/src/locales/cz/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/de/address/street_address.ts b/src/locales/de/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/de/address/street_address.ts +++ b/src/locales/de/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/de_AT/address/street_address.ts b/src/locales/de_AT/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/de_AT/address/street_address.ts +++ b/src/locales/de_AT/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/en/address/street_address.ts b/src/locales/en/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/en/address/street_address.ts +++ b/src/locales/en/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/en_GH/address/street_address.ts b/src/locales/en_GH/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/en_GH/address/street_address.ts +++ b/src/locales/en_GH/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/es/address/street_address.ts b/src/locales/es/address/street_address.ts index b313d432161..36449d0b2e1 100644 --- a/src/locales/es/address/street_address.ts +++ b/src/locales/es/address/street_address.ts @@ -1,4 +1,4 @@ -export default [ - '#{street_name}#{building_number}', - '#{street_name}#{building_number} #{secondary_address}', -]; +export default { + normal: '{{address.streetName}}{{address.buildingNumber}}', + full: '{{address.streetName}}{{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/es_MX/address/street_address.ts b/src/locales/es_MX/address/street_address.ts index b313d432161..36449d0b2e1 100644 --- a/src/locales/es_MX/address/street_address.ts +++ b/src/locales/es_MX/address/street_address.ts @@ -1,4 +1,4 @@ -export default [ - '#{street_name}#{building_number}', - '#{street_name}#{building_number} #{secondary_address}', -]; +export default { + normal: '{{address.streetName}}{{address.buildingNumber}}', + full: '{{address.streetName}}{{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/fa/address/street_address.ts b/src/locales/fa/address/street_address.ts index 22ab96e3e01..74133d4015a 100644 --- a/src/locales/fa/address/street_address.ts +++ b/src/locales/fa/address/street_address.ts @@ -1,4 +1,4 @@ -export default [ - '#{street_name}, پلاک #{building_number}', - '#{street_name}, #{street_name}, پلاک #{building_number}', -]; +export default { + normal: '{{address.streetName}}, پلاک {{address.buildingNumber}}', + full: '{{address.streetName}}, پلاک {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/fr/address/street_address.ts b/src/locales/fr/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/fr/address/street_address.ts +++ b/src/locales/fr/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/fr_BE/address/street_address.ts b/src/locales/fr_BE/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/fr_BE/address/street_address.ts +++ b/src/locales/fr_BE/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/ge/address/street_address.ts b/src/locales/ge/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/ge/address/street_address.ts +++ b/src/locales/ge/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/he/address/street_address.ts b/src/locales/he/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/he/address/street_address.ts +++ b/src/locales/he/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/hr/address/street_address.ts b/src/locales/hr/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/hr/address/street_address.ts +++ b/src/locales/hr/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/hy/address/street_address.ts b/src/locales/hy/address/street_address.ts index 41ed0474025..aaf5810e3a4 100644 --- a/src/locales/hy/address/street_address.ts +++ b/src/locales/hy/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{address.street_name} #{address.building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/id_ID/address/street_address.ts b/src/locales/id_ID/address/street_address.ts index 33d2e0ce565..1a4028a2498 100644 --- a/src/locales/id_ID/address/street_address.ts +++ b/src/locales/id_ID/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} no #{building_number}']; +export default { + normal: '{{address.streetName}} no {{address.buildingNumber}}', + full: '{{address.streetName}} no {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/it/address/street_address.ts b/src/locales/it/address/street_address.ts index 98c792d0608..fc1a70df4b5 100644 --- a/src/locales/it/address/street_address.ts +++ b/src/locales/it/address/street_address.ts @@ -1,4 +1,4 @@ -export default [ - '#{street_name} #{building_number}', - '#{street_name} #{building_number}, #{secondary_address}', -]; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}}, {{address.secondaryAddress}}', +}; diff --git a/src/locales/lv/address/street_address.ts b/src/locales/lv/address/street_address.ts index 5987b430a30..aaf5810e3a4 100644 --- a/src/locales/lv/address/street_address.ts +++ b/src/locales/lv/address/street_address.ts @@ -1,4 +1,4 @@ -export default [ - '#{street_name} #{building_number}', - '#{street_name} #{building_number} #{secondary_address}', -]; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/mk/address/street_address.ts b/src/locales/mk/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/mk/address/street_address.ts +++ b/src/locales/mk/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/nb_NO/address/street_address.ts b/src/locales/nb_NO/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/nb_NO/address/street_address.ts +++ b/src/locales/nb_NO/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/nl/address/street_address.ts b/src/locales/nl/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/nl/address/street_address.ts +++ b/src/locales/nl/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/nl_BE/address/street_address.ts b/src/locales/nl_BE/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/nl_BE/address/street_address.ts +++ b/src/locales/nl_BE/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/pl/address/street_address.ts b/src/locales/pl/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/pl/address/street_address.ts +++ b/src/locales/pl/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/pt_PT/address/street_address.ts b/src/locales/pt_PT/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/pt_PT/address/street_address.ts +++ b/src/locales/pt_PT/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/ro/address/street_address.ts b/src/locales/ro/address/street_address.ts index 4a09fa36918..b8624265269 100644 --- a/src/locales/ro/address/street_address.ts +++ b/src/locales/ro/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}, #{building_number}, #{secondary_address}']; +export default { + normal: '{{address.streetName}}, {{address.buildingNumber}}', + full: '{{address.streetName}}, {{address.buildingNumber}}, {{address.secondaryAddress}}', +}; diff --git a/src/locales/ru/address/street_address.ts b/src/locales/ru/address/street_address.ts index a6c7cff8a2d..73037a5c55f 100644 --- a/src/locales/ru/address/street_address.ts +++ b/src/locales/ru/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}, #{building_number}']; +export default { + normal: '{{address.streetName}}, {{address.buildingNumber}}', + full: '{{address.streetName}}, {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/sk/address/street_address.ts b/src/locales/sk/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/sk/address/street_address.ts +++ b/src/locales/sk/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/sv/address/street_address.ts b/src/locales/sv/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/sv/address/street_address.ts +++ b/src/locales/sv/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/tr/address/street_address.ts b/src/locales/tr/address/street_address.ts index 51642bdd055..aaf5810e3a4 100644 --- a/src/locales/tr/address/street_address.ts +++ b/src/locales/tr/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name} #{building_number}']; +export default { + normal: '{{address.streetName}} {{address.buildingNumber}}', + full: '{{address.streetName}} {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/uk/address/street_address.ts b/src/locales/uk/address/street_address.ts index a6c7cff8a2d..73037a5c55f 100644 --- a/src/locales/uk/address/street_address.ts +++ b/src/locales/uk/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}, #{building_number}']; +export default { + normal: '{{address.streetName}}, {{address.buildingNumber}}', + full: '{{address.streetName}}, {{address.buildingNumber}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/ur/address/street_address.ts b/src/locales/ur/address/street_address.ts index 0fcaf4695d6..d6c5878a730 100644 --- a/src/locales/ur/address/street_address.ts +++ b/src/locales/ur/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{building_number} #{street_name}']; +export default { + normal: '{{address.buildingNumber}} {{address.streetName}}', + full: '{{address.buildingNumber}} {{address.streetName}} {{address.secondaryAddress}}', +}; diff --git a/src/locales/zh_CN/address/street_address.ts b/src/locales/zh_CN/address/street_address.ts index ad30a40d255..4b7603430c1 100644 --- a/src/locales/zh_CN/address/street_address.ts +++ b/src/locales/zh_CN/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}#{building_number}号']; +export default { + normal: '{{address.streetName}}{{address.buildingNumber}}号', + full: '{{address.streetName}}{{address.buildingNumber}}号 {{address.secondaryAddress}}', +}; diff --git a/src/locales/zh_TW/address/street_address.ts b/src/locales/zh_TW/address/street_address.ts index cb37c30c607..21e9547332c 100644 --- a/src/locales/zh_TW/address/street_address.ts +++ b/src/locales/zh_TW/address/street_address.ts @@ -1 +1,4 @@ -export default ['#{street_name}#{building_number}號']; +export default { + normal: '{{address.streetName}}{{address.buildingNumber}}號', + full: '{{address.streetName}}{{address.buildingNumber}}號 {{address.secondaryAddress}}', +}; From c6d0cc7ae4f8ea220803bcee5a5e84a7b8230951 Mon Sep 17 00:00:00 2001 From: Krychaxp <55843050+krychaxp@users.noreply.github.com> Date: Tue, 5 Apr 2022 23:56:13 +0200 Subject: [PATCH 128/130] feat: add os. as street prefix for pl (#640) --- src/locales/pl/address/street_prefix.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/pl/address/street_prefix.ts b/src/locales/pl/address/street_prefix.ts index 45b9ba5740f..04bf4b2b72a 100644 --- a/src/locales/pl/address/street_prefix.ts +++ b/src/locales/pl/address/street_prefix.ts @@ -1 +1 @@ -export default ['ul.', 'al.']; +export default ['ul.', 'al.', 'os.']; From 46b2bd4837643b7a97b801d88134dc6b4ceeda21 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 6 Apr 2022 00:29:25 +0200 Subject: [PATCH 129/130] chore: fix finance.iban warnings (#781) --- src/iban.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/iban.ts b/src/iban.ts index b608357ee93..2e67f2813a6 100644 --- a/src/iban.ts +++ b/src/iban.ts @@ -30,21 +30,13 @@ export = { pattern10: ['01', '02', '03', '04', '05', '06', '07', '08', '09'], pattern100: ['001', '002', '003', '004', '005', '006', '007', '008', '009'], toDigitString: (str: string): string => - str.replace( - /[A-Z]/gi, - (match) => - // TODO @Shinigami92 2022-01-13: This needs to be converted to string - // @ts-expect-error - match.toUpperCase().charCodeAt(0) - 55 + str.replace(/[A-Z]/gi, (match) => + String(match.toUpperCase().charCodeAt(0) - 55) ), mod97: (digitStr: string): number => { let m = 0; for (let i = 0; i < digitStr.length; i++) { - m = - (m * 10 + - // @ts-expect-error: We need to convert this properly - (digitStr[i] | 0)) % - 97; + m = (m * 10 + +digitStr[i]) % 97; } return m; }, From 5beac4be3ebcd2bc6096f6ed2988353bb592aa26 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Wed, 6 Apr 2022 00:33:47 +0200 Subject: [PATCH 130/130] feat: extend list of domain suffix for PL locale (#266) --- src/locales/pl/internet/domain_suffix.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/locales/pl/internet/domain_suffix.ts b/src/locales/pl/internet/domain_suffix.ts index 0ecff71e0be..e40e15d94aa 100644 --- a/src/locales/pl/internet/domain_suffix.ts +++ b/src/locales/pl/internet/domain_suffix.ts @@ -1 +1,21 @@ -export default ['com', 'pl', 'com.pl', 'net', 'org']; +export default [ + 'agro.pl', + 'auto.pl', + 'biz.pl', + 'com.pl', + 'edu.pl', + 'gmina.pl', + 'gov.pl', + 'info.pl', + 'miasta.pl', + 'net.pl', + 'nieruchomosci.pl', + 'org.pl', + 'pl', + 'powiat.pl', + 'priv.pl', + 'sklep.pl', + 'szkola.pl', + 'targi.pl', + 'turystyka.pl', +];