From f09825e985f829828020847cfe5cbbd05751849f Mon Sep 17 00:00:00 2001 From: brano Date: Fri, 1 Nov 2024 17:56:12 +0100 Subject: [PATCH 1/3] Bump packages --- CHANGELOG.md | 2 +- package.json | 12 +- pnpm-lock.yaml | 1693 ++++++++++++++++++++---------------------------- 3 files changed, 694 insertions(+), 1013 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc8a6e..e37e906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## 2.5.9 // ### 🔨 Maintenance -- Reorganie the folder structure +- Reorganize the folder structure - Update NPM packages to their latest versions diff --git a/package.json b/package.json index 15d9ac0..ab0789b 100644 --- a/package.json +++ b/package.json @@ -41,14 +41,14 @@ "node": ">=6.9.4" }, "devDependencies": { - "@babel/cli": "^7.25.7", - "@babel/core": "^7.25.7", - "@babel/preset-env": "^7.25.7", - "@babel/register": "^7.25.7", + "@babel/cli": "^7.25.9", + "@babel/core": "^7.26.0", + "@babel/preset-env": "^7.26.0", + "@babel/register": "^7.25.9", "babelify": "^10.0.0", "browser-sync": "^3.0.3", "browserify": "^17.0.1", - "eslint": "^9.11.1", + "eslint": "^9.13.0", "gulp": "^5.0.0", "gulp-babel": "^8.0.0", "gulp-cli": "^3.0.0", @@ -59,7 +59,7 @@ "gulp-uglify": "^3.0.2", "husky": "^9.1.6", "lint-staged": "^15.2.10", - "mocha": "^10.7.3", + "mocha": "^10.8.2", "vinyl-buffer": "^1.0.1", "vinyl-source-stream": "^2.0.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 79f92a7..424c496 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,20 +9,20 @@ importers: .: devDependencies: '@babel/cli': - specifier: ^7.25.7 - version: 7.25.7(@babel/core@7.25.7) + specifier: ^7.25.9 + version: 7.25.9(@babel/core@7.26.0) '@babel/core': - specifier: ^7.25.7 - version: 7.25.7 + specifier: ^7.26.0 + version: 7.26.0 '@babel/preset-env': - specifier: ^7.25.7 - version: 7.25.7(@babel/core@7.25.7) + specifier: ^7.26.0 + version: 7.26.0(@babel/core@7.26.0) '@babel/register': - specifier: ^7.25.7 - version: 7.25.7(@babel/core@7.25.7) + specifier: ^7.25.9 + version: 7.25.9(@babel/core@7.26.0) babelify: specifier: ^10.0.0 - version: 10.0.0(@babel/core@7.25.7) + version: 10.0.0(@babel/core@7.26.0) browser-sync: specifier: ^3.0.3 version: 3.0.3 @@ -30,14 +30,14 @@ importers: specifier: ^17.0.1 version: 17.0.1 eslint: - specifier: ^9.11.1 - version: 9.11.1 + specifier: ^9.13.0 + version: 9.13.0 gulp: specifier: ^5.0.0 version: 5.0.0 gulp-babel: specifier: ^8.0.0 - version: 8.0.0(@babel/core@7.25.7) + version: 8.0.0(@babel/core@7.26.0) gulp-cli: specifier: ^3.0.0 version: 3.0.0 @@ -63,8 +63,8 @@ importers: specifier: ^15.2.10 version: 15.2.10 mocha: - specifier: ^10.7.3 - version: 10.7.3 + specifier: ^10.8.2 + version: 10.8.2 vinyl-buffer: specifier: ^1.0.1 version: 1.0.1 @@ -78,53 +78,47 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - '@babel/cli@7.25.7': - resolution: {integrity: sha512-vQw4QjrqjLSuL0Tt3gfVXbxEHOfsCcHN8tKyTclpSMYLq3Bp0BTzWYZfMKBs3PQ+to8q3BnumBIAsMdOqDJ6nw==} + '@babel/cli@7.25.9': + resolution: {integrity: sha512-I+02IfrTiSanpxJBlZQYb18qCxB6c2Ih371cVpfgIrPQrjAYkf45XxomTJOG8JBWX5GY35/+TmhCMdJ4ZPkL8Q==} engines: {node: '>=6.9.0'} hasBin: true peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/code-frame@7.25.7': - resolution: {integrity: sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==} + '@babel/code-frame@7.26.2': + resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} engines: {node: '>=6.9.0'} - '@babel/compat-data@7.25.7': - resolution: {integrity: sha512-9ickoLz+hcXCeh7jrcin+/SLWm+GkxE2kTvoYyp38p4WkdFXfQJxDFGWp/YHjiKLPx06z2A7W8XKuqbReXDzsw==} + '@babel/compat-data@7.26.2': + resolution: {integrity: sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==} engines: {node: '>=6.9.0'} - '@babel/core@7.25.7': - resolution: {integrity: sha512-yJ474Zv3cwiSOO9nXJuqzvwEeM+chDuQ8GJirw+pZ91sCGCyOZ3dJkVE09fTV0VEVzXyLWhh3G/AolYTPX7Mow==} + '@babel/core@7.26.0': + resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} engines: {node: '>=6.9.0'} - '@babel/generator@7.25.7': - resolution: {integrity: sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-annotate-as-pure@7.24.7': - resolution: {integrity: sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==} + '@babel/generator@7.26.2': + resolution: {integrity: sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==} engines: {node: '>=6.9.0'} '@babel/helper-annotate-as-pure@7.25.7': resolution: {integrity: sha512-4xwU8StnqnlIhhioZf1tqnVWeQ9pvH/ujS8hRfw/WOza+/a+1qv69BWNy+oY231maTCWgKWhfBU7kDpsds6zAA==} engines: {node: '>=6.9.0'} - '@babel/helper-builder-binary-assignment-operator-visitor@7.25.7': - resolution: {integrity: sha512-12xfNeKNH7jubQNm7PAkzlLwEmCs1tfuX3UjIw6vP6QXi+leKh6+LyC/+Ed4EIQermwd58wsyh070yjDHFlNGg==} + '@babel/helper-annotate-as-pure@7.25.9': + resolution: {integrity: sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==} engines: {node: '>=6.9.0'} - '@babel/helper-compilation-targets@7.25.7': - resolution: {integrity: sha512-DniTEax0sv6isaw6qSQSfV4gVRNtw2rte8HHM45t9ZR0xILaufBRNkpMifCRiAPyvL4ACD6v0gfCwCmtOQaV4A==} + '@babel/helper-builder-binary-assignment-operator-visitor@7.25.9': + resolution: {integrity: sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g==} engines: {node: '>=6.9.0'} - '@babel/helper-create-class-features-plugin@7.25.7': - resolution: {integrity: sha512-bD4WQhbkx80mAyj/WCm4ZHcF4rDxkoLFO6ph8/5/mQ3z4vAzltQXAmbc7GvVJx5H+lk5Mi5EmbTeox5nMGCsbw==} + '@babel/helper-compilation-targets@7.25.9': + resolution: {integrity: sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==} engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - '@babel/helper-create-regexp-features-plugin@7.25.2': - resolution: {integrity: sha512-+wqVGP+DFmqwFD3EH6TMTfUNeqDehV3E/dl+Sd54eaXqm17tEUNbEIn4sVivVowbvUpOtIGxdo3GoXyDH9N/9g==} + '@babel/helper-create-class-features-plugin@7.25.9': + resolution: {integrity: sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -135,116 +129,118 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + '@babel/helper-create-regexp-features-plugin@7.25.9': + resolution: {integrity: sha512-ORPNZ3h6ZRkOyAa/SaHU+XsLZr0UQzRwuDQ0cczIA17nAzZ+85G5cVkOJIj7QavLZGSe8QXUmNFxSZzjcZF9bw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + '@babel/helper-define-polyfill-provider@0.6.2': resolution: {integrity: sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==} peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - '@babel/helper-member-expression-to-functions@7.25.7': - resolution: {integrity: sha512-O31Ssjd5K6lPbTX9AAYpSKrZmLeagt9uwschJd+Ixo6QiRyfpvgtVQp8qrDR9UNFjZ8+DO34ZkdrN+BnPXemeA==} + '@babel/helper-member-expression-to-functions@7.25.9': + resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} engines: {node: '>=6.9.0'} - '@babel/helper-module-imports@7.25.7': - resolution: {integrity: sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==} + '@babel/helper-module-imports@7.25.9': + resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} engines: {node: '>=6.9.0'} - '@babel/helper-module-transforms@7.25.7': - resolution: {integrity: sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==} + '@babel/helper-module-transforms@7.26.0': + resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/helper-optimise-call-expression@7.25.7': - resolution: {integrity: sha512-VAwcwuYhv/AT+Vfr28c9y6SHzTan1ryqrydSTFGjU0uDJHw3uZ+PduI8plCLkRsDnqK2DMEDmwrOQRsK/Ykjng==} + '@babel/helper-optimise-call-expression@7.25.9': + resolution: {integrity: sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==} engines: {node: '>=6.9.0'} - '@babel/helper-plugin-utils@7.25.7': - resolution: {integrity: sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==} + '@babel/helper-plugin-utils@7.25.9': + resolution: {integrity: sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==} engines: {node: '>=6.9.0'} - '@babel/helper-remap-async-to-generator@7.25.7': - resolution: {integrity: sha512-kRGE89hLnPfcz6fTrlNU+uhgcwv0mBE4Gv3P9Ke9kLVJYpi4AMVVEElXvB5CabrPZW4nCM8P8UyyjrzCM0O2sw==} + '@babel/helper-remap-async-to-generator@7.25.9': + resolution: {integrity: sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/helper-replace-supers@7.25.7': - resolution: {integrity: sha512-iy8JhqlUW9PtZkd4pHM96v6BdJ66Ba9yWSE4z0W4TvSZwLBPkyDsiIU3ENe4SmrzRBs76F7rQXTy1lYC49n6Lw==} + '@babel/helper-replace-supers@7.25.9': + resolution: {integrity: sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/helper-simple-access@7.25.7': - resolution: {integrity: sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-skip-transparent-expression-wrappers@7.25.7': - resolution: {integrity: sha512-pPbNbchZBkPMD50K0p3JGcFMNLVUCuU/ABybm/PGNj4JiHrpmNyqqCphBk4i19xXtNV0JhldQJJtbSW5aUvbyA==} + '@babel/helper-simple-access@7.25.9': + resolution: {integrity: sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==} engines: {node: '>=6.9.0'} - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} + '@babel/helper-skip-transparent-expression-wrappers@7.25.9': + resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==} engines: {node: '>=6.9.0'} '@babel/helper-string-parser@7.25.7': resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} engines: {node: '>=6.9.0'} '@babel/helper-validator-identifier@7.25.7': resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-option@7.25.7': - resolution: {integrity: sha512-ytbPLsm+GjArDYXJ8Ydr1c/KJuutjF2besPNbIZnZ6MKUxi/uTA22t2ymmA4WFjZFpjiAMO0xuuJPqK2nvDVfQ==} + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} engines: {node: '>=6.9.0'} - '@babel/helper-wrap-function@7.25.7': - resolution: {integrity: sha512-MA0roW3JF2bD1ptAaJnvcabsVlNQShUaThyJbCDD4bCp8NEgiFvpoqRI2YS22hHlc2thjO/fTg2ShLMC3jygAg==} + '@babel/helper-validator-option@7.25.9': + resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==} engines: {node: '>=6.9.0'} - '@babel/helpers@7.25.7': - resolution: {integrity: sha512-Sv6pASx7Esm38KQpF/U/OXLwPPrdGHNKoeblRxgZRLXnAtnkEe4ptJPDtAZM7fBLadbc1Q07kQpSiGQ0Jg6tRA==} + '@babel/helper-wrap-function@7.25.9': + resolution: {integrity: sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==} engines: {node: '>=6.9.0'} - '@babel/highlight@7.25.7': - resolution: {integrity: sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==} + '@babel/helpers@7.26.0': + resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} engines: {node: '>=6.9.0'} - '@babel/parser@7.25.7': - resolution: {integrity: sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==} + '@babel/parser@7.26.2': + resolution: {integrity: sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==} engines: {node: '>=6.0.0'} hasBin: true - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.7': - resolution: {integrity: sha512-UV9Lg53zyebzD1DwQoT9mzkEKa922LNUp5YkTJ6Uta0RbyXaQNUgcvSt7qIu1PpPzVb6rd10OVNTzkyBGeVmxQ==} + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9': + resolution: {integrity: sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.7': - resolution: {integrity: sha512-GDDWeVLNxRIkQTnJn2pDOM1pkCgYdSqPeT1a9vh9yIqu2uzzgw1zcqEb+IJOhy+dTBMlNdThrDIksr2o09qrrQ==} + '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9': + resolution: {integrity: sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.7': - resolution: {integrity: sha512-wxyWg2RYaSUYgmd9MR0FyRGyeOMQE/Uzr1wzd/g5cf5bwi9A4v6HFdDm7y1MgDtod/fLOSTZY6jDgV0xU9d5bA==} + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9': + resolution: {integrity: sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.7': - resolution: {integrity: sha512-Xwg6tZpLxc4iQjorYsyGMyfJE7nP5MV8t/Ka58BgiA7Jw0fRqQNcANlLfdJ/yvBt9z9LD2We+BEkT7vLqZRWng==} + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9': + resolution: {integrity: sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.13.0 - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.7': - resolution: {integrity: sha512-UVATLMidXrnH+GMUIuxq55nejlj02HP7F5ETyBONzP6G87fPBogG4CH6kxrSrdIuAjdwNO9VzyaYsrZPscWUrw==} + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9': + resolution: {integrity: sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -255,92 +251,14 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-syntax-async-generators@7.8.4': - resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-properties@7.12.13': - resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-static-block@7.14.5': - resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-dynamic-import@7.8.3': - resolution: {integrity: sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-export-namespace-from@7.8.3': - resolution: {integrity: sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-assertions@7.25.7': - resolution: {integrity: sha512-ZvZQRmME0zfJnDQnVBKYzHxXT7lYBB3Revz1GuS7oLXWMgqUPX4G+DDbT30ICClht9WKV34QVrZhSw6WdklwZQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-attributes@7.25.7': - resolution: {integrity: sha512-AqVo+dguCgmpi/3mYBdu9lkngOBlQ2w2vnNpa6gfiCxQZLzV4ZbhsXitJ2Yblkoe1VQwtHSaNmIaGll/26YWRw==} + '@babel/plugin-syntax-import-assertions@7.26.0': + resolution: {integrity: sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-syntax-import-meta@7.10.4': - resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-json-strings@7.8.3': - resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4': - resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': - resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-numeric-separator@7.10.4': - resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-object-rest-spread@7.8.3': - resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3': - resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-chaining@7.8.3': - resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-private-property-in-object@7.14.5': - resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-top-level-await@7.14.5': - resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} + '@babel/plugin-syntax-import-attributes@7.26.0': + resolution: {integrity: sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -351,302 +269,308 @@ packages: peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-transform-arrow-functions@7.25.7': - resolution: {integrity: sha512-EJN2mKxDwfOUCPxMO6MUI58RN3ganiRAG/MS/S3HfB6QFNjroAMelQo/gybyYq97WerCBAZoyrAoW8Tzdq2jWg==} + '@babel/plugin-transform-arrow-functions@7.25.9': + resolution: {integrity: sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-async-generator-functions@7.25.7': - resolution: {integrity: sha512-4B6OhTrwYKHYYgcwErvZjbmH9X5TxQBsaBHdzEIB4l71gR5jh/tuHGlb9in47udL2+wVUcOz5XXhhfhVJwEpEg==} + '@babel/plugin-transform-async-generator-functions@7.25.9': + resolution: {integrity: sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-async-to-generator@7.25.7': - resolution: {integrity: sha512-ZUCjAavsh5CESCmi/xCpX1qcCaAglzs/7tmuvoFnJgA1dM7gQplsguljoTg+Ru8WENpX89cQyAtWoaE0I3X3Pg==} + '@babel/plugin-transform-async-to-generator@7.25.9': + resolution: {integrity: sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-block-scoped-functions@7.25.7': - resolution: {integrity: sha512-xHttvIM9fvqW+0a3tZlYcZYSBpSWzGBFIt/sYG3tcdSzBB8ZeVgz2gBP7Df+sM0N1850jrviYSSeUuc+135dmQ==} + '@babel/plugin-transform-block-scoped-functions@7.25.9': + resolution: {integrity: sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-block-scoping@7.25.7': - resolution: {integrity: sha512-ZEPJSkVZaeTFG/m2PARwLZQ+OG0vFIhPlKHK/JdIMy8DbRJ/htz6LRrTFtdzxi9EHmcwbNPAKDnadpNSIW+Aow==} + '@babel/plugin-transform-block-scoping@7.25.9': + resolution: {integrity: sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-class-properties@7.25.7': - resolution: {integrity: sha512-mhyfEW4gufjIqYFo9krXHJ3ElbFLIze5IDp+wQTxoPd+mwFb1NxatNAwmv8Q8Iuxv7Zc+q8EkiMQwc9IhyGf4g==} + '@babel/plugin-transform-class-properties@7.25.9': + resolution: {integrity: sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-class-static-block@7.25.7': - resolution: {integrity: sha512-rvUUtoVlkDWtDWxGAiiQj0aNktTPn3eFynBcMC2IhsXweehwgdI9ODe+XjWw515kEmv22sSOTp/rxIRuTiB7zg==} + '@babel/plugin-transform-class-static-block@7.26.0': + resolution: {integrity: sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.12.0 - '@babel/plugin-transform-classes@7.25.7': - resolution: {integrity: sha512-9j9rnl+YCQY0IGoeipXvnk3niWicIB6kCsWRGLwX241qSXpbA4MKxtp/EdvFxsc4zI5vqfLxzOd0twIJ7I99zg==} + '@babel/plugin-transform-classes@7.25.9': + resolution: {integrity: sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-computed-properties@7.25.7': - resolution: {integrity: sha512-QIv+imtM+EtNxg/XBKL3hiWjgdLjMOmZ+XzQwSgmBfKbfxUjBzGgVPklUuE55eq5/uVoh8gg3dqlrwR/jw3ZeA==} + '@babel/plugin-transform-computed-properties@7.25.9': + resolution: {integrity: sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-destructuring@7.25.7': - resolution: {integrity: sha512-xKcfLTlJYUczdaM1+epcdh1UGewJqr9zATgrNHcLBcV2QmfvPPEixo/sK/syql9cEmbr7ulu5HMFG5vbbt/sEA==} + '@babel/plugin-transform-destructuring@7.25.9': + resolution: {integrity: sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-dotall-regex@7.25.7': - resolution: {integrity: sha512-kXzXMMRzAtJdDEgQBLF4oaiT6ZCU3oWHgpARnTKDAqPkDJ+bs3NrZb310YYevR5QlRo3Kn7dzzIdHbZm1VzJdQ==} + '@babel/plugin-transform-dotall-regex@7.25.9': + resolution: {integrity: sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-duplicate-keys@7.25.7': - resolution: {integrity: sha512-by+v2CjoL3aMnWDOyCIg+yxU9KXSRa9tN6MbqggH5xvymmr9p4AMjYkNlQy4brMceBnUyHZ9G8RnpvT8wP7Cfg==} + '@babel/plugin-transform-duplicate-keys@7.25.9': + resolution: {integrity: sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.7': - resolution: {integrity: sha512-HvS6JF66xSS5rNKXLqkk7L9c/jZ/cdIVIcoPVrnl8IsVpLggTjXs8OWekbLHs/VtYDDh5WXnQyeE3PPUGm22MA==} + '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9': + resolution: {integrity: sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-transform-dynamic-import@7.25.7': - resolution: {integrity: sha512-UvcLuual4h7/GfylKm2IAA3aph9rwvAM2XBA0uPKU3lca+Maai4jBjjEVUS568ld6kJcgbouuumCBhMd/Yz17w==} + '@babel/plugin-transform-dynamic-import@7.25.9': + resolution: {integrity: sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-exponentiation-operator@7.25.7': - resolution: {integrity: sha512-yjqtpstPfZ0h/y40fAXRv2snciYr0OAoMXY/0ClC7tm4C/nG5NJKmIItlaYlLbIVAWNfrYuy9dq1bE0SbX0PEg==} + '@babel/plugin-transform-exponentiation-operator@7.25.9': + resolution: {integrity: sha512-KRhdhlVk2nObA5AYa7QMgTMTVJdfHprfpAk4DjZVtllqRg9qarilstTKEhpVjyt+Npi8ThRyiV8176Am3CodPA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-export-namespace-from@7.25.7': - resolution: {integrity: sha512-h3MDAP5l34NQkkNulsTNyjdaR+OiB0Im67VU//sFupouP8Q6m9Spy7l66DcaAQxtmCqGdanPByLsnwFttxKISQ==} + '@babel/plugin-transform-export-namespace-from@7.25.9': + resolution: {integrity: sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-for-of@7.25.7': - resolution: {integrity: sha512-n/TaiBGJxYFWvpJDfsxSj9lEEE44BFM1EPGz4KEiTipTgkoFVVcCmzAL3qA7fdQU96dpo4gGf5HBx/KnDvqiHw==} + '@babel/plugin-transform-for-of@7.25.9': + resolution: {integrity: sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-function-name@7.25.7': - resolution: {integrity: sha512-5MCTNcjCMxQ63Tdu9rxyN6cAWurqfrDZ76qvVPrGYdBxIj+EawuuxTu/+dgJlhK5eRz3v1gLwp6XwS8XaX2NiQ==} + '@babel/plugin-transform-function-name@7.25.9': + resolution: {integrity: sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-json-strings@7.25.7': - resolution: {integrity: sha512-Ot43PrL9TEAiCe8C/2erAjXMeVSnE/BLEx6eyrKLNFCCw5jvhTHKyHxdI1pA0kz5njZRYAnMO2KObGqOCRDYSA==} + '@babel/plugin-transform-json-strings@7.25.9': + resolution: {integrity: sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-literals@7.25.7': - resolution: {integrity: sha512-fwzkLrSu2fESR/cm4t6vqd7ebNIopz2QHGtjoU+dswQo/P6lwAG04Q98lliE3jkz/XqnbGFLnUcE0q0CVUf92w==} + '@babel/plugin-transform-literals@7.25.9': + resolution: {integrity: sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-logical-assignment-operators@7.25.7': - resolution: {integrity: sha512-iImzbA55BjiovLyG2bggWS+V+OLkaBorNvc/yJoeeDQGztknRnDdYfp2d/UPmunZYEnZi6Lg8QcTmNMHOB0lGA==} + '@babel/plugin-transform-logical-assignment-operators@7.25.9': + resolution: {integrity: sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-member-expression-literals@7.25.7': - resolution: {integrity: sha512-Std3kXwpXfRV0QtQy5JJcRpkqP8/wG4XL7hSKZmGlxPlDqmpXtEPRmhF7ztnlTCtUN3eXRUJp+sBEZjaIBVYaw==} + '@babel/plugin-transform-member-expression-literals@7.25.9': + resolution: {integrity: sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-modules-amd@7.25.7': - resolution: {integrity: sha512-CgselSGCGzjQvKzghCvDTxKHP3iooenLpJDO842ehn5D2G5fJB222ptnDwQho0WjEvg7zyoxb9P+wiYxiJX5yA==} + '@babel/plugin-transform-modules-amd@7.25.9': + resolution: {integrity: sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-modules-commonjs@7.25.7': - resolution: {integrity: sha512-L9Gcahi0kKFYXvweO6n0wc3ZG1ChpSFdgG+eV1WYZ3/dGbJK7vvk91FgGgak8YwRgrCuihF8tE/Xg07EkL5COg==} + '@babel/plugin-transform-modules-commonjs@7.25.9': + resolution: {integrity: sha512-dwh2Ol1jWwL2MgkCzUSOvfmKElqQcuswAZypBSUsScMXvgdT8Ekq5YA6TtqpTVWH+4903NmboMuH1o9i8Rxlyg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-modules-systemjs@7.25.7': - resolution: {integrity: sha512-t9jZIvBmOXJsiuyOwhrIGs8dVcD6jDyg2icw1VL4A/g+FnWyJKwUfSSU2nwJuMV2Zqui856El9u+ElB+j9fV1g==} + '@babel/plugin-transform-modules-systemjs@7.25.9': + resolution: {integrity: sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-modules-umd@7.25.7': - resolution: {integrity: sha512-p88Jg6QqsaPh+EB7I9GJrIqi1Zt4ZBHUQtjw3z1bzEXcLh6GfPqzZJ6G+G1HBGKUNukT58MnKG7EN7zXQBCODw==} + '@babel/plugin-transform-modules-umd@7.25.9': + resolution: {integrity: sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-named-capturing-groups-regex@7.25.7': - resolution: {integrity: sha512-BtAT9LzCISKG3Dsdw5uso4oV1+v2NlVXIIomKJgQybotJY3OwCwJmkongjHgwGKoZXd0qG5UZ12JUlDQ07W6Ow==} + '@babel/plugin-transform-named-capturing-groups-regex@7.25.9': + resolution: {integrity: sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/plugin-transform-new-target@7.25.7': - resolution: {integrity: sha512-CfCS2jDsbcZaVYxRFo2qtavW8SpdzmBXC2LOI4oO0rP+JSRDxxF3inF4GcPsLgfb5FjkhXG5/yR/lxuRs2pySA==} + '@babel/plugin-transform-new-target@7.25.9': + resolution: {integrity: sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-nullish-coalescing-operator@7.25.7': - resolution: {integrity: sha512-FbuJ63/4LEL32mIxrxwYaqjJxpbzxPVQj5a+Ebrc8JICV6YX8nE53jY+K0RZT3um56GoNWgkS2BQ/uLGTjtwfw==} + '@babel/plugin-transform-nullish-coalescing-operator@7.25.9': + resolution: {integrity: sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-numeric-separator@7.25.7': - resolution: {integrity: sha512-8CbutzSSh4hmD+jJHIA8vdTNk15kAzOnFLVVgBSMGr28rt85ouT01/rezMecks9pkU939wDInImwCKv4ahU4IA==} + '@babel/plugin-transform-numeric-separator@7.25.9': + resolution: {integrity: sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-object-rest-spread@7.25.7': - resolution: {integrity: sha512-1JdVKPhD7Y5PvgfFy0Mv2brdrolzpzSoUq2pr6xsR+m+3viGGeHEokFKsCgOkbeFOQxfB1Vt2F0cPJLRpFI4Zg==} + '@babel/plugin-transform-object-rest-spread@7.25.9': + resolution: {integrity: sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-object-super@7.25.7': - resolution: {integrity: sha512-pWT6UXCEW3u1t2tcAGtE15ornCBvopHj9Bps9D2DsH15APgNVOTwwczGckX+WkAvBmuoYKRCFa4DK+jM8vh5AA==} + '@babel/plugin-transform-object-super@7.25.9': + resolution: {integrity: sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-optional-catch-binding@7.25.7': - resolution: {integrity: sha512-m9obYBA39mDPN7lJzD5WkGGb0GO54PPLXsbcnj1Hyeu8mSRz7Gb4b1A6zxNX32ZuUySDK4G6it8SDFWD1nCnqg==} + '@babel/plugin-transform-optional-catch-binding@7.25.9': + resolution: {integrity: sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-optional-chaining@7.25.7': - resolution: {integrity: sha512-h39agClImgPWg4H8mYVAbD1qP9vClFbEjqoJmt87Zen8pjqK8FTPUwrOXAvqu5soytwxrLMd2fx2KSCp2CHcNg==} + '@babel/plugin-transform-optional-chaining@7.25.9': + resolution: {integrity: sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-parameters@7.25.7': - resolution: {integrity: sha512-FYiTvku63me9+1Nz7TOx4YMtW3tWXzfANZtrzHhUZrz4d47EEtMQhzFoZWESfXuAMMT5mwzD4+y1N8ONAX6lMQ==} + '@babel/plugin-transform-parameters@7.25.9': + resolution: {integrity: sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-private-methods@7.25.7': - resolution: {integrity: sha512-KY0hh2FluNxMLwOCHbxVOKfdB5sjWG4M183885FmaqWWiGMhRZq4DQRKH6mHdEucbJnyDyYiZNwNG424RymJjA==} + '@babel/plugin-transform-private-methods@7.25.9': + resolution: {integrity: sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-private-property-in-object@7.25.7': - resolution: {integrity: sha512-LzA5ESzBy7tqj00Yjey9yWfs3FKy4EmJyKOSWld144OxkTji81WWnUT8nkLUn+imN/zHL8ZQlOu/MTUAhHaX3g==} + '@babel/plugin-transform-private-property-in-object@7.25.9': + resolution: {integrity: sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-property-literals@7.25.7': - resolution: {integrity: sha512-lQEeetGKfFi0wHbt8ClQrUSUMfEeI3MMm74Z73T9/kuz990yYVtfofjf3NuA42Jy3auFOpbjDyCSiIkTs1VIYw==} + '@babel/plugin-transform-property-literals@7.25.9': + resolution: {integrity: sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-regenerator@7.25.7': - resolution: {integrity: sha512-mgDoQCRjrY3XK95UuV60tZlFCQGXEtMg8H+IsW72ldw1ih1jZhzYXbJvghmAEpg5UVhhnCeia1CkGttUvCkiMQ==} + '@babel/plugin-transform-regenerator@7.25.9': + resolution: {integrity: sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-reserved-words@7.25.7': - resolution: {integrity: sha512-3OfyfRRqiGeOvIWSagcwUTVk2hXBsr/ww7bLn6TRTuXnexA+Udov2icFOxFX9abaj4l96ooYkcNN1qi2Zvqwng==} + '@babel/plugin-transform-regexp-modifiers@7.26.0': + resolution: {integrity: sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-reserved-words@7.25.9': + resolution: {integrity: sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-shorthand-properties@7.25.7': - resolution: {integrity: sha512-uBbxNwimHi5Bv3hUccmOFlUy3ATO6WagTApenHz9KzoIdn0XeACdB12ZJ4cjhuB2WSi80Ez2FWzJnarccriJeA==} + '@babel/plugin-transform-shorthand-properties@7.25.9': + resolution: {integrity: sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-spread@7.25.7': - resolution: {integrity: sha512-Mm6aeymI0PBh44xNIv/qvo8nmbkpZze1KvR8MkEqbIREDxoiWTi18Zr2jryfRMwDfVZF9foKh060fWgni44luw==} + '@babel/plugin-transform-spread@7.25.9': + resolution: {integrity: sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-sticky-regex@7.25.7': - resolution: {integrity: sha512-ZFAeNkpGuLnAQ/NCsXJ6xik7Id+tHuS+NT+ue/2+rn/31zcdnupCdmunOizEaP0JsUmTFSTOPoQY7PkK2pttXw==} + '@babel/plugin-transform-sticky-regex@7.25.9': + resolution: {integrity: sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-template-literals@7.25.7': - resolution: {integrity: sha512-SI274k0nUsFFmyQupiO7+wKATAmMFf8iFgq2O+vVFXZ0SV9lNfT1NGzBEhjquFmD8I9sqHLguH+gZVN3vww2AA==} + '@babel/plugin-transform-template-literals@7.25.9': + resolution: {integrity: sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-typeof-symbol@7.25.7': - resolution: {integrity: sha512-OmWmQtTHnO8RSUbL0NTdtpbZHeNTnm68Gj5pA4Y2blFNh+V4iZR68V1qL9cI37J21ZN7AaCnkfdHtLExQPf2uA==} + '@babel/plugin-transform-typeof-symbol@7.25.9': + resolution: {integrity: sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-unicode-escapes@7.25.7': - resolution: {integrity: sha512-BN87D7KpbdiABA+t3HbVqHzKWUDN3dymLaTnPFAMyc8lV+KN3+YzNhVRNdinaCPA4AUqx7ubXbQ9shRjYBl3SQ==} + '@babel/plugin-transform-unicode-escapes@7.25.9': + resolution: {integrity: sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-unicode-property-regex@7.25.7': - resolution: {integrity: sha512-IWfR89zcEPQGB/iB408uGtSPlQd3Jpq11Im86vUgcmSTcoWAiQMCTOa2K2yNNqFJEBVICKhayctee65Ka8OB0w==} + '@babel/plugin-transform-unicode-property-regex@7.25.9': + resolution: {integrity: sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-unicode-regex@7.25.7': - resolution: {integrity: sha512-8JKfg/hiuA3qXnlLx8qtv5HWRbgyFx2hMMtpDDuU2rTckpKkGu4ycK5yYHwuEa16/quXfoxHBIApEsNyMWnt0g==} + '@babel/plugin-transform-unicode-regex@7.25.9': + resolution: {integrity: sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-unicode-sets-regex@7.25.7': - resolution: {integrity: sha512-YRW8o9vzImwmh4Q3Rffd09bH5/hvY0pxg+1H1i0f7APoUeg12G7+HhLj9ZFNIrYkgBXhIijPJ+IXypN0hLTIbw==} + '@babel/plugin-transform-unicode-sets-regex@7.25.9': + resolution: {integrity: sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - '@babel/preset-env@7.25.7': - resolution: {integrity: sha512-Gibz4OUdyNqqLj+7OAvBZxOD7CklCtMA5/j0JgUEwOnaRULsPDXmic2iKxL2DX2vQduPR5wH2hjZas/Vr/Oc0g==} + '@babel/preset-env@7.26.0': + resolution: {integrity: sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -656,35 +580,32 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 - '@babel/register@7.25.7': - resolution: {integrity: sha512-qHTd2Rhn/rKhSUwdY6+n98FmwXN+N+zxSVx3zWqRe9INyvTpv+aQ5gDV2+43ACd3VtMBzPPljbb0gZb8u5ma6Q==} + '@babel/register@7.25.9': + resolution: {integrity: sha512-8D43jXtGsYmEeDvm4MWHYUpWf8iiXgWYx3fW7E7Wb7Oe6FWqJPl5K6TuFW0dOwNZzEE5rjlaSJYH9JjrUKJszA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/regjsgen@0.8.0': - resolution: {integrity: sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==} - '@babel/runtime@7.25.6': resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==} engines: {node: '>=6.9.0'} - '@babel/template@7.25.7': - resolution: {integrity: sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==} + '@babel/template@7.25.9': + resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} engines: {node: '>=6.9.0'} - '@babel/traverse@7.25.7': - resolution: {integrity: sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==} - engines: {node: '>=6.9.0'} - - '@babel/types@7.25.6': - resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==} + '@babel/traverse@7.25.9': + resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==} engines: {node: '>=6.9.0'} '@babel/types@7.25.7': resolution: {integrity: sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==} engines: {node: '>=6.9.0'} + '@babel/types@7.26.0': + resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==} + engines: {node: '>=6.9.0'} + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -699,16 +620,16 @@ packages: resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/core@0.6.0': - resolution: {integrity: sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==} + '@eslint/core@0.7.0': + resolution: {integrity: sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/eslintrc@3.1.0': resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.11.1': - resolution: {integrity: sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA==} + '@eslint/js@9.13.0': + resolution: {integrity: sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -735,12 +656,20 @@ packages: resolution: {integrity: sha512-kjotm7XJrJ6v+7knhPaRgaT6q8F8K2jiafwYdNHLzmV0uGLuZY43FK6smNSHUPrhq5kX2slCUy+RGG/xGqmIKA==} engines: {node: '>=10.13.0'} + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/retry@0.3.0': - resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} engines: {node: '>=18.18'} '@jridgewell/gen-mapping@0.3.5': @@ -764,18 +693,6 @@ packages: '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': resolution: {integrity: sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==} - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - '@socket.io/component-emitter@3.1.2': resolution: {integrity: sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==} @@ -830,8 +747,8 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} hasBin: true @@ -858,10 +775,6 @@ packages: resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} engines: {node: '>=12'} - ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} @@ -1054,11 +967,6 @@ packages: engines: {node: '>= 0.8'} hasBin: true - browserslist@4.23.3: - resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - browserslist@4.24.0: resolution: {integrity: sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -1101,16 +1009,9 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - caniuse-lite@1.0.30001655: - resolution: {integrity: sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==} - caniuse-lite@1.0.30001667: resolution: {integrity: sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw==} - chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -1159,16 +1060,10 @@ packages: cloneable-readable@1.1.3: resolution: {integrity: sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==} - color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} - color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} @@ -1385,9 +1280,6 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.13: - resolution: {integrity: sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==} - electron-to-chromium@1.5.32: resolution: {integrity: sha512-M+7ph0VGBQqqpTT2YrabjNKSQ2fEl9PVx6AK3N558gDH9NO8O6XN9SXXFWRo9u9PbEg/bWq+tjXQr+eXmxubCw==} @@ -1463,20 +1355,20 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-scope@8.0.2: - resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} + eslint-scope@8.2.0: + resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-visitor-keys@4.0.0: - resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.11.1: - resolution: {integrity: sha512-MobhYKIoAO1s1e4VUrgx1l1Sk2JBR/Gqjjgw8+mfgoLE2xwsHur4gdfTxyTgShrhvdVFTaJSgMiQBl1jv/AWxg==} + eslint@9.13.0: + resolution: {integrity: sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -1489,8 +1381,8 @@ packages: resolution: {integrity: sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==} engines: {node: '>=0.10'} - espree@10.1.0: - resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esquery@1.6.0: @@ -1784,10 +1676,6 @@ packages: resolution: {integrity: sha512-V2FaKiOhpR3DRXZuYdRLn/qiY0yI5XmqbTKrYbdemJ+xOh2d2MOweI/XFgMzd/9+1twdvMwllnZbWZNJ+BOm4A==} engines: {node: '>= 10.13.0'} - has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -1978,10 +1866,6 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - is-plain-obj@2.1.0: resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} engines: {node: '>=8'} @@ -2050,10 +1934,6 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true - jsesc@0.5.0: - resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} - hasBin: true - jsesc@3.0.2: resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} engines: {node: '>=6'} @@ -2246,8 +2126,8 @@ packages: mkdirp-classic@0.5.3: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} - mocha@10.7.3: - resolution: {integrity: sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==} + mocha@10.8.2: + resolution: {integrity: sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==} engines: {node: '>= 14.0.0'} hasBin: true @@ -2512,9 +2392,6 @@ packages: resolution: {integrity: sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==} engines: {node: '>=0.4.x'} - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} @@ -2550,10 +2427,6 @@ packages: resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} engines: {node: '>= 10.13.0'} - regenerate-unicode-properties@10.1.1: - resolution: {integrity: sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==} - engines: {node: '>=4'} - regenerate-unicode-properties@10.2.0: resolution: {integrity: sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==} engines: {node: '>=4'} @@ -2567,10 +2440,6 @@ packages: regenerator-transform@0.15.2: resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} - regexpu-core@5.3.2: - resolution: {integrity: sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==} - engines: {node: '>=4'} - regexpu-core@6.1.1: resolution: {integrity: sha512-k67Nb9jvwJcJmVpw0jPttR1/zVfnKf8Km0IPatrU/zJ5XeG3+Slx0xLXs9HByJSzXzrlz5EDvN6yLNMDc2qdnw==} engines: {node: '>=4'} @@ -2582,10 +2451,6 @@ packages: resolution: {integrity: sha512-vTbzVAjQDzwQdKuvj7qEq6OlAprCjE656khuGQ4QaBLg7abQ9I9ISpmLuc6inWe7zP75AECjqUa4g4sdQvOXhg==} hasBin: true - regjsparser@0.9.1: - resolution: {integrity: sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==} - hasBin: true - remove-trailing-separator@1.1.0: resolution: {integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==} @@ -2645,9 +2510,6 @@ packages: ripemd160@2.0.2: resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - rx@4.1.0: resolution: {integrity: sha512-CiaiuN6gapkdl+cZUr67W6I8jquN4lkak3vtIsIWCl4XIPP8ffsoyN6/+PuGXnQy8Cu8W2y9Xxh31Rq4M6wUug==} @@ -2862,10 +2724,6 @@ packages: subarg@1.0.0: resolution: {integrity: sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==} - supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -3162,9 +3020,9 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@babel/cli@7.25.7(@babel/core@7.25.7)': + '@babel/cli@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 + '@babel/core': 7.26.0 '@jridgewell/trace-mapping': 0.3.25 commander: 6.2.1 convert-source-map: 2.0.0 @@ -3176,25 +3034,26 @@ snapshots: '@nicolo-ribaudo/chokidar-2': 2.1.8-no-fsevents.3 chokidar: 3.6.0 - '@babel/code-frame@7.25.7': + '@babel/code-frame@7.26.2': dependencies: - '@babel/highlight': 7.25.7 + '@babel/helper-validator-identifier': 7.25.9 + js-tokens: 4.0.0 picocolors: 1.0.1 - '@babel/compat-data@7.25.7': {} + '@babel/compat-data@7.26.2': {} - '@babel/core@7.25.7': + '@babel/core@7.26.0': dependencies: '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.25.7 - '@babel/generator': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7) - '@babel/helpers': 7.25.7 - '@babel/parser': 7.25.7 - '@babel/template': 7.25.7 - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.2 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helpers': 7.26.0 + '@babel/parser': 7.26.2 + '@babel/template': 7.25.9 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 convert-source-map: 2.0.0 debug: 4.3.6(supports-color@8.1.1) gensync: 1.0.0-beta.2 @@ -3203,773 +3062,668 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/generator@7.25.7': + '@babel/generator@7.26.2': dependencies: - '@babel/types': 7.25.7 + '@babel/parser': 7.26.2 + '@babel/types': 7.26.0 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 3.0.2 - '@babel/helper-annotate-as-pure@7.24.7': - dependencies: - '@babel/types': 7.25.6 - '@babel/helper-annotate-as-pure@7.25.7': dependencies: '@babel/types': 7.25.7 - '@babel/helper-builder-binary-assignment-operator-visitor@7.25.7': + '@babel/helper-annotate-as-pure@7.25.9': dependencies: - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/types': 7.26.0 + + '@babel/helper-builder-binary-assignment-operator-visitor@7.25.9': + dependencies: + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helper-compilation-targets@7.25.7': + '@babel/helper-compilation-targets@7.25.9': dependencies: - '@babel/compat-data': 7.25.7 - '@babel/helper-validator-option': 7.25.7 + '@babel/compat-data': 7.26.2 + '@babel/helper-validator-option': 7.25.9 browserslist: 4.24.0 lru-cache: 5.1.1 semver: 6.3.1 - '@babel/helper-create-class-features-plugin@7.25.7(@babel/core@7.25.7)': + '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.25.7 - '@babel/helper-member-expression-to-functions': 7.25.7 - '@babel/helper-optimise-call-expression': 7.25.7 - '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7) - '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-member-expression-to-functions': 7.25.9 + '@babel/helper-optimise-call-expression': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color - '@babel/helper-create-regexp-features-plugin@7.25.2(@babel/core@7.25.7)': + '@babel/helper-create-regexp-features-plugin@7.25.7(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.24.7 - regexpu-core: 5.3.2 + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.7 + regexpu-core: 6.1.1 semver: 6.3.1 - '@babel/helper-create-regexp-features-plugin@7.25.7(@babel/core@7.25.7)': + '@babel/helper-create-regexp-features-plugin@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 regexpu-core: 6.1.1 semver: 6.3.1 - '@babel/helper-define-polyfill-provider@0.6.2(@babel/core@7.25.7)': + '@babel/helper-define-polyfill-provider@0.6.2(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 debug: 4.3.6(supports-color@8.1.1) lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: - supports-color - '@babel/helper-member-expression-to-functions@7.25.7': + '@babel/helper-member-expression-to-functions@7.25.9': dependencies: - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helper-module-imports@7.25.7': + '@babel/helper-module-imports@7.25.9': dependencies: - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helper-module-transforms@7.25.7(@babel/core@7.25.7)': + '@babel/helper-module-transforms@7.26.0(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.7 - '@babel/helper-simple-access': 7.25.7 - '@babel/helper-validator-identifier': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/helper-optimise-call-expression@7.25.7': + '@babel/helper-optimise-call-expression@7.25.9': dependencies: - '@babel/types': 7.25.7 + '@babel/types': 7.26.0 - '@babel/helper-plugin-utils@7.25.7': {} + '@babel/helper-plugin-utils@7.25.9': {} - '@babel/helper-remap-async-to-generator@7.25.7(@babel/core@7.25.7)': + '@babel/helper-remap-async-to-generator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.25.7 - '@babel/helper-wrap-function': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-wrap-function': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/helper-replace-supers@7.25.7(@babel/core@7.25.7)': + '@babel/helper-replace-supers@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-member-expression-to-functions': 7.25.7 - '@babel/helper-optimise-call-expression': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-member-expression-to-functions': 7.25.9 + '@babel/helper-optimise-call-expression': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/helper-simple-access@7.25.7': + '@babel/helper-simple-access@7.25.9': dependencies: - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helper-skip-transparent-expression-wrappers@7.25.7': + '@babel/helper-skip-transparent-expression-wrappers@7.25.9': dependencies: - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helper-string-parser@7.24.8': {} - '@babel/helper-string-parser@7.25.7': {} - '@babel/helper-validator-identifier@7.24.7': {} + '@babel/helper-string-parser@7.25.9': {} '@babel/helper-validator-identifier@7.25.7': {} - '@babel/helper-validator-option@7.25.7': {} + '@babel/helper-validator-identifier@7.25.9': {} - '@babel/helper-wrap-function@7.25.7': + '@babel/helper-validator-option@7.25.9': {} + + '@babel/helper-wrap-function@7.25.9': dependencies: - '@babel/template': 7.25.7 - '@babel/traverse': 7.25.7 - '@babel/types': 7.25.7 + '@babel/template': 7.25.9 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color - '@babel/helpers@7.25.7': - dependencies: - '@babel/template': 7.25.7 - '@babel/types': 7.25.7 - - '@babel/highlight@7.25.7': + '@babel/helpers@7.26.0': dependencies: - '@babel/helper-validator-identifier': 7.25.7 - chalk: 2.4.2 - js-tokens: 4.0.0 - picocolors: 1.0.1 + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 - '@babel/parser@7.25.7': + '@babel/parser@7.26.2': dependencies: - '@babel/types': 7.25.7 + '@babel/types': 7.26.0 - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.26.0) transitivePeerDependencies: - supports-color - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.25.7)': + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 - '@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.25.7)': + '@babel/plugin-syntax-import-assertions@7.26.0(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-import-assertions@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-syntax-import-attributes@7.26.0(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-import-attributes@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.25.7)': + '@babel/plugin-transform-arrow-functions@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.25.7)': + '@babel/plugin-transform-async-generator-functions@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.2(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-arrow-functions@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-async-generator-functions@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.7) - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-async-to-generator@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-async-to-generator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-remap-async-to-generator': 7.25.7(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-block-scoped-functions@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-block-scoped-functions@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-block-scoping@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-block-scoping@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-class-properties@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-class-properties@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-class-static-block@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-class-static-block@7.26.0(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-classes@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-classes@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7) - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + '@babel/traverse': 7.25.9 globals: 11.12.0 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-computed-properties@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-computed-properties@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/template': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/template': 7.25.9 - '@babel/plugin-transform-destructuring@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-destructuring@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-dotall-regex@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-dotall-regex@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-duplicate-keys@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-duplicate-keys@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-dynamic-import@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-dynamic-import@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-exponentiation-operator@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-exponentiation-operator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-builder-binary-assignment-operator-visitor': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-export-namespace-from@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-export-namespace-from@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-for-of@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-for-of@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-function-name@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-function-name@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-json-strings@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-json-strings@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-literals@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-literals@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-logical-assignment-operators@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-logical-assignment-operators@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-member-expression-literals@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-member-expression-literals@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-modules-amd@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-modules-amd@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-commonjs@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-modules-commonjs@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-simple-access': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-simple-access': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-systemjs@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-modules-systemjs@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-validator-identifier': 7.25.7 - '@babel/traverse': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-umd@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-modules-umd@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-module-transforms': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-named-capturing-groups-regex@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-named-capturing-groups-regex@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-new-target@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-new-target@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-nullish-coalescing-operator@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-nullish-coalescing-operator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-numeric-separator@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-numeric-separator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-object-rest-spread@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-object-rest-spread@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.26.0) - '@babel/plugin-transform-object-super@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-object-super@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) transitivePeerDependencies: - supports-color - '@babel/plugin-transform-optional-catch-binding@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-optional-catch-binding@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-optional-chaining@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-optional-chaining@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-parameters@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-parameters@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-private-methods@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-private-methods@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-private-property-in-object@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-private-property-in-object@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-annotate-as-pure': 7.25.7 - '@babel/helper-create-class-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-property-literals@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-property-literals@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-regenerator@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-regenerator@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 regenerator-transform: 0.15.2 - '@babel/plugin-transform-reserved-words@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-regexp-modifiers@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-reserved-words@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-shorthand-properties@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-shorthand-properties@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-spread@7.25.7(@babel/core@7.25.7)': + '@babel/plugin-transform-spread@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-sticky-regex@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-template-literals@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-typeof-symbol@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-unicode-escapes@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-unicode-property-regex@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-unicode-regex@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/plugin-transform-unicode-sets-regex@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/core': 7.25.7 - '@babel/helper-create-regexp-features-plugin': 7.25.7(@babel/core@7.25.7) - '@babel/helper-plugin-utils': 7.25.7 - - '@babel/preset-env@7.25.7(@babel/core@7.25.7)': - dependencies: - '@babel/compat-data': 7.25.7 - '@babel/core': 7.25.7 - '@babel/helper-compilation-targets': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/helper-validator-option': 7.25.7 - '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.7) - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.7) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.25.7) - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.25.7) - '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-import-assertions': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-syntax-import-attributes': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.25.7) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.25.7) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.25.7) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.7) - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.7) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.25.7) - '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.25.7) - '@babel/plugin-transform-arrow-functions': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-async-generator-functions': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-async-to-generator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-block-scoped-functions': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-block-scoping': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-class-properties': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-class-static-block': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-classes': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-computed-properties': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-destructuring': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-dotall-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-duplicate-keys': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-dynamic-import': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-exponentiation-operator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-export-namespace-from': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-for-of': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-function-name': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-json-strings': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-literals': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-logical-assignment-operators': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-member-expression-literals': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-modules-amd': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-modules-commonjs': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-modules-systemjs': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-modules-umd': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-named-capturing-groups-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-new-target': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-nullish-coalescing-operator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-numeric-separator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-object-rest-spread': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-object-super': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-optional-catch-binding': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-optional-chaining': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-parameters': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-private-methods': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-private-property-in-object': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-property-literals': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-regenerator': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-reserved-words': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-shorthand-properties': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-spread': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-sticky-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-template-literals': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-typeof-symbol': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-unicode-escapes': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-unicode-property-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-unicode-regex': 7.25.7(@babel/core@7.25.7) - '@babel/plugin-transform-unicode-sets-regex': 7.25.7(@babel/core@7.25.7) - '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.25.7) - babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.25.7) - babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.25.7) - babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.25.7) + '@babel/plugin-transform-sticky-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-template-literals@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-typeof-symbol@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-escapes@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-property-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-sets-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/preset-env@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/compat-data': 7.26.2 + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-validator-option': 7.25.9 + '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.26.0) + '@babel/plugin-syntax-import-assertions': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.26.0) + '@babel/plugin-transform-arrow-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-async-generator-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-block-scoped-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-block-scoping': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-class-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-class-static-block': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-transform-classes': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-computed-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-destructuring': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-dotall-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-duplicate-keys': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-dynamic-import': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-exponentiation-operator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-export-namespace-from': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-for-of': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-function-name': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-json-strings': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-logical-assignment-operators': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-member-expression-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-amd': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-systemjs': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-umd': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-named-capturing-groups-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-new-target': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-nullish-coalescing-operator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-numeric-separator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-object-rest-spread': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-object-super': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-optional-catch-binding': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-private-methods': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-private-property-in-object': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-property-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-regenerator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-regexp-modifiers': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-transform-reserved-words': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-shorthand-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-spread': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-sticky-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-template-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-typeof-symbol': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-escapes': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-property-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-sets-regex': 7.25.9(@babel/core@7.26.0) + '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.26.0) + babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.26.0) + babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.26.0) + babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.26.0) core-js-compat: 3.38.1 semver: 6.3.1 transitivePeerDependencies: - supports-color - '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.25.7)': + '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 - '@babel/helper-plugin-utils': 7.25.7 - '@babel/types': 7.25.6 + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/types': 7.25.7 esutils: 2.0.3 - '@babel/register@7.25.7(@babel/core@7.25.7)': + '@babel/register@7.25.9(@babel/core@7.26.0)': dependencies: - '@babel/core': 7.25.7 + '@babel/core': 7.26.0 clone-deep: 4.0.1 find-cache-dir: 2.1.0 make-dir: 2.1.0 pirates: 4.0.6 source-map-support: 0.5.21 - '@babel/regjsgen@0.8.0': {} - '@babel/runtime@7.25.6': dependencies: regenerator-runtime: 0.14.1 - '@babel/template@7.25.7': + '@babel/template@7.25.9': dependencies: - '@babel/code-frame': 7.25.7 - '@babel/parser': 7.25.7 - '@babel/types': 7.25.7 + '@babel/code-frame': 7.26.2 + '@babel/parser': 7.26.2 + '@babel/types': 7.26.0 - '@babel/traverse@7.25.7': + '@babel/traverse@7.25.9': dependencies: - '@babel/code-frame': 7.25.7 - '@babel/generator': 7.25.7 - '@babel/parser': 7.25.7 - '@babel/template': 7.25.7 - '@babel/types': 7.25.7 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.2 + '@babel/parser': 7.26.2 + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 debug: 4.3.6(supports-color@8.1.1) globals: 11.12.0 transitivePeerDependencies: - supports-color - '@babel/types@7.25.6': - dependencies: - '@babel/helper-string-parser': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 - to-fast-properties: 2.0.0 - '@babel/types@7.25.7': dependencies: '@babel/helper-string-parser': 7.25.7 '@babel/helper-validator-identifier': 7.25.7 to-fast-properties: 2.0.0 - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1)': + '@babel/types@7.26.0': dependencies: - eslint: 9.11.1 + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + + '@eslint-community/eslint-utils@4.4.0(eslint@9.13.0)': + dependencies: + eslint: 9.13.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.0': {} @@ -3982,13 +3736,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/core@0.6.0': {} + '@eslint/core@0.7.0': {} '@eslint/eslintrc@3.1.0': dependencies: ajv: 6.12.6 debug: 4.3.6(supports-color@8.1.1) - espree: 10.1.0 + espree: 10.3.0 globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.0 @@ -3998,7 +3752,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.11.1': {} + '@eslint/js@9.13.0': {} '@eslint/object-schema@2.1.4': {} @@ -4025,9 +3779,16 @@ snapshots: dependencies: is-negated-glob: 1.0.0 + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/retry@0.3.0': {} + '@humanwhocodes/retry@0.3.1': {} '@jridgewell/gen-mapping@0.3.5': dependencies: @@ -4049,18 +3810,6 @@ snapshots: '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': optional: true - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 - '@socket.io/component-emitter@3.1.2': {} '@types/cookie@0.4.1': {} @@ -4094,9 +3843,9 @@ snapshots: mime-types: 2.1.35 negotiator: 0.6.3 - acorn-jsx@5.3.2(acorn@8.12.1): + acorn-jsx@5.3.2(acorn@8.14.0): dependencies: - acorn: 8.12.1 + acorn: 8.14.0 acorn-node@1.8.2: dependencies: @@ -4110,7 +3859,7 @@ snapshots: acorn@7.4.1: {} - acorn@8.12.1: {} + acorn@8.14.0: {} ajv@6.12.6: dependencies: @@ -4133,10 +3882,6 @@ snapshots: ansi-regex@6.1.0: {} - ansi-styles@3.2.1: - dependencies: - color-convert: 1.9.3 - ansi-styles@4.3.0: dependencies: color-convert: 2.0.1 @@ -4197,33 +3942,33 @@ snapshots: b4a@1.6.6: {} - babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.25.7): + babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.26.0): dependencies: - '@babel/compat-data': 7.25.7 - '@babel/core': 7.25.7 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.7) + '@babel/compat-data': 7.26.2 + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.26.0) semver: 6.3.1 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-corejs3@0.10.6(@babel/core@7.25.7): + babel-plugin-polyfill-corejs3@0.10.6(@babel/core@7.26.0): dependencies: - '@babel/core': 7.25.7 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.26.0) core-js-compat: 3.38.1 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-regenerator@0.6.2(@babel/core@7.25.7): + babel-plugin-polyfill-regenerator@0.6.2(@babel/core@7.26.0): dependencies: - '@babel/core': 7.25.7 - '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.25.7) + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.26.0) transitivePeerDependencies: - supports-color - babelify@10.0.0(@babel/core@7.25.7): + babelify@10.0.0(@babel/core@7.26.0): dependencies: - '@babel/core': 7.25.7 + '@babel/core': 7.26.0 bach@2.0.1: dependencies: @@ -4442,13 +4187,6 @@ snapshots: vm-browserify: 1.1.2 xtend: 4.0.2 - browserslist@4.23.3: - dependencies: - caniuse-lite: 1.0.30001655 - electron-to-chromium: 1.5.13 - node-releases: 2.0.18 - update-browserslist-db: 1.1.0(browserslist@4.23.3) - browserslist@4.24.0: dependencies: caniuse-lite: 1.0.30001667 @@ -4490,16 +4228,8 @@ snapshots: camelcase@6.3.0: {} - caniuse-lite@1.0.30001655: {} - caniuse-lite@1.0.30001667: {} - chalk@2.4.2: - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -4563,16 +4293,10 @@ snapshots: process-nextick-args: 2.0.1 readable-stream: 2.3.8 - color-convert@1.9.3: - dependencies: - color-name: 1.1.3 - color-convert@2.0.1: dependencies: color-name: 1.1.4 - color-name@1.1.3: {} - color-name@1.1.4: {} colorette@2.0.20: {} @@ -4635,7 +4359,7 @@ snapshots: core-js-compat@3.38.1: dependencies: - browserslist: 4.23.3 + browserslist: 4.24.0 core-util-is@1.0.3: {} @@ -4800,8 +4524,6 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.5.13: {} - electron-to-chromium@1.5.32: {} elliptic@6.5.7: @@ -4898,27 +4620,27 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-scope@8.0.2: + eslint-scope@8.2.0: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint-visitor-keys@4.0.0: {} + eslint-visitor-keys@4.2.0: {} - eslint@9.11.1: + eslint@9.13.0: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0) '@eslint-community/regexpp': 4.11.0 '@eslint/config-array': 0.18.0 - '@eslint/core': 0.6.0 + '@eslint/core': 0.7.0 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.11.1 + '@eslint/js': 9.13.0 '@eslint/plugin-kit': 0.2.0 + '@humanfs/node': 0.16.6 '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.3.0 - '@nodelib/fs.walk': 1.2.8 + '@humanwhocodes/retry': 0.3.1 '@types/estree': 1.0.6 '@types/json-schema': 7.0.15 ajv: 6.12.6 @@ -4926,9 +4648,9 @@ snapshots: cross-spawn: 7.0.3 debug: 4.3.6(supports-color@8.1.1) escape-string-regexp: 4.0.0 - eslint-scope: 8.0.2 - eslint-visitor-keys: 4.0.0 - espree: 10.1.0 + eslint-scope: 8.2.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -4938,13 +4660,11 @@ snapshots: ignore: 5.3.2 imurmurhash: 0.1.4 is-glob: 4.0.3 - is-path-inside: 3.0.3 json-stable-stringify-without-jsonify: 1.0.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 optionator: 0.9.4 - strip-ansi: 6.0.1 text-table: 0.2.0 transitivePeerDependencies: - supports-color @@ -4956,11 +4676,11 @@ snapshots: event-emitter: 0.3.5 type: 2.7.3 - espree@10.1.0: + espree@10.3.0: dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 4.0.0 + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.2.0 esquery@1.6.0: dependencies: @@ -5225,9 +4945,9 @@ snapshots: graceful-fs@4.2.11: {} - gulp-babel@8.0.0(@babel/core@7.25.7): + gulp-babel@8.0.0(@babel/core@7.26.0): dependencies: - '@babel/core': 7.25.7 + '@babel/core': 7.26.0 plugin-error: 1.0.1 replace-ext: 1.0.1 through2: 2.0.5 @@ -5313,8 +5033,6 @@ snapshots: dependencies: glogg: 2.2.0 - has-flag@3.0.0: {} - has-flag@4.0.0: {} has-gulplog@0.1.0: @@ -5499,8 +5217,6 @@ snapshots: is-number@7.0.0: {} - is-path-inside@3.0.3: {} - is-plain-obj@2.1.0: {} is-plain-object@2.0.4: @@ -5550,8 +5266,6 @@ snapshots: dependencies: argparse: 2.0.1 - jsesc@0.5.0: {} - jsesc@3.0.2: {} json-buffer@3.0.1: {} @@ -5751,7 +5465,7 @@ snapshots: mkdirp-classic@0.5.3: {} - mocha@10.7.3: + mocha@10.8.2: dependencies: ansi-colors: 4.1.3 browser-stdout: 1.3.1 @@ -6018,8 +5732,6 @@ snapshots: querystring-es3@0.2.1: {} - queue-microtask@1.2.3: {} - queue-tick@1.0.1: {} randombytes@2.1.0: @@ -6068,10 +5780,6 @@ snapshots: dependencies: resolve: 1.22.8 - regenerate-unicode-properties@10.1.1: - dependencies: - regenerate: 1.4.2 - regenerate-unicode-properties@10.2.0: dependencies: regenerate: 1.4.2 @@ -6084,15 +5792,6 @@ snapshots: dependencies: '@babel/runtime': 7.25.6 - regexpu-core@5.3.2: - dependencies: - '@babel/regjsgen': 0.8.0 - regenerate: 1.4.2 - regenerate-unicode-properties: 10.1.1 - regjsparser: 0.9.1 - unicode-match-property-ecmascript: 2.0.0 - unicode-match-property-value-ecmascript: 2.1.0 - regexpu-core@6.1.1: dependencies: regenerate: 1.4.2 @@ -6108,10 +5807,6 @@ snapshots: dependencies: jsesc: 3.0.2 - regjsparser@0.9.1: - dependencies: - jsesc: 0.5.0 - remove-trailing-separator@1.1.0: {} replace-ext@1.0.1: {} @@ -6168,10 +5863,6 @@ snapshots: hash-base: 3.1.0 inherits: 2.0.4 - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - rx@4.1.0: {} safe-buffer@5.1.2: {} @@ -6436,10 +6127,6 @@ snapshots: dependencies: minimist: 1.2.8 - supports-color@5.5.0: - dependencies: - has-flag: 3.0.0 - supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -6555,12 +6242,6 @@ snapshots: unpipe@1.0.0: {} - update-browserslist-db@1.1.0(browserslist@4.23.3): - dependencies: - browserslist: 4.23.3 - escalade: 3.2.0 - picocolors: 1.0.1 - update-browserslist-db@1.1.0(browserslist@4.24.0): dependencies: browserslist: 4.24.0 From fe75237fb78fc012bfd7c89e00e9984aa4e326f1 Mon Sep 17 00:00:00 2001 From: brano Date: Fri, 1 Nov 2024 18:02:16 +0100 Subject: [PATCH 2/3] Tabs > Spaces --- .editorconfig | 2 +- src/locale/cs.js | 50 +- src/locale/de-de.js | 106 +- src/locale/en-us.js | 38 +- src/locale/rue.js | 48 +- src/locale/sk.js | 66 +- src/modules/examples.js | 126 +- src/modules/punctuation/dash.js | 426 ++--- src/modules/punctuation/double-quotes.js | 1004 +++++------ src/modules/punctuation/ellipsis.js | 322 ++-- src/modules/punctuation/hyphen.js | 18 +- src/modules/punctuation/markdown.js | 154 +- src/modules/punctuation/period.js | 16 +- src/modules/punctuation/single-quotes.js | 932 +++++----- src/modules/symbols/exponents.js | 20 +- src/modules/symbols/multiplication-sign.js | 156 +- src/modules/symbols/number-sign.js | 42 +- src/modules/symbols/plus-minus.js | 8 +- src/modules/symbols/section-sign.js | 32 +- src/modules/whitespace/lines.js | 8 +- src/modules/whitespace/nbsp.js | 554 +++--- src/modules/whitespace/spaces.js | 260 +-- src/modules/words/abbreviations.js | 346 ++-- src/modules/words/case.js | 48 +- src/modules/words/pub-id.js | 216 +-- src/typopo.js | 80 +- tests/integration/typopo.test.js | 266 +-- tests/punctuation/dash.test.js | 702 ++++---- tests/punctuation/double-quotes.test.js | 1646 +++++++++--------- tests/punctuation/ellipsis.test.js | 492 +++--- tests/punctuation/hyphen.test.js | 34 +- tests/punctuation/markdown.test.js | 254 +-- tests/punctuation/period.test.js | 28 +- tests/punctuation/single-quotes.test.js | 1792 ++++++++++---------- tests/symbols/exponents.test.js | 188 +- tests/symbols/multiplication-sign.test.js | 162 +- tests/symbols/plus-minus.test.js | 18 +- tests/symbols/section-sign.test.js | 34 +- tests/whitespace/lines.test.js | 16 +- tests/whitespace/nbsp.test.js | 1186 ++++++------- tests/whitespace/spaces.test.js | 464 ++--- tests/words/abbreviations.test.js | 436 ++--- tests/words/case.test.js | 40 +- tests/words/pub-id.test.js | 168 +- 44 files changed, 6502 insertions(+), 6502 deletions(-) diff --git a/.editorconfig b/.editorconfig index d696edb..88423f2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,7 @@ root = true [*] -indent_style = tab +indent_style = space indent_size = 2 end_of_line = crlf charset = utf-8 diff --git a/src/locale/cs.js b/src/locale/cs.js index 6bec95e..9e990f2 100644 --- a/src/locale/cs.js +++ b/src/locale/cs.js @@ -1,42 +1,42 @@ const quotes = { - leftDoubleQuote : "„", - rightDoubleQuote : "“", - leftSingleQuote : "‚", - rightSingleQuote : "‘", + leftDoubleQuote : "„", + rightDoubleQuote : "“", + leftSingleQuote : "‚", + rightSingleQuote : "‘", }; const numbers = { - ordinalIndicator : "\\.", - romanOrdinalIndicator : "\\.", + ordinalIndicator : "\\.", + romanOrdinalIndicator : "\\.", } const singleWordAbbreviations = [ - "č", - "s", - "fol", - "str", - "r", - "par", - "odst", - "např", - "sv", - "tj", - "tzv", + "č", + "s", + "fol", + "str", + "r", + "par", + "odst", + "např", + "sv", + "tj", + "tzv", ] // Disregard correct spelling in your locale // and provide abbreviations in format “abbr abbr abbr…” const multipleWordAbbreviations = [ - "hl m", - "n l", - "p n l", - "př n l", + "hl m", + "n l", + "p n l", + "př n l", ] export default { - quotes, - numbers, - singleWordAbbreviations, - multipleWordAbbreviations + quotes, + numbers, + singleWordAbbreviations, + multipleWordAbbreviations } diff --git a/src/locale/de-de.js b/src/locale/de-de.js index 049771b..2921eaa 100644 --- a/src/locale/de-de.js +++ b/src/locale/de-de.js @@ -1,70 +1,70 @@ const quotes = { - leftDoubleQuote : "„", - rightDoubleQuote : "“", - leftSingleQuote : "‚", - rightSingleQuote : "‘", + leftDoubleQuote : "„", + rightDoubleQuote : "“", + leftSingleQuote : "‚", + rightSingleQuote : "‘", }; const numbers = { - ordinalIndicator : "\\.", - romanOrdinalIndicator : "\\.", + ordinalIndicator : "\\.", + romanOrdinalIndicator : "\\.", } const singleWordAbbreviations = [ - "S", - "z", - "St", - "Stk", - "Mo", - "Di", - "Mi", - "Do", - "Fr", - "Sa", - "So", - "Bhf", - "Hbf", - "Nr", - "ca", - "usw", - "geb", - "gest", - "u" + "S", + "z", + "St", + "Stk", + "Mo", + "Di", + "Mi", + "Do", + "Fr", + "Sa", + "So", + "Bhf", + "Hbf", + "Nr", + "ca", + "usw", + "geb", + "gest", + "u" ] // Disregard correct spelling in your locale // and provide abbreviations in format “abbr abbr abbr…” const multipleWordAbbreviations = [ - "b w", - "d h", - "d i", - "e V", - "n Chr", - "s a", - "s o", - "s u", - "u a", - "u ä", - "u Ä", - "u dgl", - "u U", - "u z", - "u zw", - "v a", - "v Chr", - "z B", - "z T", - "z Zt", - "n u Z", - "u a m", - "v u Z", - "Ges m b H", + "b w", + "d h", + "d i", + "e V", + "n Chr", + "s a", + "s o", + "s u", + "u a", + "u ä", + "u Ä", + "u dgl", + "u U", + "u z", + "u zw", + "v a", + "v Chr", + "z B", + "z T", + "z Zt", + "n u Z", + "u a m", + "v u Z", + "Ges m b H", ] export default { - quotes, - numbers, - singleWordAbbreviations, - multipleWordAbbreviations + quotes, + numbers, + singleWordAbbreviations, + multipleWordAbbreviations } diff --git a/src/locale/en-us.js b/src/locale/en-us.js index 1a2b59c..a686239 100644 --- a/src/locale/en-us.js +++ b/src/locale/en-us.js @@ -1,35 +1,35 @@ const quotes = { - leftDoubleQuote : "“", - rightDoubleQuote : "”", - leftSingleQuote : "‘", - rightSingleQuote : "’", + leftDoubleQuote : "“", + rightDoubleQuote : "”", + leftSingleQuote : "‘", + rightSingleQuote : "’", }; const numbers = { - ordinalIndicator : "st|nd|rd|th", - romanOrdinalIndicator : "", + ordinalIndicator : "st|nd|rd|th", + romanOrdinalIndicator : "", } const singleWordAbbreviations = [ - "p", - "pp", - "no", - "vol" + "p", + "pp", + "no", + "vol" ] // Disregard correct spelling in your locale // and provide abbreviations in format “abbr abbr abbr…” const multipleWordAbbreviations = [ - "U S", - "e g", - "i e", - "a m", - "p m", + "U S", + "e g", + "i e", + "a m", + "p m", ] export default { - quotes, - numbers, - singleWordAbbreviations, - multipleWordAbbreviations + quotes, + numbers, + singleWordAbbreviations, + multipleWordAbbreviations } diff --git a/src/locale/rue.js b/src/locale/rue.js index 5010acf..5450044 100644 --- a/src/locale/rue.js +++ b/src/locale/rue.js @@ -1,41 +1,41 @@ const quotes = { - leftDoubleQuote : "«", - rightDoubleQuote : "»", - leftSingleQuote : "‹", - rightSingleQuote : "›", + leftDoubleQuote : "«", + rightDoubleQuote : "»", + leftSingleQuote : "‹", + rightSingleQuote : "›", }; const numbers = { - ordinalIndicator : "\\.", - romanOrdinalIndicator : "\\.", + ordinalIndicator : "\\.", + romanOrdinalIndicator : "\\.", } const singleWordAbbreviations = [ - "ціт", - "ст", - "канц", - "абз", - "тзв", - "Зб", - "ч", - "напр" + "ціт", + "ст", + "канц", + "абз", + "тзв", + "Зб", + "ч", + "напр" ] // Disregard correct spelling in your locale // and provide abbreviations in format “abbr abbr abbr…” const multipleWordAbbreviations = [ - "т зн", - "Е Ч", - "евід ч", - "род ч", - "т ч", - "т д", + "т зн", + "Е Ч", + "евід ч", + "род ч", + "т ч", + "т д", ] export default { - quotes, - numbers, - singleWordAbbreviations, - multipleWordAbbreviations + quotes, + numbers, + singleWordAbbreviations, + multipleWordAbbreviations } diff --git a/src/locale/sk.js b/src/locale/sk.js index b948191..160ceb5 100644 --- a/src/locale/sk.js +++ b/src/locale/sk.js @@ -1,49 +1,49 @@ const quotes = { - leftDoubleQuote : "„", - rightDoubleQuote : "“", - leftSingleQuote : "‚", - rightSingleQuote : "‘", + leftDoubleQuote : "„", + rightDoubleQuote : "“", + leftSingleQuote : "‚", + rightSingleQuote : "‘", }; const numbers = { - ordinalIndicator : "\\.", - romanOrdinalIndicator : "\\.", + ordinalIndicator : "\\.", + romanOrdinalIndicator : "\\.", } const singleWordAbbreviations = [ - "č", - "s", - "fol", - "str", - "r", - "par", - "odst", - "napr", - "sv", - "tzv", - "čl", - "cit", - "roč", - "vyd" + "č", + "s", + "fol", + "str", + "r", + "par", + "odst", + "napr", + "sv", + "tzv", + "čl", + "cit", + "roč", + "vyd" ] // Disregard correct spelling in your locale // and provide abbreviations in format “abbr abbr abbr…” const multipleWordAbbreviations = [ - "hl m", - "n l", - "p n l", - "pr n l", - "s a", - "s l", - "t j", - "zodp red", - "t č" + "hl m", + "n l", + "p n l", + "pr n l", + "s a", + "s l", + "t j", + "zodp red", + "t č" ] export default { - quotes, - numbers, - singleWordAbbreviations, - multipleWordAbbreviations + quotes, + numbers, + singleWordAbbreviations, + multipleWordAbbreviations } diff --git a/src/modules/examples.js b/src/modules/examples.js index fe0630f..93dd099 100644 --- a/src/modules/examples.js +++ b/src/modules/examples.js @@ -1,89 +1,89 @@ /* - What the function does? e.g. Replace 3 and more… + What the function does? e.g. Replace 3 and more… - Example + Example - Exceptions + Exceptions - Assumptions and Limitations + Assumptions and Limitations - Theory + Theory - Algorithm + Algorithm - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with ... + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with ... */ /*eslint-disable*/ export function name(string, locale) { - let pattern = - "(\\b)" - + "(["+ locale.romanNumerals + "]+)" - + "(" + locale.romanOrdinalIndicator +")" - + "(["+ locale.spaces +"]?)" - + "(["+ locale.allChars + locale.cardinalNumber + "])"; - let re = new RegExp(pattern, "g"); - let replacement = locale.ellipsis; - - return string.replace(re, replacement); - - // shorter version - string = string.replace( - new RegExp( - "("+ locale.leftDoubleQuote +")" - + "(["+ locale.spaces +"])", - "g" - ), - "$1" - ); + let pattern = + "(\\b)" + + "(["+ locale.romanNumerals + "]+)" + + "(" + locale.romanOrdinalIndicator +")" + + "(["+ locale.spaces +"]?)" + + "(["+ locale.allChars + locale.cardinalNumber + "])"; + let re = new RegExp(pattern, "g"); + let replacement = locale.ellipsis; + + return string.replace(re, replacement); + + // shorter version + string = string.replace( + new RegExp( + "("+ locale.leftDoubleQuote +")" + + "(["+ locale.spaces +"])", + "g" + ), + "$1" + ); } export function withFunctionInReturn(string, locale) { - let pattern = - "(\\b[" + locale.uppercaseChars + "]["+ locale.lowercaseChars +"]+?)" - + "([" + locale.spaces + "])" - + "([" + locale.romanNumerals +"]+\\b)" - + "(" + locale.romanOrdinalIndicator +")" - + "([" + locale.nbsp + "]?)"; - let re = new RegExp(pattern, "g"); - - return string.replace(re, function($0, $1, $2, $3, $4, $5){ - //you use literals from $1 onwards - - }); + let pattern = + "(\\b[" + locale.uppercaseChars + "]["+ locale.lowercaseChars +"]+?)" + + "([" + locale.spaces + "])" + + "([" + locale.romanNumerals +"]+\\b)" + + "(" + locale.romanOrdinalIndicator +")" + + "([" + locale.nbsp + "]?)"; + let re = new RegExp(pattern, "g"); + + return string.replace(re, function($0, $1, $2, $3, $4, $5){ + //you use literals from $1 onwards + + }); } /* test */ describe('Test case (en-us):\n', () => { - let testCase = { - ...somePartialTestCase, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - unitFunction( - key, - new Locale("en-us")), - testCase[key] - ); - }); - it("module test", () => { - assert.strictEqual( - moduleFunction( - key, - new Locale("en-us")), - testCase[key] - ); - }); - }); + let testCase = { + ...somePartialTestCase, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + unitFunction( + key, + new Locale("en-us")), + testCase[key] + ); + }); + it("module test", () => { + assert.strictEqual( + moduleFunction( + key, + new Locale("en-us")), + testCase[key] + ); + }); + }); }); diff --git a/src/modules/punctuation/dash.js b/src/modules/punctuation/dash.js index c103a87..51d1695 100644 --- a/src/modules/punctuation/dash.js +++ b/src/modules/punctuation/dash.js @@ -1,222 +1,222 @@ -export function replaceThreeHyphensWithEmDash(string) { - return string.replace(/(---)/g, "—"); -} + export function replaceThreeHyphensWithEmDash(string) { + return string.replace(/(---)/g, "—"); + } -export function replaceTwoHyphensWithEnDash(string) { - return string.replace(/(--)/g, "–"); -} + export function replaceTwoHyphensWithEnDash(string) { + return string.replace(/(--)/g, "–"); + } -/* - Identify a spaced hyphen between words and mark it as {{typopo__spacedHyphen}} + /* + Identify a spaced hyphen between words and mark it as {{typopo__spacedHyphen}} - We identify a hyphen before fixing it into a proper dash to avoid false identification of hyphen in compound words. + We identify a hyphen before fixing it into a proper dash to avoid false identification of hyphen in compound words. - Example - word - word → word {{typopo__spacedHyphen}} word - - Exceptions - - improperly spaced dash in words such as “e-shop”, e.g. “e -shop” (we fix this in hyphen.js) - - hyphens at the beginning of the paragraph that indicate unordered list - - - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified spaced hyphen as {{typopo__spacedHyphen}} -*/ -export function identifySpacedHyphen(string, locale) { - return string.replace( - new RegExp( - "([" + locale.allChars + "])" - + "([" + locale.spaces + "]+)" - + "([" + locale.hyphen + "])" - + "([" + locale.spaces + "]+)" - + "([" + locale.allChars + "])", - "g" - ), - "$1" + locale.space + "{{typopo__spacedHyphen}}" + locale.space + "$5" - ); -} - - - - - -/* - Identify: - - {{typopo__spacedHyphen}} - - improperly used or spaced en dash - - improperly used or spaced em dash - between words and fix dash and spacing for given locale - - Example - see tests - - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with fixed dashes and spaces between words -*/ -export function fixDashesBetweenWords(string, locale) { - let pattern = - "([" + locale.allChars + "])" - + "([" + locale.spaces + "]?)+" - + "({{typopo__spacedHyphen}}|["+ locale.enDash + "|" + locale.emDash + "])" - + "([" + locale.spaces + "]?)+" - + "([" + locale.allChars + "])"; - - let re = new RegExp(pattern, "g"); - let replacement = ""; - - switch (locale.locale) { - case "en-us": - replacement = "$1" + locale.emDash + "$5"; - break; - case "rue": - case "sk": - replacement = "$1" + locale.hairSpace + locale.emDash + locale.hairSpace + "$5"; - break; - case "cs": - replacement = "$1" + locale.nbsp + locale.enDash + locale.space + "$5"; - break; - case "de-de": - replacement = "$1" + locale.hairSpace + locale.enDash + locale.hairSpace + "$5"; - break; - } - - return string = string.replace(re, replacement); -} - - - - -/* - Replace hyphen placed between a word and punctuation, - or placed at the end of a paragaph. - - Examples (en-us): - so there is a dash -, → so there is a dash—, - so there is a dash-, → so there is a dash—, - so there is a dash -? → so there is a dash—? - so there is a dash - → so there is a dash— - - @param {string} string — input text for identification - @returns {string} — output with locale-specific dash and spacing between a word and a punctuation. -*/ -export function fixHyphenBetweenWordAndPunctuation(string, locale) { - let pattern = "(["+ locale.allChars +"])(["+ locale.spaces +"]?)("+ locale.hyphen +")(["+ locale.spaces +"]?)(["+ locale.sentencePunctuation +"\\n\\r])"; - let re = new RegExp(pattern, "g"); - let replacement = ""; - - switch (locale.locale) { - case "en-us": - replacement = "$1" + locale.emDash + "$5"; - break; - case "rue": - case "sk": - replacement = "$1" + locale.hairSpace + locale.emDash + "$5"; - break; - case "cs": - replacement = "$1" + locale.nbsp + locale.enDash + "$5"; - break; - case "de-de": - replacement = "$1" + locale.hairSpace + locale.enDash + "$5"; - break; - } - - return string = string.replace(re, replacement); -} - - - -/* - Replace hyphen or dash, placed between 2 cardinal numbers, - with an en dash; including cases when there is an extra space - from either one side or both sides of the dash - - Because in edge cases we would need to tackle overlapping regex matches - (e.g. 1–2–3), we've made the function bit more verbose. - [1] Match the pattern twice, replace it with enDash adepts - [2] Replace enDash adepts with actual enDashes - - @param {string} string — input text for identification - @returns {string} — output with en dash between cardinal numbers -*/ -export function fixDashBetweenCardinalNumbers(string, locale) { - /* [1] Match the pattern twice, replace it with enDash adepts */ - let pattern = - "(" + locale.cardinalNumber + ")" - + "([" + locale.spaces + "]?" - + "[" + locale.hyphen + locale.enDash + locale.emDash + "]" - + "[" + locale.spaces + "]?)" - + "(" + locale.cardinalNumber + ")"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + "{{typopo__endash}}" + "$3"; - string = string.replace(re, replacement); // [1] replace odd matches - string = string.replace(re, replacement); // [1] reaplce even matches - - /* [2] Replace enDash adepts with actual enDashes */ - pattern = "{{typopo__endash}}"; - re = new RegExp(pattern, "g"); - replacement = locale.enDash; - - return string.replace(re, replacement); -} - - - -/* - Replace hyphen or dash, placed between percentage range, - with an en dash; including cases when there is an extra space - from either one side or both sides of the dash - - @param {string} string — input text for identification - @returns {string} — output with en dash between percentage range -*/ -export function fixDashBetweenPercentageRange(string, locale) { - let pattern = "([" + locale.percent + locale.permille + locale.permyriad + "])([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)(" + locale.cardinalNumber + ")"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.enDash + "$3"; - return string.replace(re, replacement); -} - - - -/* - Replace hyphen or dash, placed between 2 ordinal numbers, - with an en dash; including cases when there is an extra space - from either one side or both sides of the dash - - @param {string} string — input text for identification - @returns {string} — output with dash between ordinal numbers -*/ -export function fixDashBetweenOrdinalNumbers(string, locale) { - let pattern = "(" + locale.cardinalNumber + ")(" + locale.ordinalIndicator + ")([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)(" + locale.cardinalNumber + ")(" + locale.ordinalIndicator + ")"; - let re = new RegExp(pattern, "gi"); - let replacement = "$1$2" + locale.enDash + "$4$5"; - - return string.replace(re, replacement); -} - - - -/* - Fixes dashes - - @param {string} string — input text for identification - @returns {string} — output with fixed dashes -*/ -export function fixDash(string, locale) { - string = replaceThreeHyphensWithEmDash(string, locale); - string = replaceTwoHyphensWithEnDash(string, locale); - string = identifySpacedHyphen(string, locale); - string = fixDashesBetweenWords(string, locale); - string = fixHyphenBetweenWordAndPunctuation(string, locale); - string = fixDashBetweenCardinalNumbers(string, locale); - string = fixDashBetweenPercentageRange(string, locale); - string = fixDashBetweenOrdinalNumbers(string, locale); - return string; -} + Example + word - word → word {{typopo__spacedHyphen}} word + + Exceptions + - improperly spaced dash in words such as “e-shop”, e.g. “e -shop” (we fix this in hyphen.js) + - hyphens at the beginning of the paragraph that indicate unordered list + + + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified spaced hyphen as {{typopo__spacedHyphen}} + */ + export function identifySpacedHyphen(string, locale) { + return string.replace( + new RegExp( + "([" + locale.allChars + "])" + + "([" + locale.spaces + "]+)" + + "([" + locale.hyphen + "])" + + "([" + locale.spaces + "]+)" + + "([" + locale.allChars + "])", + "g" + ), + "$1" + locale.space + "{{typopo__spacedHyphen}}" + locale.space + "$5" + ); + } + + + + + + /* + Identify: + - {{typopo__spacedHyphen}} + - improperly used or spaced en dash + - improperly used or spaced em dash + between words and fix dash and spacing for given locale + + Example + see tests + + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with fixed dashes and spaces between words + */ + export function fixDashesBetweenWords(string, locale) { + let pattern = + "([" + locale.allChars + "])" + + "([" + locale.spaces + "]?)+" + + "({{typopo__spacedHyphen}}|["+ locale.enDash + "|" + locale.emDash + "])" + + "([" + locale.spaces + "]?)+" + + "([" + locale.allChars + "])"; + + let re = new RegExp(pattern, "g"); + let replacement = ""; + + switch (locale.locale) { + case "en-us": + replacement = "$1" + locale.emDash + "$5"; + break; + case "rue": + case "sk": + replacement = "$1" + locale.hairSpace + locale.emDash + locale.hairSpace + "$5"; + break; + case "cs": + replacement = "$1" + locale.nbsp + locale.enDash + locale.space + "$5"; + break; + case "de-de": + replacement = "$1" + locale.hairSpace + locale.enDash + locale.hairSpace + "$5"; + break; + } + + return string = string.replace(re, replacement); + } + + + + + /* + Replace hyphen placed between a word and punctuation, + or placed at the end of a paragaph. + + Examples (en-us): + so there is a dash -, → so there is a dash—, + so there is a dash-, → so there is a dash—, + so there is a dash -? → so there is a dash—? + so there is a dash - → so there is a dash— + + @param {string} string — input text for identification + @returns {string} — output with locale-specific dash and spacing between a word and a punctuation. + */ + export function fixHyphenBetweenWordAndPunctuation(string, locale) { + let pattern = "(["+ locale.allChars +"])(["+ locale.spaces +"]?)("+ locale.hyphen +")(["+ locale.spaces +"]?)(["+ locale.sentencePunctuation +"\\n\\r])"; + let re = new RegExp(pattern, "g"); + let replacement = ""; + + switch (locale.locale) { + case "en-us": + replacement = "$1" + locale.emDash + "$5"; + break; + case "rue": + case "sk": + replacement = "$1" + locale.hairSpace + locale.emDash + "$5"; + break; + case "cs": + replacement = "$1" + locale.nbsp + locale.enDash + "$5"; + break; + case "de-de": + replacement = "$1" + locale.hairSpace + locale.enDash + "$5"; + break; + } + + return string = string.replace(re, replacement); + } + + + + /* + Replace hyphen or dash, placed between 2 cardinal numbers, + with an en dash; including cases when there is an extra space + from either one side or both sides of the dash + + Because in edge cases we would need to tackle overlapping regex matches + (e.g. 1–2–3), we've made the function bit more verbose. + [1] Match the pattern twice, replace it with enDash adepts + [2] Replace enDash adepts with actual enDashes + + @param {string} string — input text for identification + @returns {string} — output with en dash between cardinal numbers + */ + export function fixDashBetweenCardinalNumbers(string, locale) { + /* [1] Match the pattern twice, replace it with enDash adepts */ + let pattern = + "(" + locale.cardinalNumber + ")" + + "([" + locale.spaces + "]?" + + "[" + locale.hyphen + locale.enDash + locale.emDash + "]" + + "[" + locale.spaces + "]?)" + + "(" + locale.cardinalNumber + ")"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + "{{typopo__endash}}" + "$3"; + string = string.replace(re, replacement); // [1] replace odd matches + string = string.replace(re, replacement); // [1] reaplce even matches + + /* [2] Replace enDash adepts with actual enDashes */ + pattern = "{{typopo__endash}}"; + re = new RegExp(pattern, "g"); + replacement = locale.enDash; + + return string.replace(re, replacement); + } + + + + /* + Replace hyphen or dash, placed between percentage range, + with an en dash; including cases when there is an extra space + from either one side or both sides of the dash + + @param {string} string — input text for identification + @returns {string} — output with en dash between percentage range + */ + export function fixDashBetweenPercentageRange(string, locale) { + let pattern = "([" + locale.percent + locale.permille + locale.permyriad + "])([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)(" + locale.cardinalNumber + ")"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.enDash + "$3"; + return string.replace(re, replacement); + } + + + + /* + Replace hyphen or dash, placed between 2 ordinal numbers, + with an en dash; including cases when there is an extra space + from either one side or both sides of the dash + + @param {string} string — input text for identification + @returns {string} — output with dash between ordinal numbers + */ + export function fixDashBetweenOrdinalNumbers(string, locale) { + let pattern = "(" + locale.cardinalNumber + ")(" + locale.ordinalIndicator + ")([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)(" + locale.cardinalNumber + ")(" + locale.ordinalIndicator + ")"; + let re = new RegExp(pattern, "gi"); + let replacement = "$1$2" + locale.enDash + "$4$5"; + + return string.replace(re, replacement); + } + + + + /* + Fixes dashes + + @param {string} string — input text for identification + @returns {string} — output with fixed dashes + */ + export function fixDash(string, locale) { + string = replaceThreeHyphensWithEmDash(string, locale); + string = replaceTwoHyphensWithEnDash(string, locale); + string = identifySpacedHyphen(string, locale); + string = fixDashesBetweenWords(string, locale); + string = fixHyphenBetweenWordAndPunctuation(string, locale); + string = fixDashBetweenCardinalNumbers(string, locale); + string = fixDashBetweenPercentageRange(string, locale); + string = fixDashBetweenOrdinalNumbers(string, locale); + return string; + } diff --git a/src/modules/punctuation/double-quotes.js b/src/modules/punctuation/double-quotes.js index c22a25b..3657c3d 100644 --- a/src/modules/punctuation/double-quotes.js +++ b/src/modules/punctuation/double-quotes.js @@ -5,288 +5,288 @@ import { identifyMarkdownCodeTicks, /* - Remove extra punctuation before double quotes + Remove extra punctuation before double quotes - Example - “Hey!,” she said" → “Hey!” she said + Example + “Hey!,” she said" → “Hey!” she said - Exceptions - (cs/sk) Byl to “Karel IV.”, ktery neco… - č., s., fol., str., + Exceptions + (cs/sk) Byl to “Karel IV.”, ktery neco… + č., s., fol., str., - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with removed extra terminal punctuation + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with removed extra terminal punctuation */ export function removeExtraPunctuationBeforeQuotes(string, locale) { - let pattern = - "([^"+ locale.romanNumerals + "])" - + "([" + locale.sentencePunctuation + "])" - + "([" + locale.sentencePunctuation + "])" - + "(" + locale.doubleQuoteAdepts + ")" - let re = new RegExp(pattern, "g"); - - return string.replace(re, "$1$2$4"); + let pattern = + "([^"+ locale.romanNumerals + "])" + + "([" + locale.sentencePunctuation + "])" + + "([" + locale.sentencePunctuation + "])" + + "(" + locale.doubleQuoteAdepts + ")" + let re = new RegExp(pattern, "g"); + + return string.replace(re, "$1$2$4"); } /* - Remove extra punctuation after double quotes + Remove extra punctuation after double quotes - Example - “We will continue tomorrow.”. → “We will continue tomorrow.” + Example + “We will continue tomorrow.”. → “We will continue tomorrow.” - Exceptions - (cs/sk) Byl to “Karel IV.”, ktery neco… + Exceptions + (cs/sk) Byl to “Karel IV.”, ktery neco… - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with removed extra terminal punctuation + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with removed extra terminal punctuation */ export function removeExtraPunctuationAfterQuotes(string, locale) { - let pattern = - "([^"+ locale.romanNumerals + "])" - + "([" + locale.sentencePunctuation + "])" - + "(" + locale.doubleQuoteAdepts + ")" - + "([" + locale.sentencePunctuation + "])" - let re = new RegExp(pattern, "g"); - - return string.replace(re, "$1$2$3"); + let pattern = + "([^"+ locale.romanNumerals + "])" + + "([" + locale.sentencePunctuation + "])" + + "(" + locale.doubleQuoteAdepts + ")" + + "([" + locale.sentencePunctuation + "])" + let re = new RegExp(pattern, "g"); + + return string.replace(re, "$1$2$3"); } /* - Identify inches, arcseconds, seconds following a 1–3 numbers - - Algorithm - [1] // swap quote adepts so they're not identified as a doble prime - {quote adept} sentence 12{quote adept}. - {quote adept} sentence 12.{quote adept} - - [2] // identify inches following a number - 12′ 45" → - 12′ 45″ - - Double-quotes module impact - Function falsely identifies inches, where we are expecting quotes, e.g. - "Konference 2020" in quotes → - “Konference 2020” in quotes - → this is corrected in replaceDoublePrimeWDoubleQuote - - Implementation note - We’re not using locale.doubleQuoteAdepts variable - as commas, low-positioned quotes, guillemets are ommited - - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified double primes as a temporary variable string, e.g. {{typopo__double-prime}} + Identify inches, arcseconds, seconds following a 1–3 numbers + + Algorithm + [1] // swap quote adepts so they're not identified as a doble prime + {quote adept} sentence 12{quote adept}. + {quote adept} sentence 12.{quote adept} + + [2] // identify inches following a number + 12′ 45" → + 12′ 45″ + + Double-quotes module impact + Function falsely identifies inches, where we are expecting quotes, e.g. + "Konference 2020" in quotes → + “Konference 2020” in quotes + → this is corrected in replaceDoublePrimeWDoubleQuote + + Implementation note + We’re not using locale.doubleQuoteAdepts variable + as commas, low-positioned quotes, guillemets are ommited + + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified double primes as a temporary variable string, e.g. {{typopo__double-prime}} */ export function identifyDoublePrimes(string, locale) { - // [1] - string = string.replace( - new RegExp( - "([^0-9]|^)" - + "(" + locale.doubleQuoteAdepts + ")" - + "(.+?)" - + "(\\d+)" - + "(" + locale.doubleQuoteAdepts + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])", - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$6" - + "$5" - ) - - // [2] - string = string.replace( - new RegExp( - "(\\b\\d{1,3})" - + "([" + locale.spaces +"]?)" - + "(“|”|\"|″|‘{2,}|’{2,}|'{2,}|′{2,})", - "g" - ), - "$1" - + "$2" - + "{{typopo__double-prime}}" - ) - - - return string; + // [1] + string = string.replace( + new RegExp( + "([^0-9]|^)" + + "(" + locale.doubleQuoteAdepts + ")" + + "(.+?)" + + "(\\d+)" + + "(" + locale.doubleQuoteAdepts + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])", + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$6" + + "$5" + ) + + // [2] + string = string.replace( + new RegExp( + "(\\b\\d{1,3})" + + "([" + locale.spaces +"]?)" + + "(“|”|\"|″|‘{2,}|’{2,}|'{2,}|′{2,})", + "g" + ), + "$1" + + "$2" + + "{{typopo__double-prime}}" + ) + + + return string; } /* - Identify double quote pairs + Identify double quote pairs - Example - "quoted material" → “quoted material” + Example + "quoted material" → “quoted material” - Assumptions and Limitations - We assume that double primes, inches and arcseconds were identified in the previous run. + Assumptions and Limitations + We assume that double primes, inches and arcseconds were identified in the previous run. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified double quote pairs + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified double quote pairs */ export function identifyDoubleQuotePairs(string, locale) { - // double quotes around a number - string = string.replace( - new RegExp( - "(" + locale.doubleQuoteAdepts + ")" - + "(\\d+)" - + "({{typopo__double-prime}})", - "g" - ), - "{{typopo__left-double-quote}}" - + "$2" - + "{{typopo__right-double-quote}}" - ); - - // generic rule - string = string.replace( - new RegExp( - "(" + locale.doubleQuoteAdepts + ")" - + "(.*?)" - + "(" + locale.doubleQuoteAdepts + ")", - "g" - ), - "{{typopo__left-double-quote}}" - + "$2" - + "{{typopo__right-double-quote}}" - ); - - return string; + // double quotes around a number + string = string.replace( + new RegExp( + "(" + locale.doubleQuoteAdepts + ")" + + "(\\d+)" + + "({{typopo__double-prime}})", + "g" + ), + "{{typopo__left-double-quote}}" + + "$2" + + "{{typopo__right-double-quote}}" + ); + + // generic rule + string = string.replace( + new RegExp( + "(" + locale.doubleQuoteAdepts + ")" + + "(.*?)" + + "(" + locale.doubleQuoteAdepts + ")", + "g" + ), + "{{typopo__left-double-quote}}" + + "$2" + + "{{typopo__right-double-quote}}" + ); + + return string; } /* - After identifying double quote pairs, identify standalone left double quotes. + After identifying double quote pairs, identify standalone left double quotes. - Example - There is a "standalone left quote. → - There is a “standalone left quote. + Example + There is a "standalone left quote. → + There is a “standalone left quote. - Assumptions and Limitations - Double quote pairs have been identified in the analysed text already + Assumptions and Limitations + Double quote pairs have been identified in the analysed text already - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified standalone left double quotes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified standalone left double quotes */ export function identifyStandaloneLeftDoubleQuote(string, locale) { - let pattern = - "(" + locale.doubleQuoteAdepts + ")" - + "([0-9" + locale.lowercaseChars + locale.uppercaseChars + "])"; + let pattern = + "(" + locale.doubleQuoteAdepts + ")" + + "([0-9" + locale.lowercaseChars + locale.uppercaseChars + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "{{typopo__left-double-quote--standalone}}$2"); + let re = new RegExp(pattern, "g"); + return string.replace(re, "{{typopo__left-double-quote--standalone}}$2"); } /* - After identifying double quote pairs, identify standalone right double quotes. + After identifying double quote pairs, identify standalone right double quotes. - Example - There is a standalone" right quote. → - There is a standalone” right quote. + Example + There is a standalone" right quote. → + There is a standalone” right quote. - Assumptions and Limitations - Double quote pairs have been identified in the analysed text already + Assumptions and Limitations + Double quote pairs have been identified in the analysed text already - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified standalone right double quotes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified standalone right double quotes */ export function identifyStandaloneRightDoubleQuote(string, locale) { - let pattern = - "([" + locale.lowercaseChars + locale.uppercaseChars + locale.sentencePunctuation + locale.ellipsis + "])" - + "(" + locale.doubleQuoteAdepts + ")"; - let re = new RegExp(pattern, "g"); - - return string.replace(re, "$1{{typopo__right-double-quote--standalone}}"); + let pattern = + "([" + locale.lowercaseChars + locale.uppercaseChars + locale.sentencePunctuation + locale.ellipsis + "])" + + "(" + locale.doubleQuoteAdepts + ")"; + let re = new RegExp(pattern, "g"); + + return string.replace(re, "$1{{typopo__right-double-quote--standalone}}"); } /* - Remove double quotes that cannot be identified whether they are left or right double quotes. + Remove double quotes that cannot be identified whether they are left or right double quotes. - Example - word " word → word word + Example + word " word → word word - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with removed unidentified double quotes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with removed unidentified double quotes */ export function removeUnidentifiedDoubleQuote(string, locale) { - let pattern = - "([" + locale.spaces + "])" - + "(" + locale.doubleQuoteAdepts + ")" - + "([" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1"); + let pattern = + "([" + locale.spaces + "])" + + "(" + locale.doubleQuoteAdepts + ")" + + "([" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1"); } /* - Replace a double qoute & a double prime with a double quote pair + Replace a double qoute & a double prime with a double quote pair - Assumptions and Limitations - This function follows previous functions that identify double primes or standalone double quotes. - So it may happen that previous functions falsely identify a double quote pair around situations such as: - - It’s called “Localhost 3000” and it’s pretty fast. + Assumptions and Limitations + This function follows previous functions that identify double primes or standalone double quotes. + So it may happen that previous functions falsely identify a double quote pair around situations such as: + - It’s called “Localhost 3000” and it’s pretty fast. - Algorithm - Find standalone double quote and double prime in pair and change them to a double quote pair + Algorithm + Find standalone double quote and double prime in pair and change them to a double quote pair - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with a double quote pair + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with a double quote pair */ export function replaceDoublePrimeWDoubleQuote(string) { - string = string.replace( - new RegExp( - "({{typopo__left-double-quote--standalone}})" - + "(.*?)" - + "({{typopo__double-prime}})", - "g" - ), - "{{typopo__left-double-quote}}" - + "$2" - + "{{typopo__right-double-quote}}" - ); - - string = string.replace( - new RegExp( - "({{typopo__double-prime}})" - + "(.*?)" - + "({{typopo__right-double-quote--standalone}})", - "g" - ), - "{{typopo__left-double-quote}}" - + "$2" - + "{{typopo__right-double-quote}}" - ); - - return string; + string = string.replace( + new RegExp( + "({{typopo__left-double-quote--standalone}})" + + "(.*?)" + + "({{typopo__double-prime}})", + "g" + ), + "{{typopo__left-double-quote}}" + + "$2" + + "{{typopo__right-double-quote}}" + ); + + string = string.replace( + new RegExp( + "({{typopo__double-prime}})" + + "(.*?)" + + "({{typopo__right-double-quote--standalone}})", + "g" + ), + "{{typopo__left-double-quote}}" + + "$2" + + "{{typopo__right-double-quote}}" + ); + + return string; } @@ -296,211 +296,211 @@ export function replaceDoublePrimeWDoubleQuote(string) { Swap quotes and terminal punctuation for a quoted part - There are two different rules to follow quotes: - 1. Quotes contain only quoted material: - “Sometimes it can be a whole sentence.” - Sometimes it can be only a “quoted part”. - The difference is where the terminal and sentence pause punctuation is. + There are two different rules to follow quotes: + 1. Quotes contain only quoted material: + “Sometimes it can be a whole sentence.” + Sometimes it can be only a “quoted part”. + The difference is where the terminal and sentence pause punctuation is. - 2. American editorial style - Similar as the first rule, but commas (,) and periods (.) go before closing quotation marks, regardless whether they are part of the quoted material. + 2. American editorial style + Similar as the first rule, but commas (,) and periods (.) go before closing quotation marks, regardless whether they are part of the quoted material. - The aim here is to support the first rule. + The aim here is to support the first rule. - - Examples - “Sometimes it can be a whole sentence.” - Sometimes it can be only a “quoted part”. + + Examples + “Sometimes it can be a whole sentence.” + Sometimes it can be only a “quoted part”. - So we’re looking to swap here: - Sometimes it can be only a “quoted part.” → - Sometimes it can be only a “quoted part”. + So we’re looking to swap here: + Sometimes it can be only a “quoted part.” → + Sometimes it can be only a “quoted part”. - Exceptions - Byl to “Karel IV.”, ktery + Exceptions + Byl to “Karel IV.”, ktery - Algorithm - Three different cases, see comments in code + Algorithm + Three different cases, see comments in code - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with swapped double quotes and terminal punctuation within a quoted part + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with swapped double quotes and terminal punctuation within a quoted part */ export function swapQuotesAndTerminalPunctuation(string, locale) { - // match quoted part within a sentence and - // place punctuation outside of quoted part - string = string.replace( - new RegExp( - "([^" + locale.sentencePunctuation + "])" // 1 - + "([" + locale.spaces + "])" // 2 - + "(" + locale.leftDoubleQuote + ")" // 3 - + "([^" + locale.rightDoubleQuote +"]+?)" // 4 - + "([^" + locale.romanNumerals + locale.closingBrackets + "])" // 5 - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" // 6 - + "(" + locale.rightDoubleQuote + ")", // 7 - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$5" - + "$7" - + "$6" - ); - - // Match quoted sentence within an unquoted sentence - // and place terminal punctuation of the quoted sentence - // within quotes - string = string.replace( - new RegExp( - "([^" + locale.sentencePunctuation + "])" - + "([" + locale.spaces + "])" - + "(" + locale.leftDoubleQuote + ")" - + "(.+?)" - + "([^" + locale.romanNumerals + "])" - + "(" + locale.rightDoubleQuote + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "([" + locale.spaces + "])" - + "([" + locale.lowercaseChars + "])", - - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$5" - + "$7" - + "$6" - + "$8" - + "$9" - ); - - - // Match the whole quoted sentence starting at the beginning of paragraph - // and place terminal punctuation within that sentence. - string = string.replace( - new RegExp( - "(^" - + locale.leftDoubleQuote - + "[^" + locale.rightDoubleQuote +"]+?" - + "[^" + locale.romanNumerals + "])" - - + "(" + locale.rightDoubleQuote + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "(\\B)", - - "gm" - ), - "$1" - + "$3" - + "$2" - + "$4" - ); - - // Match the whole quoted sentence starting after a sentence - // and place terminal punctuation within that sentence. - string = string.replace( - new RegExp( - "([" + locale.sentencePunctuation + "]" - + "[" + locale.spaces + "]" - + locale.leftDoubleQuote - + "[^" + locale.rightDoubleQuote +"]+?" - + "[^" + locale.romanNumerals + "])" - - + "(" + locale.rightDoubleQuote + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "(\\B)", - - "g" - ), - "$1" - + "$3" - + "$2" - + "$4" - ); - - - // Match the whole quoted sentence starting after a quoted sentence - // and place terminal punctuation within that sentence. - string = string.replace( - new RegExp( - "([" + locale.sentencePunctuation + "]" - + "[" + locale.rightDoubleQuote + "]" - + "[" + locale.spaces + "]" - + locale.leftDoubleQuote - + "[^" + locale.rightDoubleQuote +"]+?" - + "[^" + locale.romanNumerals + "])" - - + "(" + locale.rightDoubleQuote + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "(\\B)", - - "g" - ), - "$1" - + "$3" - + "$2" - + "$4" - ); - - return string; + // match quoted part within a sentence and + // place punctuation outside of quoted part + string = string.replace( + new RegExp( + "([^" + locale.sentencePunctuation + "])" // 1 + + "([" + locale.spaces + "])" // 2 + + "(" + locale.leftDoubleQuote + ")" // 3 + + "([^" + locale.rightDoubleQuote +"]+?)" // 4 + + "([^" + locale.romanNumerals + locale.closingBrackets + "])" // 5 + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" // 6 + + "(" + locale.rightDoubleQuote + ")", // 7 + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$5" + + "$7" + + "$6" + ); + + // Match quoted sentence within an unquoted sentence + // and place terminal punctuation of the quoted sentence + // within quotes + string = string.replace( + new RegExp( + "([^" + locale.sentencePunctuation + "])" + + "([" + locale.spaces + "])" + + "(" + locale.leftDoubleQuote + ")" + + "(.+?)" + + "([^" + locale.romanNumerals + "])" + + "(" + locale.rightDoubleQuote + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "([" + locale.spaces + "])" + + "([" + locale.lowercaseChars + "])", + + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$5" + + "$7" + + "$6" + + "$8" + + "$9" + ); + + + // Match the whole quoted sentence starting at the beginning of paragraph + // and place terminal punctuation within that sentence. + string = string.replace( + new RegExp( + "(^" + + locale.leftDoubleQuote + + "[^" + locale.rightDoubleQuote +"]+?" + + "[^" + locale.romanNumerals + "])" + + + "(" + locale.rightDoubleQuote + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "(\\B)", + + "gm" + ), + "$1" + + "$3" + + "$2" + + "$4" + ); + + // Match the whole quoted sentence starting after a sentence + // and place terminal punctuation within that sentence. + string = string.replace( + new RegExp( + "([" + locale.sentencePunctuation + "]" + + "[" + locale.spaces + "]" + + locale.leftDoubleQuote + + "[^" + locale.rightDoubleQuote +"]+?" + + "[^" + locale.romanNumerals + "])" + + + "(" + locale.rightDoubleQuote + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "(\\B)", + + "g" + ), + "$1" + + "$3" + + "$2" + + "$4" + ); + + + // Match the whole quoted sentence starting after a quoted sentence + // and place terminal punctuation within that sentence. + string = string.replace( + new RegExp( + "([" + locale.sentencePunctuation + "]" + + "[" + locale.rightDoubleQuote + "]" + + "[" + locale.spaces + "]" + + locale.leftDoubleQuote + + "[^" + locale.rightDoubleQuote +"]+?" + + "[^" + locale.romanNumerals + "])" + + + "(" + locale.rightDoubleQuote + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "(\\B)", + + "g" + ), + "$1" + + "$3" + + "$2" + + "$4" + ); + + return string; } /* - Replace all identified punctuation with appropriate punctuation in given language + Replace all identified punctuation with appropriate punctuation in given language - Context - In double-quotes module, we first identify double quote and double prime adepts, and replace them temporaririly with labels as “{{typopo__double-prime}}”. - This is the function in the sequence to swap temporary labels to desired quotes. + Context + In double-quotes module, we first identify double quote and double prime adepts, and replace them temporaririly with labels as “{{typopo__double-prime}}”. + This is the function in the sequence to swap temporary labels to desired quotes. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} an output with locale-specific double quotes and double primes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} an output with locale-specific double quotes and double primes */ export function placeLocaleDoubleQuotes(string, locale) { - string = string.replace( - /{{typopo__double-prime}}/g, - locale.doublePrime); - string = string.replace( - /({{typopo__left-double-quote}}|{{typopo__left-double-quote--standalone}})/g, - locale.leftDoubleQuote); - string = string.replace( - /({{typopo__right-double-quote}}|{{typopo__right-double-quote--standalone}})/g, - locale.rightDoubleQuote); - - return string; + string = string.replace( + /{{typopo__double-prime}}/g, + locale.doublePrime); + string = string.replace( + /({{typopo__left-double-quote}}|{{typopo__left-double-quote--standalone}})/g, + locale.leftDoubleQuote); + string = string.replace( + /({{typopo__right-double-quote}}|{{typopo__right-double-quote--standalone}})/g, + locale.rightDoubleQuote); + + return string; } /* - Remove an extra comma after sentence punctuation in direct speech + Remove an extra comma after sentence punctuation in direct speech - Example - “Hey!,” she said → - “Hey!” she said + Example + “Hey!,” she said → + “Hey!” she said - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with ... + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with ... */ export function removeExtraCommaAfterSentencePunctuation(string, locale) { - let pattern = - "([" + locale.sentencePunctuation + "])" - + "([,])" - + "(" + locale.rightDoubleQuote +")"; + let pattern = + "([" + locale.sentencePunctuation + "])" + + "([,])" + + "(" + locale.rightDoubleQuote +")"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1$3"); + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1$3"); } @@ -508,175 +508,175 @@ export function removeExtraCommaAfterSentencePunctuation(string, locale) { /* - Remove extra spaces around quotes and primes + Remove extra spaces around quotes and primes - Example - “ English ” → - “English” + Example + “ English ” → + “English” - 12′ 45 ″ → - 12′ 45″ + 12′ 45 ″ → + 12′ 45″ - Assumptions and Limitations - The functions runs after all double quotes and double primes have been identified. + Assumptions and Limitations + The functions runs after all double quotes and double primes have been identified. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with adjusted spacing around double quotes and double primes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with adjusted spacing around double quotes and double primes */ export function removeExtraSpacesAroundQuotes(string, locale) { - string = string.replace( - new RegExp( - "("+ locale.leftDoubleQuote +")" - + "(["+ locale.spaces +"])", - "g" - ), - "$1" - ) - - - string = string.replace( - new RegExp( - "(["+ locale.spaces +"])" - + "("+ locale.rightDoubleQuote +")", - "g" - ), - "$2" - ) - - - string = string.replace( - new RegExp( - "(["+ locale.spaces +"])" - + "("+ locale.doublePrime +")", - "g" - ), - "$2" - ) - - return string; + string = string.replace( + new RegExp( + "("+ locale.leftDoubleQuote +")" + + "(["+ locale.spaces +"])", + "g" + ), + "$1" + ) + + + string = string.replace( + new RegExp( + "(["+ locale.spaces +"])" + + "("+ locale.rightDoubleQuote +")", + "g" + ), + "$2" + ) + + + string = string.replace( + new RegExp( + "(["+ locale.spaces +"])" + + "("+ locale.doublePrime +")", + "g" + ), + "$2" + ) + + return string; } /* - Add a missing space before a left double quote + Add a missing space before a left double quote - Example - It’s a“nice” saying. → - It’s a “nice” saying. // also fix nbsp after “a” + Example + It’s a“nice” saying. → + It’s a “nice” saying. // also fix nbsp after “a” - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with added space before left double quote + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with added space before left double quote */ export function addSpaceBeforeLeftDoubleQuote(string, locale) { - string = string.replace( - new RegExp( - "([" + locale.sentencePunctuation + locale.allChars + "])" - + "(["+ locale.leftDoubleQuote +"])", - "g" - ), - "$1 $2" - ) + string = string.replace( + new RegExp( + "([" + locale.sentencePunctuation + locale.allChars + "])" + + "(["+ locale.leftDoubleQuote +"])", + "g" + ), + "$1 $2" + ) - string = addNbspAfterPreposition(string, locale) + string = addNbspAfterPreposition(string, locale) - return string; + return string; } /* - Add a missing space after a right double quote + Add a missing space after a right double quote - Example - It’s a “nice”saying. → - It’s a “nice” saying. + Example + It’s a “nice”saying. → + It’s a “nice” saying. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with added space after a right double quote + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with added space after a right double quote */ export function addSpaceAfterRightDoubleQuote(string, locale) { - return string.replace( - new RegExp( - "([" + locale.rightDoubleQuote + "])" - + "([" + locale.allChars + "])", - "g" - ), - "$1 $2" - ) + return string.replace( + new RegExp( + "([" + locale.rightDoubleQuote + "])" + + "([" + locale.allChars + "])", + "g" + ), + "$1 $2" + ) } /* - Correct improper use of double quotes and double primes - - Assumptions and Limitations - This function assumes that double quotes are always used in pair, - i.e. authors did not forget to close double quotes in their text. - - Algorithm - [0] Identify markdown code ticks - [1] Remove extra terminal punctuation around double quotes - [2] Identify inches, arcseconds, seconds - [3] Identify double quote pairs - [4] Identify standalone double quotes - [5] Replace a double qoute & a double prime with a double quote pair - [6] Replace all identified punctuation with appropriate punctuation in given language - [7] Consolidate spaces around double quotes and primes - [8] Swap quotes and terminal punctuation for a quoted part - [9] Remove extra comma after punctuation in direct speech + Correct improper use of double quotes and double primes + + Assumptions and Limitations + This function assumes that double quotes are always used in pair, + i.e. authors did not forget to close double quotes in their text. + + Algorithm + [0] Identify markdown code ticks + [1] Remove extra terminal punctuation around double quotes + [2] Identify inches, arcseconds, seconds + [3] Identify double quote pairs + [4] Identify standalone double quotes + [5] Replace a double qoute & a double prime with a double quote pair + [6] Replace all identified punctuation with appropriate punctuation in given language + [7] Consolidate spaces around double quotes and primes + [8] Swap quotes and terminal punctuation for a quoted part + [9] Remove extra comma after punctuation in direct speech @param {string} string: input text for identification @param {string} locale: locale option - @returns {string} output with properly replaces double qoutes and double primes + @returns {string} output with properly replaces double qoutes and double primes */ export function fixDoubleQuotesAndPrimes(string, locale, configuration) { - /* [0] Identify markdown code ticks */ - string = identifyMarkdownCodeTicks(string, configuration); - - /* [1] Remove extra terminal punctuation around double quotes */ - string = removeExtraPunctuationBeforeQuotes(string, locale); - string = removeExtraPunctuationAfterQuotes(string, locale); - - /* [2] Identify inches, arcseconds, seconds */ - string = identifyDoublePrimes(string, locale); - - /* [3] Identify double quote pairs */ - string = identifyDoubleQuotePairs(string, locale); - - /* [4] Identify standalone double quotes */ - string = identifyStandaloneLeftDoubleQuote(string, locale); - string = identifyStandaloneRightDoubleQuote(string, locale); - string = removeUnidentifiedDoubleQuote(string, locale); - - /* [5] Replace a double qoute & a double prime with a double quote pair */ - string = replaceDoublePrimeWDoubleQuote(string, locale); - - /* [6] Replace all identified punctuation with appropriate punctuation in given language */ - string = placeLocaleDoubleQuotes(string, locale); - string = placeMarkdownCodeTicks(string, configuration); - - /* [7] Consolidate spaces around double quotes and primes */ - string = removeExtraSpacesAroundQuotes(string, locale); - string = addSpaceBeforeLeftDoubleQuote(string, locale); - string = addSpaceAfterRightDoubleQuote(string, locale); - - /* [8] Swap quotes and terminal punctuation */ - string = swapQuotesAndTerminalPunctuation(string, locale); - - /* [9] Remove an extra comma after sentence punctuation in direct speech */ - string = removeExtraCommaAfterSentencePunctuation(string, locale); - - return string; + /* [0] Identify markdown code ticks */ + string = identifyMarkdownCodeTicks(string, configuration); + + /* [1] Remove extra terminal punctuation around double quotes */ + string = removeExtraPunctuationBeforeQuotes(string, locale); + string = removeExtraPunctuationAfterQuotes(string, locale); + + /* [2] Identify inches, arcseconds, seconds */ + string = identifyDoublePrimes(string, locale); + + /* [3] Identify double quote pairs */ + string = identifyDoubleQuotePairs(string, locale); + + /* [4] Identify standalone double quotes */ + string = identifyStandaloneLeftDoubleQuote(string, locale); + string = identifyStandaloneRightDoubleQuote(string, locale); + string = removeUnidentifiedDoubleQuote(string, locale); + + /* [5] Replace a double qoute & a double prime with a double quote pair */ + string = replaceDoublePrimeWDoubleQuote(string, locale); + + /* [6] Replace all identified punctuation with appropriate punctuation in given language */ + string = placeLocaleDoubleQuotes(string, locale); + string = placeMarkdownCodeTicks(string, configuration); + + /* [7] Consolidate spaces around double quotes and primes */ + string = removeExtraSpacesAroundQuotes(string, locale); + string = addSpaceBeforeLeftDoubleQuote(string, locale); + string = addSpaceAfterRightDoubleQuote(string, locale); + + /* [8] Swap quotes and terminal punctuation */ + string = swapQuotesAndTerminalPunctuation(string, locale); + + /* [9] Remove an extra comma after sentence punctuation in direct speech */ + string = removeExtraCommaAfterSentencePunctuation(string, locale); + + return string; } \ No newline at end of file diff --git a/src/modules/punctuation/ellipsis.js b/src/modules/punctuation/ellipsis.js index 5fcfb57..9523aa1 100644 --- a/src/modules/punctuation/ellipsis.js +++ b/src/modules/punctuation/ellipsis.js @@ -1,268 +1,268 @@ /* - Ellipsis (as a character) is used for 2 different purposes: - 1. as an ellipsis to ommit a piece of information deliberately - 2. as an aposiopesis; a figure of speech wherein a sentence is - deliberately broken off and left unfinished - - sources - https://en.wikipedia.org/wiki/Ellipsis - https://en.wikipedia.org/wiki/Aposiopesis - http://www.liteera.cz/slovnik/vypustka + Ellipsis (as a character) is used for 2 different purposes: + 1. as an ellipsis to ommit a piece of information deliberately + 2. as an aposiopesis; a figure of speech wherein a sentence is + deliberately broken off and left unfinished + + sources + https://en.wikipedia.org/wiki/Ellipsis + https://en.wikipedia.org/wiki/Aposiopesis + http://www.liteera.cz/slovnik/vypustka */ /* - Replace 3 and more dots/ellipses with an ellipsis + Replace 3 and more dots/ellipses with an ellipsis - Example: - Sentence ending…..... → Sentence ending… + Example: + Sentence ending…..... → Sentence ending… - @param {string} string — input text for identification - @param {string} locale — locale option - @returns {string} — output with fixed ellipsis + @param {string} string — input text for identification + @param {string} locale — locale option + @returns {string} — output with fixed ellipsis */ export function replaceThreeCharsWithEllipsis(string, locale) { - let pattern = "[" + locale.ellipsis + "\\.]{3,}"; - let re = new RegExp(pattern, "g"); - let replacement = locale.ellipsis; - return string.replace(re, replacement); + let pattern = "[" + locale.ellipsis + "\\.]{3,}"; + let re = new RegExp(pattern, "g"); + let replacement = locale.ellipsis; + return string.replace(re, replacement); } /* - Replace combination of period/ellipsis with an ellipsis + Replace combination of period/ellipsis with an ellipsis - Example: - .…, …., …… → … + Example: + .…, …., …… → … - @param {string} string — input text for identification - @returns {string} — output with fixed ellipsis + @param {string} string — input text for identification + @returns {string} — output with fixed ellipsis */ export function replaceTwoCharsWithEllipsis(string, locale) { - let pattern = - "\\." + locale.ellipsis + "|" - + locale.ellipsis + "{2,}|" - + locale.ellipsis + "\\."; - let re = new RegExp(pattern, "g"); - let replacement = locale.ellipsis; - return string.replace(re, replacement); + let pattern = + "\\." + locale.ellipsis + "|" + + locale.ellipsis + "{2,}|" + + locale.ellipsis + "\\."; + let re = new RegExp(pattern, "g"); + let replacement = locale.ellipsis; + return string.replace(re, replacement); } /* - Replace two periods between words (spaces) with an ellipsis + Replace two periods between words (spaces) with an ellipsis - Example - word .. word → word … word + Example + word .. word → word … word - @param {string} string — input text for identification - @returns {string} — output with fixed ellipsis + @param {string} string — input text for identification + @returns {string} — output with fixed ellipsis */ export function replaceTwoPeriodsWithEllipsis(string, locale) { - let pattern = "[" + locale.spaces + "]\\.{2}[" + locale.spaces + "]"; - let re = new RegExp(pattern, "g"); - let replacement = locale.space + locale.ellipsis + locale.space; - return string.replace(re, replacement); + let pattern = "[" + locale.spaces + "]\\.{2}[" + locale.spaces + "]"; + let re = new RegExp(pattern, "g"); + let replacement = locale.space + locale.ellipsis + locale.space; + return string.replace(re, replacement); } /* - Fix spacing, when ellipsis is used around commas + Fix spacing, when ellipsis is used around commas - Example: - We sell apples, oranges,…, pens. → We sell apples, oranges, …, pens. - We sell apples, oranges, … , pens. → We sell apples, oranges, …, pens. + Example: + We sell apples, oranges,…, pens. → We sell apples, oranges, …, pens. + We sell apples, oranges, … , pens. → We sell apples, oranges, …, pens. - @param {string} string — input text for identification - @returns {string} — output with fixed spacing around ellipsis + @param {string} string — input text for identification + @returns {string} — output with fixed spacing around ellipsis */ export function fixEllipsisSpacingAroundCommas(string, locale) { - let pattern = - "," - + "[" + locale.spaces + "]?" - + locale.ellipsis - + "[" + locale.spaces + "]?" - + ","; - let re = new RegExp(pattern, "g"); - return string.replace(re, ", …,"); + let pattern = + "," + + "[" + locale.spaces + "]?" + + locale.ellipsis + + "[" + locale.spaces + "]?" + + ","; + let re = new RegExp(pattern, "g"); + return string.replace(re, ", …,"); } /* - Fix spacing, when ellipsis is used as the last item in the list + Fix spacing, when ellipsis is used as the last item in the list - Example: - We sell apples, oranges, … → We sell apples, oranges,… - (apples, oranges, … ) → (apples, oranges,…) + Example: + We sell apples, oranges, … → We sell apples, oranges,… + (apples, oranges, … ) → (apples, oranges,…) - @param {string} string — input text for identification - @returns {string} — output with fixed spacing around ellipsis + @param {string} string — input text for identification + @returns {string} — output with fixed spacing around ellipsis */ export function fixEllipsisAsLastItem(string, locale) { - let pattern = - "(,)" - + "([" + locale.spaces + "])?" - + "(" + locale.ellipsis + ")" - + "([" + locale.spaces + "])?" - + "(\\B|[" + locale.closingBrackets + "])" - + "([^,]|$)" + let pattern = + "(,)" + + "([" + locale.spaces + "])?" + + "(" + locale.ellipsis + ")" + + "([" + locale.spaces + "])?" + + "(\\B|[" + locale.closingBrackets + "])" + + "([^,]|$)" - let re = new RegExp(pattern, "g"); + let re = new RegExp(pattern, "g"); - return string.replace(re, "$1$3$5$6"); + return string.replace(re, "$1$3$5$6"); } /* - Fix spacing, when aposiopesis is starting a paragraph + Fix spacing, when aposiopesis is starting a paragraph - Examples: - … and we were there. → …and we were there. + Examples: + … and we were there. → …and we were there. - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixAposiopesisStartingParagraph(string, locale) { - let pattern = - "(^" + locale.ellipsis + ")" - + "([" + locale.spaces + "])" - + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; - let re = new RegExp(pattern, "gm"); - return string.replace(re, "$1$3"); + let pattern = + "(^" + locale.ellipsis + ")" + + "([" + locale.spaces + "])" + + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; + let re = new RegExp(pattern, "gm"); + return string.replace(re, "$1$3"); } /* - Fix spacing, when aposiopesis is starting a sentence + Fix spacing, when aposiopesis is starting a sentence - Examples: - Sentence ended. … and we were there. → - Sentence ended. …and we were there. + Examples: + Sentence ended. … and we were there. → + Sentence ended. …and we were there. - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixAposiopesisStartingSentence(string, locale) { - let pattern = - "([" + locale.sentencePunctuation + locale.terminalQuotes + "])" - + "([" + locale.spaces + "]?)" - + "([" + locale.ellipsis +"])" - + "([" + locale.spaces + "]?)" - + "([" + locale.lowercaseChars +"])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1 $3$5"); + let pattern = + "([" + locale.sentencePunctuation + locale.terminalQuotes + "])" + + "([" + locale.spaces + "]?)" + + "([" + locale.ellipsis +"])" + + "([" + locale.spaces + "]?)" + + "([" + locale.lowercaseChars +"])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1 $3$5"); } /* - Fix spacing, when aposiopesis is between sentences - Aposiopesis × Ellipsis between sentences? Ellipsis follows a finished sentece. + Fix spacing, when aposiopesis is between sentences + Aposiopesis × Ellipsis between sentences? Ellipsis follows a finished sentece. - Examples: - Sentence ending … And another starting → - Sentence ending… And another starting + Examples: + Sentence ending … And another starting → + Sentence ending… And another starting - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixAposiopesisBetweenSentences(string, locale) { - let pattern = - "([" + locale.lowercaseChars + "])" - + "([" + locale.spaces + "])" - + "([" + locale.ellipsis + "])" - + "([" + locale.spaces + "]?)" - + "([" + locale.uppercaseChars + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1$3 $5"); + let pattern = + "([" + locale.lowercaseChars + "])" + + "([" + locale.spaces + "])" + + "([" + locale.ellipsis + "])" + + "([" + locale.spaces + "]?)" + + "([" + locale.uppercaseChars + "])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1$3 $5"); } /* - Fix spacing, when aposiopesis is between words - This is a best effort guess, that we’re dealing with aposiopesis. + Fix spacing, when aposiopesis is between words + This is a best effort guess, that we’re dealing with aposiopesis. - Examples: - word…word → word… word + Examples: + word…word → word… word - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixAposiopesisBetweenWords(string, locale) { - let pattern = - "([" + locale.allChars + "])" - + "([" + locale.ellipsis + "])" - + "([" + locale.allChars + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1$2 $3"); + let pattern = + "([" + locale.allChars + "])" + + "([" + locale.ellipsis + "])" + + "([" + locale.allChars + "])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1$2 $3"); } /* - Fix spacing, when ellipsis is between sentences - Aposiopesis × Ellipsis between sentences? Ellipsis follows a finished sentece. + Fix spacing, when ellipsis is between sentences + Aposiopesis × Ellipsis between sentences? Ellipsis follows a finished sentece. - Examples: - What are you saying. …She did not answer. → - What are you saying. … She did not answer. + Examples: + What are you saying. …She did not answer. → + What are you saying. … She did not answer. - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixEllipsisBetweenSentences(string, locale) { - /* [4] keep spaces around ellipsis when it is used at the beginning - of the full sentence in the middle of the paragraph */ - let pattern = - "([" + locale.sentencePunctuation + locale.terminalQuotes + "])" - + "([" + locale.spaces + "]?)" - + "(" + locale.ellipsis +")" - + "([" + locale.spaces + "]?)" - + "([" + locale.uppercaseChars +"])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1 $3 $5"); + /* [4] keep spaces around ellipsis when it is used at the beginning + of the full sentence in the middle of the paragraph */ + let pattern = + "([" + locale.sentencePunctuation + locale.terminalQuotes + "])" + + "([" + locale.spaces + "]?)" + + "(" + locale.ellipsis +")" + + "([" + locale.spaces + "]?)" + + "([" + locale.uppercaseChars +"])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1 $3 $5"); } /* - Fix spacing, when aposiopesis is ending a paragraph + Fix spacing, when aposiopesis is ending a paragraph - Examples: - Sentence ending … → Sentence ending… + Examples: + Sentence ending … → Sentence ending… - @param {string} string — input text for identification - @returns {string} — output with fixed spacing + @param {string} string — input text for identification + @returns {string} — output with fixed spacing */ export function fixAposiopesisEndingParagraph(string, locale) { - let pattern = - "([" + locale.lowercaseChars + "])" - + "([" + locale.spaces + "])+" - + "([" + locale.ellipsis + "][" + locale.rightDoubleQuote + locale.rightSingleQuote + "]?$)"; - let re = new RegExp(pattern, "gm"); - return string.replace(re, "$1$3"); + let pattern = + "([" + locale.lowercaseChars + "])" + + "([" + locale.spaces + "])+" + + "([" + locale.ellipsis + "][" + locale.rightDoubleQuote + locale.rightSingleQuote + "]?$)"; + let re = new RegExp(pattern, "gm"); + return string.replace(re, "$1$3"); } export function fixEllipsis(string, locale) { - string = replaceThreeCharsWithEllipsis(string, locale); - string = fixEllipsisSpacingAroundCommas(string, locale); - string = fixEllipsisAsLastItem(string, locale); - string = fixAposiopesisStartingParagraph(string, locale); - string = fixAposiopesisStartingSentence(string, locale); - string = fixAposiopesisBetweenSentences(string, locale); - string = fixAposiopesisBetweenWords(string, locale); - string = fixEllipsisBetweenSentences(string, locale); - string = fixAposiopesisEndingParagraph(string, locale); - string = replaceTwoCharsWithEllipsis(string, locale); - string = replaceTwoPeriodsWithEllipsis(string, locale); - return string; + string = replaceThreeCharsWithEllipsis(string, locale); + string = fixEllipsisSpacingAroundCommas(string, locale); + string = fixEllipsisAsLastItem(string, locale); + string = fixAposiopesisStartingParagraph(string, locale); + string = fixAposiopesisStartingSentence(string, locale); + string = fixAposiopesisBetweenSentences(string, locale); + string = fixAposiopesisBetweenWords(string, locale); + string = fixEllipsisBetweenSentences(string, locale); + string = fixAposiopesisEndingParagraph(string, locale); + string = replaceTwoCharsWithEllipsis(string, locale); + string = replaceTwoPeriodsWithEllipsis(string, locale); + return string; } diff --git a/src/modules/punctuation/hyphen.js b/src/modules/punctuation/hyphen.js index 98f344d..2be3b17 100644 --- a/src/modules/punctuation/hyphen.js +++ b/src/modules/punctuation/hyphen.js @@ -1,18 +1,18 @@ export function fixSpaceAroundHyphen(string, locale){ - let pattern = "(["+ locale.allChars +"])(-)([" + locale.spaces + "])(["+ locale.allChars +"])"; - let re = new RegExp(pattern, "g"); - string = string.replace(re, "$1-$4"); + let pattern = "(["+ locale.allChars +"])(-)([" + locale.spaces + "])(["+ locale.allChars +"])"; + let re = new RegExp(pattern, "g"); + string = string.replace(re, "$1-$4"); - pattern = "(["+ locale.allChars +"])([" + locale.spaces + "])(-)(["+ locale.allChars +"])"; - re = new RegExp(pattern, "g"); - string = string.replace(re, "$1-$4"); + pattern = "(["+ locale.allChars +"])([" + locale.spaces + "])(-)(["+ locale.allChars +"])"; + re = new RegExp(pattern, "g"); + string = string.replace(re, "$1-$4"); - return string; + return string; } export function fixHyphen(string, locale){ - string = fixSpaceAroundHyphen(string, locale) - return string; + string = fixSpaceAroundHyphen(string, locale) + return string; } diff --git a/src/modules/punctuation/markdown.js b/src/modules/punctuation/markdown.js index b0aa233..df18823 100644 --- a/src/modules/punctuation/markdown.js +++ b/src/modules/punctuation/markdown.js @@ -1,103 +1,103 @@ /* - Utility classes to identify and handle exceptions for Markdown files + Utility classes to identify and handle exceptions for Markdown files /* - Identify markdown code ticks that wrap code blocks, so they’re not fixed as apostrophes + Identify markdown code ticks that wrap code blocks, so they’re not fixed as apostrophes - Examples - inline `code block` + Examples + inline `code block` - ``escaping inline `code block` in Markdown file`` + ``escaping inline `code block` in Markdown file`` - ``` - fenced code block - ``` + ``` + fenced code block + ``` - Docs - https://www.markdownguide.org/basic-syntax + Docs + https://www.markdownguide.org/basic-syntax - @param {string} string: input text for identification - @returns {string} output with identified markdown ticks that wrap code blocks + @param {string} string: input text for identification + @returns {string} output with identified markdown ticks that wrap code blocks */ export function identifyMarkdownCodeTicks(string, configuration) { - if (configuration.keepMarkdownCodeBlocks) { - - // ``` - // fenced code block - // ``` - string = string.replace( - new RegExp( - "(\\s*)" - + "(```)", - "g" - ), - "$1" - + "{{typopo__markdown_tick}}" - + "{{typopo__markdown_tick}}" - + "{{typopo__markdown_tick}}" - ) - - // ``escaping inline `code block` in Markdown file`` - string = string.replace( - new RegExp( - "(``)" - + "(.+?)" - + "(``)", - "g" - ), - "{{typopo__markdown_tick}}" - + "{{typopo__markdown_tick}}" - + "$2" - + "{{typopo__markdown_tick}}" - + "{{typopo__markdown_tick}}" - ) - - - // inline `code block` - string = string.replace( - new RegExp( - "(`)" - + "(.+?)" - + "(`)", - "g" - ), - "{{typopo__markdown_tick}}" - + "$2" - + "{{typopo__markdown_tick}}" - ) - - } - - return string; + if (configuration.keepMarkdownCodeBlocks) { + + // ``` + // fenced code block + // ``` + string = string.replace( + new RegExp( + "(\\s*)" + + "(```)", + "g" + ), + "$1" + + "{{typopo__markdown_tick}}" + + "{{typopo__markdown_tick}}" + + "{{typopo__markdown_tick}}" + ) + + // ``escaping inline `code block` in Markdown file`` + string = string.replace( + new RegExp( + "(``)" + + "(.+?)" + + "(``)", + "g" + ), + "{{typopo__markdown_tick}}" + + "{{typopo__markdown_tick}}" + + "$2" + + "{{typopo__markdown_tick}}" + + "{{typopo__markdown_tick}}" + ) + + + // inline `code block` + string = string.replace( + new RegExp( + "(`)" + + "(.+?)" + + "(`)", + "g" + ), + "{{typopo__markdown_tick}}" + + "$2" + + "{{typopo__markdown_tick}}" + ) + + } + + return string; } /* - Place markdown code ticks, identified in identifyMarkdownCodeTicks + Place markdown code ticks, identified in identifyMarkdownCodeTicks - Docs - https://www.markdownguide.org/basic-syntax + Docs + https://www.markdownguide.org/basic-syntax - @param {string} string: input text for identification - @returns {string} output with placed Markdown code tick + @param {string} string: input text for identification + @returns {string} output with placed Markdown code tick */ export function placeMarkdownCodeTicks(string, configuration) { - if (configuration.keepMarkdownCodeBlocks) { - string = string.replace( - new RegExp( - "{{typopo__markdown_tick}}", - "g" - ), - "`" - ) - } - - return string; + if (configuration.keepMarkdownCodeBlocks) { + string = string.replace( + new RegExp( + "{{typopo__markdown_tick}}", + "g" + ), + "`" + ) + } + + return string; } diff --git a/src/modules/punctuation/period.js b/src/modules/punctuation/period.js index 78afb31..01fe733 100644 --- a/src/modules/punctuation/period.js +++ b/src/modules/punctuation/period.js @@ -2,15 +2,15 @@ export function removeExtraPeriod(string) { - return string.replace( - new RegExp( - "\\.{2}(?![\\\\/])", - "g" - ), - "." - ); + return string.replace( + new RegExp( + "\\.{2}(?![\\\\/])", + "g" + ), + "." + ); } export function fixPeriod(string) { - return removeExtraPeriod(string); + return removeExtraPeriod(string); } diff --git a/src/modules/punctuation/single-quotes.js b/src/modules/punctuation/single-quotes.js index 8e24e09..9f553d2 100644 --- a/src/modules/punctuation/single-quotes.js +++ b/src/modules/punctuation/single-quotes.js @@ -4,266 +4,266 @@ import { identifyMarkdownCodeTicks, /* - Identify ’n’ contractions as apostrophes + Identify ’n’ contractions as apostrophes - Example - rock 'n' roll → rock ’n’ roll - fish 'n' chips → fish ’n’ chips + Example + rock 'n' roll → rock ’n’ roll + fish 'n' chips → fish ’n’ chips - Exceptions - Press 'N' to continue (should be identified as single quotes) + Exceptions + Press 'N' to continue (should be identified as single quotes) - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified contractions as apostrophes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified contractions as apostrophes */ export function identifyContractedAnd(string, locale) { - let commonContractions = [ - ["dead", "buried"], - ["drill", "bass"], - ["drum", "bass"], - ["rock", "roll"], - ["pick", "mix"], - ["fish", "chips"], - ["salt", "shake"], - ["mac", "cheese"], - ["pork", "beans"], - ["drag", "drop"], - ["rake", "scrape"], - ["hook", "kill"], - ]; - - commonContractions.forEach(item =>{ - - string = string.replace( - new RegExp( - "(" + item[0] + ")" - + "([" + locale.spaces + "])?" - + "(" + locale.singleQuoteAdepts + ")" - + "(n)" - + "(" + locale.singleQuoteAdepts + ")" - + "([" + locale.spaces + "])?" - + "(" + item[1] + ")", - "gi" - ), - "$1" - + locale.nbsp - + "{{typopo__apostrophe}}" - + "$4" - + "{{typopo__apostrophe}}" - + locale.nbsp - + "$7" - ) - }); - - return string; + let commonContractions = [ + ["dead", "buried"], + ["drill", "bass"], + ["drum", "bass"], + ["rock", "roll"], + ["pick", "mix"], + ["fish", "chips"], + ["salt", "shake"], + ["mac", "cheese"], + ["pork", "beans"], + ["drag", "drop"], + ["rake", "scrape"], + ["hook", "kill"], + ]; + + commonContractions.forEach(item =>{ + + string = string.replace( + new RegExp( + "(" + item[0] + ")" + + "([" + locale.spaces + "])?" + + "(" + locale.singleQuoteAdepts + ")" + + "(n)" + + "(" + locale.singleQuoteAdepts + ")" + + "([" + locale.spaces + "])?" + + "(" + item[1] + ")", + "gi" + ), + "$1" + + locale.nbsp + + "{{typopo__apostrophe}}" + + "$4" + + "{{typopo__apostrophe}}" + + locale.nbsp + + "$7" + ) + }); + + return string; } /* - Identify common contractions at the beginning of the word as apostrophes + Identify common contractions at the beginning of the word as apostrophes - Example - ’em, ’cause,… see list of words in the function + Example + ’em, ’cause,… see list of words in the function - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified contractions as apostrophes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified contractions as apostrophes */ export function identifyContractedBeginnings(string, locale) { - let contractedWords = "cause|em|mid|midst|mongst|prentice|round|sblood|ssdeath|sfoot|sheart|shun|slid|slife|slight|snails|strewth|til|tis|twas|tween|twere|twill|twixt|twould"; - - return string.replace( - new RegExp( - "(" + locale.singleQuoteAdepts + ")" - + "(" + contractedWords + ")", - "gi" - ), - "{{typopo__apostrophe}}" - + "$2" - ); + let contractedWords = "cause|em|mid|midst|mongst|prentice|round|sblood|ssdeath|sfoot|sheart|shun|slid|slife|slight|snails|strewth|til|tis|twas|tween|twere|twill|twixt|twould"; + + return string.replace( + new RegExp( + "(" + locale.singleQuoteAdepts + ")" + + "(" + contractedWords + ")", + "gi" + ), + "{{typopo__apostrophe}}" + + "$2" + ); } /* - Identify common contractions at the ends of the word as apostrophes + Identify common contractions at the ends of the word as apostrophes - Example - contraction of an -ing form, e.g. nottin’ + Example + contraction of an -ing form, e.g. nottin’ - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified contractions as apostrophes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified contractions as apostrophes */ export function identifyContractedEnds(string, locale) { - return string.replace( - new RegExp( - "(\\Bin)" - + "(" + locale.singleQuoteAdepts + ")", - "gi" - ), - "$1" - + "{{typopo__apostrophe}}" - ); + return string.replace( + new RegExp( + "(\\Bin)" + + "(" + locale.singleQuoteAdepts + ")", + "gi" + ), + "$1" + + "{{typopo__apostrophe}}" + ); } /* - Identify in-word contractions as apostrophes + Identify in-word contractions as apostrophes - Examples - Don’t, I’m, O’Doole, 69’ers,… + Examples + Don’t, I’m, O’Doole, 69’ers,… - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified contractions as apostrophes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified contractions as apostrophes */ export function identifyInWordContractions(string, locale) { - return string.replace( - new RegExp( - "(["+ locale.cardinalNumber + locale.allChars +"])" - + "(" + locale.singleQuoteAdepts +")+" - + "(["+ locale.allChars +"])", - "g" - ), - "$1" - + "{{typopo__apostrophe}}" - + "$3" - ); + return string.replace( + new RegExp( + "(["+ locale.cardinalNumber + locale.allChars +"])" + + "(" + locale.singleQuoteAdepts +")+" + + "(["+ locale.allChars +"])", + "g" + ), + "$1" + + "{{typopo__apostrophe}}" + + "$3" + ); } /* - Identify contracted years + Identify contracted years - Example - in ’70s, INCHEBA ’89,… + Example + in ’70s, INCHEBA ’89,… - Exceptions - 12 '45″ // when there is a wrongly spaced feet + Exceptions + 12 '45″ // when there is a wrongly spaced feet - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified contractions as apostrophes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified contractions as apostrophes */ export function identifyContractedYears(string, locale) { - return string.replace( - new RegExp( - "([^0-9]|[A-Z][0-9])" - + "([" + locale.spaces + "])" - + "(" + locale.singleQuoteAdepts + ")" - + "([" + locale.cardinalNumber + "]{2})", - "g" - ), - "$1" - + "$2" - + "{{typopo__apostrophe}}" - + "$4" - ); + return string.replace( + new RegExp( + "([^0-9]|[A-Z][0-9])" + + "([" + locale.spaces + "])" + + "(" + locale.singleQuoteAdepts + ")" + + "([" + locale.cardinalNumber + "]{2})", + "g" + ), + "$1" + + "$2" + + "{{typopo__apostrophe}}" + + "$4" + ); } /* - Identify feet and arcminutes following a 1–3 numbers + Identify feet and arcminutes following a 1–3 numbers - Example - 12' 45″ → - 12′ 45″ + Example + 12' 45″ → + 12′ 45″ - Single-quotes module impact - Function falsely identifies feet, where we are expecting quotes, e.g. - 'Konference 2020' in quotes → - ‘Konference 2020’ in quotes - → this is corrected in replaceSinglePrimeWSingleQuote + Single-quotes module impact + Function falsely identifies feet, where we are expecting quotes, e.g. + 'Konference 2020' in quotes → + ‘Konference 2020’ in quotes + → this is corrected in replaceSinglePrimeWSingleQuote - Implementation note - We’re not using locale.singleQuoteAdepts variable as commas and low-positioned quotes are ommited + Implementation note + We’re not using locale.singleQuoteAdepts variable as commas and low-positioned quotes are ommited - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified single primes as a temporary variable string, e.g. {{typopo__sinlge-prime}} + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified single primes as a temporary variable string, e.g. {{typopo__sinlge-prime}} */ export function identifySinglePrimes(string) { - return string.replace(/(\d)( ?)('|‘|’|‛|′)/g, "$1$2{{typopo__single-prime}}"); + return string.replace(/(\d)( ?)('|‘|’|‛|′)/g, "$1$2{{typopo__single-prime}}"); } /* - Identify standalone left single quote + Identify standalone left single quote - Algorithm - Find left single quotes: - - following a space, en dash or em dash - - preceding a word + Algorithm + Find left single quotes: + - following a space, en dash or em dash + - preceding a word - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified standalone left single quote + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified standalone left single quote */ export function identifyStandaloneLeftSingleQuote(string, locale) { - return string.replace( - new RegExp( - "([" + locale.spaces + locale.emDash + locale.enDash + "])" - + "(" + locale.singleQuoteAdepts + "|,)" - + "(["+ locale.allChars +"])", - "g" - ), - "$1" - + "{{typopo__left-single-quote--standalone}}" - + "$3" - ); + return string.replace( + new RegExp( + "([" + locale.spaces + locale.emDash + locale.enDash + "])" + + "(" + locale.singleQuoteAdepts + "|,)" + + "(["+ locale.allChars +"])", + "g" + ), + "$1" + + "{{typopo__left-single-quote--standalone}}" + + "$3" + ); } /* - Identify single quotes within double quotes + Identify single quotes within double quotes - Limitations - Since it’s difficult to identify apostrophe contracting end of the word (e.g. “jes’”), it’s difficult to identify single quotes universally. Therefore we’re identifying only single quotes and single quote pairs that are enclosed in double quote pairs. + Limitations + Since it’s difficult to identify apostrophe contracting end of the word (e.g. “jes’”), it’s difficult to identify single quotes universally. Therefore we’re identifying only single quotes and single quote pairs that are enclosed in double quote pairs. - Algorithm - - find text in double quotes - - in quoted text find - - standalone left single quote - - standalone right single quote - - single quote pairs + Algorithm + - find text in double quotes + - in quoted text find + - standalone left single quote + - standalone right single quote + - single quote pairs - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified standalone left single quote + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified standalone left single quote */ export function identifySingleQuotesWithinDoubleQuotes(string, locale) { - return string.replace( - new RegExp( - "(" + locale.doubleQuoteAdepts + ")" - + "(.*?)" - + "(" + locale.doubleQuoteAdepts + ")", - "g" - ), - function($0, $1, $2, $3){ + return string.replace( + new RegExp( + "(" + locale.doubleQuoteAdepts + ")" + + "(.*?)" + + "(" + locale.doubleQuoteAdepts + ")", + "g" + ), + function($0, $1, $2, $3){ - $2 = identifyStandaloneLeftSingleQuote($2, locale); - $2 = identifyStandaloneRightSingleQuote($2, locale); - $2 = identifySingleQuotePairs($2, locale); + $2 = identifyStandaloneLeftSingleQuote($2, locale); + $2 = identifyStandaloneRightSingleQuote($2, locale); + $2 = identifySingleQuotePairs($2, locale); - return $1 + $2 + $3; - } - ); + return $1 + $2 + $3; + } + ); } @@ -271,33 +271,33 @@ export function identifySingleQuotesWithinDoubleQuotes(string, locale) { /* - Identify standalone right single quote + Identify standalone right single quote - Algorithm - Find right single quotes: - - following a word - - optionally, following a sentence punctuation - - optionally, preceding a space or a sentence punctuation + Algorithm + Find right single quotes: + - following a word + - optionally, following a sentence punctuation + - optionally, preceding a space or a sentence punctuation - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified standalone right single quote + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified standalone right single quote */ export function identifyStandaloneRightSingleQuote(string, locale) { - return string.replace( - new RegExp( - "(["+ locale.allChars +"])" - + "(["+ locale.sentencePunctuation +"])?" - + "(" + locale.singleQuoteAdepts + ")" - + "([ "+ locale.sentencePunctuation +"])?", - "g" - ), - "$1" - + "$2" - + "{{typopo__right-single-quote--standalone}}" - + "$4" - ); + return string.replace( + new RegExp( + "(["+ locale.allChars +"])" + + "(["+ locale.sentencePunctuation +"])?" + + "(" + locale.singleQuoteAdepts + ")" + + "([ "+ locale.sentencePunctuation +"])?", + "g" + ), + "$1" + + "$2" + + "{{typopo__right-single-quote--standalone}}" + + "$4" + ); } @@ -305,91 +305,91 @@ export function identifyStandaloneRightSingleQuote(string, locale) { /* - Identify single quote pairs + Identify single quote pairs - Example - "a 'quoted material' here" → “a ‘quoted material’ here” + Example + "a 'quoted material' here" → “a ‘quoted material’ here” - Assumptions and Limitations - - This function assumes apostrophes and standalone single quotes were identified. The function itself is part of the identifySingleQuotesWithinDoubleQuotes. - - It is difficult to identify all contractions at the end of the word, and thus it is difficult to identify single quote pairs. This function therefore only identifies one single quote pair with a double quote pair + Assumptions and Limitations + - This function assumes apostrophes and standalone single quotes were identified. The function itself is part of the identifySingleQuotesWithinDoubleQuotes. + - It is difficult to identify all contractions at the end of the word, and thus it is difficult to identify single quote pairs. This function therefore only identifies one single quote pair with a double quote pair - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified single quote pair + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified single quote pair */ export function identifySingleQuotePairs(string) { - // identify one phrase wrapped in single quotes - return string.replace( - new RegExp( - "({{typopo__left-single-quote--standalone}})" - + "(.*)" - + "({{typopo__right-single-quote--standalone}})", - "g" - ), - "{{typopo__left-single-quote}}" - + "$2" - + "{{typopo__right-single-quote}}" - ); + // identify one phrase wrapped in single quotes + return string.replace( + new RegExp( + "({{typopo__left-single-quote--standalone}})" + + "(.*)" + + "({{typopo__right-single-quote--standalone}})", + "g" + ), + "{{typopo__left-single-quote}}" + + "$2" + + "{{typopo__right-single-quote}}" + ); } /* - Identify single quote pair around a single word + Identify single quote pair around a single word - Example + Example 'word' → ‘word’ - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified single quote pairs around single word + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified single quote pairs around single word */ export function identifySingleQuotePairAroundSingleWord(string, locale){ - return string.replace( - new RegExp( - "(\\B)" - + "(" + locale.singleQuoteAdepts + ")" - + "([" + locale.allChars + "]+)" - + "(" + locale.singleQuoteAdepts + ")" - + "(\\B)", - "g" - ), - "$1" - + "{{typopo__left-single-quote}}" - + "$3" - + "{{typopo__right-single-quote}}" - + "$5" - ); + return string.replace( + new RegExp( + "(\\B)" + + "(" + locale.singleQuoteAdepts + ")" + + "([" + locale.allChars + "]+)" + + "(" + locale.singleQuoteAdepts + ")" + + "(\\B)", + "g" + ), + "$1" + + "{{typopo__left-single-quote}}" + + "$3" + + "{{typopo__right-single-quote}}" + + "$5" + ); } /* - Identify residual apostrophes + Identify residual apostrophes - Finds remaining single quote adepts and changes them to apostrophes. + Finds remaining single quote adepts and changes them to apostrophes. - Limitation - This function runs as last in the row identification function as it catches what’s left. + Limitation + This function runs as last in the row identification function as it catches what’s left. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with identified single quote pairs + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with identified single quote pairs */ export function identifyResidualApostrophes(string, locale) { - return string.replace( - new RegExp( - "(" + locale.singleQuoteAdepts + ")", - "g" - ), - "{{typopo__apostrophe}}" - ); + return string.replace( + new RegExp( + "(" + locale.singleQuoteAdepts + ")", + "g" + ), + "{{typopo__apostrophe}}" + ); } @@ -397,48 +397,48 @@ export function identifyResidualApostrophes(string, locale) { /* - Replace a single qoute & a single prime with a single quote pair + Replace a single qoute & a single prime with a single quote pair - Assumptions and Limitations - This function follows previous functions that identify single primes or standalone single quotes. - So it may happen that previous functions falsely identify a single quote pair around situations such as: - - He said: “What about 'Localhost 3000', is that good?” + Assumptions and Limitations + This function follows previous functions that identify single primes or standalone single quotes. + So it may happen that previous functions falsely identify a single quote pair around situations such as: + - He said: “What about 'Localhost 3000', is that good?” - Algorithm - Find standalone single quote and single prime in pair and change them to a single quote pair + Algorithm + Find standalone single quote and single prime in pair and change them to a single quote pair - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with a single quote pair + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with a single quote pair */ export function replaceSinglePrimeWSingleQuote(string) { - string = string.replace( - new RegExp( - "({{typopo__left-single-quote--standalone}})" - + "(.*?)" - + "({{typopo__single-prime}})", - "g" - ), - "{{typopo__left-single-quote}}" - + "$2" - + "{{typopo__right-single-quote}}" - ); - - string = string.replace( - new RegExp( - "({{typopo__single-prime}})" - + "(.*?)" - + "({{typopo__right-single-quote--standalone}})", - "g" - ), - "{{typopo__left-single-quote}}" - + "$2" - + "{{typopo__right-single-quote}}" - ); - - return string; + string = string.replace( + new RegExp( + "({{typopo__left-single-quote--standalone}})" + + "(.*?)" + + "({{typopo__single-prime}})", + "g" + ), + "{{typopo__left-single-quote}}" + + "$2" + + "{{typopo__right-single-quote}}" + ); + + string = string.replace( + new RegExp( + "({{typopo__single-prime}})" + + "(.*?)" + + "({{typopo__right-single-quote--standalone}})", + "g" + ), + "{{typopo__left-single-quote}}" + + "$2" + + "{{typopo__right-single-quote}}" + ); + + return string; } @@ -447,112 +447,112 @@ export function replaceSinglePrimeWSingleQuote(string) { Swap single quotes and terminal punctuation for a quoted part - There are two different rules to follow quotes: - 1. Quotes contain only quoted material: - ‘Sometimes it can be a whole sentence.’ - Sometimes it can be only a ‘quoted part’. - The difference is where the terminal and sentence pause punctuation is. + There are two different rules to follow quotes: + 1. Quotes contain only quoted material: + ‘Sometimes it can be a whole sentence.’ + Sometimes it can be only a ‘quoted part’. + The difference is where the terminal and sentence pause punctuation is. - 2. American editorial style - Similar as the first rule, but commas (,) and periods (.) go before closing quotation marks, regardless whether they are part of the quoted material. + 2. American editorial style + Similar as the first rule, but commas (,) and periods (.) go before closing quotation marks, regardless whether they are part of the quoted material. - The aim here is to support the first rule. + The aim here is to support the first rule. - - Examples - ‘Sometimes it can be a whole sentence.’ - Sometimes it can be only a ‘quoted part’. + + Examples + ‘Sometimes it can be a whole sentence.’ + Sometimes it can be only a ‘quoted part’. - So we’re looking to swap here: - Sometimes it can be only a ‘quoted part.’ → - Sometimes it can be only a ‘quoted part’. + So we’re looking to swap here: + Sometimes it can be only a ‘quoted part.’ → + Sometimes it can be only a ‘quoted part’. - Exceptions - Byl to ‘Karel IV.’, ktery + Exceptions + Byl to ‘Karel IV.’, ktery - Algorithm - Three different cases, see comments in code + Algorithm + Three different cases, see comments in code - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with swapped single quotes and terminal punctuation within a quoted part + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with swapped single quotes and terminal punctuation within a quoted part */ export function swapSingleQuotesAndTerminalPunctuation(string, locale) { - // place punctuation outside of quoted part - string = string.replace( - new RegExp( - "([^" + locale.sentencePunctuation + "])" - + "([" + locale.spaces + "])" - + "(" + locale.leftSingleQuote + ")" - + "([^" + locale.rightSingleQuote +"]+?)" - + "([^" + locale.romanNumerals + "])" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "(" + locale.rightSingleQuote + ")", - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$5" - + "$7" - + "$6" - ); - - // place punctuation within a quoted sentence that’s in the middle of the sentence. - string = string.replace( - new RegExp( - "([^" + locale.sentencePunctuation + "])" - + "([" + locale.spaces + "])" - + "(" + locale.leftSingleQuote + ")" - + "(.+?)" - + "([^" + locale.romanNumerals + "])" - + "(" + locale.rightSingleQuote + ")" - // + "([" + locale.lowercaseChars + "])" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "([" + locale.spaces + "])" - + "([" + locale.lowercaseChars + "])", - - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$5" - + "$7" - + "$6" - + "$8" - + "$9" - ); - - - // place punctuation within a quoted sentence - // following a previous sentence or starting from a beginning - string = string.replace( - new RegExp( - "([" + locale.sentencePunctuation + "][" + locale.spaces + "]|^)" - + "(" + locale.leftSingleQuote + ")" - + "([^" + locale.rightSingleQuote +"]+?)" - + "([^" + locale.romanNumerals + "])" - + "(" + locale.rightSingleQuote + ")" - + "([" + locale.terminalPunctuation + locale.ellipsis + "])" - + "(\\B)", - - "g" - ), - "$1" - + "$2" - + "$3" - + "$4" - + "$6" - + "$5" - + "$7" - ); - - return string; + // place punctuation outside of quoted part + string = string.replace( + new RegExp( + "([^" + locale.sentencePunctuation + "])" + + "([" + locale.spaces + "])" + + "(" + locale.leftSingleQuote + ")" + + "([^" + locale.rightSingleQuote +"]+?)" + + "([^" + locale.romanNumerals + "])" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "(" + locale.rightSingleQuote + ")", + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$5" + + "$7" + + "$6" + ); + + // place punctuation within a quoted sentence that’s in the middle of the sentence. + string = string.replace( + new RegExp( + "([^" + locale.sentencePunctuation + "])" + + "([" + locale.spaces + "])" + + "(" + locale.leftSingleQuote + ")" + + "(.+?)" + + "([^" + locale.romanNumerals + "])" + + "(" + locale.rightSingleQuote + ")" + // + "([" + locale.lowercaseChars + "])" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "([" + locale.spaces + "])" + + "([" + locale.lowercaseChars + "])", + + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$5" + + "$7" + + "$6" + + "$8" + + "$9" + ); + + + // place punctuation within a quoted sentence + // following a previous sentence or starting from a beginning + string = string.replace( + new RegExp( + "([" + locale.sentencePunctuation + "][" + locale.spaces + "]|^)" + + "(" + locale.leftSingleQuote + ")" + + "([^" + locale.rightSingleQuote +"]+?)" + + "([^" + locale.romanNumerals + "])" + + "(" + locale.rightSingleQuote + ")" + + "([" + locale.terminalPunctuation + locale.ellipsis + "])" + + "(\\B)", + + "g" + ), + "$1" + + "$2" + + "$3" + + "$4" + + "$6" + + "$5" + + "$7" + ); + + return string; } @@ -560,63 +560,63 @@ export function swapSingleQuotesAndTerminalPunctuation(string, locale) { /* - Remove extra space around a single prime + Remove extra space around a single prime - Example - 12 ′ 45″ → - 12′ 45″ + Example + 12 ′ 45″ → + 12′ 45″ - Assumptions and Limitations - The functions runs after all single quotes and single primes have been identified. + Assumptions and Limitations + The functions runs after all single quotes and single primes have been identified. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with adjusted spacing around single quotes and single primes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with adjusted spacing around single quotes and single primes */ export function removeExtraSpaceAroundSinglePrime(string, locale) { - return string.replace( - new RegExp( - "(["+ locale.spaces +"])" - + "("+ locale.singlePrime +")", - "g" - ), - "$2" - ) + return string.replace( + new RegExp( + "(["+ locale.spaces +"])" + + "("+ locale.singlePrime +")", + "g" + ), + "$2" + ) } /* - Replace all identified punctuation with appropriate punctuation in given language + Replace all identified punctuation with appropriate punctuation in given language - Context - In single-quotes module, we first identify single quote and single prime adepts, and then we replace them temporarily with labels as “{{typopo__single-prime}}”. - This is the function in the sequence to swap temporary labels to desired quotes. - + Context + In single-quotes module, we first identify single quote and single prime adepts, and then we replace them temporarily with labels as “{{typopo__single-prime}}”. + This is the function in the sequence to swap temporary labels to desired quotes. + - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} an output with locale-specific single quotes and single primes + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} an output with locale-specific single quotes and single primes */ export function placeLocaleSingleQuotes(string, locale) { - string = string.replace(/({{typopo__single-prime}})/g, locale.singlePrime); + string = string.replace(/({{typopo__single-prime}})/g, locale.singlePrime); - string = string.replace(/{{typopo__apostrophe}}|{{typopo__left-single-quote--standalone}}|{{typopo__right-single-quote--standalone}}/g, locale.apostrophe); + string = string.replace(/{{typopo__apostrophe}}|{{typopo__left-single-quote--standalone}}|{{typopo__right-single-quote--standalone}}/g, locale.apostrophe); - string = string.replace(/{{typopo__left-single-quote}}/g, locale.leftSingleQuote); - string = string.replace(/{{typopo__right-single-quote}}/g, locale.rightSingleQuote); + string = string.replace(/{{typopo__left-single-quote}}/g, locale.leftSingleQuote); + string = string.replace(/{{typopo__right-single-quote}}/g, locale.rightSingleQuote); - string = string.replace(/{{typopo__markdown_syntax_highlight}}/g, "```"); + string = string.replace(/{{typopo__markdown_syntax_highlight}}/g, "```"); - + - return string; + return string; } @@ -624,70 +624,70 @@ export function placeLocaleSingleQuotes(string, locale) { /* - Corrects improper use of single quotes, single primes and apostrophes - - Assumptions and Limitations - This function assumes that double quotes are always used in pair, - i.e. authors did not forget to close double quotes in their text. - Further, single quotes are used as secondary and they're properly spaced, - e.g. ␣'word or sentence portion'␣ (and not like ␣'␣word␣'␣) - - Algorithm - [0] Identify markdown code ticks - [1] Identify common apostrophe contractions - [2] Identify feet, arcminutes, minutes - [3] Identify single quote pair around a single word - [4] Identify single quotes - [5] Replace a single qoute & a single prime with a single quote pair - [6] Identify residual apostrophes - [7] Replace all identified punctuation with appropriate punctuation in given language - [8] Swap quotes and terminal punctuation - [9] Consolidate spaces around single primes - - @param {string} string — input text for identification - @param {string} language — language options - @returns {string} — corrected output + Corrects improper use of single quotes, single primes and apostrophes + + Assumptions and Limitations + This function assumes that double quotes are always used in pair, + i.e. authors did not forget to close double quotes in their text. + Further, single quotes are used as secondary and they're properly spaced, + e.g. ␣'word or sentence portion'␣ (and not like ␣'␣word␣'␣) + + Algorithm + [0] Identify markdown code ticks + [1] Identify common apostrophe contractions + [2] Identify feet, arcminutes, minutes + [3] Identify single quote pair around a single word + [4] Identify single quotes + [5] Replace a single qoute & a single prime with a single quote pair + [6] Identify residual apostrophes + [7] Replace all identified punctuation with appropriate punctuation in given language + [8] Swap quotes and terminal punctuation + [9] Consolidate spaces around single primes + + @param {string} string — input text for identification + @param {string} language — language options + @returns {string} — corrected output */ export function fixSingleQuotesPrimesAndApostrophes(string, locale, configuration) { - /* [0] Identify markdown code ticks */ - string = identifyMarkdownCodeTicks(string, configuration); + /* [0] Identify markdown code ticks */ + string = identifyMarkdownCodeTicks(string, configuration); - /* [1] Identify common apostrophe contractions */ - string = identifyContractedAnd(string, locale); - string = identifyContractedBeginnings(string, locale); - string = identifyInWordContractions(string, locale); - string = identifyContractedYears(string, locale); - string = identifyContractedEnds(string, locale); + /* [1] Identify common apostrophe contractions */ + string = identifyContractedAnd(string, locale); + string = identifyContractedBeginnings(string, locale); + string = identifyInWordContractions(string, locale); + string = identifyContractedYears(string, locale); + string = identifyContractedEnds(string, locale); - /* [2] Identify feet, arcminutes, minutes */ - string = identifySinglePrimes(string, locale); + /* [2] Identify feet, arcminutes, minutes */ + string = identifySinglePrimes(string, locale); - /* [3] Identify single quote pair around a single word */ - string = identifySingleQuotePairAroundSingleWord(string, locale); + /* [3] Identify single quote pair around a single word */ + string = identifySingleQuotePairAroundSingleWord(string, locale); - /* [4] Identify single quotes within double quotes */ - string = identifySingleQuotesWithinDoubleQuotes(string, locale); + /* [4] Identify single quotes within double quotes */ + string = identifySingleQuotesWithinDoubleQuotes(string, locale); - /* [5] Replace a single qoute & a single prime with a single quote pair */ - string = replaceSinglePrimeWSingleQuote(string, locale); + /* [5] Replace a single qoute & a single prime with a single quote pair */ + string = replaceSinglePrimeWSingleQuote(string, locale); - /* [6] Identify residual apostrophes*/ - string = identifyResidualApostrophes(string, locale); + /* [6] Identify residual apostrophes*/ + string = identifyResidualApostrophes(string, locale); - /* [7] Replace all identified punctuation with appropriate punctuation in given language */ - string = placeLocaleSingleQuotes(string,locale); - string = placeMarkdownCodeTicks(string, configuration); + /* [7] Replace all identified punctuation with appropriate punctuation in given language */ + string = placeLocaleSingleQuotes(string,locale); + string = placeMarkdownCodeTicks(string, configuration); - /* [8] Swap quotes and terminal punctuation */ - string = swapSingleQuotesAndTerminalPunctuation(string, locale); + /* [8] Swap quotes and terminal punctuation */ + string = swapSingleQuotesAndTerminalPunctuation(string, locale); - /* [9] Consolidate spaces around single primes */ - string = removeExtraSpaceAroundSinglePrime(string, locale); + /* [9] Consolidate spaces around single primes */ + string = removeExtraSpaceAroundSinglePrime(string, locale); - return string; + return string; } \ No newline at end of file diff --git a/src/modules/symbols/exponents.js b/src/modules/symbols/exponents.js index 67568d1..c3fed85 100644 --- a/src/modules/symbols/exponents.js +++ b/src/modules/symbols/exponents.js @@ -1,27 +1,27 @@ function fixExponent(string, locale, originalExponent, fixedExponent) { - let metrePrefixes = "m|dam|hm|km|Mm|Gm|Tm|Pm|Em|Zm|Ym|m|dm|cm|mm|µm|nm|pm|fm|am|zm|ym"; - let pattern = "([" + locale.spaces + locale.slash + "])(" + metrePrefixes + ")(" + originalExponent + ")"; - let re = new RegExp(pattern, "g"); - let replacement = "$1$2" + fixedExponent; - return string.replace(re, replacement); + let metrePrefixes = "m|dam|hm|km|Mm|Gm|Tm|Pm|Em|Zm|Ym|m|dm|cm|mm|µm|nm|pm|fm|am|zm|ym"; + let pattern = "([" + locale.spaces + locale.slash + "])(" + metrePrefixes + ")(" + originalExponent + ")"; + let re = new RegExp(pattern, "g"); + let replacement = "$1$2" + fixedExponent; + return string.replace(re, replacement); } export function fixSquares(string, locale) { - return fixExponent(string, locale, "2", "²"); + return fixExponent(string, locale, "2", "²"); } export function fixCubes(string, locale) { - return fixExponent(string, locale, "3", "³"); + return fixExponent(string, locale, "3", "³"); } export function fixExponents(string, locale) { - string = fixSquares(string, locale); - string = fixCubes(string, locale); - return string; + string = fixSquares(string, locale); + string = fixCubes(string, locale); + return string; } diff --git a/src/modules/symbols/multiplication-sign.js b/src/modules/symbols/multiplication-sign.js index 6d7a606..07ab69e 100644 --- a/src/modules/symbols/multiplication-sign.js +++ b/src/modules/symbols/multiplication-sign.js @@ -1,122 +1,122 @@ /* - Replace “x/X” with “×” in the following contexts: - * 5 x 5 → 5⎵×⎵5 (number × number) - * 5″ x 4″ → 5″⎵×⎵4″ (number including double/single primes) - * 5 mm X 5 mm → 5 mm⎵×⎵5 mm (number with measurement) - * 5cm x 5cm → 5cm⎵×⎵5cm (number as an adjective) + Replace “x/X” with “×” in the following contexts: + * 5 x 5 → 5⎵×⎵5 (number × number) + * 5″ x 4″ → 5″⎵×⎵4″ (number including double/single primes) + * 5 mm X 5 mm → 5 mm⎵×⎵5 mm (number with measurement) + * 5cm x 5cm → 5cm⎵×⎵5cm (number as an adjective) - Also, provide non-breaking spaces around multiplication sign. + Also, provide non-breaking spaces around multiplication sign. - @param {string} string — input text for identification - @returns {string} — output with replaced and spaced multiplication sign + @param {string} string — input text for identification + @returns {string} — output with replaced and spaced multiplication sign */ export function fixMultiplicationSignBetweenNumbers(string, locale) { - let pattern = - "([" + locale.cardinalNumber + "]+)" - + "([" + locale.spaces + "]?[" + locale.lowercaseChars + locale.singlePrime + locale.doublePrime + "]*)" - + "([" + locale.spaces + "][x][" + locale.spaces + "])" - + "([" + locale.cardinalNumber + "]+)" - + "([" + locale.spaces + "]?[" + locale.lowercaseChars + locale.singlePrime + locale.doublePrime + "]*)"; + let pattern = + "([" + locale.cardinalNumber + "]+)" + + "([" + locale.spaces + "]?[" + locale.lowercaseChars + locale.singlePrime + locale.doublePrime + "]*)" + + "([" + locale.spaces + "][x][" + locale.spaces + "])" + + "([" + locale.cardinalNumber + "]+)" + + "([" + locale.spaces + "]?[" + locale.lowercaseChars + locale.singlePrime + locale.doublePrime + "]*)"; - let re = new RegExp(pattern, "gi"); - let replacement = "$1$2" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$4$5"; + let re = new RegExp(pattern, "gi"); + let replacement = "$1$2" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$4$5"; - string = string.replace(re, replacement); - string = string.replace(re, replacement); // run it twice to catch odd/even occurences + string = string.replace(re, replacement); + string = string.replace(re, replacement); // run it twice to catch odd/even occurences - return string; + return string; } /* - Replace “x/X” with “×” in the following contexts: - * š x v x h → š⎵×⎵v⎵×⎵h (single letters) - * mm x mm → mm⎵×⎵mm (abbreviations) - * Marciano x Clay → Marciano⎵×⎵Clay (words) + Replace “x/X” with “×” in the following contexts: + * š x v x h → š⎵×⎵v⎵×⎵h (single letters) + * mm x mm → mm⎵×⎵mm (abbreviations) + * Marciano x Clay → Marciano⎵×⎵Clay (words) - Also, provide non-breaking spaces around multiplication sign. + Also, provide non-breaking spaces around multiplication sign. - @param {string} string — input text for identification - @returns {string} — output with replaced and spaced multiplication sign + @param {string} string — input text for identification + @returns {string} — output with replaced and spaced multiplication sign */ export function fixMultiplicationSignBetweenWords(string, locale) { - let pattern = - "([" + locale.allChars + "]+)" - + "([" + locale.spaces + "][x][" + locale.spaces + "])" - + "([" + locale.allChars + "]+)"; + let pattern = + "([" + locale.allChars + "]+)" + + "([" + locale.spaces + "][x][" + locale.spaces + "])" + + "([" + locale.allChars + "]+)"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$3"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$3"; - string = string.replace(re, replacement); - string = string.replace(re, replacement); // run it twice to catch odd/even occurences + string = string.replace(re, replacement); + string = string.replace(re, replacement); // run it twice to catch odd/even occurences - return string; + return string; } /* - Replace “x/X” with “×” in the following contexts: - * 4 x object → 4⎵×⎵object - * 4X object → 4X⎵object + Replace “x/X” with “×” in the following contexts: + * 4 x object → 4⎵×⎵object + * 4X object → 4X⎵object - Also, provide non-breaking spaces around multiplication sign. + Also, provide non-breaking spaces around multiplication sign. - @param {string} string — input text for identification - @returns {string} — output with replaced and spaced multiplication sign + @param {string} string — input text for identification + @returns {string} — output with replaced and spaced multiplication sign */ export function fixMultiplicationSignBetweenNumberAndWord(string, locale) { - let pattern = - "([" + locale.cardinalNumber + "])" - + "([" + locale.spaces + "]?)" - + "([x|×])" - + "([" + locale.spaces + "])" - + "([" + locale.lowercaseChars + "]+)"; - let re = new RegExp(pattern, "gi"); - - string = string.replace(re, function($0, $1, $2, $3, $4, $5){ - if ($2 == "") { - return $1 + $2 + locale.multiplicationSign + locale.nbsp + $5; - } - return $1 + locale.nbsp + locale.multiplicationSign + locale.nbsp + $5; - }); - - return string; + let pattern = + "([" + locale.cardinalNumber + "])" + + "([" + locale.spaces + "]?)" + + "([x|×])" + + "([" + locale.spaces + "])" + + "([" + locale.lowercaseChars + "]+)"; + let re = new RegExp(pattern, "gi"); + + string = string.replace(re, function($0, $1, $2, $3, $4, $5){ + if ($2 == "") { + return $1 + $2 + locale.multiplicationSign + locale.nbsp + $5; + } + return $1 + locale.nbsp + locale.multiplicationSign + locale.nbsp + $5; + }); + + return string; } /* - Fix spacing around intended multiplication sign in the following contexts: - * 12x3 → 12⎵×⎵3 - * 12×3 → 12⎵×⎵3 - * 12″×3″ → 12″⎵×⎵3″ (number including double/single primes) + Fix spacing around intended multiplication sign in the following contexts: + * 12x3 → 12⎵×⎵3 + * 12×3 → 12⎵×⎵3 + * 12″×3″ → 12″⎵×⎵3″ (number including double/single primes) - @param {string} string — input text for identification - @returns {string} — output with spaced multiplication sign + @param {string} string — input text for identification + @returns {string} — output with spaced multiplication sign */ export function fixNbspAroundMultiplicationSign(string, locale) { - let pattern = - "([" + locale.cardinalNumber + "]+)" - + "([" + locale.singlePrime + locale.doublePrime + "])?" - + "([x|×])" - + "([" + locale.cardinalNumber + "]+)" - + "([" + locale.singlePrime + locale.doublePrime + "])?"; - let re = new RegExp(pattern, "gi"); - let replacement = "$1$2" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$4$5"; - - return string.replace(re, replacement); + let pattern = + "([" + locale.cardinalNumber + "]+)" + + "([" + locale.singlePrime + locale.doublePrime + "])?" + + "([x|×])" + + "([" + locale.cardinalNumber + "]+)" + + "([" + locale.singlePrime + locale.doublePrime + "])?"; + let re = new RegExp(pattern, "gi"); + let replacement = "$1$2" + locale.nbsp + locale.multiplicationSign + locale.nbsp + "$4$5"; + + return string.replace(re, replacement); } export function fixMultiplicationSign(string, locale) { - string = fixMultiplicationSignBetweenNumbers(string, locale); - string = fixMultiplicationSignBetweenWords(string, locale); - string = fixMultiplicationSignBetweenNumberAndWord(string, locale); - string = fixNbspAroundMultiplicationSign(string, locale); + string = fixMultiplicationSignBetweenNumbers(string, locale); + string = fixMultiplicationSignBetweenWords(string, locale); + string = fixMultiplicationSignBetweenNumberAndWord(string, locale); + string = fixNbspAroundMultiplicationSign(string, locale); - return string + return string } diff --git a/src/modules/symbols/number-sign.js b/src/modules/symbols/number-sign.js index 8d6266a..5d08244 100644 --- a/src/modules/symbols/number-sign.js +++ b/src/modules/symbols/number-sign.js @@ -1,36 +1,36 @@ /* - Remove extra space, nbsp, hairSpace, narrowNbsp - after number sign (octothorpe) and before number + Remove extra space, nbsp, hairSpace, narrowNbsp + after number sign (octothorpe) and before number - Exceptions - Do not remove spaces, when number sign is at the beginning of the paragraph and probably works as Markdown headline. + Exceptions + Do not remove spaces, when number sign is at the beginning of the paragraph and probably works as Markdown headline. - @param {string} string — input text for identification - @returns {string} — output without extra spaces + @param {string} string — input text for identification + @returns {string} — output without extra spaces */ export function removeExtraSpacesAfterNumberSign(string, locale) { - return string.replace( - new RegExp( - "([" + locale.spaces + "]+)" - + "(" + locale.numberSign + ")" - + "([" + locale.spaces + "]+)" - + "(" + locale.cardinalNumber + ")", - "g" - ), - "$1$2$4" - ); + return string.replace( + new RegExp( + "([" + locale.spaces + "]+)" + + "(" + locale.numberSign + ")" + + "([" + locale.spaces + "]+)" + + "(" + locale.cardinalNumber + ")", + "g" + ), + "$1$2$4" + ); } /* - Consolidates the use of number sign (#) + Consolidates the use of number sign (#) - @param {string} string — input text for identification - @returns {string} — output with properly used number sign + @param {string} string — input text for identification + @returns {string} — output with properly used number sign */ export function fixNumberSign(string, locale) { - string = removeExtraSpacesAfterNumberSign(string, locale); - return string; + string = removeExtraSpacesAfterNumberSign(string, locale); + return string; } diff --git a/src/modules/symbols/plus-minus.js b/src/modules/symbols/plus-minus.js index e76fd49..361f684 100644 --- a/src/modules/symbols/plus-minus.js +++ b/src/modules/symbols/plus-minus.js @@ -1,7 +1,7 @@ export function fixPlusMinus(string, locale) { - let pattern = "(\\+\\-)|(\\-\\+)"; - let re = new RegExp(pattern, "g"); - let replacement = locale.plusMinus; + let pattern = "(\\+\\-)|(\\-\\+)"; + let re = new RegExp(pattern, "g"); + let replacement = locale.plusMinus; - return string.replace(re, replacement); + return string.replace(re, replacement); } diff --git a/src/modules/symbols/section-sign.js b/src/modules/symbols/section-sign.js index 95ed49a..c27416d 100644 --- a/src/modules/symbols/section-sign.js +++ b/src/modules/symbols/section-sign.js @@ -1,37 +1,37 @@ function addSpaceBeforeSectionSign(string, locale) { - let pattern = "([^" + locale.spaces + locale.sectionSign + locale.openingBrackets + "])("+ locale.sectionSign +")"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.space + "$2"; + let pattern = "([^" + locale.spaces + locale.sectionSign + locale.openingBrackets + "])("+ locale.sectionSign +")"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.space + "$2"; - return string.replace(re, replacement); + return string.replace(re, replacement); } function addNbspAfterSectionSign(string, locale) { - let pattern = "("+ locale.sectionSign +")([^" + locale.spaces + locale.sectionSign +"])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp + "$2"; + let pattern = "("+ locale.sectionSign +")([^" + locale.spaces + locale.sectionSign +"])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp + "$2"; - return string.replace(re, replacement); + return string.replace(re, replacement); } function replaceSpacesAfterSectionSign(string, locale) { - let pattern = "("+ locale.sectionSign +")([" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp; + let pattern = "("+ locale.sectionSign +")([" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp; - return string.replace(re, replacement); + return string.replace(re, replacement); } export function fixSectionSign(string, locale) { - string = addSpaceBeforeSectionSign(string, locale); - string = addNbspAfterSectionSign(string, locale); - string = replaceSpacesAfterSectionSign(string, locale); + string = addSpaceBeforeSectionSign(string, locale); + string = addNbspAfterSectionSign(string, locale); + string = replaceSpacesAfterSectionSign(string, locale); - return string + return string } diff --git a/src/modules/whitespace/lines.js b/src/modules/whitespace/lines.js index 63ff594..246f774 100644 --- a/src/modules/whitespace/lines.js +++ b/src/modules/whitespace/lines.js @@ -1,9 +1,9 @@ /* - Removes empty lines + Removes empty lines - @param {string} string — input text for identification - @returns {string} — output with removed empty lines + @param {string} string — input text for identification + @returns {string} — output with removed empty lines */ export function removeEmptyLines(string) { - return string.replace(/[\n\r]{2,}/gm, "\n"); + return string.replace(/[\n\r]{2,}/gm, "\n"); } diff --git a/src/modules/whitespace/nbsp.js b/src/modules/whitespace/nbsp.js index 64ad96d..537798a 100644 --- a/src/modules/whitespace/nbsp.js +++ b/src/modules/whitespace/nbsp.js @@ -1,384 +1,384 @@ export function removeNbspBetweenMultiCharWords(string, locale) { - let pattern = "(["+ locale.lowercaseChars + locale.uppercaseChars +"]{2,})(["+ locale.nbsp + locale.narrowNbsp +"])(["+ locale.lowercaseChars + locale.uppercaseChars +"]{2,})"; - let re = new RegExp(pattern, "g"); - string = string.replace(re, "$1 $3"); - string = string.replace(re, "$1 $3"); //calling it twice to catch odd/even occurences + let pattern = "(["+ locale.lowercaseChars + locale.uppercaseChars +"]{2,})(["+ locale.nbsp + locale.narrowNbsp +"])(["+ locale.lowercaseChars + locale.uppercaseChars +"]{2,})"; + let re = new RegExp(pattern, "g"); + string = string.replace(re, "$1 $3"); + string = string.replace(re, "$1 $3"); //calling it twice to catch odd/even occurences - return string; + return string; } /* - Replace a space with a non-breaking space after a single-letter preposition + Replace a space with a non-breaking space after a single-letter preposition - Examples: - V obchode → V⎵obchode - Skáče o tyči → Skáče o⎵tyči + Examples: + V obchode → V⎵obchode + Skáče o tyči → Skáče o⎵tyči - Counterexamples - See test case + Counterexamples + See test case - Approach - Split identification of - a) small letter prepositions (that can be placed anywhere in the sentence) - b) and capital letter prepositions (that are placed at the beginning of the sentence) - Reason: capital letters in the mid-sentence are rather bound to a previous word and nbsp is fixed by addNbspBeforeSingleLetter - c) “I” in English + Approach + Split identification of + a) small letter prepositions (that can be placed anywhere in the sentence) + b) and capital letter prepositions (that are placed at the beginning of the sentence) + Reason: capital letters in the mid-sentence are rather bound to a previous word and nbsp is fixed by addNbspBeforeSingleLetter + c) “I” in English - @param {string} string — input text for identification - @returns {string} — output with correctly placed non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly placed non-breaking space */ export function addNbspAfterPreposition(string, locale) { - // a) small letter prepositions - let pattern = - "(^|[" + locale.space + "]|[^" + locale.allChars + locale.cardinalNumber + locale.apostrophe + locale.plus + locale.minus + locale.hyphen + "])" - + "([" + locale.lowercaseChars + "])" - + "([" + locale.space + "])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1$2" + locale.nbsp; - string = string.replace(re, replacement); - string = string.replace(re, replacement); //calling it twice to catch odd/even occurences - - // b) capital letter prepositions at the beggining of the sentence - pattern = - "(^|[" - + locale.sentencePunctuation - + locale.ellipsis - + locale.copyright - + locale.registeredTrademark - + locale.soundRecordingCopyright - + "])" - + "(["+ locale.spaces +"]?)" - + "(["+ locale.uppercaseChars +"])" - + "(["+ locale.spaces +"])" - - re = new RegExp(pattern, "g"); - replacement = "$1$2$3" + locale.nbsp; - string = string.replace(re, replacement); - - // c) “I” in English - - if (locale.locale == "en-us") { - string = string.replace( - new RegExp( - "(^|[" + locale.spaces + "])" - + "(I)" - + "(["+ locale.spaces +"])", - "g" - ), - "$1$2" + locale.nbsp - ); - } - - - return string; + // a) small letter prepositions + let pattern = + "(^|[" + locale.space + "]|[^" + locale.allChars + locale.cardinalNumber + locale.apostrophe + locale.plus + locale.minus + locale.hyphen + "])" + + "([" + locale.lowercaseChars + "])" + + "([" + locale.space + "])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1$2" + locale.nbsp; + string = string.replace(re, replacement); + string = string.replace(re, replacement); //calling it twice to catch odd/even occurences + + // b) capital letter prepositions at the beggining of the sentence + pattern = + "(^|[" + + locale.sentencePunctuation + + locale.ellipsis + + locale.copyright + + locale.registeredTrademark + + locale.soundRecordingCopyright + + "])" + + "(["+ locale.spaces +"]?)" + + "(["+ locale.uppercaseChars +"])" + + "(["+ locale.spaces +"])" + + re = new RegExp(pattern, "g"); + replacement = "$1$2$3" + locale.nbsp; + string = string.replace(re, replacement); + + // c) “I” in English + + if (locale.locale == "en-us") { + string = string.replace( + new RegExp( + "(^|[" + locale.spaces + "])" + + "(I)" + + "(["+ locale.spaces +"])", + "g" + ), + "$1$2" + locale.nbsp + ); + } + + + return string; } export function addNbspAfterAmpersand(string, locale) { - let pattern = "([" + locale.spaces + "])(" + locale.ampersand + ")([" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - let replacement = " $2" + locale.nbsp; + let pattern = "([" + locale.spaces + "])(" + locale.ampersand + ")([" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + let replacement = " $2" + locale.nbsp; - return string.replace(re, replacement); + return string.replace(re, replacement); } /* - Add a non-breaking space after a cardinal number (up to 99) that precedes a word. + Add a non-breaking space after a cardinal number (up to 99) that precedes a word. - Assumptions and Limitations - We’ll identify and place nbsp for 1- or 2-digit cardinal numbers. + Assumptions and Limitations + We’ll identify and place nbsp for 1- or 2-digit cardinal numbers. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with nbsp after cardinal numbers + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with nbsp after cardinal numbers */ export function addNbspAfterCardinalNumber(string, locale) { - return string.replace( - new RegExp( - "([^" + locale.nbsp + locale.cardinalNumber + "]|^)" - + "(" + locale.cardinalNumber + "{1,2})" - + "([" + locale.spaces + "])" - + "(["+ locale.allChars +"])", - "g" - ), - "$1" - + "$2" - + locale.nbsp - + "$4" - ); + return string.replace( + new RegExp( + "([^" + locale.nbsp + locale.cardinalNumber + "]|^)" + + "(" + locale.cardinalNumber + "{1,2})" + + "([" + locale.spaces + "])" + + "(["+ locale.allChars +"])", + "g" + ), + "$1" + + "$2" + + locale.nbsp + + "$4" + ); } /* - Add a non-breaking space after on ordinal number (up to 99) that precedes a word. + Add a non-breaking space after on ordinal number (up to 99) that precedes a word. - Assumptions and Limitations - We’ll identify and place nbsp for 1- or 2-digit ordinal numbers. + Assumptions and Limitations + We’ll identify and place nbsp for 1- or 2-digit ordinal numbers. - @param {string} string: input text for identification - @param {string} locale: locale option - @returns {string} output with nbsp after ordinal numbers + @param {string} string: input text for identification + @param {string} locale: locale option + @returns {string} output with nbsp after ordinal numbers */ export function addNbspAfterOrdinalNumber(string, locale) { - return string.replace( - new RegExp( - "([^" + locale.nbsp + locale.cardinalNumber + "_%\\-]|^)" - + "("+ locale.cardinalNumber +"{1,2})" - + "("+ locale.ordinalIndicator +")" - + "(["+ locale.spaces +"]?)" - + "(["+ locale.allChars +"])", - "g" - ), - "$1" - + "$2" - + "$3" - + locale.nbsp - + "$5" - ); + return string.replace( + new RegExp( + "([^" + locale.nbsp + locale.cardinalNumber + "_%\\-]|^)" + + "("+ locale.cardinalNumber +"{1,2})" + + "("+ locale.ordinalIndicator +")" + + "(["+ locale.spaces +"]?)" + + "(["+ locale.allChars +"])", + "g" + ), + "$1" + + "$2" + + "$3" + + locale.nbsp + + "$5" + ); } export function addNbspWithinOrdinalDate(string, locale) { - let pattern = "("+ locale.cardinalNumber +")("+ locale.ordinalIndicator +")(["+ locale.spaces +"]?)("+ locale.cardinalNumber +")("+ locale.ordinalIndicator +")(["+ locale.spaces +"]?)("+ locale.cardinalNumber +")"; - let re = new RegExp(pattern, "g"); - let replacement = ""; - - switch (locale.locale) { - case "en-us": - case "rue": - case "sk": - case "cs": - replacement = "$1$2" + locale.nbsp + "$4$5" + locale.nbsp + "$7"; - break; - case "de-de": - replacement = "$1$2" + locale.nbsp + "$4$5" + locale.space + "$7"; - break; - } - - return string.replace(re, replacement); + let pattern = "("+ locale.cardinalNumber +")("+ locale.ordinalIndicator +")(["+ locale.spaces +"]?)("+ locale.cardinalNumber +")("+ locale.ordinalIndicator +")(["+ locale.spaces +"]?)("+ locale.cardinalNumber +")"; + let re = new RegExp(pattern, "g"); + let replacement = ""; + + switch (locale.locale) { + case "en-us": + case "rue": + case "sk": + case "cs": + replacement = "$1$2" + locale.nbsp + "$4$5" + locale.nbsp + "$7"; + break; + case "de-de": + replacement = "$1$2" + locale.nbsp + "$4$5" + locale.space + "$7"; + break; + } + + return string.replace(re, replacement); } /* - Fix non-breaking space after Ordinal Roman Number + Fix non-breaking space after Ordinal Roman Number - Examples: - I. kapitola - X. ročník - 8. V. 1945 + Examples: + I. kapitola + X. ročník + 8. V. 1945 - @param {string} string — input text for identification - @returns {string} — output with correctly placed non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly placed non-breaking space */ export function addNbspAfterRomanNumeral(string, locale) { - // we can identify roman numeral effectively only if it has an ordinal indicator - if(locale.romanOrdinalIndicator != "") { - let pattern = - "(\\b)" - + "(["+ locale.romanNumerals + "]+)" - + "("+ locale.romanOrdinalIndicator +")" - + "(["+ locale.spaces +"]?)" - + "([" + locale.allChars + locale.cardinalNumber + "])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1$2$3" + locale.nbsp + "$5"; - - return string.replace(re, replacement); - } - - return string; + // we can identify roman numeral effectively only if it has an ordinal indicator + if(locale.romanOrdinalIndicator != "") { + let pattern = + "(\\b)" + + "(["+ locale.romanNumerals + "]+)" + + "("+ locale.romanOrdinalIndicator +")" + + "(["+ locale.spaces +"]?)" + + "([" + locale.allChars + locale.cardinalNumber + "])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1$2$3" + locale.nbsp + "$5"; + + return string.replace(re, replacement); + } + + return string; } /* - Fix non-breaking space around name with regnal number + Fix non-breaking space around name with regnal number - Examples: - Karel IV. → Karel⎵IV. - Karel IV.⎵byl → Karel⎵IV. byl - Charles IV → Charles⎵IV + Examples: + Karel IV. → Karel⎵IV. + Karel IV.⎵byl → Karel⎵IV. byl + Charles IV → Charles⎵IV - Unsupported: - Charles I → Charles I - (first emperor, English language; otherwise “When I am” would be incorrectly fixed) + Unsupported: + Charles I → Charles I + (first emperor, English language; otherwise “When I am” would be incorrectly fixed) - @param {string} string — input text for identification - @returns {string} — output with correctly placed non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly placed non-breaking space */ export function fixNbspForNameWithRegnalNumber(string, locale) { - let pattern = - "(\\b[" + locale.uppercaseChars + "]["+ locale.lowercaseChars +"]+?)" - + "([" + locale.spaces + "])" - + "([" + locale.romanNumerals +"]+\\b)" - + "(" + locale.romanOrdinalIndicator +")" - + "([" + locale.nbsp + "]?)"; - let re = new RegExp(pattern, "g"); - - return string.replace(re, function($0, $1, $2, $3, $4, $5){ - if ($5 == "" && $3 == "I") { - return $1 + locale.space + $3 + $4; - } - else if ($5 == "" && $3 != "I") { - return $1 + locale.nbsp + $3 + $4; - } - else if ($5 == locale.nbsp && $3 == "I") { - return $1 + locale.space + $3 + $4 + $5; - } - else { - return $1 + locale.nbsp + $3 + $4 + locale.space; - } - - }); + let pattern = + "(\\b[" + locale.uppercaseChars + "]["+ locale.lowercaseChars +"]+?)" + + "([" + locale.spaces + "])" + + "([" + locale.romanNumerals +"]+\\b)" + + "(" + locale.romanOrdinalIndicator +")" + + "([" + locale.nbsp + "]?)"; + let re = new RegExp(pattern, "g"); + + return string.replace(re, function($0, $1, $2, $3, $4, $5){ + if ($5 == "" && $3 == "I") { + return $1 + locale.space + $3 + $4; + } + else if ($5 == "" && $3 != "I") { + return $1 + locale.nbsp + $3 + $4; + } + else if ($5 == locale.nbsp && $3 == "I") { + return $1 + locale.space + $3 + $4 + $5; + } + else { + return $1 + locale.nbsp + $3 + $4 + locale.space; + } + + }); } /* - Fix nbsp before % (percent), ‰ (permille) and ‱ (permyriad) + Fix nbsp before % (percent), ‰ (permille) and ‱ (permyriad) - @param {string} string — input text for identification - @returns {string} — output with correctly added non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly added non-breaking space */ export function addNbspBeforePercent(string, locale) { - let pattern = "([" + locale.spaces + "])([" + locale.percent + locale.permille + locale.permyriad + "])"; - let re = new RegExp(pattern, "g"); - let replacement = locale.nbsp + "$2"; + let pattern = "([" + locale.spaces + "])([" + locale.percent + locale.permille + locale.permyriad + "])"; + let re = new RegExp(pattern, "g"); + let replacement = locale.nbsp + "$2"; - return string.replace(re, replacement); + return string.replace(re, replacement); } /* - Add/Swap non-breaking space before a single capital letter in a sentence - - Examples: - The product X is missing the feature Y. - Sputnik V - © V Inc. - Človek Č - - Counter examples: - When I talk to emerging product designers (capital I in English language) - Dear Christopher - pán Šťastný - pán ŠŤASTNÝ - One sentence ends. A bad apple. (single letter before sentence punctuation) - sentence; C-level executive (single letter befor sentence punctuation) - I’d say… A-player. - sentence (brackets) A-player - “qouted part” A capital letter - A × A (this should be fixed in multiplication sign, but maybe irrelevant) + Add/Swap non-breaking space before a single capital letter in a sentence + + Examples: + The product X is missing the feature Y. + Sputnik V + © V Inc. + Človek Č + + Counter examples: + When I talk to emerging product designers (capital I in English language) + Dear Christopher + pán Šťastný + pán ŠŤASTNÝ + One sentence ends. A bad apple. (single letter before sentence punctuation) + sentence; C-level executive (single letter befor sentence punctuation) + I’d say… A-player. + sentence (brackets) A-player + “qouted part” A capital letter + A × A (this should be fixed in multiplication sign, but maybe irrelevant) famous company — A Inc. (this should be fixed in dash.js) - @param {string} string — input text for identification - @returns {string} — output with correctly added non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly added non-breaking space */ export function addNbspBeforeSingleLetter(string, locale) { - let uppercaseChars = locale.uppercaseChars; - - if (locale.locale == "en-us") { - // remove “I” from the list to avoid placing nbsp before “something I do” - uppercaseChars = uppercaseChars.replace(/A-Z/g, "A-HJ-Z"); - } - - let pattern = - "([^" - + locale.sentencePunctuation - + locale.ellipsis - + locale.closingBrackets - + locale.rightDoubleQuote - + locale.rightSingleQuote - + locale.apostrophe - + locale.multiplicationSign - + locale.emDash - + locale.enDash - + "])" - + "(["+ locale.spaces +"])" - + "(["+ uppercaseChars +"])" - + "((["+ locale.spaces +"])|(\\.$|$))"; - - let re = new RegExp(pattern, "g"); - - return string.replace(re, function($0, $1, $2, $3, $4, $5){ - if (locale.locale == "en-us") { - // don't make changes after "I" in en-us - return $1 + locale.nbsp + $3 + $4 - - } else if ($3 == "I" && ($5 == locale.nbsp || $5 == locale.hairSpace || $5 == locale.narrowNbsp)) { - // replace nbsp after "I" in other languages - return $1 + locale.nbsp + $3 + locale.space - - } else { - // just add nbsp before single word capital letter in the rest of the cases - return $1 + locale.nbsp + $3 + $4 - - } - }); + let uppercaseChars = locale.uppercaseChars; + + if (locale.locale == "en-us") { + // remove “I” from the list to avoid placing nbsp before “something I do” + uppercaseChars = uppercaseChars.replace(/A-Z/g, "A-HJ-Z"); + } + + let pattern = + "([^" + + locale.sentencePunctuation + + locale.ellipsis + + locale.closingBrackets + + locale.rightDoubleQuote + + locale.rightSingleQuote + + locale.apostrophe + + locale.multiplicationSign + + locale.emDash + + locale.enDash + + "])" + + "(["+ locale.spaces +"])" + + "(["+ uppercaseChars +"])" + + "((["+ locale.spaces +"])|(\\.$|$))"; + + let re = new RegExp(pattern, "g"); + + return string.replace(re, function($0, $1, $2, $3, $4, $5){ + if (locale.locale == "en-us") { + // don't make changes after "I" in en-us + return $1 + locale.nbsp + $3 + $4 + + } else if ($3 == "I" && ($5 == locale.nbsp || $5 == locale.hairSpace || $5 == locale.narrowNbsp)) { + // replace nbsp after "I" in other languages + return $1 + locale.nbsp + $3 + locale.space + + } else { + // just add nbsp before single word capital letter in the rest of the cases + return $1 + locale.nbsp + $3 + $4 + + } + }); } /* - Helper function that adds nbsp after symbols - in their respective *.js files + Helper function that adds nbsp after symbols + in their respective *.js files - @param {string} string — input text for identification - @returns {string} — output with correctly added non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly added non-breaking space */ export function addNbspAfterSymbol(string, symbol, locale) { - let pattern = "("+ symbol +")([^" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp + "$2"; + let pattern = "("+ symbol +")([^" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp + "$2"; - return string.replace(re, replacement); + return string.replace(re, replacement); } /* - Helper function that fixes various spaces for nbsp after symbols - in their respective *.js files + Helper function that fixes various spaces for nbsp after symbols + in their respective *.js files - @param {string} string — input text for identification - @returns {string} — output with correctly placed non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly placed non-breaking space */ export function replaceSpacesWithNbspAfterSymbol(string, symbol, locale) { - let pattern = "("+ symbol +")([" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp; + let pattern = "("+ symbol +")([" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp; - return string.replace(re, replacement); + return string.replace(re, replacement); } /* - Consolidates the use of non-breaking spaces + Consolidates the use of non-breaking spaces - @param {string} string — input text for identification - @returns {string} — output with correctly placed non-breaking space + @param {string} string — input text for identification + @returns {string} — output with correctly placed non-breaking space */ export function fixNbsp(string, locale) { - string = removeNbspBetweenMultiCharWords(string, locale); - string = addNbspAfterPreposition(string, locale); - string = addNbspAfterAmpersand(string, locale); - string = addNbspAfterCardinalNumber(string, locale); - string = addNbspAfterOrdinalNumber(string, locale); - string = addNbspWithinOrdinalDate(string, locale); - string = addNbspAfterRomanNumeral(string, locale); - string = addNbspBeforeSingleLetter(string, locale); - string = fixNbspForNameWithRegnalNumber(string, locale); - string = addNbspBeforePercent(string, locale); - - return string; + string = removeNbspBetweenMultiCharWords(string, locale); + string = addNbspAfterPreposition(string, locale); + string = addNbspAfterAmpersand(string, locale); + string = addNbspAfterCardinalNumber(string, locale); + string = addNbspAfterOrdinalNumber(string, locale); + string = addNbspWithinOrdinalDate(string, locale); + string = addNbspAfterRomanNumeral(string, locale); + string = addNbspBeforeSingleLetter(string, locale); + string = fixNbspForNameWithRegnalNumber(string, locale); + string = addNbspBeforePercent(string, locale); + + return string; } diff --git a/src/modules/whitespace/spaces.js b/src/modules/whitespace/spaces.js index f6b631a..6ac93a7 100644 --- a/src/modules/whitespace/spaces.js +++ b/src/modules/whitespace/spaces.js @@ -9,7 +9,7 @@ export function removeMultipleSpaces(string, locale) { "(\\S)" + "([" + locale.spaces + "]{2,})" + "(\\S)"; - let re = new RegExp(pattern, "g"); + let re = new RegExp(pattern, "g"); return string.replace(re, "$1 $3"); } @@ -18,17 +18,17 @@ export function removeMultipleSpaces(string, locale) { /* Removes extra spaces and tabs at the beginning of each paragraph, unless user configures to keep spaces before beginning of the nested markdown lists - [1] split the lines manually + [1] split the lines manually [2] if removeWhitespacesBeforeMarkdownList = false; keep the spaces before the markdown lists [3] otherwise remove other empty spaces or tabs at the beginning of the paragraph - [4] join lines together to a single string + [4] join lines together to a single string - @param {string} string — input text for identification - @returns {string} — output with removed spaces at the beginning of paragraphs + @param {string} string — input text for identification + @returns {string} — output with removed spaces at the beginning of paragraphs */ export function removeSpacesAtParagraphBeginning(string, locale, configuration) { - /* [1] split the lines manually */ - let lines = string.split(/\r?\n/); + /* [1] split the lines manually */ + let lines = string.split(/\r?\n/); let pattern = "(^\\s+)([-\\*\\+]*)"; // identify whitespaces and markdown list indicators -/* let re = new RegExp(pattern, "g"); @@ -47,8 +47,8 @@ export function removeSpacesAtParagraphBeginning(string, locale, configuration) ); } - /* [4] join lines together to a single string */ - return lines.join("\n"); + /* [4] join lines together to a single string */ + return lines.join("\n"); } @@ -82,195 +82,195 @@ export function removeSpacesAtParagraphBeginning(string, locale, configuration) export function removeSpaceBeforeSentencePausePunctuation(string, locale) { - let pattern = "([" + locale.spaces + "])([" + locale.sentencePausePunctuation + "])([^\\-\\)]|$)"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$2$3"); + let pattern = "([" + locale.spaces + "])([" + locale.sentencePausePunctuation + "])([^\\-\\)]|$)"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$2$3"); } /* - Removes extra space before: - - terminal punctuation - - closing brackets - - degree symbol (°) - - Examples: - Hey . → Hey. - Sentence and… ! → Sentence and…! - Something (… ) something else → Something (…) something else - 5 ° → 5° - - @param {string} string — input text for identification - @returns {string} — output with removed spaces before terminal punctuation + Removes extra space before: + - terminal punctuation + - closing brackets + - degree symbol (°) + + Examples: + Hey . → Hey. + Sentence and… ! → Sentence and…! + Something (… ) something else → Something (…) something else + 5 ° → 5° + + @param {string} string — input text for identification + @returns {string} — output with removed spaces before terminal punctuation */ export function removeSpaceBeforeTerminalPunctuation(string, locale) { - let pattern = - "([" + locale.spaces + "])" - + "([" + locale.terminalPunctuation + locale.closingBrackets + locale.degree + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$2"); + let pattern = + "([" + locale.spaces + "])" + + "([" + locale.terminalPunctuation + locale.closingBrackets + locale.degree + "])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$2"); } /* - Removes extra spaces before ordinal indicator + Removes extra spaces before ordinal indicator - Examples: - 1 st → 1st - 2 nd → 2nd - 1 . spoj → 1. spoj + Examples: + 1 st → 1st + 2 nd → 2nd + 1 . spoj → 1. spoj - @param {string} string — input text for identification - @returns {string} — output with removed spaces before ordinal indicator + @param {string} string — input text for identification + @returns {string} — output with removed spaces before ordinal indicator */ export function removeSpaceBeforeOrdinalIndicator(string, locale) { - let pattern = - "("+ locale.cardinalNumber + ")" - + "(["+ locale.spaces +"]?)" - + "("+ locale.ordinalIndicator +")" - + "([" + locale.spaces + "]|\\b)"; //to avoid cathing "4 th" in "4 there" - let re = new RegExp(pattern, "g"); - let replacement = "$1$3$4"; - - return string.replace(re, replacement); + let pattern = + "("+ locale.cardinalNumber + ")" + + "(["+ locale.spaces +"]?)" + + "("+ locale.ordinalIndicator +")" + + "([" + locale.spaces + "]|\\b)"; //to avoid cathing "4 th" in "4 there" + let re = new RegExp(pattern, "g"); + let replacement = "$1$3$4"; + + return string.replace(re, replacement); } export function removeSpaceAfterOpeningBrackets(string, locale) { - let pattern = - "([" + locale.openingBrackets + "])" - + "([" + locale.spaces + "])"; - let re = new RegExp(pattern, "g"); - return string.replace(re, "$1"); + let pattern = + "([" + locale.openingBrackets + "])" + + "([" + locale.spaces + "])"; + let re = new RegExp(pattern, "g"); + return string.replace(re, "$1"); } /* - Add a space before opening brackets + Add a space before opening brackets - Examples: - Enclosed(in) the brackets. → - Enclosed (in) the brackets. + Examples: + Enclosed(in) the brackets. → + Enclosed (in) the brackets. - Enclosed[in] the brackets. → - Enclosed [in] the brackets. + Enclosed[in] the brackets. → + Enclosed [in] the brackets. - Enclosed{in} the brackets. → - Enclosed {in} the brackets. + Enclosed{in} the brackets. → + Enclosed {in} the brackets. - Exclusions: - name(s) → name(s) - NAME(S) → NAME(S) - mass(es) → mass(es) - MASS(ES) → MASS(ES) + Exclusions: + name(s) → name(s) + NAME(S) → NAME(S) + mass(es) → mass(es) + MASS(ES) → MASS(ES) - @param {string} string — input text for identification - @returns {string} — output with a space before an opening bracket + @param {string} string — input text for identification + @returns {string} — output with a space before an opening bracket */ export function addSpaceBeforeOpeningBrackets(string, locale) { - let pattern = - "([" + locale.lowercaseChars + locale.uppercaseChars + "])" - + "([" + locale.openingBrackets + "])" - + "([" + locale.lowercaseChars + locale.uppercaseChars + locale.ellipsis + "])" - + "([" + locale.lowercaseChars + locale.uppercaseChars + locale.ellipsis + locale.closingBrackets + "])"; - let re = new RegExp(pattern, "g"); - - return string.replace(re, function ($0, $1, $2, $3, $4) { - if ($3 == "s" | $3 == "S" | $3 + $4 == "es" | $3 + $4 == "ES" ) { - return $1 + $2 + $3 + $4; - } else { - return $1 + locale.space + $2 + $3 + $4; - } - }); + let pattern = + "([" + locale.lowercaseChars + locale.uppercaseChars + "])" + + "([" + locale.openingBrackets + "])" + + "([" + locale.lowercaseChars + locale.uppercaseChars + locale.ellipsis + "])" + + "([" + locale.lowercaseChars + locale.uppercaseChars + locale.ellipsis + locale.closingBrackets + "])"; + let re = new RegExp(pattern, "g"); + + return string.replace(re, function ($0, $1, $2, $3, $4) { + if ($3 == "s" | $3 == "S" | $3 + $4 == "es" | $3 + $4 == "ES" ) { + return $1 + $2 + $3 + $4; + } else { + return $1 + locale.space + $2 + $3 + $4; + } + }); } /* - Add a space after terminal punctuation + Add a space after terminal punctuation - Example: - One sentence ended.Another started. → - One sentence ended. Another started. + Example: + One sentence ended.Another started. → + One sentence ended. Another started. - @param {string} string — input text for identification - @returns {string} — output with a space after terminal punctuation + @param {string} string — input text for identification + @returns {string} — output with a space after terminal punctuation */ export function addSpaceAfterTerminalPunctuation(string, locale) { - var pattern = - "([" + locale.lowercaseChars + locale.uppercaseChars + "]{2,}|["+ locale.ellipsis + "])" - + "([" + locale.terminalPunctuation + "])" - + "([" + locale.uppercaseChars + "])"; - var re = new RegExp(pattern, "g"); - return string.replace(re, "$1$2 $3"); + var pattern = + "([" + locale.lowercaseChars + locale.uppercaseChars + "]{2,}|["+ locale.ellipsis + "])" + + "([" + locale.terminalPunctuation + "])" + + "([" + locale.uppercaseChars + "])"; + var re = new RegExp(pattern, "g"); + return string.replace(re, "$1$2 $3"); } /* - Add a space after sentence pause punctuation + Add a space after sentence pause punctuation - Example: - One sentence ended,another started. → - One sentence ended, another started. + Example: + One sentence ended,another started. → + One sentence ended, another started. - @param {string} string — input text for identification - @returns {string} — output with a space after closing brackets + @param {string} string — input text for identification + @returns {string} — output with a space after closing brackets */ export function addSpaceAfterSentencePause(string, locale) { - var pattern = - "([" + locale.lowercaseChars + locale.uppercaseChars + "]{2,}|["+ locale.ellipsis + "])" - + "([" + locale.sentencePausePunctuation + "])" - + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; - var re = new RegExp(pattern, "g"); - return string.replace(re, "$1$2 $3"); + var pattern = + "([" + locale.lowercaseChars + locale.uppercaseChars + "]{2,}|["+ locale.ellipsis + "])" + + "([" + locale.sentencePausePunctuation + "])" + + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; + var re = new RegExp(pattern, "g"); + return string.replace(re, "$1$2 $3"); } /* - Add a space after closing brackets + Add a space after closing brackets - Example: - Enclosed (in)the brackets. → Enclosed (in) the brackets. + Example: + Enclosed (in)the brackets. → Enclosed (in) the brackets. - @param {string} string — input text for identification - @returns {string} — output with a space after closing brackets + @param {string} string — input text for identification + @returns {string} — output with a space after closing brackets */ export function addSpaceAfterClosingBrackets(string, locale) { - var pattern = - "([" + locale.closingBrackets + "])" - + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; - var re = new RegExp(pattern, "g"); - return string.replace(re, "$1 $2"); + var pattern = + "([" + locale.closingBrackets + "])" + + "([" + locale.lowercaseChars + locale.uppercaseChars + "])"; + var re = new RegExp(pattern, "g"); + return string.replace(re, "$1 $2"); } export function addSpaceBeforeSymbol(string, symbol, locale) { - let pattern = "([^" + locale.spaces + locale.openingBrackets + "])("+ symbol +")"; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.space + "$2"; + let pattern = "([^" + locale.spaces + locale.openingBrackets + "])("+ symbol +")"; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.space + "$2"; - return string.replace(re, replacement); + return string.replace(re, replacement); } export function fixSpaces(string, locale, configuration) { - string = removeMultipleSpaces(string, locale); - string = removeSpacesAtParagraphBeginning(string, locale, configuration); - string = removeSpacesAtParagraphEnd(string, locale); - string = removeSpaceBeforeSentencePausePunctuation(string, locale); - string = removeSpaceBeforeTerminalPunctuation(string, locale); - string = removeSpaceBeforeOrdinalIndicator(string, locale); - string = removeSpaceAfterOpeningBrackets(string, locale); - string = addSpaceBeforeOpeningBrackets(string, locale); - string = addSpaceAfterTerminalPunctuation(string, locale); - string = addSpaceAfterClosingBrackets(string, locale); - string = addSpaceAfterSentencePause(string, locale); - return string; + string = removeMultipleSpaces(string, locale); + string = removeSpacesAtParagraphBeginning(string, locale, configuration); + string = removeSpacesAtParagraphEnd(string, locale); + string = removeSpaceBeforeSentencePausePunctuation(string, locale); + string = removeSpaceBeforeTerminalPunctuation(string, locale); + string = removeSpaceBeforeOrdinalIndicator(string, locale); + string = removeSpaceAfterOpeningBrackets(string, locale); + string = addSpaceBeforeOpeningBrackets(string, locale); + string = addSpaceAfterTerminalPunctuation(string, locale); + string = addSpaceAfterClosingBrackets(string, locale); + string = addSpaceAfterSentencePause(string, locale); + return string; } diff --git a/src/modules/words/abbreviations.js b/src/modules/words/abbreviations.js index 8ceb256..b63173c 100644 --- a/src/modules/words/abbreviations.js +++ b/src/modules/words/abbreviations.js @@ -1,219 +1,219 @@ /* - Fixes spaces around initials for First and up to two Middle names - It won't fix any other abbreviation. + Fixes spaces around initials for First and up to two Middle names + It won't fix any other abbreviation. - Algorithm - [1] Identify and replace pattern "I. FullName" - [2] Identify and replace pattern "I. I. FullName" - [3] Identify and replace pattern "I. I. I. FullName" + Algorithm + [1] Identify and replace pattern "I. FullName" + [2] Identify and replace pattern "I. I. FullName" + [3] Identify and replace pattern "I. I. I. FullName" - @param {string} input text for identification - @returns {string} corrected output + @param {string} input text for identification + @returns {string} corrected output */ export function fixInitials(string, locale) { - // define pattern for initial and a full name - let initialPattern = "(["+ locale.uppercaseChars + "]["+ locale.allChars + "]?\\.)(["+ locale.spaces +"]?)"; - let fullNamePattern = "(["+ locale.allChars + "]{2,}[^\\.])"; + // define pattern for initial and a full name + let initialPattern = "(["+ locale.uppercaseChars + "]["+ locale.allChars + "]?\\.)(["+ locale.spaces +"]?)"; + let fullNamePattern = "(["+ locale.allChars + "]{2,}[^\\.])"; - // define locale-specific spacing for multiple initials - let initialSpace = ""; - switch (locale.locale) { - case "en-us": - initialSpace = ""; - break; - case "rue": - case "sk": - case "cs": - case "de-de": - initialSpace = locale.nbsp; - break; - } + // define locale-specific spacing for multiple initials + let initialSpace = ""; + switch (locale.locale) { + case "en-us": + initialSpace = ""; + break; + case "rue": + case "sk": + case "cs": + case "de-de": + initialSpace = locale.nbsp; + break; + } - // [1] Identify and replace pattern "I. FullName" - let pattern = initialPattern + fullNamePattern; - let re = new RegExp(pattern, "g"); - let replacement = "$1" + locale.nbsp + "$3"; - string = string.replace(re, replacement); + // [1] Identify and replace pattern "I. FullName" + let pattern = initialPattern + fullNamePattern; + let re = new RegExp(pattern, "g"); + let replacement = "$1" + locale.nbsp + "$3"; + string = string.replace(re, replacement); - // [2] Identify and replace pattern "I. I. FullName" - pattern = initialPattern + initialPattern + fullNamePattern; - re = new RegExp(pattern, "g"); - replacement = "$1" + initialSpace + "$3" + locale.space + "$5"; - string = string.replace(re, replacement); + // [2] Identify and replace pattern "I. I. FullName" + pattern = initialPattern + initialPattern + fullNamePattern; + re = new RegExp(pattern, "g"); + replacement = "$1" + initialSpace + "$3" + locale.space + "$5"; + string = string.replace(re, replacement); - // [3] Identify and replace pattern "I. I. I. FullName" - pattern = initialPattern + initialPattern + initialPattern + fullNamePattern; - re = new RegExp(pattern, "g"); - replacement = "$1" + initialSpace + "$3" + initialSpace + "$5" + locale.space + "$7"; - string = string.replace(re, replacement); + // [3] Identify and replace pattern "I. I. I. FullName" + pattern = initialPattern + initialPattern + initialPattern + fullNamePattern; + re = new RegExp(pattern, "g"); + replacement = "$1" + initialSpace + "$3" + initialSpace + "$5" + locale.space + "$7"; + string = string.replace(re, replacement); - return string; + return string; } /* - Fixes spaces between multiple-word abbreviations. - Each locale has its own pattern for fixing abbreviations, - please refer to the test suites. - - Algorithm - [1] Set locale-specific space between abbreviations - [2] Change multiple-word abbreviations from all locales abbr. patterns - [3] Identify and fix multiple-word abbreviations before the word - [4] Identify and fix multiple-word abbreviations after the word or on their own - - @param {string} input text for identification - @returns {string} corrected output + Fixes spaces between multiple-word abbreviations. + Each locale has its own pattern for fixing abbreviations, + please refer to the test suites. + + Algorithm + [1] Set locale-specific space between abbreviations + [2] Change multiple-word abbreviations from all locales abbr. patterns + [3] Identify and fix multiple-word abbreviations before the word + [4] Identify and fix multiple-word abbreviations after the word or on their own + + @param {string} input text for identification + @returns {string} corrected output */ export function fixMultipleWordAbbreviations(string, locale) { - /* Partial patterns for a composition */ - let patternPrecedingNonLatinBoundary = "([^" + locale.allChars + locale.enDash + locale.emDash + "]|^)"; - let patternFollowingWord = "([" + locale.allChars + "]|\\D)"; - let patternFollowingNonLatinBoundary = "([^" + locale.allChars + locale.leftDoubleQuote + locale.leftSingleQuote + locale.backtick + "\\p{Emoji}]|$)"; - - - - /* [1] Set locale-specific space between abbreviations */ - let abbrSpace = ""; - switch (locale.locale) { - case "en-us": - abbrSpace = ""; - break; - case "rue": - case "sk": - case "cs": - case "de-de": - abbrSpace = locale.nbsp; - break; - } - - - /* [2] Change multiple-word abbreviations from all locales abbr. patterns */ - let abbreviationPatterns = []; - for (let i = 0; i < locale.multipleWordAbbreviations.length; i++) { - let splitAbbreviation = locale.multipleWordAbbreviations[i].split(" "); - let abbrevationPattern = ""; - for (let j = 0; j < splitAbbreviation.length; j++) { - abbrevationPattern += "(" + splitAbbreviation[j] + ")(\\.)([" + locale.spaces + "]?)"; - } - abbreviationPatterns[i] = abbrevationPattern; - } - - /* [3] Identify multiple-word abbreviations before the word - - Algorithm as follows: - * build up pattern by setting preceding and following boundaries - * build replacement of concatenating - * preceding boundary - * n-1 word abbreviations where locale-specific space will be - * nth abbreviation the will follow with a normal space - * following boundary - */ - for (let i = 0; i < abbreviationPatterns.length; i++) { - let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingWord; - let re = new RegExp(pattern, "gi"); - - let replacement = "$1"; - let abbrCount = ((abbreviationPatterns[i].match(/\(/g) || []).length)/3; - for (let j = 0; j < abbrCount - 1; j++) { - replacement += "$" + (j*3+2) + "." + abbrSpace; - } - replacement += "$" + ((abbrCount - 1)*3+2) + ". $" + ((abbrCount)*3+2); - - string = string.replace(re, replacement); - } - - /* [4] Identify multiple-word abbreviations after the word - - Algorithm follows: - * build up pattern by setting preceding and following boundaries - * build replacement of concatenating - * preceding boundary - * n-1 word abbreviations where locale-specific space will be - * nth abbreviation the will follow with no space - * following boundary - */ - for (let i = 0; i < abbreviationPatterns.length; i++) { - let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingNonLatinBoundary; - let re = new RegExp(pattern, "giu"); - - let replacement = "$1"; - let abbrCount = ((abbreviationPatterns[i].match(/\(/g) || []).length)/3; - for (let j = 0; j < abbrCount - 1; j++) { - replacement += "$" + (j*3+2) + "." + abbrSpace; - } - replacement += "$" + ((abbrCount - 1)*3+2) + ".$" + ((abbrCount)*3+2); - - string = string.replace(re, replacement); - } - - return string; + /* Partial patterns for a composition */ + let patternPrecedingNonLatinBoundary = "([^" + locale.allChars + locale.enDash + locale.emDash + "]|^)"; + let patternFollowingWord = "([" + locale.allChars + "]|\\D)"; + let patternFollowingNonLatinBoundary = "([^" + locale.allChars + locale.leftDoubleQuote + locale.leftSingleQuote + locale.backtick + "\\p{Emoji}]|$)"; + + + + /* [1] Set locale-specific space between abbreviations */ + let abbrSpace = ""; + switch (locale.locale) { + case "en-us": + abbrSpace = ""; + break; + case "rue": + case "sk": + case "cs": + case "de-de": + abbrSpace = locale.nbsp; + break; + } + + + /* [2] Change multiple-word abbreviations from all locales abbr. patterns */ + let abbreviationPatterns = []; + for (let i = 0; i < locale.multipleWordAbbreviations.length; i++) { + let splitAbbreviation = locale.multipleWordAbbreviations[i].split(" "); + let abbrevationPattern = ""; + for (let j = 0; j < splitAbbreviation.length; j++) { + abbrevationPattern += "(" + splitAbbreviation[j] + ")(\\.)([" + locale.spaces + "]?)"; + } + abbreviationPatterns[i] = abbrevationPattern; + } + + /* [3] Identify multiple-word abbreviations before the word + + Algorithm as follows: + * build up pattern by setting preceding and following boundaries + * build replacement of concatenating + * preceding boundary + * n-1 word abbreviations where locale-specific space will be + * nth abbreviation the will follow with a normal space + * following boundary + */ + for (let i = 0; i < abbreviationPatterns.length; i++) { + let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingWord; + let re = new RegExp(pattern, "gi"); + + let replacement = "$1"; + let abbrCount = ((abbreviationPatterns[i].match(/\(/g) || []).length)/3; + for (let j = 0; j < abbrCount - 1; j++) { + replacement += "$" + (j*3+2) + "." + abbrSpace; + } + replacement += "$" + ((abbrCount - 1)*3+2) + ". $" + ((abbrCount)*3+2); + + string = string.replace(re, replacement); + } + + /* [4] Identify multiple-word abbreviations after the word + + Algorithm follows: + * build up pattern by setting preceding and following boundaries + * build replacement of concatenating + * preceding boundary + * n-1 word abbreviations where locale-specific space will be + * nth abbreviation the will follow with no space + * following boundary + */ + for (let i = 0; i < abbreviationPatterns.length; i++) { + let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingNonLatinBoundary; + let re = new RegExp(pattern, "giu"); + + let replacement = "$1"; + let abbrCount = ((abbreviationPatterns[i].match(/\(/g) || []).length)/3; + for (let j = 0; j < abbrCount - 1; j++) { + replacement += "$" + (j*3+2) + "." + abbrSpace; + } + replacement += "$" + ((abbrCount - 1)*3+2) + ".$" + ((abbrCount)*3+2); + + string = string.replace(re, replacement); + } + + return string; } /* - Fixes spaces between single-word abbreviations. - Each locale has its own pattern for fixing abbreviations, - please refer to the test suites. + Fixes spaces between single-word abbreviations. + Each locale has its own pattern for fixing abbreviations, + please refer to the test suites. - Algorithm - [1] Change single-word abbreviations from all locales abbr. patterns - [2] Identify and fix single-word abbreviations before the word - [3] Identify and fix single-word abbreviations after the word or on their own + Algorithm + [1] Change single-word abbreviations from all locales abbr. patterns + [2] Identify and fix single-word abbreviations before the word + [3] Identify and fix single-word abbreviations after the word or on their own - @param {string} input text for identification - @returns {string} corrected output + @param {string} input text for identification + @returns {string} corrected output */ export function fixSingleWordAbbreviations(string, locale) { - /* [1] Change single-word abbreviations from all locales abbr. patterns */ - let abbreviationPatterns = []; - for (let i = 0; i < locale.singleWordAbbreviations.length; i++) { - abbreviationPatterns[i] = "(" + locale.singleWordAbbreviations[i] + ")(\\.)([" + locale.spaces + "]?)"; - } + /* [1] Change single-word abbreviations from all locales abbr. patterns */ + let abbreviationPatterns = []; + for (let i = 0; i < locale.singleWordAbbreviations.length; i++) { + abbreviationPatterns[i] = "(" + locale.singleWordAbbreviations[i] + ")(\\.)([" + locale.spaces + "]?)"; + } - /* [2] Identify single-word abbreviations before the word - */ - let patternPrecedingNonLatinBoundary = "([^" + locale.allChars + locale.enDash + locale.emDash + locale.nbsp + "\\.]|^)"; - let patternFollowingWord = "([" + locale.allChars + "\\d]+)([^\\.]|$)"; + /* [2] Identify single-word abbreviations before the word + */ + let patternPrecedingNonLatinBoundary = "([^" + locale.allChars + locale.enDash + locale.emDash + locale.nbsp + "\\.]|^)"; + let patternFollowingWord = "([" + locale.allChars + "\\d]+)([^\\.]|$)"; - for (let i = 0; i < abbreviationPatterns.length; i++) { - let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingWord; - let re = new RegExp(pattern, "gi"); - let replacement = "$1$2$3" + locale.nbsp + "$5$6"; + for (let i = 0; i < abbreviationPatterns.length; i++) { + let pattern = patternPrecedingNonLatinBoundary + abbreviationPatterns[i] + patternFollowingWord; + let re = new RegExp(pattern, "gi"); + let replacement = "$1$2$3" + locale.nbsp + "$5$6"; - string = string.replace(re, replacement); - } + string = string.replace(re, replacement); + } - /* [3] Identify single-word abbreviations after the word - */ - let patternPrecedingWord = "([" + locale.allChars + "\\d])([" + locale.spaces + "])"; - let patternFollowingNonLatinBoundary = "([^" + locale.spaces + locale.allChars + "\\d]|$)"; - for (let i = 0; i < abbreviationPatterns.length; i++) { - let pattern = patternPrecedingWord + abbreviationPatterns[i] + patternFollowingNonLatinBoundary; - let re = new RegExp(pattern, "gi"); - let replacement = "$1" + locale.nbsp + "$3$4$5$6"; + /* [3] Identify single-word abbreviations after the word + */ + let patternPrecedingWord = "([" + locale.allChars + "\\d])([" + locale.spaces + "])"; + let patternFollowingNonLatinBoundary = "([^" + locale.spaces + locale.allChars + "\\d]|$)"; + for (let i = 0; i < abbreviationPatterns.length; i++) { + let pattern = patternPrecedingWord + abbreviationPatterns[i] + patternFollowingNonLatinBoundary; + let re = new RegExp(pattern, "gi"); + let replacement = "$1" + locale.nbsp + "$3$4$5$6"; - string = string.replace(re, replacement); - } + string = string.replace(re, replacement); + } - return string; + return string; } export function fixAbbreviations(string, locale) { - string = fixInitials(string, locale); - string = fixMultipleWordAbbreviations(string, locale) - string = fixSingleWordAbbreviations(string, locale) + string = fixInitials(string, locale); + string = fixMultipleWordAbbreviations(string, locale) + string = fixSingleWordAbbreviations(string, locale) - return string; + return string; } diff --git a/src/modules/words/case.js b/src/modules/words/case.js index 0d9b377..7d9bf1c 100644 --- a/src/modules/words/case.js +++ b/src/modules/words/case.js @@ -1,38 +1,38 @@ /* - Corrects accidental uppercase + Corrects accidental uppercase - Best-effort function to fix most common accidental uppercase errors, namely: - [1] 2 first uppercase letters (ie. UPpercase) - [2] Swapped cases (ie. uPPERCASE) + Best-effort function to fix most common accidental uppercase errors, namely: + [1] 2 first uppercase letters (ie. UPpercase) + [2] Swapped cases (ie. uPPERCASE) - Algorithm does not fix other uppercase eventualities, - e.g. mixed case (UppERcaSe) as there are many cases for corporate brands - that could potentially match the algorithm as false positive. + Algorithm does not fix other uppercase eventualities, + e.g. mixed case (UppERcaSe) as there are many cases for corporate brands + that could potentially match the algorithm as false positive. - @param {string} string — input text for identification - @returns {string} — output with corrected accidental uppercase + @param {string} string — input text for identification + @returns {string} — output with corrected accidental uppercase */ export function fixCase(string, locale) { - /* [1] two first uppercase letters (i.e. UPpercase) */ - let pattern = "([^" + locale.allChars + "]|^)(["+ locale.uppercaseChars +"]{2})(["+ locale.lowercaseChars +"]{2,})"; - let re = new RegExp(pattern, "g"); + /* [1] two first uppercase letters (i.e. UPpercase) */ + let pattern = "([^" + locale.allChars + "]|^)(["+ locale.uppercaseChars +"]{2})(["+ locale.lowercaseChars +"]{2,})"; + let re = new RegExp(pattern, "g"); - string = string.replace(re, function($0, $1, $2, $3){ - return $1 + $2.substring(0,1) + $2.substring(1).toLowerCase() + $3; - }); + string = string.replace(re, function($0, $1, $2, $3){ + return $1 + $2.substring(0,1) + $2.substring(1).toLowerCase() + $3; + }); - /* [2] Swapped cases (n-letter cases, i.e. uPPERCASE) - There is one exception excluded from swapping → iOS - If needed, update this part of code to exclude the list of other popular names. - */ - pattern = "(\\b)(?!iOS)(["+ locale.lowercaseChars +"])(["+ locale.uppercaseChars +"]{2,})"; - re = new RegExp(pattern, "g"); - string = string.replace(re, function($0, $1, $2, $3){ + /* [2] Swapped cases (n-letter cases, i.e. uPPERCASE) + There is one exception excluded from swapping → iOS + If needed, update this part of code to exclude the list of other popular names. + */ + pattern = "(\\b)(?!iOS)(["+ locale.lowercaseChars +"])(["+ locale.uppercaseChars +"]{2,})"; + re = new RegExp(pattern, "g"); + string = string.replace(re, function($0, $1, $2, $3){ return ($1 + $2.toUpperCase() + $3.toLowerCase()); - }); + }); - return string; + return string; } diff --git a/src/modules/words/pub-id.js b/src/modules/words/pub-id.js index f4ed057..8b67174 100644 --- a/src/modules/words/pub-id.js +++ b/src/modules/words/pub-id.js @@ -1,153 +1,153 @@ /* - Identifies wrongly formatted ISSN and corrects it - Wiki: https://en.wikipedia.org/wiki/International_Standard_Serial_Number + Identifies wrongly formatted ISSN and corrects it + Wiki: https://en.wikipedia.org/wiki/International_Standard_Serial_Number - Since the ISSN format is 0000-0000, the script will only catch ISSN - for correction if there is ISSN abbreviation placed before digits + Since the ISSN format is 0000-0000, the script will only catch ISSN + for correction if there is ISSN abbreviation placed before digits - Examples - ISSN 0000 - 0000 → ISSN 0000-0000 - issn 0000 - 0000 → ISSN 0000-0000 - ISSN 0000—0000 → ISSN 0000-0000 - ISSN: 0000 - 0000 → ISSN: 0000-0000 // the use of colon + Examples + ISSN 0000 - 0000 → ISSN 0000-0000 + issn 0000 - 0000 → ISSN 0000-0000 + ISSN 0000—0000 → ISSN 0000-0000 + ISSN: 0000 - 0000 → ISSN: 0000-0000 // the use of colon - @param {string} string — input text for identification - @returns {string} — output with correct ISSN format + @param {string} string — input text for identification + @returns {string} — output with correct ISSN format */ export function fixISSN(string, locale) { - let pattern = - "(issn)" - + "(:?)" - + "([" + locale.spaces + "]?)" - + "(\\d{4})" - + "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" - + "(\\d{4})"; - let re = new RegExp(pattern, "gi"); - let replacement = "ISSN$2" + locale.nbsp + "$4-$6"; - - return string.replace(re, replacement); + let pattern = + "(issn)" + + "(:?)" + + "([" + locale.spaces + "]?)" + + "(\\d{4})" + + "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" + + "(\\d{4})"; + let re = new RegExp(pattern, "gi"); + let replacement = "ISSN$2" + locale.nbsp + "$4-$6"; + + return string.replace(re, replacement); } /* - Identifies wrongly formatted ISBN10 and corrects it - Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe + Identifies wrongly formatted ISBN10 and corrects it + Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe - Since the ISBN10 format varies among publishers, the function will try - to catch possible variations + Since the ISBN10 format varies among publishers, the function will try + to catch possible variations - Examples - Isbn 80- 902734—1-6 → ISBN 80-902734-1-6 - Isbn 80- 902734—1-6 → ISBN 80-902734-1-6 - Isbn: 0-9752298-0-X → ISBN: 0-9752298-0-X // the use of colon + Examples + Isbn 80- 902734—1-6 → ISBN 80-902734-1-6 + Isbn 80- 902734—1-6 → ISBN 80-902734-1-6 + Isbn: 0-9752298-0-X → ISBN: 0-9752298-0-X // the use of colon - @param {string} string — input text for identification - @returns {string} — output with correct ISBN format + @param {string} string — input text for identification + @returns {string} — output with correct ISBN format */ export function fixISBN10(string, locale) { - let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" - let pattern = - "(isbn)" - + "(:?)" - + "([" + locale.spaces + "]?)" - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(X|\\d+)"; - let re = new RegExp(pattern, "gi"); - let replacement = "ISBN$2" + locale.nbsp + "$4-$6-$8-$10"; - - return string.replace(re, replacement); + let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" + let pattern = + "(isbn)" + + "(:?)" + + "([" + locale.spaces + "]?)" + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(X|\\d+)"; + let re = new RegExp(pattern, "gi"); + let replacement = "ISBN$2" + locale.nbsp + "$4-$6-$8-$10"; + + return string.replace(re, replacement); } /* - Identifies wrongly formatted ISBN13 and corrects it - Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe + Identifies wrongly formatted ISBN13 and corrects it + Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe - Since the ISBN13 format varies among publishers, the function will try - to catch possible variations + Since the ISBN13 format varies among publishers, the function will try + to catch possible variations - Examples - Isbn 978-80- 902734—1-6 → ISBN 80-902734-1-6 - Isbn 978-80- 902734—1-6 → ISBN 80-902734-1-6 - Isbn: 978-0-9752298-0-X → ISBN: 0-9752298-0-X // the use of colon + Examples + Isbn 978-80- 902734—1-6 → ISBN 80-902734-1-6 + Isbn 978-80- 902734—1-6 → ISBN 80-902734-1-6 + Isbn: 978-0-9752298-0-X → ISBN: 0-9752298-0-X // the use of colon - @param {string} string — input text for identification - @returns {string} — output with correct ISBN format + @param {string} string — input text for identification + @returns {string} — output with correct ISBN format */ export function fixISBN13(string, locale) { - let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" - let pattern = - "(isbn)" - + "(:?)" - + "([" + locale.spaces + "]?)" - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(X|\\d+)"; - let re = new RegExp(pattern, "gi"); - let replacement = "ISBN$2" + locale.nbsp + "$4-$6-$8-$10-$12"; - - return string.replace(re, replacement); + let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" + let pattern = + "(isbn)" + + "(:?)" + + "([" + locale.spaces + "]?)" + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(X|\\d+)"; + let re = new RegExp(pattern, "gi"); + let replacement = "ISBN$2" + locale.nbsp + "$4-$6-$8-$10-$12"; + + return string.replace(re, replacement); } /* - Identifies wrongly formatted ISBN13 number and corrects it - Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe + Identifies wrongly formatted ISBN13 number and corrects it + Wiki: https://en.wikipedia.org/wiki/International_Standard_Book_Numbe - When ISBN number is standalone, it fixes hyphens and spaces in between. + When ISBN number is standalone, it fixes hyphens and spaces in between. - Examples - 978-80- 902734—1-6 → 80-902734-1-6 - 978-80- 902734—1-6 → 80-902734-1-6 - 978-0-9752298- 0-X → 0-9752298-0-X // the use of colon + Examples + 978-80- 902734—1-6 → 80-902734-1-6 + 978-80- 902734—1-6 → 80-902734-1-6 + 978-0-9752298- 0-X → 0-9752298-0-X // the use of colon - @param {string} string — input text for identification - @returns {string} — output with correct ISBN format + @param {string} string — input text for identification + @returns {string} — output with correct ISBN format */ export function fixISBNnumber(string, locale) { - let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" - let pattern = - "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(\\d+)" - + dashedSpace - + "(X|\\d+?)"; - let re = new RegExp(pattern, "g"); - let replacement = "$1-$3-$5-$7-$9"; - - return string.replace(re, replacement); + let dashedSpace = "([" + locale.spaces + "]?[" + locale.hyphen + locale.enDash + locale.emDash + "][" + locale.spaces + "]?)" + let pattern = + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(\\d+)" + + dashedSpace + + "(X|\\d+?)"; + let re = new RegExp(pattern, "g"); + let replacement = "$1-$3-$5-$7-$9"; + + return string.replace(re, replacement); } /* - Fixes publication identifiers — ISSN, ISBN + Fixes publication identifiers — ISSN, ISBN - @param {string} string — input text for identification - @returns {string} — output with fixed publication identifiers + @param {string} string — input text for identification + @returns {string} — output with fixed publication identifiers */ export function fixPubId(string, locale) { - string = fixISSN(string, locale) - string = fixISBN10(string, locale) - string = fixISBN13(string, locale) - string = fixISBNnumber(string, locale) + string = fixISSN(string, locale) + string = fixISBN10(string, locale) + string = fixISBN13(string, locale) + string = fixISBNnumber(string, locale) - return string; + return string; } diff --git a/src/typopo.js b/src/typopo.js index a827945..b2923cc 100644 --- a/src/typopo.js +++ b/src/typopo.js @@ -24,69 +24,69 @@ import {fixAbbreviations} from "./modules/words/abbreviations"; import {fixCase} from "./modules/words/case"; import {fixPubId} from "./modules/words/pub-id"; import {excludeExceptions, - placeExceptions} from "./modules/words/exceptions"; + placeExceptions} from "./modules/words/exceptions"; /* - Correct typos + Correct typos - @param {string} string — input text for correction - @param {locale} string — (optional, default: en) supported languages: en, sk, cs, rue. - @param {configuration} object — (optional) configuration - @returns {string} corrected output + @param {string} string — input text for correction + @param {locale} string — (optional, default: en) supported languages: en, sk, cs, rue. + @param {configuration} object — (optional) configuration + @returns {string} corrected output */ export function fixTypos(string, locale, configuration) { - locale = (typeof locale === "undefined") ? "en-us" : locale; + locale = (typeof locale === "undefined") ? "en-us" : locale; - let currentLocale = new Locale(locale); + let currentLocale = new Locale(locale); - configuration = (typeof configuration === "undefined") ? { + configuration = (typeof configuration === "undefined") ? { removeLines : true, removeWhitespacesBeforeMarkdownList : true, keepMarkdownCodeBlocks : false, - } : configuration; + } : configuration; - // exclude exceptions from fixing + // exclude exceptions from fixing const { processedText, exceptions } = excludeExceptions(string, currentLocale); string = processedText; - if(configuration.removeLines) { - string = removeEmptyLines(string); - } + if(configuration.removeLines) { + string = removeEmptyLines(string); + } - // ellipsis (since it can have different spacing around, it has to go before spaces cleanup) - string = fixEllipsis(string, currentLocale); + // ellipsis (since it can have different spacing around, it has to go before spaces cleanup) + string = fixEllipsis(string, currentLocale); - // spaces cleanup - string = fixSpaces(string, currentLocale, configuration); + // spaces cleanup + string = fixSpaces(string, currentLocale, configuration); - // punctuation - string = fixPeriod(string); - string = fixDash(string, currentLocale); - string = fixHyphen(string, currentLocale); - string = fixSingleQuotesPrimesAndApostrophes(string, currentLocale, configuration); - string = fixDoubleQuotesAndPrimes(string, currentLocale, configuration); + // punctuation + string = fixPeriod(string); + string = fixDash(string, currentLocale); + string = fixHyphen(string, currentLocale); + string = fixSingleQuotesPrimesAndApostrophes(string, currentLocale, configuration); + string = fixDoubleQuotesAndPrimes(string, currentLocale, configuration); - // symbols - string = fixMultiplicationSign(string, currentLocale); - string = fixSectionSign(string, currentLocale); - string = fixCopyrights(string, currentLocale); - string = fixPlusMinus(string, currentLocale); - string = fixMarks(string, currentLocale); - string = fixExponents(string, currentLocale); - string = fixNumberSign(string, currentLocale); + // symbols + string = fixMultiplicationSign(string, currentLocale); + string = fixSectionSign(string, currentLocale); + string = fixCopyrights(string, currentLocale); + string = fixPlusMinus(string, currentLocale); + string = fixMarks(string, currentLocale); + string = fixExponents(string, currentLocale); + string = fixNumberSign(string, currentLocale); - // words - string = fixCase(string, currentLocale); - string = fixAbbreviations(string, currentLocale); - string = fixPubId(string, currentLocale); + // words + string = fixCase(string, currentLocale); + string = fixAbbreviations(string, currentLocale); + string = fixPubId(string, currentLocale); - // spaces - string = fixNbsp(string, currentLocale); + // spaces + string = fixNbsp(string, currentLocale); - // place excluded exceptions - string = placeExceptions(string, exceptions); + // place excluded exceptions + string = placeExceptions(string, exceptions); return string; } diff --git a/tests/integration/typopo.test.js b/tests/integration/typopo.test.js index 4355325..1602f9e 100644 --- a/tests/integration/typopo.test.js +++ b/tests/integration/typopo.test.js @@ -4,60 +4,60 @@ import assert from 'assert'; describe('Test consistency of internal variables', () => { let testCase = { - /* - We are using temporary {variables} in curly brackets as text replacement - in some functions. Make sure that variables in curly brackets do not change - in course of running algorithm. - */ - "{{test-variable}}": "{{test-variable}}", - "{{test-variable}} at the beginning of the sentence.": "{{test-variable}} at the beginning of the sentence.", - "And {{test-variable}} in the middle of the sentence.": "And {{test-variable}} in the middle of the sentence.", - }; - - Object.keys(testCase).forEach((key) => { - it("", () => { - assert.strictEqual(fixTypos(key, "en-us"), testCase[key]); - }); - }); + /* + We are using temporary {variables} in curly brackets as text replacement + in some functions. Make sure that variables in curly brackets do not change + in course of running algorithm. + */ + "{{test-variable}}": "{{test-variable}}", + "{{test-variable}} at the beginning of the sentence.": "{{test-variable}} at the beginning of the sentence.", + "And {{test-variable}} in the middle of the sentence.": "And {{test-variable}} in the middle of the sentence.", + }; + + Object.keys(testCase).forEach((key) => { + it("", () => { + assert.strictEqual(fixTypos(key, "en-us"), testCase[key]); + }); + }); }); describe('Test that exceptions remain intact', () => { - let testCase = { + let testCase = { - /* - Exceptions + /* + Exceptions - This is list of exceptions that we want skip while correcting errors, - namely: - [1] URL address - [2] IP address - [3] Email adress + This is list of exceptions that we want skip while correcting errors, + namely: + [1] URL address + [2] IP address + [3] Email adress - Sidenote: List of tests is incomplete, however to identify - all kinds of URLs, IPs or emails, we’re adapting following implementation: - http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.0_r1/android/text/util/Regex.java#Regex.0WEB_URL_PATTERN - */ + Sidenote: List of tests is incomplete, however to identify + all kinds of URLs, IPs or emails, we’re adapting following implementation: + http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.0_r1/android/text/util/Regex.java#Regex.0WEB_URL_PATTERN + */ - // [1] URL address - "www.tota.sk": "www.tota.sk", - "http://www.tota.sk": "http://www.tota.sk", + // [1] URL address + "www.tota.sk": "www.tota.sk", + "http://www.tota.sk": "http://www.tota.sk", - // [2] IP address - "127.0.0.1": "127.0.0.1", + // [2] IP address + "127.0.0.1": "127.0.0.1", - // [3] Email address - "mail@domain.com": "mail@domain.com", + // [3] Email address + "mail@domain.com": "mail@domain.com", - // test order of replacements - "www.tota.sk and 127.0.0.1 and mail@domain.com": "www.tota.sk and 127.0.0.1 and mail@domain.com", + // test order of replacements + "www.tota.sk and 127.0.0.1 and mail@domain.com": "www.tota.sk and 127.0.0.1 and mail@domain.com", - }; + }; - Object.keys(testCase).forEach((key) => { - it("", () => { - assert.strictEqual(fixTypos(key, "en-us"), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("", () => { + assert.strictEqual(fixTypos(key, "en-us"), testCase[key]); + }); + }); }); @@ -84,17 +84,17 @@ let configKeepMarkdownCodeBlocks = { /* test cases */ let testModules = { - // ellipsis - "Sentence ..….. another sentence": "Sentence … another sentence", - "Sentence ended. … and we were there.": "Sentence ended. …and we were there.", + // ellipsis + "Sentence ..….. another sentence": "Sentence … another sentence", + "Sentence ended. … and we were there.": "Sentence ended. …and we were there.", - // hyphen - "e- shop": "e-shop", + // hyphen + "e- shop": "e-shop", - // section sign - "under Law §1782": "under Law § 1782", - // copyright - "Company (c)2017": "Company © 2017", + // section sign + "under Law §1782": "under Law § 1782", + // copyright + "Company (c)2017": "Company © 2017", "( c ) 2017": "© 2017", "( c ) 2017": "© 2017", "( c )2017": "© 2017", @@ -104,12 +104,12 @@ let testModules = { "Company (c) 2017": "Company © 2017", "Company © 2017": "Company © 2017", - // exponents - "100 km3": "100 km³", - // plus-minus - "+-": "±", - // sound recording copyright - "Company (p)2017": "Company ℗ 2017", + // exponents + "100 km3": "100 km³", + // plus-minus + "+-": "±", + // sound recording copyright + "Company (p)2017": "Company ℗ 2017", "( p ) 2017": "℗ 2017", "( p ) 2017": "℗ 2017", "( p )2017": "℗ 2017", @@ -118,24 +118,24 @@ let testModules = { "Company (p) 2017": "Company ℗ 2017", "Company (p) 2017": "Company ℗ 2017", "Company ℗ 2017": "Company ℗ 2017", - //registered trademark - "Company (r)": "Company®", - "Company ( r )": "Company®", + //registered trademark + "Company (r)": "Company®", + "Company ( r )": "Company®", //service trademark - "Company (sm)": "Company℠", - "Company ( sm )": "Company℠", - // trademark - "Company (tm)": "Company™", - "Company ( tm )": "Company™", - // number sign - "word # 9": "word #9", - - // spaces - "Sentence and… ?": "Sentence and…?", - "🥳 word 🥳 word 🥳": "🥳 word 🥳 word 🥳", - "🥳 word 🥳 word 🥳": "🥳 word 🥳 word 🥳", - // nbsp - "v a v a v": "v a v a v", + "Company (sm)": "Company℠", + "Company ( sm )": "Company℠", + // trademark + "Company (tm)": "Company™", + "Company ( tm )": "Company™", + // number sign + "word # 9": "word #9", + + // spaces + "Sentence and… ?": "Sentence and…?", + "🥳 word 🥳 word 🥳": "🥳 word 🥳 word 🥳", + "🥳 word 🥳 word 🥳": "🥳 word 🥳 word 🥳", + // nbsp + "v a v a v": "v a v a v", "The product X is missing the feature Y.": "The product X is missing the feature Y.", @@ -159,18 +159,18 @@ let testModules = { "sentence {brackets} A-player" : "sentence {brackets} A-player", "A × A" : "A × A", - // "the U.S. and" : "the U.S. and", not yet supported + // "the U.S. and" : "the U.S. and", not yet supported - //case - CMSko: "CMSko", - cAPSLOCK: "Capslock", + //case + CMSko: "CMSko", + cAPSLOCK: "Capslock", - // publication identifiers - "ISSN 0000-0000": "ISSN 0000-0000", - "ISBN: 978-80-86102-81-8": "ISBN: 978-80-86102-81-8", + // publication identifiers + "ISSN 0000-0000": "ISSN 0000-0000", + "ISBN: 978-80-86102-81-8": "ISBN: 978-80-86102-81-8", - // double primes - 'It’s 12" x 12".': "It’s 12″ × 12″.", + // double primes + 'It’s 12" x 12".': "It’s 12″ × 12″.", }; let testRemoveLines = { @@ -281,16 +281,16 @@ let testModuleSingleQuotesRue = { let testModuleAbbreviationsEnUs = { - // abbreviations - "(e.g.)": "(e.g.)", - "a.m.": "a.m.", - "5 a.m.": "5 a.m.", - "CH. CH. CH. Lambert": "CH.CH.CH. Lambert", - "the U.S.": "the U.S.", - "e.g. 🥳": "e.g. 🥳", - "i. e. 🥳": "i.e. 🥳", - // punctuation trimming - "č., s., fol., e.g., i.e., str.,": "č., s., fol., e.g., i.e., str.,", + // abbreviations + "(e.g.)": "(e.g.)", + "a.m.": "a.m.", + "5 a.m.": "5 a.m.", + "CH. CH. CH. Lambert": "CH.CH.CH. Lambert", + "the U.S.": "the U.S.", + "e.g. 🥳": "e.g. 🥳", + "i. e. 🥳": "i.e. 🥳", + // punctuation trimming + "č., s., fol., e.g., i.e., str.,": "č., s., fol., e.g., i.e., str.,", }; let testModuleAbbreviationsDeDe = { @@ -342,29 +342,29 @@ let testModuleNbsp = { "A × A" : "A × A", // false positive for filenames - "url-to-image-5.jpg" : - "url-to-image-5.jpg", + "url-to-image-5.jpg" : + "url-to-image-5.jpg", - "url_to_image_5.jpg" : - "url_to_image_5.jpg", + "url_to_image_5.jpg" : + "url_to_image_5.jpg", - "url%to%image%5.jpg" : - "url%to%image%5.jpg", + "url%to%image%5.jpg" : + "url%to%image%5.jpg", - "url to image 5.jpg" : - "url to image 5.jpg", + "url to image 5.jpg" : + "url to image 5.jpg", - "URL-TO-IMAGE-5.JPG" : - "URL-TO-IMAGE-5.JPG", + "URL-TO-IMAGE-5.JPG" : + "URL-TO-IMAGE-5.JPG", - "URL_TO_IMAGE_5.JPG" : - "URL_TO_IMAGE_5.JPG", + "URL_TO_IMAGE_5.JPG" : + "URL_TO_IMAGE_5.JPG", - "URL%TO%IMAGE%5.JPG" : - "URL%TO%IMAGE%5.JPG", + "URL%TO%IMAGE%5.JPG" : + "URL%TO%IMAGE%5.JPG", - "URL TO IMAGE 5.JPG" : - "URL TO IMAGE 5.JPG", + "URL TO IMAGE 5.JPG" : + "URL TO IMAGE 5.JPG", } let testModuleNbspEnUs = { @@ -433,14 +433,14 @@ let testModuleCombinations = { }; describe('Tests that all modules are plugged for en-us', () => { - let testCase = { + let testCase = { ...testModules, ...testModuleCombinations, ...testModuleDoubleQuotesEnUs, ...testModuleSingleQuotesEnUs, ...testModuleAbbreviationsEnUs, ...testModuleNbspEnUs, - }; + }; let testCaseDefault = { ...testCase, @@ -448,8 +448,8 @@ describe('Tests that all modules are plugged for en-us', () => { ...testRemoveWhitespacesBeforeMarkdownList } - Object.keys(testCaseDefault).forEach((key) => { - it("integration test w config: default", () => { + Object.keys(testCaseDefault).forEach((key) => { + it("integration test w config: default", () => { assert.strictEqual(fixTypos(key, "en-us", configDefault), testCaseDefault[key]); }); }); @@ -665,33 +665,33 @@ describe('Tests that all modules are plugged for rue', () => { describe('Test if markdown ticks are kept (integration test) (en-us):\n', () => { - let testCase = { - "```\ncode\n```": "```\ncode\n```", + let testCase = { + "```\ncode\n```": "```\ncode\n```", - "``code``": "``code``", + "``code``": "``code``", - "``code code``": "``code code``", + "``code code``": "``code code``", - "``code`` ``code``": "``code`` ``code``", + "``code`` ``code``": "``code`` ``code``", - "`code`": "`code`", + "`code`": "`code`", - "`code code`": "`code code`", + "`code code`": "`code code`", - "`code` `code`": "`code` `code`", + "`code` `code`": "`code` `code`", - "e.g. `something`": "e.g. `something`", - }; + "e.g. `something`": "e.g. `something`", + }; - Object.keys(testCase).forEach((key) => { + Object.keys(testCase).forEach((key) => { - it("keepMarkdownCodeBlocks: true” configuration", () => { - assert.strictEqual( - fixTypos( - key, - "en-us", - configKeepMarkdownCodeBlocks - ), testCase[key]); - }); - }); + it("keepMarkdownCodeBlocks: true” configuration", () => { + assert.strictEqual( + fixTypos( + key, + "en-us", + configKeepMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); \ No newline at end of file diff --git a/tests/punctuation/dash.test.js b/tests/punctuation/dash.test.js index 03bca02..0a301bf 100644 --- a/tests/punctuation/dash.test.js +++ b/tests/punctuation/dash.test.js @@ -1,38 +1,38 @@ import {replaceThreeHyphensWithEmDash, - replaceTwoHyphensWithEnDash, - identifySpacedHyphen, - fixDashesBetweenWords, - fixHyphenBetweenWordAndPunctuation, - fixDashBetweenCardinalNumbers, - fixDashBetweenPercentageRange, - fixDashBetweenOrdinalNumbers, - fixDash} from "../../src/modules/punctuation/dash"; + replaceTwoHyphensWithEnDash, + identifySpacedHyphen, + fixDashesBetweenWords, + fixHyphenBetweenWordAndPunctuation, + fixDashBetweenCardinalNumbers, + fixDashBetweenPercentageRange, + fixDashBetweenOrdinalNumbers, + fixDash} from "../../src/modules/punctuation/dash"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Replace 3 hyphens with an em dash\n', () => { - let testCase = { - "and --- she said": "and — she said", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(replaceThreeHyphensWithEmDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "and --- she said": "and — she said", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(replaceThreeHyphensWithEmDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Replace 2 hyphens with an en dash\n', () => { - let testCase = { - "and -- she said": "and – she said", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(replaceTwoHyphensWithEnDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "and -- she said": "and – she said", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(replaceTwoHyphensWithEnDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); @@ -40,270 +40,270 @@ describe('Replace 2 hyphens with an en dash\n', () => { describe('Identify a spaced hyphen between words (en-us, sk, cs, rue, de-de)\n', () => { - let testCase = { - - "word - word" : "word {{typopo__spacedHyphen}} word", - "word - word" : "word {{typopo__spacedHyphen}} word", - "word - word" : "word {{typopo__spacedHyphen}} word", //nbsp - "word - word" : "word {{typopo__spacedHyphen}} word", //hairSpace - "word - word" : "word {{typopo__spacedHyphen}} word", //narrowNbsp - "ptaškŷ -  čadič" : "ptaškŷ {{typopo__spacedHyphen}} čadič", // non-latin chars - "хотїв - нияке" : "хотїв {{typopo__spacedHyphen}} нияке", // non-latin chars - - /* - False positive: compound words - */ - "e -shop" : "e -shop", - "e- shop" : "e- shop", - "e- shop" : "e- shop", //nbsp - "e- shop" : "e- shop", //hairSpace - "e- shop" : "e- shop", //narrowNbsp - - - /* - False positive: hyphen at the beginning of the paragraph - */ + let testCase = { + + "word - word" : "word {{typopo__spacedHyphen}} word", + "word - word" : "word {{typopo__spacedHyphen}} word", + "word - word" : "word {{typopo__spacedHyphen}} word", //nbsp + "word - word" : "word {{typopo__spacedHyphen}} word", //hairSpace + "word - word" : "word {{typopo__spacedHyphen}} word", //narrowNbsp + "ptaškŷ -  čadič" : "ptaškŷ {{typopo__spacedHyphen}} čadič", // non-latin chars + "хотїв - нияке" : "хотїв {{typopo__spacedHyphen}} нияке", // non-latin chars + + /* + False positive: compound words + */ + "e -shop" : "e -shop", + "e- shop" : "e- shop", + "e- shop" : "e- shop", //nbsp + "e- shop" : "e- shop", //hairSpace + "e- shop" : "e- shop", //narrowNbsp + + + /* + False positive: hyphen at the beginning of the paragraph + */ "- she said": "- she said", " - she said": " - she said", " - she said": " - she said", "\t- she said": "\t- she said", "\t\t- she said": "\t\t- she said", - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test (en-us)", () => { - assert.strictEqual(identifySpacedHyphen(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test (en-us)", () => { + assert.strictEqual(identifySpacedHyphen(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix a dash, an en dash, an em dash and spacing between words (en-us)\n', () => { - let testCase = { + let testCase = { "and {{typopo__spacedHyphen}} she said": "and—she said", - "and – she said": "and—she said", - "and – she said": "and—she said", - "and — she said": "and—she said", - "and — she said": "and—she said", - "and — she said": "and—she said", //mixed spaces - "and— she said": "and—she said", //mixed spaces - "and —she said": "and—she said", - "and—she said": "and—she said", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixDashesBetweenWords(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); - }); - }); + "and – she said": "and—she said", + "and – she said": "and—she said", + "and — she said": "and—she said", + "and — she said": "and—she said", + "and — she said": "and—she said", //mixed spaces + "and— she said": "and—she said", //mixed spaces + "and —she said": "and—she said", + "and—she said": "and—she said", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixDashesBetweenWords(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix a dash, an en dash, an em dash and spacing between words (rue, sk)\n', () => { - let testCase = { + let testCase = { "ptaškŷ {{typopo__spacedHyphen}} čadič": "ptaškŷ — čadič", "ptaškŷ {{typopo__spacedHyphen}} čadič": "ptaškŷ — čadič", - "ptaškŷ – čadič": "ptaškŷ — čadič", - "ptaškŷ – čadič": "ptaškŷ — čadič", - "ptaškŷ — čadič": "ptaškŷ — čadič", - "ptaškŷ — čadič": "ptaškŷ — čadič", - "ptaškŷ — čadič": "ptaškŷ — čadič", //mixed spaces - "ptaškŷ— čadič": "ptaškŷ — čadič", //mixed spaces - "ptaškŷ —čadič": "ptaškŷ — čadič", - "ptaškŷ—čadič": "ptaškŷ — čadič", + "ptaškŷ – čadič": "ptaškŷ — čadič", + "ptaškŷ – čadič": "ptaškŷ — čadič", + "ptaškŷ — čadič": "ptaškŷ — čadič", + "ptaškŷ — čadič": "ptaškŷ — čadič", + "ptaškŷ — čadič": "ptaškŷ — čadič", //mixed spaces + "ptaškŷ— čadič": "ptaškŷ — čadič", //mixed spaces + "ptaškŷ —čadič": "ptaškŷ — čadič", + "ptaškŷ—čadič": "ptaškŷ — čadič", "хотїв {{typopo__spacedHyphen}} нияке": "хотїв — нияке", "хотїв {{typopo__spacedHyphen}} нияке": "хотїв — нияке", - "хотїв – нияке": "хотїв — нияке", - "хотїв – нияке": "хотїв — нияке", - "хотїв — нияке": "хотїв — нияке", - "хотїв — нияке": "хотїв — нияке", - "хотїв — нияке": "хотїв — нияке", //mixed spaces - "хотїв— нияке": "хотїв — нияке", //mixed spaces - "хотїв —нияке": "хотїв — нияке", - "хотїв—нияке": "хотїв — нияке", - - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test (rue)", () => { - assert.strictEqual(fixDashesBetweenWords(key, new Locale("rue")), testCase[key]); - }); - it("unit test (sk)", () => { - assert.strictEqual(fixDashesBetweenWords(key, new Locale("sk")), testCase[key]); - }); - it("module test (rue)", () => { - assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); - }); - it("module test (sk)", () => { - assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); - }); - }); + "хотїв – нияке": "хотїв — нияке", + "хотїв – нияке": "хотїв — нияке", + "хотїв — нияке": "хотїв — нияке", + "хотїв — нияке": "хотїв — нияке", + "хотїв — нияке": "хотїв — нияке", //mixed spaces + "хотїв— нияке": "хотїв — нияке", //mixed spaces + "хотїв —нияке": "хотїв — нияке", + "хотїв—нияке": "хотїв — нияке", + + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test (rue)", () => { + assert.strictEqual(fixDashesBetweenWords(key, new Locale("rue")), testCase[key]); + }); + it("unit test (sk)", () => { + assert.strictEqual(fixDashesBetweenWords(key, new Locale("sk")), testCase[key]); + }); + it("module test (rue)", () => { + assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); + }); + it("module test (sk)", () => { + assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); + }); + }); }); describe('Fix a dash, an en dash, an em dash and spacing between words (cs)\n', () => { - let testCase = { + let testCase = { "domů {{typopo__spacedHyphen}} čadič": "domů – čadič", "domů {{typopo__spacedHyphen}} čadič": "domů – čadič", - "domů – čadič": "domů – čadič", - "domů – čadič": "domů – čadič", - "domů — čadič": "domů – čadič", - "domů — čadič": "domů – čadič", - "domů — čadič": "domů – čadič", //mixed spaces - "domů— čadič": "domů – čadič", //mixed spaces - "domů —čadič": "domů – čadič", - "domů—čadič": "domů – čadič", - - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test (cs)", () => { - assert.strictEqual(fixDashesBetweenWords(key, new Locale("cs")), testCase[key]); - }); - it("module test (cs)", () => { - assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); - }); - }); + "domů – čadič": "domů – čadič", + "domů – čadič": "domů – čadič", + "domů — čadič": "domů – čadič", + "domů — čadič": "domů – čadič", + "domů — čadič": "domů – čadič", //mixed spaces + "domů— čadič": "domů – čadič", //mixed spaces + "domů —čadič": "domů – čadič", + "domů—čadič": "domů – čadič", + + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test (cs)", () => { + assert.strictEqual(fixDashesBetweenWords(key, new Locale("cs")), testCase[key]); + }); + it("module test (cs)", () => { + assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); + }); + }); }); describe('Fix a dash, an en dash, an em dash and spacing between words (de-de)\n', () => { - let testCase = { + let testCase = { "und {{typopo__spacedHyphen}} sie sagte": "und – sie sagte", "und {{typopo__spacedHyphen}} sie sagte": "und – sie sagte", - "und – sie sagte": "und – sie sagte", - "und – sie sagte": "und – sie sagte", - "und — sie sagte": "und – sie sagte", - "und — sie sagte": "und – sie sagte", - "und — sie sagte": "und – sie sagte", //mixed spaces - "und— sie sagte": "und – sie sagte", //mixed spaces - "und —sie sagte": "und – sie sagte", - "und—sie sagte": "und – sie sagte", - - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test (de-de)", () => { - assert.strictEqual(fixDashesBetweenWords(key, new Locale("de-de")), testCase[key]); - }); - it("module test (de-de)", () => { - assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); - }); - }); + "und – sie sagte": "und – sie sagte", + "und – sie sagte": "und – sie sagte", + "und — sie sagte": "und – sie sagte", + "und — sie sagte": "und – sie sagte", + "und — sie sagte": "und – sie sagte", //mixed spaces + "und— sie sagte": "und – sie sagte", //mixed spaces + "und —sie sagte": "und – sie sagte", + "und—sie sagte": "und – sie sagte", + + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test (de-de)", () => { + assert.strictEqual(fixDashesBetweenWords(key, new Locale("de-de")), testCase[key]); + }); + it("module test (de-de)", () => { + assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); + }); + }); }); describe('Fix hyphen between word and punctuation (en-us)\n', () => { - let testCase = { - "so there is a dash -," : "so there is a dash—,", - "so there is a dash-," : "so there is a dash—,", - "so there is a dash -:" : "so there is a dash—:", - "so there is a dash -;" : "so there is a dash—;", - "so there is a dash -." : "so there is a dash—.", - "so there is a dash -?" : "so there is a dash—?", - "so there is a dash -!" : "so there is a dash—!", - "so there is a dash -\n" : "so there is a dash—\n", - - //false positives - "e-shop" : "e-shop", - "e- shop" : "e- shop", // this individual method shouldn't catch that - "+-" : "+-", - "{{test-variable}}" : "{{test-variable}}" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "so there is a dash -," : "so there is a dash—,", + "so there is a dash-," : "so there is a dash—,", + "so there is a dash -:" : "so there is a dash—:", + "so there is a dash -;" : "so there is a dash—;", + "so there is a dash -." : "so there is a dash—.", + "so there is a dash -?" : "so there is a dash—?", + "so there is a dash -!" : "so there is a dash—!", + "so there is a dash -\n" : "so there is a dash—\n", + + //false positives + "e-shop" : "e-shop", + "e- shop" : "e- shop", // this individual method shouldn't catch that + "+-" : "+-", + "{{test-variable}}" : "{{test-variable}}" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix hyphen between word and punctuation (sk, rue)\n', () => { - let testCase = { - "so there is a dash -," : "so there is a dash —,", //hairSpace - "so there is a dash -." : "so there is a dash —.", - "so there is a dash -\n" : "so there is a dash —\n", - - //false positives - "e-shop" : "e-shop", - "e- shop" : "e- shop", // this individual method shouldn't catch that - "+-" : "+-", - "{{test-variable}}" : "{{test-variable}}" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("sk")), testCase[key]); - assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("rue")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); - assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); - }); - }); + let testCase = { + "so there is a dash -," : "so there is a dash —,", //hairSpace + "so there is a dash -." : "so there is a dash —.", + "so there is a dash -\n" : "so there is a dash —\n", + + //false positives + "e-shop" : "e-shop", + "e- shop" : "e- shop", // this individual method shouldn't catch that + "+-" : "+-", + "{{test-variable}}" : "{{test-variable}}" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("sk")), testCase[key]); + assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("rue")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); + assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); + }); + }); }); describe('Fix hyphen between word and punctuation (cs)\n', () => { - let testCase = { - "so there is a dash -," : "so there is a dash –,", //nbsp + enDash - "so there is a dash -." : "so there is a dash –.", - "so there is a dash -\n" : "so there is a dash –\n", - - //false positives - "e-shop" : "e-shop", - "e- shop" : "e- shop", // this individual method shouldn't catch that - "+-" : "+-", - "{{test-variable}}" : "{{test-variable}}" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("cs")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); - }); - }); + let testCase = { + "so there is a dash -," : "so there is a dash –,", //nbsp + enDash + "so there is a dash -." : "so there is a dash –.", + "so there is a dash -\n" : "so there is a dash –\n", + + //false positives + "e-shop" : "e-shop", + "e- shop" : "e- shop", // this individual method shouldn't catch that + "+-" : "+-", + "{{test-variable}}" : "{{test-variable}}" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("cs")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); + }); + }); }); describe('Fix hyphen between word and punctuation (de-de)\n', () => { - let testCase = { - "so there is a dash -," : "so there is a dash –,", //hairSpace + enDash - "so there is a dash -." : "so there is a dash –.", - "so there is a dash -\n" : "so there is a dash –\n", - - //false positives - "e-shop" : "e-shop", - "e- shop" : "e- shop", // this individual method shouldn't catch that - "+-" : "+-", - "{{test-variable}}" : "{{test-variable}}" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("de-de")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); - }); - }); + let testCase = { + "so there is a dash -," : "so there is a dash –,", //hairSpace + enDash + "so there is a dash -." : "so there is a dash –.", + "so there is a dash -\n" : "so there is a dash –\n", + + //false positives + "e-shop" : "e-shop", + "e- shop" : "e- shop", // this individual method shouldn't catch that + "+-" : "+-", + "{{test-variable}}" : "{{test-variable}}" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixHyphenBetweenWordAndPunctuation(key, new Locale("de-de")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); + }); + }); }); @@ -311,133 +311,133 @@ describe('Fix hyphen between word and punctuation (de-de)\n', () => { describe('Fix dash between cardinal numbers\n', () => { - let testCase = { - "5-6 eggs": "5–6 eggs", - "15-16 eggs": "15–16 eggs", - "5 -6 eggs": "5–6 eggs", - "5- 6 eggs": "5–6 eggs", - "5 - 6 eggs": "5–6 eggs", - "5—6 eggs": "5–6 eggs", - "5-12″ long": "5–12″ long", - "In 5.25-10.75 range": "In 5.25–10.75 range", - "In 5,000.25-10,000.75 range": "In 5,000.25–10,000.75 range", - "v rozmedzí 5,25-10,75": "v rozmedzí 5,25–10,75", - "v rozmedzí 5 000,25-10 000,75": "v rozmedzí 5 000,25–10 000,75", - "2-3 Eier": "2–3 Eier", - "2 -3 Eier": "2–3 Eier", - "2- 3 Eier": "2–3 Eier", - "2 - 3 Eier": "2–3 Eier", - "2—3 Eier": "2–3 Eier", - "im Bereich von 5.000,25-10.000,75": "im Bereich von 5.000,25–10.000,75", - - // date formats - "2019-02-03" : "2019–02–03", - "2019 - 02 - 03" : "2019–02–03", - "2019- 02 -03" : "2019–02–03", - "2019-02" : "2019–02", - "2019 -02" : "2019–02", - "2019 - 02" : "2019–02", - "2019- 02" : "2019–02", - "19 - 02 - 03" : "19–02–03", - "19- 02 -03" : "19–02–03", - - //telephone numbers - "1–2–3" : "1–2–3", // correct - "1 – 2 – 3" : "1–2–3", - "1– 2 –3" : "1–2–3", - - "1-2-3" : "1–2–3", - "1 - 2 - 3" : "1–2–3", - "1- 2 -3" : "1–2–3", - - "1—2—3" : "1–2–3", - "1 — 2 — 3" : "1–2–3", - "1— 2 —3" : "1–2–3", - - "154-123-4567" : "154–123–4567" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixDashBetweenCardinalNumbers(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "5-6 eggs": "5–6 eggs", + "15-16 eggs": "15–16 eggs", + "5 -6 eggs": "5–6 eggs", + "5- 6 eggs": "5–6 eggs", + "5 - 6 eggs": "5–6 eggs", + "5—6 eggs": "5–6 eggs", + "5-12″ long": "5–12″ long", + "In 5.25-10.75 range": "In 5.25–10.75 range", + "In 5,000.25-10,000.75 range": "In 5,000.25–10,000.75 range", + "v rozmedzí 5,25-10,75": "v rozmedzí 5,25–10,75", + "v rozmedzí 5 000,25-10 000,75": "v rozmedzí 5 000,25–10 000,75", + "2-3 Eier": "2–3 Eier", + "2 -3 Eier": "2–3 Eier", + "2- 3 Eier": "2–3 Eier", + "2 - 3 Eier": "2–3 Eier", + "2—3 Eier": "2–3 Eier", + "im Bereich von 5.000,25-10.000,75": "im Bereich von 5.000,25–10.000,75", + + // date formats + "2019-02-03" : "2019–02–03", + "2019 - 02 - 03" : "2019–02–03", + "2019- 02 -03" : "2019–02–03", + "2019-02" : "2019–02", + "2019 -02" : "2019–02", + "2019 - 02" : "2019–02", + "2019- 02" : "2019–02", + "19 - 02 - 03" : "19–02–03", + "19- 02 -03" : "19–02–03", + + //telephone numbers + "1–2–3" : "1–2–3", // correct + "1 – 2 – 3" : "1–2–3", + "1– 2 –3" : "1–2–3", + + "1-2-3" : "1–2–3", + "1 - 2 - 3" : "1–2–3", + "1- 2 -3" : "1–2–3", + + "1—2—3" : "1–2–3", + "1 — 2 — 3" : "1–2–3", + "1— 2 —3" : "1–2–3", + + "154-123-4567" : "154–123–4567" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixDashBetweenCardinalNumbers(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix dash between percentage range\n', () => { - let testCase = { - "20%-30%" : "20%–30%", - "20% -30%" : "20%–30%", - "20% - 30%": "20%–30%", - "20%- 30%": "20%–30%", - - "20%–30%" : "20%–30%", - "20%—30%" : "20%–30%", - - "20 %-30 %" : "20 %–30 %", - "20 % -30 %" : "20 %–30 %", - "20 % - 30 %" : "20 %–30 %", - "20 %- 30 %" : "20 %–30 %", - - "20 ‰ - 30 ‰" : "20 ‰–30 ‰", - "20 ‱ - 30 ‱" : "20 ‱–30 ‱", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixDashBetweenPercentageRange(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "20%-30%" : "20%–30%", + "20% -30%" : "20%–30%", + "20% - 30%": "20%–30%", + "20%- 30%": "20%–30%", + + "20%–30%" : "20%–30%", + "20%—30%" : "20%–30%", + + "20 %-30 %" : "20 %–30 %", + "20 % -30 %" : "20 %–30 %", + "20 % - 30 %" : "20 %–30 %", + "20 %- 30 %" : "20 %–30 %", + + "20 ‰ - 30 ‰" : "20 ‰–30 ‰", + "20 ‱ - 30 ‱" : "20 ‱–30 ‱", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixDashBetweenPercentageRange(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix dash between ordinal numbers (en-us)\n', () => { - let testCase = { - "1st-5th August": "1st–5th August", - "1st -5th August": "1st–5th August", - "1st- 5th August": "1st–5th August", - "1st - 5th August": "1st–5th August", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "1st-5th August": "1st–5th August", + "1st -5th August": "1st–5th August", + "1st- 5th August": "1st–5th August", + "1st - 5th August": "1st–5th August", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix dash between ordinal numbers (rue, sk, cs, de)\n', () => { - let testCase = { - "1.-5. augusta": "1.–5. augusta", + let testCase = { + "1.-5. augusta": "1.–5. augusta", "1. -5. augusta": "1.–5. augusta", "1.- 5. augusta": "1.–5. augusta", "1. - 5. augusta": "1.–5. augusta", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("rue")), testCase[key]); - assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("sk")), testCase[key]); - assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("cs")), testCase[key]); - assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("de-de")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); - assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); - assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); - assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); - }); - }); + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("rue")), testCase[key]); + assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("sk")), testCase[key]); + assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("cs")), testCase[key]); + assert.strictEqual(fixDashBetweenOrdinalNumbers(key, new Locale("de-de")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixDash(key, new Locale("rue")), testCase[key]); + assert.strictEqual(fixDash(key, new Locale("sk")), testCase[key]); + assert.strictEqual(fixDash(key, new Locale("cs")), testCase[key]); + assert.strictEqual(fixDash(key, new Locale("de-de")), testCase[key]); + }); + }); }); diff --git a/tests/punctuation/double-quotes.test.js b/tests/punctuation/double-quotes.test.js index 1dcbdd7..adcf28b 100644 --- a/tests/punctuation/double-quotes.test.js +++ b/tests/punctuation/double-quotes.test.js @@ -1,19 +1,19 @@ import {removeExtraPunctuationBeforeQuotes, - removeExtraPunctuationAfterQuotes, - swapQuotesAndTerminalPunctuation, - identifyDoublePrimes, - identifyDoubleQuotePairs, - identifyStandaloneLeftDoubleQuote, - identifyStandaloneRightDoubleQuote, - removeUnidentifiedDoubleQuote, - replaceDoublePrimeWDoubleQuote, - placeLocaleDoubleQuotes, - removeExtraCommaAfterSentencePunctuation, - removeExtraSpacesAroundQuotes, - addSpaceBeforeLeftDoubleQuote, - addSpaceAfterRightDoubleQuote, - fixDoubleQuotesAndPrimes} - from "../../src/modules/punctuation/double-quotes"; + removeExtraPunctuationAfterQuotes, + swapQuotesAndTerminalPunctuation, + identifyDoublePrimes, + identifyDoubleQuotePairs, + identifyStandaloneLeftDoubleQuote, + identifyStandaloneRightDoubleQuote, + removeUnidentifiedDoubleQuote, + replaceDoublePrimeWDoubleQuote, + placeLocaleDoubleQuotes, + removeExtraCommaAfterSentencePunctuation, + removeExtraSpacesAroundQuotes, + addSpaceBeforeLeftDoubleQuote, + addSpaceAfterRightDoubleQuote, + fixDoubleQuotesAndPrimes} + from "../../src/modules/punctuation/double-quotes"; import assert from 'assert'; import Locale from "../../src/locale/locale"; @@ -29,98 +29,98 @@ let configKeepMarkdownCodeBlocks = { let testFalsePositives = { - "č., s., fol., str.," : - "č., s., fol., str.,", + "č., s., fol., str.," : + "č., s., fol., str.,", - "Byl to “Karel IV.”, ktery": - "Byl to “Karel IV.”, ktery", + "Byl to “Karel IV.”, ktery": + "Byl to “Karel IV.”, ktery", - "Hey.”": - "Hey.”", + "Hey.”": + "Hey.”", - "Because of this, it’s common to have “namespace pollution”, where completely unrelated code shares global variables.": - "Because of this, it’s common to have “namespace pollution”, where completely unrelated code shares global variables.", + "Because of this, it’s common to have “namespace pollution”, where completely unrelated code shares global variables.": + "Because of this, it’s common to have “namespace pollution”, where completely unrelated code shares global variables.", } let testModule = { - "He said: \"Here’s a 12\" record.\"" : - "He said: “Here’s a 12″ record.”", + "He said: \"Here’s a 12\" record.\"" : + "He said: “Here’s a 12″ record.”", - "He said: \"He was 12.\"": - "He said: “He was 12.”", + "He said: \"He was 12.\"": + "He said: “He was 12.”", - "He said: \"He was 12\". And then he added: \"Maybe he was 13\".": - "He said: “He was 12.” And then he added: “Maybe he was 13.”", + "He said: \"He was 12\". And then he added: \"Maybe he was 13\".": + "He said: “He was 12.” And then he added: “Maybe he was 13.”", - "So it’s 12\" × 12\", right?" : - "So it’s 12″ × 12″, right?", + "So it’s 12\" × 12\", right?" : + "So it’s 12″ × 12″, right?", - "An unquoted sentence.“And a quoted one.”": - "An unquoted sentence. “And a quoted one.”", + "An unquoted sentence.“And a quoted one.”": + "An unquoted sentence. “And a quoted one.”", - "\"quoted material\" and \"extra": - "“quoted material” and “extra", + "\"quoted material\" and \"extra": + "“quoted material” and “extra", - "It was like “namespace pollution”.": - "It was like “namespace pollution”.", + "It was like “namespace pollution”.": + "It was like “namespace pollution”.", - "English „English„ „English„ English": - "English “English” “English” English", + "English „English„ „English„ English": + "English “English” “English” English", - "“English double quotation marks“": - "“English double quotation marks”", + "“English double quotation marks“": + "“English double quotation marks”", - "”English double quotation marks”": - "“English double quotation marks”", + "”English double quotation marks”": + "“English double quotation marks”", - "\"English double quotation marks\"": - "“English double quotation marks”", + "\"English double quotation marks\"": + "“English double quotation marks”", - "\"Conference 2020\" and \"something in quotes\"." : - "“Conference 2020” and “something in quotes”.", + "\"Conference 2020\" and \"something in quotes\"." : + "“Conference 2020” and “something in quotes”.", - "Here are 30 \"bucks\"": - "Here are 30 “bucks”", + "Here are 30 \"bucks\"": + "Here are 30 “bucks”", - "Within double quotes “there are single ‘quotes with mixed punctuation’, you see.”": - "Within double quotes “there are single ‘quotes with mixed punctuation’, you see”.", + "Within double quotes “there are single ‘quotes with mixed punctuation’, you see.”": + "Within double quotes “there are single ‘quotes with mixed punctuation’, you see”.", - "He was like “Georgia”.": - "He was like “Georgia”.", + "He was like “Georgia”.": + "He was like “Georgia”.", - "He was ok. “He was ok”.": - "He was ok. “He was ok.”", + "He was ok. “He was ok”.": + "He was ok. “He was ok.”", - "\"…\"": - "“…”", + "\"…\"": + "“…”", - "\"Ctrl+I and…\"": - "“Ctrl+I and…”", + "\"Ctrl+I and…\"": + "“Ctrl+I and…”", - "Hela skríkla: \"Tu je 12\" platňa \"!": - "Hela skríkla: “Tu je 12″ platňa!”", + "Hela skríkla: \"Tu je 12\" platňa \"!": + "Hela skríkla: “Tu je 12″ platňa!”", - "He was ok. “He was ok ”.": - "He was ok. “He was ok.”", + "He was ok. “He was ok ”.": + "He was ok. “He was ok.”", - "Before you ask the “How often…” question": - "Before you ask the “How often…” question", + "Before you ask the “How often…” question": + "Before you ask the “How often…” question", - "“…example”": - "“…example”", + "“…example”": + "“…example”", - "abc “…example”": - "abc “…example”", + "abc “…example”": + "abc “…example”", } function localizeDoubleQuotes(string, leftDoubleQuote, rightDoubleQuote) { - string = string.replace(/“/g, leftDoubleQuote); - string = string.replace(/”/g, rightDoubleQuote); - return string; + string = string.replace(/“/g, leftDoubleQuote); + string = string.replace(/”/g, rightDoubleQuote); + return string; } let testModuleSk = {} @@ -142,52 +142,52 @@ Object.keys(testModule).forEach(function(key){ describe('Remove punctuation before double quotes (en-us):\n', () => { - let testCase = { - /* extra comma after terminal punctuation, - as it it happens in direct speech */ - "“Hey!,” she said": - "“Hey!” she said", - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeExtraPunctuationBeforeQuotes(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + /* extra comma after terminal punctuation, + as it it happens in direct speech */ + "“Hey!,” she said": + "“Hey!” she said", + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeExtraPunctuationBeforeQuotes(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Remove punctuation after double quotes (en-us):\n', () => { - let testCase = { - /* dot at the end of a direct speech ending with abbreviation */ - "“We will continue this tomorrow at 8:00 a.m.”.": - "“We will continue this tomorrow at 8:00 a.m.”", - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeExtraPunctuationAfterQuotes(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + /* dot at the end of a direct speech ending with abbreviation */ + "“We will continue this tomorrow at 8:00 a.m.”.": + "“We will continue this tomorrow at 8:00 a.m.”", + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeExtraPunctuationAfterQuotes(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); @@ -195,260 +195,260 @@ describe('Remove punctuation after double quotes (en-us):\n', () => { describe('Identify inches, arcseconds, seconds following a 1–3 numbers (en-us):\n', () => { - let testCase = { - "12′ 45\"": "12′ 45″", - "12′ 45“": "12′ 45″", - "12′ 45”": "12′ 45″", - "12′ 45″": "12′ 45″", - "12′ 45‘‘": "12′ 45″", - "12′ 45’’": "12′ 45″", - "12′ 45''": "12′ 45″", - "12′ 45′′": "12′ 45″", - "12''" : "12″", - - "3° 5′ 30\"": "3° 5′ 30″", - "12\"3′00°": "12″3′00°", - - "So it’s 12\" × 12\", right?" : - "So it’s 12″ × 12″, right?", - - "She said: “It’s a 12\" inch!”": - "She said: “It’s a 12″ inch!”", - - "It’s 12\" × 12\".": - "It’s 12″ × 12″.", - - - // identify swapped inches with terminal punctuation - "\"He was 12\"." : - "“He was 12.”", - - "He was 12\"." : - "He was 12″.", - - ...testFalsePositives, - }; - - let unitTestCase = { - "12′ 45 \"": "12′ 45 ″", - "12′ 45 “": "12′ 45 ″", - "12′ 45 ”": "12′ 45 ″", - "12′ 45 ″": "12′ 45 ″", - "12′ 45 ‘‘": "12′ 45 ″", - "12′ 45 ’’": "12′ 45 ″", - "12′ 45 ''": "12′ 45 ″", - "12′ 45 ′′": "12′ 45 ″", - "12 ''" : "12 ″", - - // false positive to exclude long numbers (temporary) - "“Conference 2020\" and “something in quotes”." : - "“Conference 2020\" and “something in quotes”.", - - // identify swapped inches with terminal punctuation - "\"He was 12\"." : - "\"He was 12.\"", - - // false positive - "He was 12\"." : - "He was 12″.", - - "\"He was 12.\"": - "\"He was 12.\"", - - "It’s 12\" x 12\".": - "It’s 12″ x 12″.", - - "It’s 12\" × 12\".": - "It’s 12″ × 12″.", - - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleDoubleQuotes( - identifyDoublePrimes( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "12′ 45\"": "12′ 45″", + "12′ 45“": "12′ 45″", + "12′ 45”": "12′ 45″", + "12′ 45″": "12′ 45″", + "12′ 45‘‘": "12′ 45″", + "12′ 45’’": "12′ 45″", + "12′ 45''": "12′ 45″", + "12′ 45′′": "12′ 45″", + "12''" : "12″", + + "3° 5′ 30\"": "3° 5′ 30″", + "12\"3′00°": "12″3′00°", + + "So it’s 12\" × 12\", right?" : + "So it’s 12″ × 12″, right?", + + "She said: “It’s a 12\" inch!”": + "She said: “It’s a 12″ inch!”", + + "It’s 12\" × 12\".": + "It’s 12″ × 12″.", + + + // identify swapped inches with terminal punctuation + "\"He was 12\"." : + "“He was 12.”", + + "He was 12\"." : + "He was 12″.", + + ...testFalsePositives, + }; + + let unitTestCase = { + "12′ 45 \"": "12′ 45 ″", + "12′ 45 “": "12′ 45 ″", + "12′ 45 ”": "12′ 45 ″", + "12′ 45 ″": "12′ 45 ″", + "12′ 45 ‘‘": "12′ 45 ″", + "12′ 45 ’’": "12′ 45 ″", + "12′ 45 ''": "12′ 45 ″", + "12′ 45 ′′": "12′ 45 ″", + "12 ''" : "12 ″", + + // false positive to exclude long numbers (temporary) + "“Conference 2020\" and “something in quotes”." : + "“Conference 2020\" and “something in quotes”.", + + // identify swapped inches with terminal punctuation + "\"He was 12\"." : + "\"He was 12.\"", + + // false positive + "He was 12\"." : + "He was 12″.", + + "\"He was 12.\"": + "\"He was 12.\"", + + "It’s 12\" x 12\".": + "It’s 12″ x 12″.", + + "It’s 12\" × 12\".": + "It’s 12″ × 12″.", + + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleDoubleQuotes( + identifyDoublePrimes( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Identify double quote pairs (en-us):\n', () => { - let testCase = { - "\"quoted material\"": - "“quoted material”", - - "„quoted material\"": - "“quoted material”", - - "«quoted material«": - "“quoted material”", - - "’’quoted material''": - "“quoted material”", - - "‹‹quoted material››": - "“quoted material”", - - ",,quoted material,,": - "“quoted material”", - - "‘‘quoted material‘‘": - "“quoted material”", - - "‘‘‘quoted material‘‘‘": - "“quoted material”", - - "´´quoted material´´": - "“quoted material”", - - "``quoted material``": - "“quoted material”", - - - "unquoted \"quoted material\" material": - "unquoted “quoted material” material", - - "\"quoted material\" and \"quoted material\"": - "“quoted material” and “quoted material”", - - // primes × double quotes - "\"Conference 2020\" and \"something in quotes\"." : - "“Conference 2020” and “something in quotes”.", - - "\"Gone in 60{{typopo__double-prime}}\"": - "“Gone in 60″”", - - "\"2020\"": - "“2020”", - - "\"202\"": - "“202”", - - - // false positive - "\"starting quotes, primes 90{{typopo__double-prime}}, ending quotes\"": - "“starting quotes, primes 90″, ending quotes”", - - - //jibberish inside quotes - ",,idjsa ;frilj ;'f0d, if9,,": - "“idjsa ;frilj ;'f0d, if9”", - - ...testFalsePositives, - }; - - let unitTestCase = { - "\" quoted material \"": - "“ quoted material ”", - - "\"quoted material \"": - "“quoted material ”", - - "\" quoted material\"": - "“ quoted material”", - - ...testCase, - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleDoubleQuotes( - identifyDoubleQuotePairs( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "\"quoted material\"": + "“quoted material”", + + "„quoted material\"": + "“quoted material”", + + "«quoted material«": + "“quoted material”", + + "’’quoted material''": + "“quoted material”", + + "‹‹quoted material››": + "“quoted material”", + + ",,quoted material,,": + "“quoted material”", + + "‘‘quoted material‘‘": + "“quoted material”", + + "‘‘‘quoted material‘‘‘": + "“quoted material”", + + "´´quoted material´´": + "“quoted material”", + + "``quoted material``": + "“quoted material”", + + + "unquoted \"quoted material\" material": + "unquoted “quoted material” material", + + "\"quoted material\" and \"quoted material\"": + "“quoted material” and “quoted material”", + + // primes × double quotes + "\"Conference 2020\" and \"something in quotes\"." : + "“Conference 2020” and “something in quotes”.", + + "\"Gone in 60{{typopo__double-prime}}\"": + "“Gone in 60″”", + + "\"2020\"": + "“2020”", + + "\"202\"": + "“202”", + + + // false positive + "\"starting quotes, primes 90{{typopo__double-prime}}, ending quotes\"": + "“starting quotes, primes 90″, ending quotes”", + + + //jibberish inside quotes + ",,idjsa ;frilj ;'f0d, if9,,": + "“idjsa ;frilj ;'f0d, if9”", + + ...testFalsePositives, + }; + + let unitTestCase = { + "\" quoted material \"": + "“ quoted material ”", + + "\"quoted material \"": + "“quoted material ”", + + "\" quoted material\"": + "“ quoted material”", + + ...testCase, + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleDoubleQuotes( + identifyDoubleQuotePairs( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Identify standalone left double quote (en-us):\n', () => { - let testCase = { - "\"There is a standalone left quote.": - "“There is a standalone left quote.", - - "There is a \"standalone left quote.": - "There is a “standalone left quote.", - - "There is a «standalone left quote.": - "There is a “standalone left quote.", - - "There is a „standalone left quote.": - "There is a “standalone left quote.", - - "There is a ,,standalone left quote.": - "There is a “standalone left quote.", - - "There is a ‹‹standalone left quote.": - "There is a “standalone left quote.", - - "There is a ‘‘standalone left quote.": - "There is a “standalone left quote.", - - "There is ‘‘1 standalone left quote.": - "There is “1 standalone left quote.", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleDoubleQuotes( - identifyStandaloneLeftDoubleQuote( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]); - }); - - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "\"There is a standalone left quote.": + "“There is a standalone left quote.", + + "There is a \"standalone left quote.": + "There is a “standalone left quote.", + + "There is a «standalone left quote.": + "There is a “standalone left quote.", + + "There is a „standalone left quote.": + "There is a “standalone left quote.", + + "There is a ,,standalone left quote.": + "There is a “standalone left quote.", + + "There is a ‹‹standalone left quote.": + "There is a “standalone left quote.", + + "There is a ‘‘standalone left quote.": + "There is a “standalone left quote.", + + "There is ‘‘1 standalone left quote.": + "There is “1 standalone left quote.", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleDoubleQuotes( + identifyStandaloneLeftDoubleQuote( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]); + }); + + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); @@ -456,109 +456,109 @@ describe('Identify standalone left double quote (en-us):\n', () => { describe('Identify standalone right double quote (en-us):\n', () => { - let testCase = { - "There is a standalone\" right quote.": - "There is a standalone” right quote.", - - "There is a standalone« right quote.": - "There is a standalone” right quote.", - - "There is a standalone„ right quote.": - "There is a standalone” right quote.", - - "There is a standalone,, right quote.": - "There is a standalone” right quote.", - - "There is a standalone›› right quote.": - "There is a standalone” right quote.", - - "There is a standalone‘‘ right quote.": - "There is a standalone” right quote.", - - "There is a STANDALONE\" right quote.": - "There is a STANDALONE” right quote.", - - "There is a standalone right quote.\"": - "There is a standalone right quote.”", - - "There is a standalone right quote…\"": - "There is a standalone right quote…”", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleDoubleQuotes( - identifyStandaloneRightDoubleQuote( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]); - }); - - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "There is a standalone\" right quote.": + "There is a standalone” right quote.", + + "There is a standalone« right quote.": + "There is a standalone” right quote.", + + "There is a standalone„ right quote.": + "There is a standalone” right quote.", + + "There is a standalone,, right quote.": + "There is a standalone” right quote.", + + "There is a standalone›› right quote.": + "There is a standalone” right quote.", + + "There is a standalone‘‘ right quote.": + "There is a standalone” right quote.", + + "There is a STANDALONE\" right quote.": + "There is a STANDALONE” right quote.", + + "There is a standalone right quote.\"": + "There is a standalone right quote.”", + + "There is a standalone right quote…\"": + "There is a standalone right quote…”", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleDoubleQuotes( + identifyStandaloneRightDoubleQuote( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]); + }); + + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Remove unidentified double quotes (en-us):\n', () => { - let testCase = { - "word \" word": - "word word", - - "word « word": - "word word", - - "word „ word": - "word word", - - "word ,, word": - "word word", - - "word ›› word": - "word word", - - "word ‘‘ word": - "word word", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleDoubleQuotes( - removeUnidentifiedDoubleQuote( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]); - }); - - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "word \" word": + "word word", + + "word « word": + "word word", + + "word „ word": + "word word", + + "word ,, word": + "word word", + + "word ›› word": + "word word", + + "word ‘‘ word": + "word word", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleDoubleQuotes( + removeUnidentifiedDoubleQuote( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]); + }); + + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); @@ -566,340 +566,340 @@ describe('Remove unidentified double quotes (en-us):\n', () => { describe('Replace a double qoute & a double prime with a double quote pair (en-us):\n', () => { - let unitTestCase = { - "{{typopo__left-double-quote--standalone}}word{{typopo__double-prime}}": - "{{typopo__left-double-quote}}word{{typopo__right-double-quote}}", - - "{{typopo__double-prime}}word{{typopo__right-double-quote--standalone}}": - "{{typopo__left-double-quote}}word{{typopo__right-double-quote}}", - - ...testFalsePositives, - }; - - let moduleTestCase = { - "It’s called \"Localhost 3000\" and it’s pretty fast.": - "It’s called “Localhost 3000” and it’s pretty fast.", - - "Here are 30 \"bucks\"": - "Here are 30 “bucks”", - - ...testFalsePositives, - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - replaceDoublePrimeWDoubleQuote( - key, - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), moduleTestCase[key]); - }); - }); + let unitTestCase = { + "{{typopo__left-double-quote--standalone}}word{{typopo__double-prime}}": + "{{typopo__left-double-quote}}word{{typopo__right-double-quote}}", + + "{{typopo__double-prime}}word{{typopo__right-double-quote--standalone}}": + "{{typopo__left-double-quote}}word{{typopo__right-double-quote}}", + + ...testFalsePositives, + }; + + let moduleTestCase = { + "It’s called \"Localhost 3000\" and it’s pretty fast.": + "It’s called “Localhost 3000” and it’s pretty fast.", + + "Here are 30 \"bucks\"": + "Here are 30 “bucks”", + + ...testFalsePositives, + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + replaceDoublePrimeWDoubleQuote( + key, + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), moduleTestCase[key]); + }); + }); }); describe('Swap quotes and terminal punctuation for a quoted part (en-us):\n', () => { - let testCase = { + let testCase = { - // quoted part at the - // end of a sentence - // end of a paragraph - "Sometimes it can be only a “quoted part.”": - "Sometimes it can be only a “quoted part”.", + // quoted part at the + // end of a sentence + // end of a paragraph + "Sometimes it can be only a “quoted part.”": + "Sometimes it can be only a “quoted part”.", - "Sometimes it can be only a “quoted” “part.”": - "Sometimes it can be only a “quoted” “part”.", - - "Is it “Amores Perros”?": - "Is it “Amores Perros”?", + "Sometimes it can be only a “quoted” “part.”": + "Sometimes it can be only a “quoted” “part”.", + + "Is it “Amores Perros”?": + "Is it “Amores Perros”?", - "Look for “Anguanga”.": - "Look for “Anguanga”.", + "Look for “Anguanga”.": + "Look for “Anguanga”.", - "“A whole sentence.” Only a “quoted part.”": - "“A whole sentence.” Only a “quoted part”.", + "“A whole sentence.” Only a “quoted part.”": + "“A whole sentence.” Only a “quoted part”.", - // quoted part at the - // end of a sentence - // middle of a paragraph - "a “quoted part.” A “quoted part.”": - "a “quoted part”. A “quoted part”.", + // quoted part at the + // end of a sentence + // middle of a paragraph + "a “quoted part.” A “quoted part.”": + "a “quoted part”. A “quoted part”.", - "Only a “quoted part.” “A whole sentence.”": - "Only a “quoted part”. “A whole sentence.”", + "Only a “quoted part.” “A whole sentence.”": + "Only a “quoted part”. “A whole sentence.”", - // quoted part in the middle of a sentence - // toto tu je asi zbytocny test - "Only a “quoted part” in a sentence. “A whole sentence.”": - "Only a “quoted part” in a sentence. “A whole sentence.”", + // quoted part in the middle of a sentence + // toto tu je asi zbytocny test + "Only a “quoted part” in a sentence. “A whole sentence.”": + "Only a “quoted part” in a sentence. “A whole sentence.”", - // place punctuation within a quoted sentence that’s in the middle of the sentence. - "Ask “What’s going on in here”? so you can dig deeper.": - "Ask “What’s going on in here?” so you can dig deeper.", + // place punctuation within a quoted sentence that’s in the middle of the sentence. + "Ask “What’s going on in here”? so you can dig deeper.": + "Ask “What’s going on in here?” so you can dig deeper.", - "Ask “Question”? and “Question”? and done.": - "Ask “Question?” and “Question?” and done.", + "Ask “Question”? and “Question”? and done.": + "Ask “Question?” and “Question?” and done.", - "Ask “Question”? and done.\nAsk “Question”? and done.": - "Ask “Question?” and done.\nAsk “Question?” and done.", + "Ask “Question”? and done.\nAsk “Question”? and done.": + "Ask “Question?” and done.\nAsk “Question?” and done.", - "Before you ask the “How often…” question": - "Before you ask the “How often…” question", + "Before you ask the “How often…” question": + "Before you ask the “How often…” question", - "Before you ask the “How often”… question": - "Before you ask the “How often…” question", + "Before you ask the “How often”… question": + "Before you ask the “How often…” question", - "“…example”": - "“…example”", + "“…example”": + "“…example”", - "abc “…example”": - "abc “…example”", - - // Bracket before the ellipsis, false positive - "Ask “what if (the thing)…”": - "Ask “what if (the thing)…”", + "abc “…example”": + "abc “…example”", + + // Bracket before the ellipsis, false positive + "Ask “what if (the thing)…”": + "Ask “what if (the thing)…”", - // place punctuation within a quoted sentence - "He was ok. “He was ok”.": - "He was ok. “He was ok.”", + // place punctuation within a quoted sentence + "He was ok. “He was ok”.": + "He was ok. “He was ok.”", - "He was ok. “He was ok”. He was ok.": - "He was ok. “He was ok.” He was ok.", + "He was ok. “He was ok”. He was ok.": + "He was ok. “He was ok.” He was ok.", - "He was ok? “He was ok”.": - "He was ok? “He was ok.”", + "He was ok? “He was ok”.": + "He was ok? “He was ok.”", - // swap a right quote and terminal punctuation for the whole sentence - "“He was ok”.": - "“He was ok.”", + // swap a right quote and terminal punctuation for the whole sentence + "“He was ok”.": + "“He was ok.”", - "“He was ok”.\n“He was ok”.": - "“He was ok.”\n“He was ok.”", + "“He was ok”.\n“He was ok”.": + "“He was ok.”\n“He was ok.”", - "“He was ok”. “He was ok”.": - "“He was ok.” “He was ok.”", + "“He was ok”. “He was ok”.": + "“He was ok.” “He was ok.”", - "“He was ok”. “He was ok”. “He was ok”.": - "“He was ok.” “He was ok.” “He was ok.”", + "“He was ok”. “He was ok”. “He was ok”.": + "“He was ok.” “He was ok.” “He was ok.”", - "“He was ok”. “He was ok”. “He was ok”. “He was ok”.": - "“He was ok.” “He was ok.” “He was ok.” “He was ok.”", + "“He was ok”. “He was ok”. “He was ok”. “He was ok”.": + "“He was ok.” “He was ok.” “He was ok.” “He was ok.”", - "“He was ok”?": - "“He was ok?”", + "“He was ok”?": + "“He was ok?”", - "“He was ok”. He was ok.": - "“He was ok.” He was ok.", + "“He was ok”. He was ok.": + "“He was ok.” He was ok.", - // ellipsis - "“Types of”…": - "“Types of…”", + // ellipsis + "“Types of”…": + "“Types of…”", - "“Types of”…\n“Types of”…": - "“Types of…”\n“Types of…”", + "“Types of”…\n“Types of”…": + "“Types of…”\n“Types of…”", - ...testFalsePositives, - }; + ...testFalsePositives, + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - swapQuotesAndTerminalPunctuation( - key, - new Locale("en-us") - ), - testCase[key] - ); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + swapQuotesAndTerminalPunctuation( + key, + new Locale("en-us") + ), + testCase[key] + ); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Remove extra comma after sentence punctuation in direct speech (en-us):\n', () => { - let testCase = { - "“Hey!,” she said": - "“Hey!” she said", - - "“Hey?,” she said": - "“Hey?” she said", - - "“Hey.,” she said": - "“Hey.” she said", - - "“Hey,,” she said": - "“Hey,” she said", - - "“Hey:,” she said": - "“Hey:” she said", - - "“Hey;,” she said": - "“Hey;” she said", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeExtraCommaAfterSentencePunctuation(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "“Hey!,” she said": + "“Hey!” she said", + + "“Hey?,” she said": + "“Hey?” she said", + + "“Hey.,” she said": + "“Hey.” she said", + + "“Hey,,” she said": + "“Hey,” she said", + + "“Hey:,” she said": + "“Hey:” she said", + + "“Hey;,” she said": + "“Hey;” she said", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeExtraCommaAfterSentencePunctuation(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Remove extra spaces around quotes and primes (en-us):\n', () => { - let testCase = { - - "“ Ups, an extra space at the beginning”": - "“Ups, an extra space at the beginning”", - - "“Ups, an extra space at the end ”": - "“Ups, an extra space at the end”", - - "“Sentence and… ”": "“Sentence and…”", - - "12′ 45 ″": - "12′ 45″", - - "3° 5′ 30 ″": - "3° 5′ 30″", - - "3° 5′ 30 ″ and": - "3° 5′ 30″ and", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - removeExtraSpacesAroundQuotes( - key, - new Locale("en-us") - ), - testCase[key] - ); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + + "“ Ups, an extra space at the beginning”": + "“Ups, an extra space at the beginning”", + + "“Ups, an extra space at the end ”": + "“Ups, an extra space at the end”", + + "“Sentence and… ”": "“Sentence and…”", + + "12′ 45 ″": + "12′ 45″", + + "3° 5′ 30 ″": + "3° 5′ 30″", + + "3° 5′ 30 ″ and": + "3° 5′ 30″ and", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + removeExtraSpacesAroundQuotes( + key, + new Locale("en-us") + ), + testCase[key] + ); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Add a missing space before a left double quote (en-us):\n', () => { - let testCase = { - "It’s a very “nice” saying.": - "It’s a very “nice” saying.", - - "It’s a“nice” saying.": - "It’s a “nice” saying.", //add nbsp; - - "An unquoted sentence.“And a quoted one.”": - "An unquoted sentence. “And a quoted one.”", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - addSpaceBeforeLeftDoubleQuote( - key, - new Locale("en-us") - ), - testCase[key] - ); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "It’s a very “nice” saying.": + "It’s a very “nice” saying.", + + "It’s a“nice” saying.": + "It’s a “nice” saying.", //add nbsp; + + "An unquoted sentence.“And a quoted one.”": + "An unquoted sentence. “And a quoted one.”", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + addSpaceBeforeLeftDoubleQuote( + key, + new Locale("en-us") + ), + testCase[key] + ); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Add a missing space after a left double quote (en-us):\n', () => { - let testCase = { - "It’s a “nice”saying.": - "It’s a “nice” saying.", - - "“A quoted sentence.”And an unquoted one.": - "“A quoted sentence.” And an unquoted one.", - - "“A quoted sentence!”And an unquoted one.": - "“A quoted sentence!” And an unquoted one.", - - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - addSpaceAfterRightDoubleQuote( - key, - new Locale("en-us") - ), - testCase[key] - ); - }); - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "It’s a “nice”saying.": + "It’s a “nice” saying.", + + "“A quoted sentence.”And an unquoted one.": + "“A quoted sentence.” And an unquoted one.", + + "“A quoted sentence!”And an unquoted one.": + "“A quoted sentence!” And an unquoted one.", + + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + addSpaceAfterRightDoubleQuote( + key, + new Locale("en-us") + ), + testCase[key] + ); + }); + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); @@ -910,124 +910,124 @@ describe('Add a missing space after a left double quote (en-us):\n', () => { describe('Double quotes in default language (en-us)\n', () => { - let testCase = { - ...testModule, - ...testFalsePositives, - }; - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + ...testModule, + ...testFalsePositives, + }; + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Double quotes in Slovak, Czech and German language (sk, cs, de-de)\n', () => { - let testCase = { - ...testModuleSk, - }; - - Object.keys(testCase).forEach((key) => { - it("module test (sk)", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("sk"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - - it("module test (cs)", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("cs"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - - it("module test (de-de)", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("de-de"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + ...testModuleSk, + }; + + Object.keys(testCase).forEach((key) => { + it("module test (sk)", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("sk"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + + it("module test (cs)", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("cs"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + + it("module test (de-de)", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("de-de"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Double quotes in Rusyn language (rue)\n', () => { - let testCase = { - ...testModuleRue, - }; - - Object.keys(testCase).forEach((key) => { - it("module test (rue)", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("rue"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + ...testModuleRue, + }; + + Object.keys(testCase).forEach((key) => { + it("module test (rue)", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("rue"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Test if markdown ticks are kept (double quotes) (en-us):\n', () => { - let testCase = { - "```\ncode\n```": - "```\ncode\n```", + let testCase = { + "```\ncode\n```": + "```\ncode\n```", - "\t```\ncode\n```": - "\t```\ncode\n```", + "\t```\ncode\n```": + "\t```\ncode\n```", - "\t\t```\ncode\n```": - "\t\t```\ncode\n```", + "\t\t```\ncode\n```": + "\t\t```\ncode\n```", - " ```\ncode\n```": - " ```\ncode\n```", + " ```\ncode\n```": + " ```\ncode\n```", - " ```\ncode\n```": - " ```\ncode\n```", + " ```\ncode\n```": + " ```\ncode\n```", - "``code``": - "``code``", + "``code``": + "``code``", - "``code code``": - "``code code``", + "``code code``": + "``code code``", - "``code`` ``code``": - "``code`` ``code``", + "``code`` ``code``": + "``code`` ``code``", - "`code`": - "`code`", + "`code`": + "`code`", - "`code code`": - "`code code`", + "`code code`": + "`code code`", - "`code` `code`": - "`code` `code`", - }; + "`code` `code`": + "`code` `code`", + }; - Object.keys(testCase).forEach((key) => { + Object.keys(testCase).forEach((key) => { - it("keepMarkdownCodeBlocks: true” configuration", () => { - assert.strictEqual( - fixDoubleQuotesAndPrimes( - key, - new Locale("en-us"), - configKeepMarkdownCodeBlocks - ), testCase[key]); - }); - }); + it("keepMarkdownCodeBlocks: true” configuration", () => { + assert.strictEqual( + fixDoubleQuotesAndPrimes( + key, + new Locale("en-us"), + configKeepMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); \ No newline at end of file diff --git a/tests/punctuation/ellipsis.test.js b/tests/punctuation/ellipsis.test.js index 6337644..1416665 100644 --- a/tests/punctuation/ellipsis.test.js +++ b/tests/punctuation/ellipsis.test.js @@ -1,310 +1,310 @@ import {replaceThreeCharsWithEllipsis, - replaceTwoCharsWithEllipsis, - replaceTwoPeriodsWithEllipsis, - fixEllipsisSpacingAroundCommas, - fixAposiopesisStartingParagraph, - fixAposiopesisStartingSentence, - fixAposiopesisBetweenSentences, - fixAposiopesisBetweenWords, - fixEllipsisBetweenSentences, - fixAposiopesisEndingParagraph, - fixEllipsis, - fixEllipsisAsLastItem} from "../../src/modules/punctuation/ellipsis"; + replaceTwoCharsWithEllipsis, + replaceTwoPeriodsWithEllipsis, + fixEllipsisSpacingAroundCommas, + fixAposiopesisStartingParagraph, + fixAposiopesisStartingSentence, + fixAposiopesisBetweenSentences, + fixAposiopesisBetweenWords, + fixEllipsisBetweenSentences, + fixAposiopesisEndingParagraph, + fixEllipsis, + fixEllipsisAsLastItem} from "../../src/modules/punctuation/ellipsis"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Replace periods/ellipses with a single ellipsis:\n', () => { - let testCase = { - /* [1] replace 3 and more dots/ellipses with an ellipsis */ - "Sentence ... another sentence": "Sentence … another sentence", - "Sentence .... another sentence": "Sentence … another sentence", - "Sentence ..... another sentence": "Sentence … another sentence", - "Sentence ending...": "Sentence ending…", - "Sentence ending....": "Sentence ending…", - "Sentence ending.....": "Sentence ending…", - "Sentence ending….....": "Sentence ending…", - "Sentence ending….…": "Sentence ending…", - "Sentence ending.….....": "Sentence ending…", - - /* false positives */ - "Sentence ending.": "Sentence ending.", - "Sentence ending..": "Sentence ending..", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(replaceThreeCharsWithEllipsis(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + /* [1] replace 3 and more dots/ellipses with an ellipsis */ + "Sentence ... another sentence": "Sentence … another sentence", + "Sentence .... another sentence": "Sentence … another sentence", + "Sentence ..... another sentence": "Sentence … another sentence", + "Sentence ending...": "Sentence ending…", + "Sentence ending....": "Sentence ending…", + "Sentence ending.....": "Sentence ending…", + "Sentence ending….....": "Sentence ending…", + "Sentence ending….…": "Sentence ending…", + "Sentence ending.….....": "Sentence ending…", + + /* false positives */ + "Sentence ending.": "Sentence ending.", + "Sentence ending..": "Sentence ending..", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(replaceThreeCharsWithEllipsis(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Replace combination of period/ellipsis with an ellipsis:\n', () => { - let testCase = { - "Sentence ending…": "Sentence ending…", - "Sentence ending……": "Sentence ending…", - "Sentence ending….": "Sentence ending…", - "Sentence ending.…": "Sentence ending…", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(replaceTwoCharsWithEllipsis(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Sentence ending…": "Sentence ending…", + "Sentence ending……": "Sentence ending…", + "Sentence ending….": "Sentence ending…", + "Sentence ending.…": "Sentence ending…", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(replaceTwoCharsWithEllipsis(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Replace two periods between words (spaces) with an ellipsis:\n', () => { - let testCase = { - "Sentence .. another sentence": "Sentence … another sentence", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(replaceTwoPeriodsWithEllipsis(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Sentence .. another sentence": "Sentence … another sentence", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(replaceTwoPeriodsWithEllipsis(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when ellipsis is used around commas:\n', () => { - let testCase = { - "We sell apples, oranges, …, pens.": "We sell apples, oranges, …, pens.", // neutral - "We sell apples, oranges,…, pens.": "We sell apples, oranges, …, pens.", - "We sell apples, oranges,… , pens.": "We sell apples, oranges, …, pens.", - "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", - "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // nbsp - "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // hair_space - "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // narrow_nbsp - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixEllipsisSpacingAroundCommas(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "We sell apples, oranges, …, pens.": "We sell apples, oranges, …, pens.", // neutral + "We sell apples, oranges,…, pens.": "We sell apples, oranges, …, pens.", + "We sell apples, oranges,… , pens.": "We sell apples, oranges, …, pens.", + "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", + "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // nbsp + "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // hair_space + "We sell apples, oranges, … , pens.": "We sell apples, oranges, …, pens.", // narrow_nbsp + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixEllipsisSpacingAroundCommas(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when ellipsis is used as a list item int the list:\n', () => { - let testCase = { - "We sell apples, oranges,…": - "We sell apples, oranges,…", - - "We sell apples, oranges, …": - "We sell apples, oranges,…", - - "We sell apples, oranges,… ": - "We sell apples, oranges,…", - - "We sell apples, oranges, … ": - "We sell apples, oranges,…", - - "We sell apples, oranges, … ": // nbsp - "We sell apples, oranges,…", - - "We sell apples, oranges, … ": // hair_space - "We sell apples, oranges,…", - - "We sell apples, oranges, … ": // narrow_nbsp - "We sell apples, oranges,…", - - "(apples, oranges,…)": - "(apples, oranges,…)", - - "(apples, oranges, …)": - "(apples, oranges,…)", - - "(apples, oranges, … )": - "(apples, oranges,…)", - - "(apples, oranges,… )": - "(apples, oranges,…)", - - // false positive - "We sell apples, oranges, …, pens.": - "We sell apples, oranges, …, pens.", - - }; - - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixEllipsisAsLastItem(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "We sell apples, oranges,…": + "We sell apples, oranges,…", + + "We sell apples, oranges, …": + "We sell apples, oranges,…", + + "We sell apples, oranges,… ": + "We sell apples, oranges,…", + + "We sell apples, oranges, … ": + "We sell apples, oranges,…", + + "We sell apples, oranges, … ": // nbsp + "We sell apples, oranges,…", + + "We sell apples, oranges, … ": // hair_space + "We sell apples, oranges,…", + + "We sell apples, oranges, … ": // narrow_nbsp + "We sell apples, oranges,…", + + "(apples, oranges,…)": + "(apples, oranges,…)", + + "(apples, oranges, …)": + "(apples, oranges,…)", + + "(apples, oranges, … )": + "(apples, oranges,…)", + + "(apples, oranges,… )": + "(apples, oranges,…)", + + // false positive + "We sell apples, oranges, …, pens.": + "We sell apples, oranges, …, pens.", + + }; + + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixEllipsisAsLastItem(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when aposiopesis is starting a paragraph:\n', () => { - let testCase = { - "…да святить ся": "…да святить ся", // correct - "… да святить ся": "…да святить ся", - "… да святить ся\n… multiline test": "…да святить ся\n…multiline test", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixAposiopesisStartingParagraph(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "…да святить ся": "…да святить ся", // correct + "… да святить ся": "…да святить ся", + "… да святить ся\n… multiline test": "…да святить ся\n…multiline test", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixAposiopesisStartingParagraph(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when aposiopesis is starting a sentence:\n', () => { - let testCase = { - "Sentence ended. …and we were there.": "Sentence ended. …and we were there.", // neutral - "Sentence ended. … and we were there.": "Sentence ended. …and we were there.", - "Sentence ended.… and we were there.": "Sentence ended. …and we were there.", - "Sentence ended! …and we were there.": "Sentence ended! …and we were there.", - "Sentence ended! … and we were there.": "Sentence ended! …and we were there.", - "Sentence ended!… and we were there.": "Sentence ended! …and we were there.", - "Sentence ended? … and we were there.": "Sentence ended? …and we were there.", - "Sentence ended?’ … and we were there.": "Sentence ended?’ …and we were there.", - "Sentence ended?’… and we were there.": "Sentence ended?’ …and we were there.", - "Sentence ended?”… and we were there.": "Sentence ended?” …and we were there.", - "We sell apples, oranges, …, pens.": "We sell apples, oranges, …, pens.", // false positive - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixAposiopesisStartingSentence(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Sentence ended. …and we were there.": "Sentence ended. …and we were there.", // neutral + "Sentence ended. … and we were there.": "Sentence ended. …and we were there.", + "Sentence ended.… and we were there.": "Sentence ended. …and we were there.", + "Sentence ended! …and we were there.": "Sentence ended! …and we were there.", + "Sentence ended! … and we were there.": "Sentence ended! …and we were there.", + "Sentence ended!… and we were there.": "Sentence ended! …and we were there.", + "Sentence ended? … and we were there.": "Sentence ended? …and we were there.", + "Sentence ended?’ … and we were there.": "Sentence ended?’ …and we were there.", + "Sentence ended?’… and we were there.": "Sentence ended?’ …and we were there.", + "Sentence ended?”… and we were there.": "Sentence ended?” …and we were there.", + "We sell apples, oranges, …, pens.": "We sell apples, oranges, …, pens.", // false positive + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixAposiopesisStartingSentence(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when aposiopesis is between sentences:\n', () => { - let testCase = { - "Sentence ending… And another starting": "Sentence ending… And another starting", - "Sentence ending … And another starting": "Sentence ending… And another starting", - "Sentence ending …And another starting": "Sentence ending… And another starting", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixAposiopesisBetweenSentences(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Sentence ending… And another starting": "Sentence ending… And another starting", + "Sentence ending … And another starting": "Sentence ending… And another starting", + "Sentence ending …And another starting": "Sentence ending… And another starting", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixAposiopesisBetweenSentences(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when aposiopesis is between words:\n', () => { - let testCase = { - "word… word" : "word… word", - "word…word" : "word… word", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixAposiopesisBetweenWords(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "word… word" : "word… word", + "word…word" : "word… word", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixAposiopesisBetweenWords(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when ellipsis is between sentences:\n', () => { - let testCase = { - "What are you saying. … She did not answer." : "What are you saying. … She did not answer.", - "What are you saying. …She did not answer." : "What are you saying. … She did not answer.", - "What are you saying.…She did not answer." : "What are you saying. … She did not answer.", - - "What are you saying! … She did not answer." : "What are you saying! … She did not answer.", - "What are you saying! …She did not answer." : "What are you saying! … She did not answer.", - "What are you saying!…She did not answer." : "What are you saying! … She did not answer.", - - "What are you saying? … She did not answer." : "What are you saying? … She did not answer.", - "What are you saying? …She did not answer." : "What are you saying? … She did not answer.", - "What are you saying?…She did not answer." : "What are you saying? … She did not answer.", - - "‘What are you saying?’ … She did not answer." : "‘What are you saying?’ … She did not answer.", - "‘What are you saying?’ …She did not answer." : "‘What are you saying?’ … She did not answer.", - "‘What are you saying?’…She did not answer." : "‘What are you saying?’ … She did not answer.", - "“What are you saying?”…She did not answer." : "“What are you saying?” … She did not answer.", - - /* false positive: keep spaces around aposiopesis, that is used in the middle of a sentence */ - "Sentence using … aposiopesis in the middle of a sentence.": "Sentence using … aposiopesis in the middle of a sentence.", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixEllipsisBetweenSentences(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "What are you saying. … She did not answer." : "What are you saying. … She did not answer.", + "What are you saying. …She did not answer." : "What are you saying. … She did not answer.", + "What are you saying.…She did not answer." : "What are you saying. … She did not answer.", + + "What are you saying! … She did not answer." : "What are you saying! … She did not answer.", + "What are you saying! …She did not answer." : "What are you saying! … She did not answer.", + "What are you saying!…She did not answer." : "What are you saying! … She did not answer.", + + "What are you saying? … She did not answer." : "What are you saying? … She did not answer.", + "What are you saying? …She did not answer." : "What are you saying? … She did not answer.", + "What are you saying?…She did not answer." : "What are you saying? … She did not answer.", + + "‘What are you saying?’ … She did not answer." : "‘What are you saying?’ … She did not answer.", + "‘What are you saying?’ …She did not answer." : "‘What are you saying?’ … She did not answer.", + "‘What are you saying?’…She did not answer." : "‘What are you saying?’ … She did not answer.", + "“What are you saying?”…She did not answer." : "“What are you saying?” … She did not answer.", + + /* false positive: keep spaces around aposiopesis, that is used in the middle of a sentence */ + "Sentence using … aposiopesis in the middle of a sentence.": "Sentence using … aposiopesis in the middle of a sentence.", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixEllipsisBetweenSentences(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix spacing, when aposiopesis is ending a paragraph:\n', () => { - let testCase = { - "Sentence ending…": - "Sentence ending…", + let testCase = { + "Sentence ending…": + "Sentence ending…", - "Sentence ending …": - "Sentence ending…", + "Sentence ending …": + "Sentence ending…", - "Sentence ending …": - "Sentence ending…", + "Sentence ending …": + "Sentence ending…", - "“Sentence ending …”": - "“Sentence ending…”", + "“Sentence ending …”": + "“Sentence ending…”", - "‘Sentence ending …’": - "‘Sentence ending…’", + "‘Sentence ending …’": + "‘Sentence ending…’", - "Sentence ending …\nSentence ending …": - "Sentence ending…\nSentence ending…", - }; + "Sentence ending …\nSentence ending …": + "Sentence ending…\nSentence ending…", + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixAposiopesisEndingParagraph(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixAposiopesisEndingParagraph(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixEllipsis(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/punctuation/hyphen.test.js b/tests/punctuation/hyphen.test.js index 7562576..9cf472d 100644 --- a/tests/punctuation/hyphen.test.js +++ b/tests/punctuation/hyphen.test.js @@ -1,26 +1,26 @@ import {fixHyphen, - fixSpaceAroundHyphen} from "../../src/modules/punctuation/hyphen"; + fixSpaceAroundHyphen} from "../../src/modules/punctuation/hyphen"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix spaces around hyphen\n', () => { - let testCase = { - "e-shop": "e-shop", // correct - "e- shop": "e-shop", - "e- shop": "e-shop", // nbsp - "e- shop": "e-shop", // hairSpace - "e- shop": "e-shop", // narrowNbsp - "e -shop": "e-shop", - }; + let testCase = { + "e-shop": "e-shop", // correct + "e- shop": "e-shop", + "e- shop": "e-shop", // nbsp + "e- shop": "e-shop", // hairSpace + "e- shop": "e-shop", // narrowNbsp + "e -shop": "e-shop", + }; - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(fixSpaceAroundHyphen(key, new Locale("en-us")), testCase[key]); - }); - it("module tests", () => { - assert.strictEqual(fixHyphen(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(fixSpaceAroundHyphen(key, new Locale("en-us")), testCase[key]); + }); + it("module tests", () => { + assert.strictEqual(fixHyphen(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/punctuation/markdown.test.js b/tests/punctuation/markdown.test.js index 55a0fef..5f2fca2 100644 --- a/tests/punctuation/markdown.test.js +++ b/tests/punctuation/markdown.test.js @@ -1,6 +1,6 @@ import {identifyMarkdownCodeTicks, - placeMarkdownCodeTicks} - from "../../src/modules/punctuation/markdown"; + placeMarkdownCodeTicks} + from "../../src/modules/punctuation/markdown"; import assert from 'assert'; @@ -14,162 +14,162 @@ let configIgnoreMarkdownCodeBlocks = { } describe('Identify markdown code ticks:\n', () => { - let testCase = { - "```\ncode\n```": - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + let testCase = { + "```\ncode\n```": + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "\t```\ncode\n```": - "\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + "\t```\ncode\n```": + "\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "\t\t```\ncode\n```": - "\t\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + "\t\t```\ncode\n```": + "\t\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - " ```\ncode\n```": - " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + " ```\ncode\n```": + " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - " ```\ncode\n```": - " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + " ```\ncode\n```": + " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "``code``": - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + "``code``": + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "``code code``": - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + "``code code``": + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "``code`` ``code``": - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}} {{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", + "``code`` ``code``": + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}} {{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}", - "`code`": - "{{typopo__markdown_tick}}code{{typopo__markdown_tick}}", + "`code`": + "{{typopo__markdown_tick}}code{{typopo__markdown_tick}}", - "`code code`": - "{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}", + "`code code`": + "{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}", - "`code` `code`": - "{{typopo__markdown_tick}}code{{typopo__markdown_tick}} {{typopo__markdown_tick}}code{{typopo__markdown_tick}}", - }; + "`code` `code`": + "{{typopo__markdown_tick}}code{{typopo__markdown_tick}} {{typopo__markdown_tick}}code{{typopo__markdown_tick}}", + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - identifyMarkdownCodeTicks( - key, - configKeepMarkdownCodeBlocks - ), - testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + identifyMarkdownCodeTicks( + key, + configKeepMarkdownCodeBlocks + ), + testCase[key]); + }); + }); }); describe('Place markdown code ticks:\n', () => { - let testCase = { - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "```\ncode\n```", + let testCase = { + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "```\ncode\n```", - "\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "\t```\ncode\n```", + "\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "\t```\ncode\n```", - "\t\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "\t\t```\ncode\n```", + "\t\t{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "\t\t```\ncode\n```", - " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - " ```\ncode\n```", + " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + " ```\ncode\n```", - " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - " ```\ncode\n```", + " {{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}\ncode\n{{typopo__markdown_tick}}{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + " ```\ncode\n```", - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "``code``", + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "``code``", - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "``code code``", + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "``code code``", - "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}} {{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": - "``code`` ``code``", + "{{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}} {{typopo__markdown_tick}}{{typopo__markdown_tick}}code{{typopo__markdown_tick}}{{typopo__markdown_tick}}": + "``code`` ``code``", - "{{typopo__markdown_tick}}code{{typopo__markdown_tick}}": - "`code`", + "{{typopo__markdown_tick}}code{{typopo__markdown_tick}}": + "`code`", - "{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}": - "`code code`", + "{{typopo__markdown_tick}}code code{{typopo__markdown_tick}}": + "`code code`", - "{{typopo__markdown_tick}}code{{typopo__markdown_tick}} {{typopo__markdown_tick}}code{{typopo__markdown_tick}}": - "`code` `code`", - }; + "{{typopo__markdown_tick}}code{{typopo__markdown_tick}} {{typopo__markdown_tick}}code{{typopo__markdown_tick}}": + "`code` `code`", + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeMarkdownCodeTicks( - key, - configKeepMarkdownCodeBlocks - ), - testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeMarkdownCodeTicks( + key, + configKeepMarkdownCodeBlocks + ), + testCase[key]); + }); + }); }); describe('Ignore markdown code ticks:\n', () => { - let testCase = { - "```\ncode\n```": - "```\ncode\n```", - - "\t```\ncode\n```": - "\t```\ncode\n```", - - "\t\t```\ncode\n```": - "\t\t```\ncode\n```", - - " ```\ncode\n```": - " ```\ncode\n```", - - " ```\ncode\n```": - " ```\ncode\n```", - - "``code``": - "``code``", - - "``code code``": - "``code code``", - - "``code`` ``code``": - "``code`` ``code``", - - "`code`": - "`code`", - - "`code code`": - "`code code`", - - "`code` `code`": - "`code` `code`", - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - identifyMarkdownCodeTicks( - key, - configIgnoreMarkdownCodeBlocks - ), - testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeMarkdownCodeTicks( - key, - configIgnoreMarkdownCodeBlocks - ), - testCase[key]); - }); - }); + let testCase = { + "```\ncode\n```": + "```\ncode\n```", + + "\t```\ncode\n```": + "\t```\ncode\n```", + + "\t\t```\ncode\n```": + "\t\t```\ncode\n```", + + " ```\ncode\n```": + " ```\ncode\n```", + + " ```\ncode\n```": + " ```\ncode\n```", + + "``code``": + "``code``", + + "``code code``": + "``code code``", + + "``code`` ``code``": + "``code`` ``code``", + + "`code`": + "`code`", + + "`code code`": + "`code code`", + + "`code` `code`": + "`code` `code`", + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + identifyMarkdownCodeTicks( + key, + configIgnoreMarkdownCodeBlocks + ), + testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeMarkdownCodeTicks( + key, + configIgnoreMarkdownCodeBlocks + ), + testCase[key]); + }); + }); }); diff --git a/tests/punctuation/period.test.js b/tests/punctuation/period.test.js index 98e51b1..30632c7 100644 --- a/tests/punctuation/period.test.js +++ b/tests/punctuation/period.test.js @@ -5,21 +5,21 @@ import Locale from "../../src/locale/locale"; describe('Replace 2 periods at the end of the sentecne with a single period\n', () => { - let testCase = { - "Sentence ending..": "Sentence ending.", - "He is a vice president at Apple Inc..": "He is a vice president at Apple Inc.", + let testCase = { + "Sentence ending..": "Sentence ending.", + "He is a vice president at Apple Inc..": "He is a vice president at Apple Inc.", - //false positives - "../../src/filename.ext":"../../src/filename.ext", - "..\\..\\filename.ext":"..\\..\\filename.ext", - "../":"../", - "..\\":"..\\", - }; + //false positives + "../../src/filename.ext":"../../src/filename.ext", + "..\\..\\filename.ext":"..\\..\\filename.ext", + "../":"../", + "..\\":"..\\", + }; - Object.keys(testCase).forEach((key) => { - it("", () => { - assert.strictEqual(fixPeriod(key, new Locale("rue")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("", () => { + assert.strictEqual(fixPeriod(key, new Locale("rue")), testCase[key]); + }); + }); }); diff --git a/tests/punctuation/single-quotes.test.js b/tests/punctuation/single-quotes.test.js index 732c265..344ebc6 100644 --- a/tests/punctuation/single-quotes.test.js +++ b/tests/punctuation/single-quotes.test.js @@ -1,23 +1,23 @@ import {identifyContractedAnd, - identifyContractedBeginnings, - identifyContractedEnds, - identifyInWordContractions, - identifyContractedYears, - - identifySinglePrimes, - identifyStandaloneLeftSingleQuote, - identifyStandaloneRightSingleQuote, - identifySingleQuotePairAroundSingleWord, - identifySingleQuotePairs, - replaceSinglePrimeWSingleQuote, - identifyResidualApostrophes, - - placeLocaleSingleQuotes, - - swapSingleQuotesAndTerminalPunctuation, - removeExtraSpaceAroundSinglePrime, - fixSingleQuotesPrimesAndApostrophes} - from "../../src/modules/punctuation/single-quotes"; + identifyContractedBeginnings, + identifyContractedEnds, + identifyInWordContractions, + identifyContractedYears, + + identifySinglePrimes, + identifyStandaloneLeftSingleQuote, + identifyStandaloneRightSingleQuote, + identifySingleQuotePairAroundSingleWord, + identifySingleQuotePairs, + replaceSinglePrimeWSingleQuote, + identifyResidualApostrophes, + + placeLocaleSingleQuotes, + + swapSingleQuotesAndTerminalPunctuation, + removeExtraSpaceAroundSinglePrime, + fixSingleQuotesPrimesAndApostrophes} + from "../../src/modules/punctuation/single-quotes"; import Locale from "../../src/locale/locale"; import assert from 'assert'; @@ -35,36 +35,36 @@ let configKeepMarkdownCodeBlocks = { describe('Identify contracted and (’n’) as apostrophes (en-us):\n', () => { - let moduleTestCase = { - "rock 'n' roll": - "rock ’n’ roll", - - "rock'n'roll": - "rock ’n’ roll", - - "rock 'n'roll": - "rock ’n’ roll", - - "rock'n' roll": - "rock ’n’ roll", - - "rock ‚n‘ roll": - "rock ’n’ roll", - - "rock ’nʼ roll": - "rock ’n’ roll", - - "rock ‛n′ roll": - "rock ’n’ roll", - - "rock ‹n› roll": - "rock ’n’ roll", - - "rock ´n` roll": - "rock ’n’ roll", - - "ROCK 'N' ROLL": - "ROCK ’N’ ROLL", + let moduleTestCase = { + "rock 'n' roll": + "rock ’n’ roll", + + "rock'n'roll": + "rock ’n’ roll", + + "rock 'n'roll": + "rock ’n’ roll", + + "rock'n' roll": + "rock ’n’ roll", + + "rock ‚n‘ roll": + "rock ’n’ roll", + + "rock ’nʼ roll": + "rock ’n’ roll", + + "rock ‛n′ roll": + "rock ’n’ roll", + + "rock ‹n› roll": + "rock ’n’ roll", + + "rock ´n` roll": + "rock ’n’ roll", + + "ROCK 'N' ROLL": + "ROCK ’N’ ROLL", "dead 'n' buried": "dead ’n’ buried", @@ -72,207 +72,207 @@ describe('Identify contracted and (’n’) as apostrophes (en-us):\n', () => { "drill 'n' bass": "drill ’n’ bass", - "drum 'n' bass": - "drum ’n’ bass", + "drum 'n' bass": + "drum ’n’ bass", + + "pick 'n' mix": + "pick ’n’ mix", - "pick 'n' mix": - "pick ’n’ mix", + "fish 'n' chips": + "fish ’n’ chips", - "fish 'n' chips": - "fish ’n’ chips", + "salt 'n' shake": + "salt ’n’ shake", - "salt 'n' shake": - "salt ’n’ shake", + "mac 'n' cheese": + "mac ’n’ cheese", - "mac 'n' cheese": - "mac ’n’ cheese", - "pork 'n' beans": "pork ’n’ beans", - "drag 'n' drop": - "drag ’n’ drop", + "drag 'n' drop": + "drag ’n’ drop", - "rake 'n' scrape": - "rake ’n’ scrape", + "rake 'n' scrape": + "rake ’n’ scrape", "hook 'n' kill": "hook ’n’ kill", - }; + }; let unitTestCase = { - ...moduleTestCase, - - //false positives - "Press ‘n’ button": - "Press ‘n’ button", - - }; - - - - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyContractedAnd( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - moduleTestCase[key]); - }); - }); + ...moduleTestCase, + + //false positives + "Press ‘n’ button": + "Press ‘n’ button", + + }; + + + + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyContractedAnd( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + moduleTestCase[key]); + }); + }); }); describe('Identify common contractions at the beginning of the word as apostrophes (en-us):\n', () => { - let testCase = { - "Just 'cause I wanna.": - "Just ’cause I wanna.", + let testCase = { + "Just 'cause I wanna.": + "Just ’cause I wanna.", - "'Tis the season": - "’Tis the season", + "'Tis the season": + "’Tis the season", - "'sblood": - "’sblood", + "'sblood": + "’sblood", - "'mongst": - "’mongst", + "'mongst": + "’mongst", - "'prentice": - "’prentice", + "'prentice": + "’prentice", - "'slight": - "’slight", + "'slight": + "’slight", - "'Strewth": - "’Strewth", + "'Strewth": + "’Strewth", - "'Twixt": - "’Twixt", + "'Twixt": + "’Twixt", - "'shun": - "’shun", + "'shun": + "’shun", - "'slid": - "’slid", + "'slid": + "’slid", - "Find 'em!": - "Find ’em!", + "Find 'em!": + "Find ’em!", - "'Twas the Night Before Christmas": - "’Twas the Night Before Christmas", + "'Twas the Night Before Christmas": + "’Twas the Night Before Christmas", - "'Til The Season Comes 'Round Again": - "’Til The Season Comes ’Round Again", + "'Til The Season Comes 'Round Again": + "’Til The Season Comes ’Round Again", - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyContractedBeginnings( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyContractedBeginnings( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]); + }); + }); - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Identify common contractions at the end of the word as apostrophes (en-us):\n', () => { - let testCase = { - "nottin'": - "nottin’", - - "gettin'": - "gettin’", - - "NOTTIN'": - "NOTTIN’", - - "GETTIN'": - "GETTIN’", - - }; - - let unitTestCase = { - ...testCase, - - // false positive, when it’s not a contracted word - "'something in'": - "'something in'", - } - - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyContractedEnds( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + let testCase = { + "nottin'": + "nottin’", + + "gettin'": + "gettin’", + + "NOTTIN'": + "NOTTIN’", + + "GETTIN'": + "GETTIN’", + + }; + + let unitTestCase = { + ...testCase, + + // false positive, when it’s not a contracted word + "'something in'": + "'something in'", + } + + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyContractedEnds( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Identify in-word contractions as apostrophes (en-us):\n', () => { - let testCase = { - "69'ers": "69’ers", - "iPhone6's": "iPhone6’s", - "1990's": "1990’s", - "don't" : "don’t", - "don''t" : "don’t", + let testCase = { + "69'ers": "69’ers", + "iPhone6's": "iPhone6’s", + "1990's": "1990’s", + "don't" : "don’t", + "don''t" : "don’t", "don''’t" : "don’t", "Paul‘s Diner": "Paul’s Diner", "Paul’s Diner": "Paul’s Diner", @@ -281,386 +281,386 @@ describe('Identify in-word contractions as apostrophes (en-us):\n', () => { "Paul`s Diner": "Paul’s Diner", "Paul‚s Diner": "Paul’s Diner", "Paul´s Diner": "Paul’s Diner", - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyInWordContractions( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyInWordContractions( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Identify contracted years as apostrophes (en-us):\n', () => { - let testCase = { - "INCHEBA '89": "INCHEBA ’89", - "in '70s": "in ’70s", - "Q1 '23": "Q1 ’23", - - - - }; - - - let unitTestCase = { - ...testCase, - - // false positive, when there is a wrongly spaced feet - "12 '45″": - "12 '45″", - } - - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyContractedYears( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + let testCase = { + "INCHEBA '89": "INCHEBA ’89", + "in '70s": "in ’70s", + "Q1 '23": "Q1 ’23", + + + + }; + + + let unitTestCase = { + ...testCase, + + // false positive, when there is a wrongly spaced feet + "12 '45″": + "12 '45″", + } + + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyContractedYears( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Identify feet and arcminutes following a 1–3 numbers (en-us):\n', () => { - let moduleTestCase = { - "12 ' 45″": - "12′ 45″", - - "12 ‘ 45″": - "12′ 45″", - - "12 ’ 45″": - "12′ 45″", - - "12 ‛ 45″": - "12′ 45″", - - "12 ′ 45″": - "12′ 45″", - - "12 ‛45″": - "12′45″", - - "12 '45″": //this is identified wrongly as 8217, right quotation mark in module tests - "12′45″", - - }; - - let unitTestCase = { - "12' 45″": - "12′ 45″", - - "12‘ 45″": - "12′ 45″", - - "12’ 45″": - "12′ 45″", - - "12‛ 45″": - "12′ 45″", - - "12′ 45″": - "12′ 45″", - - "12 ′ 45″": - "12 ′ 45″", - - "12'45″": - "12′45″", - - "12 '45″": - "12 ′45″", - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifySinglePrimes( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key] - ); - }); - }); - - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual( - fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), - moduleTestCase[key] - ); - }); - }); + let moduleTestCase = { + "12 ' 45″": + "12′ 45″", + + "12 ‘ 45″": + "12′ 45″", + + "12 ’ 45″": + "12′ 45″", + + "12 ‛ 45″": + "12′ 45″", + + "12 ′ 45″": + "12′ 45″", + + "12 ‛45″": + "12′45″", + + "12 '45″": //this is identified wrongly as 8217, right quotation mark in module tests + "12′45″", + + }; + + let unitTestCase = { + "12' 45″": + "12′ 45″", + + "12‘ 45″": + "12′ 45″", + + "12’ 45″": + "12′ 45″", + + "12‛ 45″": + "12′ 45″", + + "12′ 45″": + "12′ 45″", + + "12 ′ 45″": + "12 ′ 45″", + + "12'45″": + "12′45″", + + "12 '45″": + "12 ′45″", + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifySinglePrimes( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key] + ); + }); + }); + + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual( + fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), + moduleTestCase[key] + ); + }); + }); }); describe('Identify standalone left single quote (en-us):\n', () => { - let unitTestCase = { - "\" 'word\"": - "\" {{typopo__left-single-quote--standalone}}word\"", + let unitTestCase = { + "\" 'word\"": + "\" {{typopo__left-single-quote--standalone}}word\"", - "\" ‚word\"": - "\" {{typopo__left-single-quote--standalone}}word\"", + "\" ‚word\"": + "\" {{typopo__left-single-quote--standalone}}word\"", - " ‘word": - " {{typopo__left-single-quote--standalone}}word", + " ‘word": + " {{typopo__left-single-quote--standalone}}word", - "–‘word": - "–{{typopo__left-single-quote--standalone}}word", + "–‘word": + "–{{typopo__left-single-quote--standalone}}word", - "—‘word": - "—{{typopo__left-single-quote--standalone}}word", + "—‘word": + "—{{typopo__left-single-quote--standalone}}word", - " ʼword": - " {{typopo__left-single-quote--standalone}}word", + " ʼword": + " {{typopo__left-single-quote--standalone}}word", - " ‛word": - " {{typopo__left-single-quote--standalone}}word", + " ‛word": + " {{typopo__left-single-quote--standalone}}word", - " ´word": - " {{typopo__left-single-quote--standalone}}word", + " ´word": + " {{typopo__left-single-quote--standalone}}word", - " `word": - " {{typopo__left-single-quote--standalone}}word", + " `word": + " {{typopo__left-single-quote--standalone}}word", - " ′word": - " {{typopo__left-single-quote--standalone}}word", + " ′word": + " {{typopo__left-single-quote--standalone}}word", - " ‹word": - " {{typopo__left-single-quote--standalone}}word", + " ‹word": + " {{typopo__left-single-quote--standalone}}word", - " ›word": - " {{typopo__left-single-quote--standalone}}word", + " ›word": + " {{typopo__left-single-quote--standalone}}word", - }; + }; - let moduleTestCase = { - // heads up! since it’s a standalone quote it’s fixed as apostrophe within a module + let moduleTestCase = { + // heads up! since it’s a standalone quote it’s fixed as apostrophe within a module - "“ ‘word”": - "“ ’word”", + "“ ‘word”": + "“ ’word”", - "“–‘word”": - "“–’word”", + "“–‘word”": + "“–’word”", - "“—‘word”": - "“—’word”", + "“—‘word”": + "“—’word”", - "“ ʼword”": - "“ ’word”", + "“ ʼword”": + "“ ’word”", - "“ ‛word”": - "“ ’word”", + "“ ‛word”": + "“ ’word”", - "“ ´word”": - "“ ’word”", + "“ ´word”": + "“ ’word”", - "“ `word”": - "“ ’word”", + "“ `word”": + "“ ’word”", - "“ ′word”": - "“ ’word”", + "“ ′word”": + "“ ’word”", - "“ ‹word”": - "“ ’word”", + "“ ‹word”": + "“ ’word”", - "“ ›word”": - "“ ’word”", + "“ ›word”": + "“ ’word”", - }; + }; - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - identifyStandaloneLeftSingleQuote( - key, - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - moduleTestCase[key]); - }); - }); + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + identifyStandaloneLeftSingleQuote( + key, + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + moduleTestCase[key]); + }); + }); }); describe('Identify standalone right single quote (en-us):\n', () => { - let unitTestCase = { - "\"word'\"": - "\"word{{typopo__right-single-quote--standalone}}\"", + let unitTestCase = { + "\"word'\"": + "\"word{{typopo__right-single-quote--standalone}}\"", - "\"word‚\"": - "\"word{{typopo__right-single-quote--standalone}}\"", + "\"word‚\"": + "\"word{{typopo__right-single-quote--standalone}}\"", - "word‘": - "word{{typopo__right-single-quote--standalone}}", + "word‘": + "word{{typopo__right-single-quote--standalone}}", - "wordʼ": - "word{{typopo__right-single-quote--standalone}}", + "wordʼ": + "word{{typopo__right-single-quote--standalone}}", - "word‛": - "word{{typopo__right-single-quote--standalone}}", + "word‛": + "word{{typopo__right-single-quote--standalone}}", - "word´": - "word{{typopo__right-single-quote--standalone}}", + "word´": + "word{{typopo__right-single-quote--standalone}}", - "word`": - "word{{typopo__right-single-quote--standalone}}", + "word`": + "word{{typopo__right-single-quote--standalone}}", - "word′": - "word{{typopo__right-single-quote--standalone}}", + "word′": + "word{{typopo__right-single-quote--standalone}}", - "word‹": - "word{{typopo__right-single-quote--standalone}}", + "word‹": + "word{{typopo__right-single-quote--standalone}}", - "word›": - "word{{typopo__right-single-quote--standalone}}", + "word›": + "word{{typopo__right-single-quote--standalone}}", - "word.'": - "word.{{typopo__right-single-quote--standalone}}", + "word.'": + "word.{{typopo__right-single-quote--standalone}}", - "word!'": - "word!{{typopo__right-single-quote--standalone}}", + "word!'": + "word!{{typopo__right-single-quote--standalone}}", - "word':": - "word{{typopo__right-single-quote--standalone}}:", + "word':": + "word{{typopo__right-single-quote--standalone}}:", - "word',": - "word{{typopo__right-single-quote--standalone}},", + "word',": + "word{{typopo__right-single-quote--standalone}},", - "word' ": - "word{{typopo__right-single-quote--standalone}} ", + "word' ": + "word{{typopo__right-single-quote--standalone}} ", - }; + }; - let moduleTestCase = { - // heads up! since it’s a standalone quote it’s fixed as apostrophe within a module + let moduleTestCase = { + // heads up! since it’s a standalone quote it’s fixed as apostrophe within a module - "“word'”": - "“word’”", + "“word'”": + "“word’”", - "“word‚”": - "“word’”", + "“word‚”": + "“word’”", - "“word‘”": - "“word’”", + "“word‘”": + "“word’”", - "“wordʼ”": - "“word’”", + "“wordʼ”": + "“word’”", - "“word‛”": - "“word’”", + "“word‛”": + "“word’”", - "“word´”": - "“word’”", + "“word´”": + "“word’”", - "“word`”": - "“word’”", + "“word`”": + "“word’”", - "“word′”": - "“word’”", + "“word′”": + "“word’”", - "“word‹”": - "“word’”", + "“word‹”": + "“word’”", - "“word›”": - "“word’”", + "“word›”": + "“word’”", - "“word.'”": - "“word.’”", + "“word.'”": + "“word.’”", - "“word!'”": - "“word!’”", + "“word!'”": + "“word!’”", - "“word':”": - "“word’:”", + "“word':”": + "“word’:”", - "“word',”": - "“word’,”", + "“word',”": + "“word’,”", - }; + }; - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - identifyStandaloneRightSingleQuote( - key, - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), - moduleTestCase[key]); - }); - }); + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + identifyStandaloneRightSingleQuote( + key, + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), + moduleTestCase[key]); + }); + }); }); @@ -668,117 +668,117 @@ describe('Identify standalone right single quote (en-us):\n', () => { describe('Identify single quote pairs (en-us):\n', () => { - let unitTestCase = { - "{{typopo__left-single-quote--standalone}}word{{typopo__right-single-quote--standalone}}": - "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", - - "{{typopo__left-single-quote--standalone}}word word{{typopo__right-single-quote--standalone}}": - "{{typopo__left-single-quote}}word word{{typopo__right-single-quote}}", - - }; - - let moduleTestCase = { - "He said: “What about 'word', is that good?”": - "He said: “What about ‘word’, is that good?”", - - "He said: “What about 'word' 'word', is that good?”": - "He said: “What about ‘word’ ‘word’, is that good?”", - - "He said: “What about 'word word', is that good?”": - "He said: “What about ‘word word’, is that good?”", - - // this case is not covered, the value is false - // the first right single quote is falsely an apostrophe - // the second left single quote is falsely an apostrophe - "He said: “What about 'word word' 'word word', is that good?”": - "He said: “What about ‘word word’ ’word word’, is that good?”", - - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - identifySingleQuotePairs( - key, - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - moduleTestCase[key]); - }); - }); + let unitTestCase = { + "{{typopo__left-single-quote--standalone}}word{{typopo__right-single-quote--standalone}}": + "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", + + "{{typopo__left-single-quote--standalone}}word word{{typopo__right-single-quote--standalone}}": + "{{typopo__left-single-quote}}word word{{typopo__right-single-quote}}", + + }; + + let moduleTestCase = { + "He said: “What about 'word', is that good?”": + "He said: “What about ‘word’, is that good?”", + + "He said: “What about 'word' 'word', is that good?”": + "He said: “What about ‘word’ ‘word’, is that good?”", + + "He said: “What about 'word word', is that good?”": + "He said: “What about ‘word word’, is that good?”", + + // this case is not covered, the value is false + // the first right single quote is falsely an apostrophe + // the second left single quote is falsely an apostrophe + "He said: “What about 'word word' 'word word', is that good?”": + "He said: “What about ‘word word’ ’word word’, is that good?”", + + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + identifySingleQuotePairs( + key, + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + moduleTestCase[key]); + }); + }); }); describe('Identify single quote pairs around single word (en-us):\n', () => { - let moduleTestCase = { - "'word'": - "‘word’", - - "'word' 'word'": - "‘word’ ‘word’", - - "He said: “What about 'word', is that good?”": - "He said: “What about ‘word’, is that good?”", - - "Press 'N' to get started": - "Press ‘N’ to get started", - }; - - - let unitTestCase = { - - ...moduleTestCase, - - // false positives - "... don't'": - "... don't'", - - "'don't ...": - "'don't ...", - - // false positive - // this function does fix multiple words within single quotes - // limitation: contractions at the end of the word, e.g. jes' - "'word word'": - "'word word'", - - }; - - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifySingleQuotePairAroundSingleWord( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - unitTestCase[key]) - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - moduleTestCase[key]); - }); - }); + let moduleTestCase = { + "'word'": + "‘word’", + + "'word' 'word'": + "‘word’ ‘word’", + + "He said: “What about 'word', is that good?”": + "He said: “What about ‘word’, is that good?”", + + "Press 'N' to get started": + "Press ‘N’ to get started", + }; + + + let unitTestCase = { + + ...moduleTestCase, + + // false positives + "... don't'": + "... don't'", + + "'don't ...": + "'don't ...", + + // false positive + // this function does fix multiple words within single quotes + // limitation: contractions at the end of the word, e.g. jes' + "'word word'": + "'word word'", + + }; + + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifySingleQuotePairAroundSingleWord( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + unitTestCase[key]) + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + moduleTestCase[key]); + }); + }); }); @@ -787,374 +787,374 @@ describe('Identify single quote pairs around single word (en-us):\n', () => { describe('Replace a single qoute & a single prime with a single quote pair (en-us):\n', () => { - let unitTestCase = { - "{{typopo__left-single-quote--standalone}}word{{typopo__single-prime}}": - "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", - - "{{typopo__single-prime}}word{{typopo__right-single-quote--standalone}}": - "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", - - // ...testFalsePositives, - }; - - let moduleTestCase = { - "He said: “What about 'Localhost 3000', is that good?”": - "He said: “What about ‘Localhost 3000’, is that good?”", - - "He said: “Here are 30 'bucks'”": - "He said: “Here are 30 ‘bucks’”", - - // ...testFalsePositives, - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - replaceSinglePrimeWSingleQuote( - key, - new Locale("en-us") - ), - unitTestCase[key]); - }); - }); - - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - moduleTestCase[key]); - }); - }); + let unitTestCase = { + "{{typopo__left-single-quote--standalone}}word{{typopo__single-prime}}": + "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", + + "{{typopo__single-prime}}word{{typopo__right-single-quote--standalone}}": + "{{typopo__left-single-quote}}word{{typopo__right-single-quote}}", + + // ...testFalsePositives, + }; + + let moduleTestCase = { + "He said: “What about 'Localhost 3000', is that good?”": + "He said: “What about ‘Localhost 3000’, is that good?”", + + "He said: “Here are 30 'bucks'”": + "He said: “Here are 30 ‘bucks’”", + + // ...testFalsePositives, + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + replaceSinglePrimeWSingleQuote( + key, + new Locale("en-us") + ), + unitTestCase[key]); + }); + }); + + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + moduleTestCase[key]); + }); + }); }); describe('Identify residual apostrophes (en-us):\n', () => { - let testCase = { - "Hers'": - "Hers’", - - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - placeLocaleSingleQuotes( - identifyResidualApostrophes( - key, - new Locale("en-us") - ), - new Locale("en-us") - ), - testCase[key]) - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + let testCase = { + "Hers'": + "Hers’", + + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + placeLocaleSingleQuotes( + identifyResidualApostrophes( + key, + new Locale("en-us") + ), + new Locale("en-us") + ), + testCase[key]) + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Remove extra space around a single prime:\n', () => { - let testCase = { - "12 ′ 45″": - "12′ 45″", - - "12 ′45″": - "12′45″", - }; - - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - removeExtraSpaceAroundSinglePrime( - key, - new Locale("en-us") - ), - testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks), - testCase[key]); - }); - }); + let testCase = { + "12 ′ 45″": + "12′ 45″", + + "12 ′45″": + "12′45″", + }; + + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + removeExtraSpaceAroundSinglePrime( + key, + new Locale("en-us") + ), + testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks), + testCase[key]); + }); + }); }); describe('Swap single quotes and terminal punctuation for a quoted part (en-us):\n', () => { - let testCase = { + let testCase = { - // quoted part at the - // end of a sentence - // end of a paragraph - "Sometimes it can be only a ‘quoted part.’": - "Sometimes it can be only a ‘quoted part’.", + // quoted part at the + // end of a sentence + // end of a paragraph + "Sometimes it can be only a ‘quoted part.’": + "Sometimes it can be only a ‘quoted part’.", - "Sometimes it can be only a ‘quoted’ ‘part.’": - "Sometimes it can be only a ‘quoted’ ‘part’.", - - "Is it ‘Amores Perros’?": - "Is it ‘Amores Perros’?", + "Sometimes it can be only a ‘quoted’ ‘part.’": + "Sometimes it can be only a ‘quoted’ ‘part’.", + + "Is it ‘Amores Perros’?": + "Is it ‘Amores Perros’?", - "Look for ‘Anguanga’.": - "Look for ‘Anguanga’.", + "Look for ‘Anguanga’.": + "Look for ‘Anguanga’.", - "‘A whole sentence.’ Only a ‘quoted part.’": - "‘A whole sentence.’ Only a ‘quoted part’.", + "‘A whole sentence.’ Only a ‘quoted part.’": + "‘A whole sentence.’ Only a ‘quoted part’.", - // quoted part at the - // end of a sentence - // middle of a paragraph - "a ‘quoted part.’ A ‘quoted part.’": - "a ‘quoted part’. A ‘quoted part’.", + // quoted part at the + // end of a sentence + // middle of a paragraph + "a ‘quoted part.’ A ‘quoted part.’": + "a ‘quoted part’. A ‘quoted part’.", - "Only a ‘quoted part.’ ‘A whole sentence.’": - "Only a ‘quoted part’. ‘A whole sentence.’", + "Only a ‘quoted part.’ ‘A whole sentence.’": + "Only a ‘quoted part’. ‘A whole sentence.’", - // quoted part in the middle of a sentence - // toto tu je asi zbytocny test - "Only a ‘quoted part’ in a sentence. ‘A whole sentence.’": - "Only a ‘quoted part’ in a sentence. ‘A whole sentence.’", + // quoted part in the middle of a sentence + // toto tu je asi zbytocny test + "Only a ‘quoted part’ in a sentence. ‘A whole sentence.’": + "Only a ‘quoted part’ in a sentence. ‘A whole sentence.’", - // place punctuation within a quoted sentence that’s in the middle of the sentence. - "Ask ‘What’s going on in here’? so you can dig deeper.": - "Ask ‘What’s going on in here?’ so you can dig deeper.", + // place punctuation within a quoted sentence that’s in the middle of the sentence. + "Ask ‘What’s going on in here’? so you can dig deeper.": + "Ask ‘What’s going on in here?’ so you can dig deeper.", - "Before you ask the ‘How often…’ question": - "Before you ask the ‘How often…’ question", + "Before you ask the ‘How often…’ question": + "Before you ask the ‘How often…’ question", - "‘…example’": - "‘…example’", + "‘…example’": + "‘…example’", - "abc ‘…example’": - "abc ‘…example’", + "abc ‘…example’": + "abc ‘…example’", - // place punctuation within a quoted sentence - "He was ok. ‘He was ok’.": - "He was ok. ‘He was ok.’", + // place punctuation within a quoted sentence + "He was ok. ‘He was ok’.": + "He was ok. ‘He was ok.’", - "He was ok. ‘He was ok’. He was ok.": - "He was ok. ‘He was ok.’ He was ok.", + "He was ok. ‘He was ok’. He was ok.": + "He was ok. ‘He was ok.’ He was ok.", - "He was ok? ‘He was ok’.": - "He was ok? ‘He was ok.’", + "He was ok? ‘He was ok’.": + "He was ok? ‘He was ok.’", - // swap a right quote and terminal punctuation for the whole sentence - "‘He was ok’.": - "‘He was ok.’", + // swap a right quote and terminal punctuation for the whole sentence + "‘He was ok’.": + "‘He was ok.’", - "‘He was ok’?": - "‘He was ok?’", + "‘He was ok’?": + "‘He was ok?’", - "‘He was ok’. He was ok.": - "‘He was ok.’ He was ok.", + "‘He was ok’. He was ok.": + "‘He was ok.’ He was ok.", - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - swapSingleQuotesAndTerminalPunctuation( - key, - new Locale("en-us") - ), - testCase[key] - ); - }); - // it("module test", () => { - // assert.strictEqual( - // fixSingleQuotesPrimesAndApostrophes( - // key, - // new Locale("en-us"), - // configIgnoreMarkdownCodeBlocks - // ), testCase[key]); - // }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + swapSingleQuotesAndTerminalPunctuation( + key, + new Locale("en-us") + ), + testCase[key] + ); + }); + // it("module test", () => { + // assert.strictEqual( + // fixSingleQuotesPrimesAndApostrophes( + // key, + // new Locale("en-us"), + // configIgnoreMarkdownCodeBlocks + // ), testCase[key]); + // }); + }); }); describe('Single quotes in default language (en-us)\n', () => { - let testCase = { - "Let's test this: “however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said”": - "Let’s test this: “however, ‘quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,’ he said”", - - "Within double quotes “there are single 'quotes with mix’d punctuation', you see”.": - "Within double quotes “there are single ‘quotes with mix’d punctuation’, you see”.", - - - "And I ask you: “What’s the idea behind this—how do you call it—'one size fits all' approach?”": - "And I ask you: “What’s the idea behind this—how do you call it—‘one size fits all’ approach?”", - - - "Hej: “Vin mu povil, 'ta de jes' take vidil' i neviril”": - "Hej: “Vin mu povil, ‘ta de jes’ take vidil’ i neviril”", - - - - "“double quotes 'and single quotes' within”": - "“double quotes ‘and single quotes’ within”", - - "“double quotes 'and single quotes’ within”": - "“double quotes ‘and single quotes’ within”", - - "“double quotes ‚and single quotes' within”": - "“double quotes ‘and single quotes’ within”", - - "He said: “What about 'name' and 'other name'?”": - "He said: “What about ‘name’ and ‘other name’?”", - }; - - Object.keys(testCase).forEach((key) => { - it("module test (en)", () => { - assert.strictEqual( - fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configIgnoreMarkdownCodeBlocks - ), testCase[key]); - }); - }); + let testCase = { + "Let's test this: “however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said”": + "Let’s test this: “however, ‘quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,’ he said”", + + "Within double quotes “there are single 'quotes with mix’d punctuation', you see”.": + "Within double quotes “there are single ‘quotes with mix’d punctuation’, you see”.", + + + "And I ask you: “What’s the idea behind this—how do you call it—'one size fits all' approach?”": + "And I ask you: “What’s the idea behind this—how do you call it—‘one size fits all’ approach?”", + + + "Hej: “Vin mu povil, 'ta de jes' take vidil' i neviril”": + "Hej: “Vin mu povil, ‘ta de jes’ take vidil’ i neviril”", + + + + "“double quotes 'and single quotes' within”": + "“double quotes ‘and single quotes’ within”", + + "“double quotes 'and single quotes’ within”": + "“double quotes ‘and single quotes’ within”", + + "“double quotes ‚and single quotes' within”": + "“double quotes ‘and single quotes’ within”", + + "He said: “What about 'name' and 'other name'?”": + "He said: “What about ‘name’ and ‘other name’?”", + }; + + Object.keys(testCase).forEach((key) => { + it("module test (en)", () => { + assert.strictEqual( + fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configIgnoreMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); describe('Single quotes in (sk, cs, de-de)\n', () => { - let testCase = { - "Let's test this: „however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said“": - "Let’s test this: „however, ‚quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,‘ he said“", - - "Within double quotes „there are single 'quotes with mix’d punctuation', you see“.": - "Within double quotes „there are single ‚quotes with mix’d punctuation‘, you see“.", - - - "And I ask you: „What’s the idea behind this—how do you call it—'one size fits all' approach?“": - "And I ask you: „What’s the idea behind this—how do you call it—‚one size fits all‘ approach?“", - - "Hej: „Vin mu povil, 'ta de jes' take vidil' i neviril“": - "Hej: „Vin mu povil, ‚ta de jes’ take vidil‘ i neviril“", - - "„double quotes 'and single quotes' within“": - "„double quotes ‚and single quotes‘ within“", - - - "He said: „What about 'name' and 'other name'?“": - "He said: „What about ‚name‘ and ‚other name‘?“", - }; - - - Object.keys(testCase).forEach((key) => { - it("should fix single quotes, primes and apostrophes in (sk, cs, de-de)", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("sk"), configIgnoreMarkdownCodeBlocks), testCase[key]); - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("cs"), configIgnoreMarkdownCodeBlocks), testCase[key]); - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("de-de"), configIgnoreMarkdownCodeBlocks), testCase[key]); - }); - }); + let testCase = { + "Let's test this: „however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said“": + "Let’s test this: „however, ‚quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,‘ he said“", + + "Within double quotes „there are single 'quotes with mix’d punctuation', you see“.": + "Within double quotes „there are single ‚quotes with mix’d punctuation‘, you see“.", + + + "And I ask you: „What’s the idea behind this—how do you call it—'one size fits all' approach?“": + "And I ask you: „What’s the idea behind this—how do you call it—‚one size fits all‘ approach?“", + + "Hej: „Vin mu povil, 'ta de jes' take vidil' i neviril“": + "Hej: „Vin mu povil, ‚ta de jes’ take vidil‘ i neviril“", + + "„double quotes 'and single quotes' within“": + "„double quotes ‚and single quotes‘ within“", + + + "He said: „What about 'name' and 'other name'?“": + "He said: „What about ‚name‘ and ‚other name‘?“", + }; + + + Object.keys(testCase).forEach((key) => { + it("should fix single quotes, primes and apostrophes in (sk, cs, de-de)", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("sk"), configIgnoreMarkdownCodeBlocks), testCase[key]); + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("cs"), configIgnoreMarkdownCodeBlocks), testCase[key]); + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("de-de"), configIgnoreMarkdownCodeBlocks), testCase[key]); + }); + }); }); describe('Single quotes in (rue)\n', () => { - let testCase = { + let testCase = { - "Let's test this: «however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said»": - "Let’s test this: «however, ‹quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,› he said»", + "Let's test this: «however, 'quote this or nottin' rock 'n' roll this will be corrected for 69'ers,' he said»": + "Let’s test this: «however, ‹quote this or nottin’ rock ’n’ roll this will be corrected for 69’ers,› he said»", - "Within double quotes «there are single 'quotes with mix’d punctuation', you see».": - "Within double quotes «there are single ‹quotes with mix’d punctuation›, you see».", + "Within double quotes «there are single 'quotes with mix’d punctuation', you see».": + "Within double quotes «there are single ‹quotes with mix’d punctuation›, you see».", - - "And I ask you: «What’s the idea behind this—how do you call it—'one size fits all' approach?»": - "And I ask you: «What’s the idea behind this—how do you call it—‹one size fits all› approach?»", + + "And I ask you: «What’s the idea behind this—how do you call it—'one size fits all' approach?»": + "And I ask you: «What’s the idea behind this—how do you call it—‹one size fits all› approach?»", - - "Hej: «Vin mu povil, 'ta de jes' take vidil' i neviril»": - "Hej: «Vin mu povil, ‹ta de jes’ take vidil› i neviril»", + + "Hej: «Vin mu povil, 'ta de jes' take vidil' i neviril»": + "Hej: «Vin mu povil, ‹ta de jes’ take vidil› i neviril»", - }; + }; - Object.keys(testCase).forEach((key) => { - it("should fix single quotes, primes and apostrophes in Rusyn", () => { - assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("rue"), configIgnoreMarkdownCodeBlocks), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("should fix single quotes, primes and apostrophes in Rusyn", () => { + assert.strictEqual(fixSingleQuotesPrimesAndApostrophes(key, new Locale("rue"), configIgnoreMarkdownCodeBlocks), testCase[key]); + }); + }); }); describe('Test if markdown ticks are kept (single quotes) (en-us):\n', () => { - let testCase = { - "```\ncode\n```": - "```\ncode\n```", + let testCase = { + "```\ncode\n```": + "```\ncode\n```", - "\t```\ncode\n```": - "\t```\ncode\n```", + "\t```\ncode\n```": + "\t```\ncode\n```", - "\t\t```\ncode\n```": - "\t\t```\ncode\n```", + "\t\t```\ncode\n```": + "\t\t```\ncode\n```", - " ```\ncode\n```": - " ```\ncode\n```", + " ```\ncode\n```": + " ```\ncode\n```", - " ```\ncode\n```": - " ```\ncode\n```", + " ```\ncode\n```": + " ```\ncode\n```", - "``code``": - "``code``", + "``code``": + "``code``", - "``code code``": - "``code code``", + "``code code``": + "``code code``", - "``code`` ``code``": - "``code`` ``code``", + "``code`` ``code``": + "``code`` ``code``", - "`code`": - "`code`", + "`code`": + "`code`", - "`code code`": - "`code code`", + "`code code`": + "`code code`", - "`code` `code`": - "`code` `code`", - }; + "`code` `code`": + "`code` `code`", + }; - Object.keys(testCase).forEach((key) => { + Object.keys(testCase).forEach((key) => { - it("keepMarkdownCodeBlocks: true” configuration", () => { - assert.strictEqual( - fixSingleQuotesPrimesAndApostrophes( - key, - new Locale("en-us"), - configKeepMarkdownCodeBlocks - ), testCase[key]); - }); - }); + it("keepMarkdownCodeBlocks: true” configuration", () => { + assert.strictEqual( + fixSingleQuotesPrimesAndApostrophes( + key, + new Locale("en-us"), + configKeepMarkdownCodeBlocks + ), testCase[key]); + }); + }); }); diff --git a/tests/symbols/exponents.test.js b/tests/symbols/exponents.test.js index 4a000ac..b57a05a 100644 --- a/tests/symbols/exponents.test.js +++ b/tests/symbols/exponents.test.js @@ -1,108 +1,108 @@ import {fixExponents, - fixSquares, - fixCubes} from "../../src/modules/symbols/exponents"; + fixSquares, + fixCubes} from "../../src/modules/symbols/exponents"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix squares\n', () => { - let testCase = { - "100 m2" : "100 m²", - "100 dam2" : "100 dam²", - "100 hm2" : "100 hm²", - "100 km2" : "100 km²", - "100 Mm2" : "100 Mm²", - "100 Gm2" : "100 Gm²", - "100 Tm2" : "100 Tm²", - "100 Pm2" : "100 Pm²", - "100 Em2" : "100 Em²", - "100 Zm2" : "100 Zm²", - "100 Ym2" : "100 Ym²", - "100 dm2" : "100 dm²", - "100 cm2" : "100 cm²", - "100 mm2" : "100 mm²", - "100 µm2" : "100 µm²", - "100 nm2" : "100 nm²", - "100 pm2" : "100 pm²", - "100 fm2" : "100 fm²", - "100 am2" : "100 am²", - "100 zm2" : "100 zm²", - "100 ym2" : "100 ym²", - "Holmen 80 g/m2" : "Holmen 80 g/m²", - "Madam2" : "Madam2", //false positive + let testCase = { + "100 m2" : "100 m²", + "100 dam2" : "100 dam²", + "100 hm2" : "100 hm²", + "100 km2" : "100 km²", + "100 Mm2" : "100 Mm²", + "100 Gm2" : "100 Gm²", + "100 Tm2" : "100 Tm²", + "100 Pm2" : "100 Pm²", + "100 Em2" : "100 Em²", + "100 Zm2" : "100 Zm²", + "100 Ym2" : "100 Ym²", + "100 dm2" : "100 dm²", + "100 cm2" : "100 cm²", + "100 mm2" : "100 mm²", + "100 µm2" : "100 µm²", + "100 nm2" : "100 nm²", + "100 pm2" : "100 pm²", + "100 fm2" : "100 fm²", + "100 am2" : "100 am²", + "100 zm2" : "100 zm²", + "100 ym2" : "100 ym²", + "Holmen 80 g/m2" : "Holmen 80 g/m²", + "Madam2" : "Madam2", //false positive - // m2 - // dam2 - // hm2 - // km2 - // Mm2 - // Gm2 - // Tm2 - // Pm2 - // Em2 - // Zm2 - // Ym2 - // m2 - // dm2 - // cm2 - // mm2 - // µm2 - // nm2 - // pm2 - // fm2 - // am2 - // zm2 - // ym2 - }; + // m2 + // dam2 + // hm2 + // km2 + // Mm2 + // Gm2 + // Tm2 + // Pm2 + // Em2 + // Zm2 + // Ym2 + // m2 + // dm2 + // cm2 + // mm2 + // µm2 + // nm2 + // pm2 + // fm2 + // am2 + // zm2 + // ym2 + }; - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(fixSquares(key, new Locale("en-us")), testCase[key]); - }); - }); - Object.keys(testCase).forEach((key) => { - it("module tests", () => { - assert.strictEqual(fixExponents(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(fixSquares(key, new Locale("en-us")), testCase[key]); + }); + }); + Object.keys(testCase).forEach((key) => { + it("module tests", () => { + assert.strictEqual(fixExponents(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix cubes\n', () => { - let testCase = { - "100 m3" : "100 m³", - "100 dam3" : "100 dam³", - "100 hm3" : "100 hm³", - "100 km3" : "100 km³", - "100 Mm3" : "100 Mm³", - "100 Gm3" : "100 Gm³", - "100 Tm3" : "100 Tm³", - "100 Pm3" : "100 Pm³", - "100 Em3" : "100 Em³", - "100 Zm3" : "100 Zm³", - "100 Ym3" : "100 Ym³", - "100 dm3" : "100 dm³", - "100 cm3" : "100 cm³", - "100 mm3" : "100 mm³", - "100 µm3" : "100 µm³", - "100 nm3" : "100 nm³", - "100 pm3" : "100 pm³", - "100 fm3" : "100 fm³", - "100 am3" : "100 am³", - "100 zm3" : "100 zm³", - "100 ym3" : "100 ym³", - "Holmen 80 g/m3" : "Holmen 80 g/m³", - "Madam3" : "Madam3", //false positive - }; + let testCase = { + "100 m3" : "100 m³", + "100 dam3" : "100 dam³", + "100 hm3" : "100 hm³", + "100 km3" : "100 km³", + "100 Mm3" : "100 Mm³", + "100 Gm3" : "100 Gm³", + "100 Tm3" : "100 Tm³", + "100 Pm3" : "100 Pm³", + "100 Em3" : "100 Em³", + "100 Zm3" : "100 Zm³", + "100 Ym3" : "100 Ym³", + "100 dm3" : "100 dm³", + "100 cm3" : "100 cm³", + "100 mm3" : "100 mm³", + "100 µm3" : "100 µm³", + "100 nm3" : "100 nm³", + "100 pm3" : "100 pm³", + "100 fm3" : "100 fm³", + "100 am3" : "100 am³", + "100 zm3" : "100 zm³", + "100 ym3" : "100 ym³", + "Holmen 80 g/m3" : "Holmen 80 g/m³", + "Madam3" : "Madam3", //false positive + }; - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(fixCubes(key, new Locale("en-us")), testCase[key]); - }); - }); - Object.keys(testCase).forEach((key) => { - it("module tests", () => { - assert.strictEqual(fixExponents(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(fixCubes(key, new Locale("en-us")), testCase[key]); + }); + }); + Object.keys(testCase).forEach((key) => { + it("module tests", () => { + assert.strictEqual(fixExponents(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/symbols/multiplication-sign.test.js b/tests/symbols/multiplication-sign.test.js index 2d897b6..84675b9 100644 --- a/tests/symbols/multiplication-sign.test.js +++ b/tests/symbols/multiplication-sign.test.js @@ -1,86 +1,86 @@ import {fixMultiplicationSignBetweenNumbers, - fixMultiplicationSignBetweenWords, - fixMultiplicationSignBetweenNumberAndWord, - fixNbspAroundMultiplicationSign, - fixMultiplicationSign} from "../../src/modules/symbols/multiplication-sign"; + fixMultiplicationSignBetweenWords, + fixMultiplicationSignBetweenNumberAndWord, + fixNbspAroundMultiplicationSign, + fixMultiplicationSign} from "../../src/modules/symbols/multiplication-sign"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix multiplication sign between numbers\n', () => { - let testCase = { - "5 x 4": "5 × 4", - "5 X 4": "5 × 4", - "5″ x 4″": "5″ × 4″", - "5′ x 4′": "5′ × 4′", - - "5 mm x 5 mm": "5 mm × 5 mm", - "5 žien X 5 žien": "5 žien × 5 žien", - "5cm x 5cm": "5cm × 5cm", - - "5 x 4 x 3": "5 × 4 × 3", - "5″ x 4″ x 3″": "5″ × 4″ × 3″", - "5 mm x 5 mm x 5 mm": "5 mm × 5 mm × 5 mm", - - "4xenographs" : "4xenographs", // false positive - "0xd" : "0xd", //false positive, hex number - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixMultiplicationSignBetweenNumbers(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "5 x 4": "5 × 4", + "5 X 4": "5 × 4", + "5″ x 4″": "5″ × 4″", + "5′ x 4′": "5′ × 4′", + + "5 mm x 5 mm": "5 mm × 5 mm", + "5 žien X 5 žien": "5 žien × 5 žien", + "5cm x 5cm": "5cm × 5cm", + + "5 x 4 x 3": "5 × 4 × 3", + "5″ x 4″ x 3″": "5″ × 4″ × 3″", + "5 mm x 5 mm x 5 mm": "5 mm × 5 mm × 5 mm", + + "4xenographs" : "4xenographs", // false positive + "0xd" : "0xd", //false positive, hex number + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixMultiplicationSignBetweenNumbers(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix multiplication sign between words\n', () => { - let testCase = { - "š x v x h" : "š × v × h", - "mm x mm": "mm × mm", - "Marciano x Clay" : "Marciano × Clay", - "žena x žena" : "žena × žena", - - "light xenons" : "light xenons", // false positive - "František X Šalda" : "František X Šalda" // false positive; noun abbr. in en-us - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixMultiplicationSignBetweenWords(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "š x v x h" : "š × v × h", + "mm x mm": "mm × mm", + "Marciano x Clay" : "Marciano × Clay", + "žena x žena" : "žena × žena", + + "light xenons" : "light xenons", // false positive + "František X Šalda" : "František X Šalda" // false positive; noun abbr. in en-us + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixMultiplicationSignBetweenWords(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix multiplication sign between a number and a word\n', () => { - let testCase = { - "4 x object" : "4 × object", - "4x object" : "4× object", - "4X object" : "4× object", - "4X žena" : "4× žena", - "4 xenographs" : "4 xenographs", // false positive - "4xenographs" : "4xenographs", // false positive - "0xd" : "0xd", //false positive, hex number - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixMultiplicationSignBetweenNumberAndWord(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "4 x object" : "4 × object", + "4x object" : "4× object", + "4X object" : "4× object", + "4X žena" : "4× žena", + "4 xenographs" : "4 xenographs", // false positive + "4xenographs" : "4xenographs", // false positive + "0xd" : "0xd", //false positive, hex number + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixMultiplicationSignBetweenNumberAndWord(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); + }); + }); }); @@ -89,19 +89,19 @@ describe('Fix multiplication sign between a number and a word\n', () => { describe('Fix nbsp around multiplication sign\n', () => { - let testCase = { - "12x3": "12 × 3", - "12×3": "12 × 3", - "12″×3″": "12″ × 3″", - "12′×3′": "12′ × 3′", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixNbspAroundMultiplicationSign(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "12x3": "12 × 3", + "12×3": "12 × 3", + "12″×3″": "12″ × 3″", + "12′×3′": "12′ × 3′", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixNbspAroundMultiplicationSign(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixMultiplicationSign(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/symbols/plus-minus.test.js b/tests/symbols/plus-minus.test.js index 50d022a..a3f9c5d 100644 --- a/tests/symbols/plus-minus.test.js +++ b/tests/symbols/plus-minus.test.js @@ -3,14 +3,14 @@ import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix plus-minus symbol ±\n', () => { - let testCase = { - "+-": "±", - "-+": "±", - }; + let testCase = { + "+-": "±", + "-+": "±", + }; - Object.keys(testCase).forEach((key) => { - it("", () => { - assert.strictEqual(fixPlusMinus(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("", () => { + assert.strictEqual(fixPlusMinus(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/symbols/section-sign.test.js b/tests/symbols/section-sign.test.js index c270081..90a786a 100644 --- a/tests/symbols/section-sign.test.js +++ b/tests/symbols/section-sign.test.js @@ -3,22 +3,22 @@ import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix section sign (§)\n', () => { - let testCase = { - "under Law§1782": "under Law § 1782", - "(e.g.§§13–21)": "(e.g. §§ 13–21)", - "(§§13–21)": "(§§ 13–21)", - "(§13–21)": "(§ 13–21)", - "under Law §1782": "under Law § 1782", - "(e.g. §§13–21)": "(e.g. §§ 13–21)", - "under Law § 1782": "under Law § 1782", - "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", - "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", // hairSpace - "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", // narrowNbsp - }; + let testCase = { + "under Law§1782": "under Law § 1782", + "(e.g.§§13–21)": "(e.g. §§ 13–21)", + "(§§13–21)": "(§§ 13–21)", + "(§13–21)": "(§ 13–21)", + "under Law §1782": "under Law § 1782", + "(e.g. §§13–21)": "(e.g. §§ 13–21)", + "under Law § 1782": "under Law § 1782", + "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", + "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", // hairSpace + "(e.g. §§ 13–21)": "(e.g. §§ 13–21)", // narrowNbsp + }; - Object.keys(testCase).forEach((key) => { - it("", () => { - assert.strictEqual(fixSectionSign(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("", () => { + assert.strictEqual(fixSectionSign(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/whitespace/lines.test.js b/tests/whitespace/lines.test.js index e27843c..f13095a 100644 --- a/tests/whitespace/lines.test.js +++ b/tests/whitespace/lines.test.js @@ -2,19 +2,19 @@ import {removeEmptyLines} from "../../src/modules/whitespace/lines"; import assert from 'assert'; describe('Remove empty lines\n', () => { - let testCase = { - // Remove excessive empty lines between paragraphs + let testCase = { + // Remove excessive empty lines between paragraphs "line\nline\n\nline\n\n\nline": "line\nline\nline\nline", "line\nline\r\nline\r\n\nline": "line\nline\nline\nline", // False positives " - she said": " - she said", // do not remove space at the beginning of paragraph - }; + }; - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(removeEmptyLines(key), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(removeEmptyLines(key), testCase[key]); + }); + }); }); diff --git a/tests/whitespace/nbsp.test.js b/tests/whitespace/nbsp.test.js index d9f6a24..f680e40 100644 --- a/tests/whitespace/nbsp.test.js +++ b/tests/whitespace/nbsp.test.js @@ -1,675 +1,675 @@ import {removeNbspBetweenMultiCharWords, - addNbspAfterPreposition, - addNbspAfterAmpersand, - addNbspAfterCardinalNumber, - addNbspAfterOrdinalNumber, - addNbspWithinOrdinalDate, - addNbspAfterRomanNumeral, - fixNbspForNameWithRegnalNumber, - addNbspBeforePercent, - addNbspBeforeSingleLetter, - addNbspAfterSymbol, - replaceSpacesWithNbspAfterSymbol, - fixNbsp} from "../../src/modules/whitespace/nbsp"; + addNbspAfterPreposition, + addNbspAfterAmpersand, + addNbspAfterCardinalNumber, + addNbspAfterOrdinalNumber, + addNbspWithinOrdinalDate, + addNbspAfterRomanNumeral, + fixNbspForNameWithRegnalNumber, + addNbspBeforePercent, + addNbspBeforeSingleLetter, + addNbspAfterSymbol, + replaceSpacesWithNbspAfterSymbol, + fixNbsp} from "../../src/modules/whitespace/nbsp"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Remove non-breaking space between multi-letter words\n', () => { - let testCase = { - "vo dvore": "vo dvore", - "Ku komore": "Ku komore", - "vo vo vo vo": "vo vo vo vo", - "vo vo vo": "vo vo vo", - "ňa moja": "ňa moja", - "Ťa tvoja": "Ťa tvoja", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeNbspBetweenMultiCharWords(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "vo dvore": "vo dvore", + "Ku komore": "Ku komore", + "vo vo vo vo": "vo vo vo vo", + "vo vo vo": "vo vo vo", + "ňa moja": "ňa moja", + "Ťa tvoja": "Ťa tvoja", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeNbspBetweenMultiCharWords(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add non-breaking spaces after single-letter prepositions\n', () => { - let testAllLang = { - "V potoku": "V potoku", - "Koniec. V potoku": "Koniec. V potoku", - "Koniec? V potoku": "Koniec? V potoku", - "Koniec! V potoku": "Koniec! V potoku", - "Koniec… V potoku": "Koniec… V potoku", - "Koniec: V potoku": "Koniec: V potoku", - "Koniec; V potoku": "Koniec; V potoku", - "Koniec, V potoku": "Koniec, V potoku", - - "© V Inc." : "© V Inc.", - "® V Inc." : "® V Inc.", - "℗ V Inc." : "℗ V Inc.", - - "Skáče o tyči": "Skáče o tyči", - "v obchode a v hospode": "v obchode a v hospode", - "v a v a v": "v a v a v", - "a з коминів": "a з коминів", - "a я іду здоїти": "a я іду здоїти", - "a в хырбетї": "a в хырбетї", - "што є му вытыкане": "што є му вытыкане", - "ся ї не": "ся ї не", - "a s’a" : "a s’a", - - // false positives - "client’s customer" : "client’s customer", - "Ctrl+I and Ctrl+B or pasting an image." : "Ctrl+I and Ctrl+B or pasting an image.", - "Ctrl-I and Ctrl-B or pasting an image." : "Ctrl-I and Ctrl-B or pasting an image.", - "získává investici $25M na něco" : "získává investici $25M na něco", //no nbsp after $25M - "starŷm kresli" : "starŷm kresli", // non-latin chars in word - "The product X is missing the feature Y.": - "The product X is missing the feature Y.", // no nbsp after a single capital letter in the middle of the sentence - }; - - let testEnUS = { - ...testAllLang, - "I was there." : "I was there.", - "When I was there." : "When I was there.", - } - - let testDeDeSkCsRue = { - ...testAllLang, - "I v potoku." : "I v potoku.", - "When I was there." : "When I was there.", - } - - Object.keys(testEnUS).forEach((key) => { - it("unit test (en-us)", () => { - assert.strictEqual(addNbspAfterPreposition(key, new Locale("en-us")), testEnUS[key]); - }); - - it("module test (en-us)", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testEnUS[key]); - }); - }); - - Object.keys(testDeDeSkCsRue).forEach((key) => { - it("unit test (de-de)", () => { - assert.strictEqual(addNbspAfterPreposition(key, new Locale("de-de")), testDeDeSkCsRue[key]); - }); - it("module test (de-de)", () => { - assert.strictEqual(fixNbsp(key, new Locale("de-de")), testDeDeSkCsRue[key]); - }); - - it("unit test (sk)", () => { - assert.strictEqual(addNbspAfterPreposition(key, new Locale("sk")), testDeDeSkCsRue[key]); - }); - it("module test (sk)", () => { - assert.strictEqual(fixNbsp(key, new Locale("sk")), testDeDeSkCsRue[key]); - }); - - it("unit test (rue)", () => { - assert.strictEqual(addNbspAfterPreposition(key, new Locale("rue")), testDeDeSkCsRue[key]); - }); - it("module test (rue)", () => { - assert.strictEqual(fixNbsp(key, new Locale("rue")), testDeDeSkCsRue[key]); - }); - - it("unit test (cs)", () => { - assert.strictEqual(addNbspAfterPreposition(key, new Locale("cs")), testDeDeSkCsRue[key]); - }); - it("module test (cs)", () => { - assert.strictEqual(fixNbsp(key, new Locale("cs")), testDeDeSkCsRue[key]); - }); - }); + let testAllLang = { + "V potoku": "V potoku", + "Koniec. V potoku": "Koniec. V potoku", + "Koniec? V potoku": "Koniec? V potoku", + "Koniec! V potoku": "Koniec! V potoku", + "Koniec… V potoku": "Koniec… V potoku", + "Koniec: V potoku": "Koniec: V potoku", + "Koniec; V potoku": "Koniec; V potoku", + "Koniec, V potoku": "Koniec, V potoku", + + "© V Inc." : "© V Inc.", + "® V Inc." : "® V Inc.", + "℗ V Inc." : "℗ V Inc.", + + "Skáče o tyči": "Skáče o tyči", + "v obchode a v hospode": "v obchode a v hospode", + "v a v a v": "v a v a v", + "a з коминів": "a з коминів", + "a я іду здоїти": "a я іду здоїти", + "a в хырбетї": "a в хырбетї", + "што є му вытыкане": "што є му вытыкане", + "ся ї не": "ся ї не", + "a s’a" : "a s’a", + + // false positives + "client’s customer" : "client’s customer", + "Ctrl+I and Ctrl+B or pasting an image." : "Ctrl+I and Ctrl+B or pasting an image.", + "Ctrl-I and Ctrl-B or pasting an image." : "Ctrl-I and Ctrl-B or pasting an image.", + "získává investici $25M na něco" : "získává investici $25M na něco", //no nbsp after $25M + "starŷm kresli" : "starŷm kresli", // non-latin chars in word + "The product X is missing the feature Y.": + "The product X is missing the feature Y.", // no nbsp after a single capital letter in the middle of the sentence + }; + + let testEnUS = { + ...testAllLang, + "I was there." : "I was there.", + "When I was there." : "When I was there.", + } + + let testDeDeSkCsRue = { + ...testAllLang, + "I v potoku." : "I v potoku.", + "When I was there." : "When I was there.", + } + + Object.keys(testEnUS).forEach((key) => { + it("unit test (en-us)", () => { + assert.strictEqual(addNbspAfterPreposition(key, new Locale("en-us")), testEnUS[key]); + }); + + it("module test (en-us)", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testEnUS[key]); + }); + }); + + Object.keys(testDeDeSkCsRue).forEach((key) => { + it("unit test (de-de)", () => { + assert.strictEqual(addNbspAfterPreposition(key, new Locale("de-de")), testDeDeSkCsRue[key]); + }); + it("module test (de-de)", () => { + assert.strictEqual(fixNbsp(key, new Locale("de-de")), testDeDeSkCsRue[key]); + }); + + it("unit test (sk)", () => { + assert.strictEqual(addNbspAfterPreposition(key, new Locale("sk")), testDeDeSkCsRue[key]); + }); + it("module test (sk)", () => { + assert.strictEqual(fixNbsp(key, new Locale("sk")), testDeDeSkCsRue[key]); + }); + + it("unit test (rue)", () => { + assert.strictEqual(addNbspAfterPreposition(key, new Locale("rue")), testDeDeSkCsRue[key]); + }); + it("module test (rue)", () => { + assert.strictEqual(fixNbsp(key, new Locale("rue")), testDeDeSkCsRue[key]); + }); + + it("unit test (cs)", () => { + assert.strictEqual(addNbspAfterPreposition(key, new Locale("cs")), testDeDeSkCsRue[key]); + }); + it("module test (cs)", () => { + assert.strictEqual(fixNbsp(key, new Locale("cs")), testDeDeSkCsRue[key]); + }); + }); }); describe('Add non-breaking space after ampersand\n', () => { - let testCase = { - "Bed & Breakfast": "Bed & Breakfast", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspAfterAmpersand(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Bed & Breakfast": "Bed & Breakfast", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspAfterAmpersand(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add non-breaking space after cardinal number\n', () => { - let testCase = { - "5 mm": "5 mm", - "5 mm": "5 mm", // nbsp - "5 mm": "5 mm", // hairSpace - "5 mm": "5 mm", // narrowNbsp - "5 Kč": "5 Kč", - "15 mm": "15 mm", - - // false positive - // no nbsp after 3+ digits - "152 mm": - "152 mm", - - "2020 rokov": - "2020 rokov", - - /* false positive, - * a number is already bound with abbreviation - * Na str.⎵5 je obsah → Na str.⎵5 je obsah - * !→ Na str. 5⎵je obsah - */ - "Na str. 5 je obsah" : "Na str. 5 je obsah", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspAfterCardinalNumber(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "5 mm": "5 mm", + "5 mm": "5 mm", // nbsp + "5 mm": "5 mm", // hairSpace + "5 mm": "5 mm", // narrowNbsp + "5 Kč": "5 Kč", + "15 mm": "15 mm", + + // false positive + // no nbsp after 3+ digits + "152 mm": + "152 mm", + + "2020 rokov": + "2020 rokov", + + /* false positive, + * a number is already bound with abbreviation + * Na str.⎵5 je obsah → Na str.⎵5 je obsah + * !→ Na str. 5⎵je obsah + */ + "Na str. 5 je obsah" : "Na str. 5 je obsah", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspAfterCardinalNumber(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add non-breaking space after ordinal number (en)\n', () => { - let testCase = { - "1st amendment": "1st amendment", - "2nd amendment": "2nd amendment", - "3rd amendment": "3rd amendment", - "4th amendment": "4th amendment", - "18th amendment": "18th amendment", - "15th March": "15th March", - - // false positive, 3+ digits - "158th amendment": "158th amendment", - "1158th amendment": "1158th amendment", - - - - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "1st amendment": "1st amendment", + "2nd amendment": "2nd amendment", + "3rd amendment": "3rd amendment", + "4th amendment": "4th amendment", + "18th amendment": "18th amendment", + "15th March": "15th March", + + // false positive, 3+ digits + "158th amendment": "158th amendment", + "1158th amendment": "1158th amendment", + + + + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add non-breaking space after ordinal number (sk, cs, rue, de-de)\n', () => { - let testCase = { - "1. dodatok" : "1. dodatok", - "1.dodatok" : "1. dodatok", - "1.štava" : "1. štava", - "12. dodatok" : "12. dodatok", - "12. január" : "12. január", - - "21. Festival otrlého diváka": - "21. Festival otrlého diváka", - - "10.00" : "10.00", // false positive for the example above - - // false positive, nbsp bound with previous - "Je to str. 5. Dalsia veta.": - "Je to str. 5. Dalsia veta.", - - - - // false positive, 3+ digits - "158. festival": - "158. festival", - - "…dokonce i v roce 2021. Důsledky…": - "…dokonce i v roce 2021. Důsledky…", - - "url-to-image-5.jpg" : - "url-to-image-5.jpg", - - "url_to_image_5.jpg" : - "url_to_image_5.jpg", - - "url%to%image%5.jpg" : - "url%to%image%5.jpg", - - // unsolved for now - // "Přišlo jich 12. Dalsi veta.": - // "Přišlo jich 12. Dalsi veta.", - - }; - - Object.keys(testCase).forEach((key) => { - it("unit test (sk)", () => { - assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("sk")), testCase[key]); - }); - it("unit test (cs)", () => { - assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("cs")), testCase[key]); - }); - it("unit test (de-de)", () => { - assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("de-de")), testCase[key]); - }); - it("unit test (rue)", () => { - assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("rue")), testCase[key]); - }); - it("module test (sk)", () => { - assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); - }); - it("module test (cs)", () => { - assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); - }); - it("module test (de-de)", () => { - assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); - }); - it("module test (rue)", () => { - assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); - }); - }); + let testCase = { + "1. dodatok" : "1. dodatok", + "1.dodatok" : "1. dodatok", + "1.štava" : "1. štava", + "12. dodatok" : "12. dodatok", + "12. január" : "12. január", + + "21. Festival otrlého diváka": + "21. Festival otrlého diváka", + + "10.00" : "10.00", // false positive for the example above + + // false positive, nbsp bound with previous + "Je to str. 5. Dalsia veta.": + "Je to str. 5. Dalsia veta.", + + + + // false positive, 3+ digits + "158. festival": + "158. festival", + + "…dokonce i v roce 2021. Důsledky…": + "…dokonce i v roce 2021. Důsledky…", + + "url-to-image-5.jpg" : + "url-to-image-5.jpg", + + "url_to_image_5.jpg" : + "url_to_image_5.jpg", + + "url%to%image%5.jpg" : + "url%to%image%5.jpg", + + // unsolved for now + // "Přišlo jich 12. Dalsi veta.": + // "Přišlo jich 12. Dalsi veta.", + + }; + + Object.keys(testCase).forEach((key) => { + it("unit test (sk)", () => { + assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("sk")), testCase[key]); + }); + it("unit test (cs)", () => { + assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("cs")), testCase[key]); + }); + it("unit test (de-de)", () => { + assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("de-de")), testCase[key]); + }); + it("unit test (rue)", () => { + assert.strictEqual(addNbspAfterOrdinalNumber(key, new Locale("rue")), testCase[key]); + }); + it("module test (sk)", () => { + assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); + }); + it("module test (cs)", () => { + assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); + }); + it("module test (de-de)", () => { + assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); + }); + it("module test (rue)", () => { + assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); + }); + }); }); describe('Add non-breaking space within ordinal date (sk, cs, rue)\n', () => { - let testCase = { - "12. 1. 2017" : "12. 1. 2017", - "12.1.2017" : "12. 1. 2017", - "10.00" : "10.00", // false positive for the example above - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("sk")), testCase[key]); - assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("cs")), testCase[key]); - assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("rue")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); - assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); - assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); - }); - }); + let testCase = { + "12. 1. 2017" : "12. 1. 2017", + "12.1.2017" : "12. 1. 2017", + "10.00" : "10.00", // false positive for the example above + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("sk")), testCase[key]); + assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("cs")), testCase[key]); + assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("rue")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); + assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); + assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); + }); + }); }); describe('Add non-breaking space within ordinal date (de-de)\n', () => { - let testCase = { - /* German standard orthography (Duden) recommends - only one nbsp (or narrowNbsp) after the day - and a regular interword space following the month*/ - "12.1.2019" : "12. 1. 2019", - "12. 1. 2019": "12. 1. 2019", - "10.00" : "10.00", // false positive for the example above - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("de-de")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); - }); - }); + let testCase = { + /* German standard orthography (Duden) recommends + only one nbsp (or narrowNbsp) after the day + and a regular interword space following the month*/ + "12.1.2019" : "12. 1. 2019", + "12. 1. 2019": "12. 1. 2019", + "10.00" : "10.00", // false positive for the example above + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspWithinOrdinalDate(key, new Locale("de-de")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); + }); + }); }); describe('Add non-breaking space after roman numeral (sk, cs, de-de, rue)\n', () => { - let testCase = { - "I. kapitola": "I. kapitola", - "bola to I. kapitola": "bola to I. kapitola", - "III. kapitola": "III. kapitola", - "III.kapitola": "III. kapitola", - "X. ročník": "X. ročník", - "Bol to X. ročník.": "Bol to X. ročník.", - "V. ročník": "V. ročník", - "L. ročník": "L. ročník", - "D. ročník": "D. ročník", - "8. V. 1945": "8. V. 1945", - "8. V.1945": "8. V. 1945", - - }; - - Object.keys(testCase).forEach((key) => { - it("unit test (sk)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("sk")), testCase[key]); - }); - it("unit test (cs)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("cs")), testCase[key]); - }); - it("unit test (de-de)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("de-de")), testCase[key]); - }); - it("unit test (rue)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("rue")), testCase[key]); - }); - it("module test (sk)", () => { - assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); - }); - it("module test (cs)", () => { - assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); - }); - it("module test (de-de)", () => { - assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); - }); - it("module test (rue)", () => { - assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); - }); - }); + let testCase = { + "I. kapitola": "I. kapitola", + "bola to I. kapitola": "bola to I. kapitola", + "III. kapitola": "III. kapitola", + "III.kapitola": "III. kapitola", + "X. ročník": "X. ročník", + "Bol to X. ročník.": "Bol to X. ročník.", + "V. ročník": "V. ročník", + "L. ročník": "L. ročník", + "D. ročník": "D. ročník", + "8. V. 1945": "8. V. 1945", + "8. V.1945": "8. V. 1945", + + }; + + Object.keys(testCase).forEach((key) => { + it("unit test (sk)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("sk")), testCase[key]); + }); + it("unit test (cs)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("cs")), testCase[key]); + }); + it("unit test (de-de)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("de-de")), testCase[key]); + }); + it("unit test (rue)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("rue")), testCase[key]); + }); + it("module test (sk)", () => { + assert.strictEqual(fixNbsp(key, new Locale("sk")), testCase[key]); + }); + it("module test (cs)", () => { + assert.strictEqual(fixNbsp(key, new Locale("cs")), testCase[key]); + }); + it("module test (de-de)", () => { + assert.strictEqual(fixNbsp(key, new Locale("de-de")), testCase[key]); + }); + it("module test (rue)", () => { + assert.strictEqual(fixNbsp(key, new Locale("rue")), testCase[key]); + }); + }); }); describe('Add non-breaking space after roman numeral (sk, cs, de-de, rue)\nExtra false positive', () => { - let testCase = { - // false positive - "Karel IV." : "Karel IV.", - - }; - - Object.keys(testCase).forEach((key) => { - it("unit test (sk)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("sk")), testCase[key]); - }); - it("unit test (cs)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("cs")), testCase[key]); - }); - it("unit test (de-de)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("de-de")), testCase[key]); - }); - it("unit test (rue)", () => { - assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("rue")), testCase[key]); - }); - }); + let testCase = { + // false positive + "Karel IV." : "Karel IV.", + + }; + + Object.keys(testCase).forEach((key) => { + it("unit test (sk)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("sk")), testCase[key]); + }); + it("unit test (cs)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("cs")), testCase[key]); + }); + it("unit test (de-de)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("de-de")), testCase[key]); + }); + it("unit test (rue)", () => { + assert.strictEqual(addNbspAfterRomanNumeral(key, new Locale("rue")), testCase[key]); + }); + }); }); describe('Fix non-breaking space around name with regnal number (sk, cs, de-de, rue)\n', () => { - let unitTestCase = { - // correct placement in mix of languages - "When I talk to emerging product designers": "When I talk to emerging product designers", - ...moduleTestCase - - }; - - let moduleTestCase = { - // Place non-breaking space between name and roman numeral - "Karel IV. byl římsko-německý král." : "Karel IV. byl římsko-německý král.", - "Karel IV. byl římsko-německý král." : "Karel IV. byl římsko-německý král.", - "Karel IV." : "Karel IV.", - //false positive - "je to IV. cenová skupina" : "je to IV. cenová skupina", - - - }; - - Object.keys(unitTestCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("sk")), unitTestCase[key]); - assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("cs")), unitTestCase[key]); - assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("de-de")), unitTestCase[key]); - assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("rue")), unitTestCase[key]); - }); - }); - Object.keys(moduleTestCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("sk")), moduleTestCase[key]); - assert.strictEqual(fixNbsp(key, new Locale("cs")), moduleTestCase[key]); - assert.strictEqual(fixNbsp(key, new Locale("de-de")), moduleTestCase[key]); - assert.strictEqual(fixNbsp(key, new Locale("rue")), moduleTestCase[key]); - }); - }); + let unitTestCase = { + // correct placement in mix of languages + "When I talk to emerging product designers": "When I talk to emerging product designers", + ...moduleTestCase + + }; + + let moduleTestCase = { + // Place non-breaking space between name and roman numeral + "Karel IV. byl římsko-německý král." : "Karel IV. byl římsko-německý král.", + "Karel IV. byl římsko-německý král." : "Karel IV. byl římsko-německý král.", + "Karel IV." : "Karel IV.", + //false positive + "je to IV. cenová skupina" : "je to IV. cenová skupina", + + + }; + + Object.keys(unitTestCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("sk")), unitTestCase[key]); + assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("cs")), unitTestCase[key]); + assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("de-de")), unitTestCase[key]); + assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("rue")), unitTestCase[key]); + }); + }); + Object.keys(moduleTestCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("sk")), moduleTestCase[key]); + assert.strictEqual(fixNbsp(key, new Locale("cs")), moduleTestCase[key]); + assert.strictEqual(fixNbsp(key, new Locale("de-de")), moduleTestCase[key]); + assert.strictEqual(fixNbsp(key, new Locale("rue")), moduleTestCase[key]); + }); + }); }); describe('Fix non-breaking space around name with regnal number (en-us)\n', () => { - let testCase = { - // Place non-breaking space between name and roman numeral - "Charles IV was an emperor." : "Charles IV was an emperor.", - "Charles IV was an emperor." : "Charles IV was an emperor.", // swapped nbsp - "Charles IV": "Charles IV", - "Charles X": "Charles X", - - // False positives - "When I talk to emerging product designers": "When I talk to emerging product designers", - "Try Ctrl+I" : "Try Ctrl+I", - "Sequoia Capital" : "Sequoia Capital", - - // Unsupported - // It’s more common to use “I + verb” in text than citing regnal names so this case is unsupported for now - "Charles I" : "Charles I", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + // Place non-breaking space between name and roman numeral + "Charles IV was an emperor." : "Charles IV was an emperor.", + "Charles IV was an emperor." : "Charles IV was an emperor.", // swapped nbsp + "Charles IV": "Charles IV", + "Charles X": "Charles X", + + // False positives + "When I talk to emerging product designers": "When I talk to emerging product designers", + "Try Ctrl+I" : "Try Ctrl+I", + "Sequoia Capital" : "Sequoia Capital", + + // Unsupported + // It’s more common to use “I + verb” in text than citing regnal names so this case is unsupported for now + "Charles I" : "Charles I", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixNbspForNameWithRegnalNumber(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add nbsp before percent, permille, permyriad\n', () => { - let testCase = { - "20 %" : "20 %", - "20 %–30 %" : "20 %–30 %", - "20 ‰" : "20 ‰", - "20 ‰–30 ‰" : "20 ‰–30 ‰", - "20 ‱" : "20 ‱", - "20 ‱–30 ‱" : "20 ‱–30 ‱", - - /* false positives - we won't include nbsp, if there was no space in the first place. - some languages distinguish when percent is used - * as a noun → 20 % - * as an adjective → 20% - we cannot fix that without additional context - */ - "20%" : "20%", - "20%–30%" : "20%–30%", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addNbspBeforePercent(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "20 %" : "20 %", + "20 %–30 %" : "20 %–30 %", + "20 ‰" : "20 ‰", + "20 ‰–30 ‰" : "20 ‰–30 ‰", + "20 ‱" : "20 ‱", + "20 ‱–30 ‱" : "20 ‱–30 ‱", + + /* false positives + we won't include nbsp, if there was no space in the first place. + some languages distinguish when percent is used + * as a noun → 20 % + * as an adjective → 20% + we cannot fix that without additional context + */ + "20%" : "20%", + "20%–30%" : "20%–30%", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addNbspBeforePercent(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixNbsp(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe("Add nbsp before single capital letter in a sentence\n", () => { - let testAllLang = { - "The product X is missing the feature Y.": - "The product X is missing the feature Y.", - - - "Sputnik V": "Sputnik V", - "Človek Č": "Človek Č", - "© V Inc." : "© V Inc.", - - // false positives - "bola to I. kapitola" : "bola to I. kapitola", - "pán Šťastný" : "pán Šťastný", - "pán ŠŤASTNÝ" : "pán ŠŤASTNÝ", - "One sentence ends. A bad apple." : "One sentence ends. A bad apple.", - "One sentence ends? A bad apple." : "One sentence ends? A bad apple.", - "One sentence ends! A bad apple." : "One sentence ends! A bad apple.", - "sentence; C-level executive" : "sentence; C-level executive", - "sentence: C-level executive" : "sentence: C-level executive", - "sentence, C-level executive" : "sentence, C-level executive", - "I’d say… A-player" : "I’d say… A-player", - "sentence (brackets) A-player" : "sentence (brackets) A-player", - "sentence [brackets] A-player" : "sentence [brackets] A-player", - "sentence {brackets} A-player" : "sentence {brackets} A-player", - "A × A" : "A × A", - "famous company — A Inc." : "famous company — A Inc." - }; - - let testEnUs = { - ...testAllLang, - // false positives - "When I talk" : "When I talk", // do not add nbsp before I - "“qouted part” A capital letter" : "“qouted part” A capital letter", - "‘qouted part’ A capital letter" : "‘qouted part’ A capital letter", - } - - let testDeDeSkCs = { - ...testAllLang, - "Vzorka I" : "Vzorka I", - "Vzorka I je fajn" : "Vzorka I je fajn", // remove nbsp after I - "Vzorka I je fajn" : "Vzorka I je fajn", // remove hairSpace after I - "Vzorka I je fajn" : "Vzorka I je fajn", // remove narrowNbsp after I - - // false positives - "„qouted part“ A capital letter" : "„qouted part“ A capital letter", - "‚qouted part‘ A capital letter" : "‚qouted part‘ A capital letter", - "apostrophe’ A capital letter" : "apostrophe’ A capital letter" - } - - let testRue = { - ...testAllLang, - "Vzorka I" : "Vzorka I", - "Vzorka I je fajn" : "Vzorka I je fajn", // remove nbsp after I - "Vzorka I je fajn" : "Vzorka I je fajn", // remove hairSpace after I - "Vzorka I je fajn" : "Vzorka I je fajn", // remove narrowNbsp after I - - // false positives - "«qouted part» A capital letter" : "«qouted part» A capital letter", - "‹qouted part› A capital letter" : "‹qouted part› A capital letter", - "apostrophe’ A capital letter" : "apostrophe’ A capital letter" - } - - - Object.keys(testEnUs).forEach((key) => { - it("unit tests (en-us)", () => { - assert.strictEqual( - addNbspBeforeSingleLetter(key, new Locale("en-us")), - testEnUs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("unit tests (de-de)", () => { - assert.strictEqual( - addNbspBeforeSingleLetter(key, new Locale("de-de")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("unit tests (sk)", () => { - assert.strictEqual( - addNbspBeforeSingleLetter(key, new Locale("sk")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("unit tests (cs)", () => { - assert.strictEqual( - addNbspBeforeSingleLetter(key, new Locale("cs")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testRue).forEach((key) => { - it("unit tests (rue)", () => { - assert.strictEqual( - addNbspBeforeSingleLetter(key, new Locale("rue")), - testRue[key] - ); - }); - }); - Object.keys(testEnUs).forEach((key) => { - it("module tests (en-us)", () => { - assert.strictEqual( - fixNbsp(key, new Locale("en-us")), - testEnUs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("module tests (de-de)", () => { - assert.strictEqual( - fixNbsp(key, new Locale("de-de")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("module tests (sk)", () => { - assert.strictEqual( - fixNbsp(key, new Locale("sk")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testDeDeSkCs).forEach((key) => { - it("module tests (cs)", () => { - assert.strictEqual( - fixNbsp(key, new Locale("cs")), - testDeDeSkCs[key] - ); - }); - }); - Object.keys(testRue).forEach((key) => { - it("module tests (rue)", () => { - assert.strictEqual( - fixNbsp(key, new Locale("rue")), - testRue[key] - ); - }); - }); + let testAllLang = { + "The product X is missing the feature Y.": + "The product X is missing the feature Y.", + + + "Sputnik V": "Sputnik V", + "Človek Č": "Človek Č", + "© V Inc." : "© V Inc.", + + // false positives + "bola to I. kapitola" : "bola to I. kapitola", + "pán Šťastný" : "pán Šťastný", + "pán ŠŤASTNÝ" : "pán ŠŤASTNÝ", + "One sentence ends. A bad apple." : "One sentence ends. A bad apple.", + "One sentence ends? A bad apple." : "One sentence ends? A bad apple.", + "One sentence ends! A bad apple." : "One sentence ends! A bad apple.", + "sentence; C-level executive" : "sentence; C-level executive", + "sentence: C-level executive" : "sentence: C-level executive", + "sentence, C-level executive" : "sentence, C-level executive", + "I’d say… A-player" : "I’d say… A-player", + "sentence (brackets) A-player" : "sentence (brackets) A-player", + "sentence [brackets] A-player" : "sentence [brackets] A-player", + "sentence {brackets} A-player" : "sentence {brackets} A-player", + "A × A" : "A × A", + "famous company — A Inc." : "famous company — A Inc." + }; + + let testEnUs = { + ...testAllLang, + // false positives + "When I talk" : "When I talk", // do not add nbsp before I + "“qouted part” A capital letter" : "“qouted part” A capital letter", + "‘qouted part’ A capital letter" : "‘qouted part’ A capital letter", + } + + let testDeDeSkCs = { + ...testAllLang, + "Vzorka I" : "Vzorka I", + "Vzorka I je fajn" : "Vzorka I je fajn", // remove nbsp after I + "Vzorka I je fajn" : "Vzorka I je fajn", // remove hairSpace after I + "Vzorka I je fajn" : "Vzorka I je fajn", // remove narrowNbsp after I + + // false positives + "„qouted part“ A capital letter" : "„qouted part“ A capital letter", + "‚qouted part‘ A capital letter" : "‚qouted part‘ A capital letter", + "apostrophe’ A capital letter" : "apostrophe’ A capital letter" + } + + let testRue = { + ...testAllLang, + "Vzorka I" : "Vzorka I", + "Vzorka I je fajn" : "Vzorka I je fajn", // remove nbsp after I + "Vzorka I je fajn" : "Vzorka I je fajn", // remove hairSpace after I + "Vzorka I je fajn" : "Vzorka I je fajn", // remove narrowNbsp after I + + // false positives + "«qouted part» A capital letter" : "«qouted part» A capital letter", + "‹qouted part› A capital letter" : "‹qouted part› A capital letter", + "apostrophe’ A capital letter" : "apostrophe’ A capital letter" + } + + + Object.keys(testEnUs).forEach((key) => { + it("unit tests (en-us)", () => { + assert.strictEqual( + addNbspBeforeSingleLetter(key, new Locale("en-us")), + testEnUs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("unit tests (de-de)", () => { + assert.strictEqual( + addNbspBeforeSingleLetter(key, new Locale("de-de")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("unit tests (sk)", () => { + assert.strictEqual( + addNbspBeforeSingleLetter(key, new Locale("sk")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("unit tests (cs)", () => { + assert.strictEqual( + addNbspBeforeSingleLetter(key, new Locale("cs")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testRue).forEach((key) => { + it("unit tests (rue)", () => { + assert.strictEqual( + addNbspBeforeSingleLetter(key, new Locale("rue")), + testRue[key] + ); + }); + }); + Object.keys(testEnUs).forEach((key) => { + it("module tests (en-us)", () => { + assert.strictEqual( + fixNbsp(key, new Locale("en-us")), + testEnUs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("module tests (de-de)", () => { + assert.strictEqual( + fixNbsp(key, new Locale("de-de")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("module tests (sk)", () => { + assert.strictEqual( + fixNbsp(key, new Locale("sk")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testDeDeSkCs).forEach((key) => { + it("module tests (cs)", () => { + assert.strictEqual( + fixNbsp(key, new Locale("cs")), + testDeDeSkCs[key] + ); + }); + }); + Object.keys(testRue).forEach((key) => { + it("module tests (rue)", () => { + assert.strictEqual( + fixNbsp(key, new Locale("rue")), + testRue[key] + ); + }); + }); }); describe('Add space after symbol, e.g. ©\n', () => { - let testCase = { - "©2017": "© 2017", - "Company ©2017": "Company © 2017", - }; - - Object.keys(testCase).forEach((key) => { - it("just unit tests", () => { - assert.strictEqual(addNbspAfterSymbol(key, "©", new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "©2017": "© 2017", + "Company ©2017": "Company © 2017", + }; + + Object.keys(testCase).forEach((key) => { + it("just unit tests", () => { + assert.strictEqual(addNbspAfterSymbol(key, "©", new Locale("en-us")), testCase[key]); + }); + }); }); describe('Replaces various spaces with non-breaking space after symbol, e.g. ©\n', () => { - let testCase = { - "Company © 2017": "Company © 2017", - "Company © 2017": "Company © 2017", // hairSpace - "Company © 2017": "Company © 2017", // narrowNbsp - }; - - Object.keys(testCase).forEach((key) => { - it("just unit tests", () => { - assert.strictEqual(replaceSpacesWithNbspAfterSymbol(key, "©", new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Company © 2017": "Company © 2017", + "Company © 2017": "Company © 2017", // hairSpace + "Company © 2017": "Company © 2017", // narrowNbsp + }; + + Object.keys(testCase).forEach((key) => { + it("just unit tests", () => { + assert.strictEqual(replaceSpacesWithNbspAfterSymbol(key, "©", new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/whitespace/spaces.test.js b/tests/whitespace/spaces.test.js index d90fad0..4eee9b7 100644 --- a/tests/whitespace/spaces.test.js +++ b/tests/whitespace/spaces.test.js @@ -1,16 +1,16 @@ import {removeMultipleSpaces, - removeSpacesAtParagraphBeginning, - removeSpaceBeforeSentencePausePunctuation, - removeSpaceBeforeTerminalPunctuation, - removeSpaceBeforeOrdinalIndicator, - removeSpaceAfterOpeningBrackets, - addSpaceBeforeOpeningBrackets, - addSpaceAfterTerminalPunctuation, - addSpaceAfterSentencePause, - addSpaceAfterClosingBrackets, - removeSpacesAtParagraphEnd, - addSpaceBeforeSymbol, - fixSpaces} from "../../src/modules/whitespace/spaces"; + removeSpacesAtParagraphBeginning, + removeSpaceBeforeSentencePausePunctuation, + removeSpaceBeforeTerminalPunctuation, + removeSpaceBeforeOrdinalIndicator, + removeSpaceAfterOpeningBrackets, + addSpaceBeforeOpeningBrackets, + addSpaceAfterTerminalPunctuation, + addSpaceAfterSentencePause, + addSpaceAfterClosingBrackets, + removeSpacesAtParagraphEnd, + addSpaceBeforeSymbol, + fixSpaces} from "../../src/modules/whitespace/spaces"; import assert from 'assert'; import Locale from "../../src/locale/locale"; @@ -23,25 +23,25 @@ let configKeepWhitespacesBeforeMarkdownList = { } describe('Replace multiple spaces with a single one\n', () => { - let testCase = { - /* Remove multiple spaces with a single one, - even non-breaking spaces and others */ - "How many spaces": "How many spaces", - "How many": "How many", - "How many": "How many", + let testCase = { + /* Remove multiple spaces with a single one, + even non-breaking spaces and others */ + "How many spaces": "How many spaces", + "How many": "How many", + "How many": "How many", "How many": "How many", - "How   many": "How many", // test includes nbsp - "How   many": "How many", // test includes hairSpace - "How   many": "How many", // test includes narrowNbsp + "How   many": "How many", // test includes nbsp + "How   many": "How many", // test includes hairSpace + "How   many": "How many", // test includes narrowNbsp "Howč čmany": "Howč čmany", // non-latin character - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeMultipleSpaces(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeMultipleSpaces(key, new Locale("en-us")), testCase[key]); + }); + }); }); let testRemoveSpacesBeforeText = { @@ -87,7 +87,7 @@ let testRemoveSpacesBeforeMarkdownList = { "\t* list": "* list", " * list": "* list", //nbsp " * list": "* list", //narrowNbsp - " + list": "+ list", + " + list": "+ list", " + list": "+ list", "\t+ list": "+ list", "\t\t+ list": "+ list", @@ -107,19 +107,19 @@ let testKeepSpacesBeforeMarkdownList = { } describe('Remove spaces and tabs at beginning of the paragraph\n', () => { - let testCase = { + let testCase = { ...testRemoveSpacesBeforeText, ...testRemoveSpacesBeforeMarkdownList, - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { + Object.keys(testCase).forEach((key) => { + it("unit test", () => { assert.strictEqual(removeSpacesAtParagraphBeginning(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); }); it("module test", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); }); - }); + }); }); @@ -141,270 +141,270 @@ describe('Remove spaces and tabs at beginning of the paragraph, but keep spaces describe('Remove space before sentence pause-punctuation\n', () => { - let testCase = { - "Hey , man.": "Hey, man.", - "Hey , man.": "Hey, man.", // nbsp - "Hey , man.": "Hey, man.", // hair_space - "Hey , man.": "Hey, man.", // narrow_nbsp - "Sentence and… :": "Sentence and…:", - "Sentence and… , else": "Sentence and…, else", - "Sentence and… ; else": "Sentence and…; else", - "Keep space before emoticon :)" : "Keep space before emoticon :)", // false positive - "Keep space before emoticon :-)" : "Keep space before emoticon :-)", // false positive - }; - - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(removeSpaceBeforeSentencePausePunctuation(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Hey , man.": "Hey, man.", + "Hey , man.": "Hey, man.", // nbsp + "Hey , man.": "Hey, man.", // hair_space + "Hey , man.": "Hey, man.", // narrow_nbsp + "Sentence and… :": "Sentence and…:", + "Sentence and… , else": "Sentence and…, else", + "Sentence and… ; else": "Sentence and…; else", + "Keep space before emoticon :)" : "Keep space before emoticon :)", // false positive + "Keep space before emoticon :-)" : "Keep space before emoticon :-)", // false positive + }; + + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(removeSpaceBeforeSentencePausePunctuation(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Remove space before a terminal punctuation, closing brackets and a degree symbol\n', () => { - let testCase = { - "Hey.": "Hey.", // correct - "Hey .": "Hey.", - "Hey .": "Hey.", // nbsp - "Hey .": "Hey.", // hair_space - "Hey .": "Hey.", // narrow_nbsp - "Sentence and…!": "Sentence and…!", // correct - "Sentence and… !": "Sentence and…!", - "Sentence and…?": "Sentence and…?", // correct - "Sentence and… ?": "Sentence and…?", - "Something (…) something else": "Something (…) something else", //correct - "Something (… ) something else": "Something (…) something else", - "Something [… ] something else": "Something […] something else", - "(? )":"(?)", - "(! )":"(!)", - "It was good (It was bad !)." : "It was good (It was bad!).", - "5°" : "5°", //correct - "5 °" : "5°", - // false positives - "Sentence ended. …and we were there.": "Sentence ended. …and we were there.", - }; - - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(removeSpaceBeforeTerminalPunctuation(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Hey.": "Hey.", // correct + "Hey .": "Hey.", + "Hey .": "Hey.", // nbsp + "Hey .": "Hey.", // hair_space + "Hey .": "Hey.", // narrow_nbsp + "Sentence and…!": "Sentence and…!", // correct + "Sentence and… !": "Sentence and…!", + "Sentence and…?": "Sentence and…?", // correct + "Sentence and… ?": "Sentence and…?", + "Something (…) something else": "Something (…) something else", //correct + "Something (… ) something else": "Something (…) something else", + "Something [… ] something else": "Something […] something else", + "(? )":"(?)", + "(! )":"(!)", + "It was good (It was bad !)." : "It was good (It was bad!).", + "5°" : "5°", //correct + "5 °" : "5°", + // false positives + "Sentence ended. …and we were there.": "Sentence ended. …and we were there.", + }; + + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(removeSpaceBeforeTerminalPunctuation(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Remove space before ordinal indicator (en-us)\n', () => { - let testCase = { - "1 st" : "1st", - "2 nd" : "2nd", - "3 rd" : "3rd", - "4 th attempt" : "4th attempt", - "104 th" : "104th", - // false positives - "Number 4 there you go" : "Number 4 there you go", - }; - - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("en-us")), testCase[key]); - }); - - it("module tests", () => { + let testCase = { + "1 st" : "1st", + "2 nd" : "2nd", + "3 rd" : "3rd", + "4 th attempt" : "4th attempt", + "104 th" : "104th", + // false positives + "Number 4 there you go" : "Number 4 there you go", + }; + + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("en-us")), testCase[key]); + }); + + it("module tests", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); - }); - }); + }); + }); }); describe('Remove space before ordinal indicator (sk, cs, rue, de-de)\n', () => { - let testCase = { - "1 . spoj" : "1. spoj", - "154 . spoj" : "154. spoj", - }; - - Object.keys(testCase).forEach((key) => { - it("unit tests", () => { - assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("sk")), testCase[key]); - assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("cs")), testCase[key]); - assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("rue")), testCase[key]); - assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("de-de")), testCase[key]); - }); - }); + let testCase = { + "1 . spoj" : "1. spoj", + "154 . spoj" : "154. spoj", + }; + + Object.keys(testCase).forEach((key) => { + it("unit tests", () => { + assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("sk")), testCase[key]); + assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("cs")), testCase[key]); + assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("rue")), testCase[key]); + assert.strictEqual(removeSpaceBeforeOrdinalIndicator(key, new Locale("de-de")), testCase[key]); + }); + }); }); describe('Remove space after opening brackets\n', () => { - let testCase = { - "Something ( …) something else": "Something (…) something else", - "Something [ …] something else": "Something […] something else", - "( ?)": "(?)", - "( !)": "(!)", + let testCase = { + "Something ( …) something else": "Something (…) something else", + "Something [ …] something else": "Something […] something else", + "( ?)": "(?)", + "( !)": "(!)", - }; + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeSpaceAfterOpeningBrackets(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeSpaceAfterOpeningBrackets(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add space before opening brackets\n', () => { - let testCase = { - "Enclosed(in) the brackets.": "Enclosed (in) the brackets.", - "Enclosed[in] the brackets.": "Enclosed [in] the brackets.", - "quote[…] with parts left out": "quote […] with parts left out", - "Enclosed{in} the brackets.": "Enclosed {in} the brackets.", - "name(s)": "name(s)", // false positive - "NAME(S)": "NAME(S)", // false positive - "mass(es)": "mass(es)", // false positive - "MASS(ES)": "MASS(ES)", // false positive - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addSpaceBeforeOpeningBrackets(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "Enclosed(in) the brackets.": "Enclosed (in) the brackets.", + "Enclosed[in] the brackets.": "Enclosed [in] the brackets.", + "quote[…] with parts left out": "quote […] with parts left out", + "Enclosed{in} the brackets.": "Enclosed {in} the brackets.", + "name(s)": "name(s)", // false positive + "NAME(S)": "NAME(S)", // false positive + "mass(es)": "mass(es)", // false positive + "MASS(ES)": "MASS(ES)", // false positive + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addSpaceBeforeOpeningBrackets(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Add space after terminal punctuation\n', () => { - let testCase = { - "One sentence ended. Another started.": "One sentence ended. Another started.", // correct - "One sentence ended.Another started.": "One sentence ended. Another started.", - "One sentence ended!Another started.": "One sentence ended! Another started.", - "One sentence ended…!Another started.": "One sentence ended…! Another started.", - "One sentence ended?Another started.": "One sentence ended? Another started.", - - // false positives - "R-N.D." : "R-N.D.", - "the U.S.":"the U.S.", - "John Thune (S.D.)" : "John Thune (S.D.)", - "filename.js" : "filename.js" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addSpaceAfterTerminalPunctuation(key, new Locale("en-us")), testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { + let testCase = { + "One sentence ended. Another started.": "One sentence ended. Another started.", // correct + "One sentence ended.Another started.": "One sentence ended. Another started.", + "One sentence ended!Another started.": "One sentence ended! Another started.", + "One sentence ended…!Another started.": "One sentence ended…! Another started.", + "One sentence ended?Another started.": "One sentence ended? Another started.", + + // false positives + "R-N.D." : "R-N.D.", + "the U.S.":"the U.S.", + "John Thune (S.D.)" : "John Thune (S.D.)", + "filename.js" : "filename.js" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addSpaceAfterTerminalPunctuation(key, new Locale("en-us")), testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); - }); - }); + }); + }); }); describe('Add a space after sentence pause punctuation\n', () => { - let testCase = { - "One sentence ended, another started.": "One sentence ended, another started.", //correct - "One sentence ended,another started.": "One sentence ended, another started.", - "One sentence ended,John started.": "One sentence ended, John started.", - "One sentence ended…,John started.": "One sentence ended…, John started.", - "One sentence ended:another started.": "One sentence ended: another started.", - "One sentence ended;another started.": "One sentence ended; another started.", - - //false positives - "R-N.D." : "R-N.D.", - "the U.S.":"the U.S.", - "John Thune (S.D.)" : "John Thune (S.D.)", - "filename.js" : "filename.js" - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addSpaceAfterSentencePause(key, new Locale("en-us")), testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { + let testCase = { + "One sentence ended, another started.": "One sentence ended, another started.", //correct + "One sentence ended,another started.": "One sentence ended, another started.", + "One sentence ended,John started.": "One sentence ended, John started.", + "One sentence ended…,John started.": "One sentence ended…, John started.", + "One sentence ended:another started.": "One sentence ended: another started.", + "One sentence ended;another started.": "One sentence ended; another started.", + + //false positives + "R-N.D." : "R-N.D.", + "the U.S.":"the U.S.", + "John Thune (S.D.)" : "John Thune (S.D.)", + "filename.js" : "filename.js" + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addSpaceAfterSentencePause(key, new Locale("en-us")), testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); - }); - }); + }); + }); }); describe('Add a space after closing brackets\n', () => { - let testCase = { - "Enclosed (in) the brackets.": "Enclosed (in) the brackets.", // correct - "Enclosed (in)the brackets.": "Enclosed (in) the brackets.", - "Enclosed [in] the brackets.": "Enclosed [in] the brackets.", // correct - "Enclosed [in]the brackets.": "Enclosed [in] the brackets.", - "Enclosed {in} the brackets.": "Enclosed {in} the brackets.", // correct - "Enclosed {in}the brackets.": "Enclosed {in} the brackets.", - "quote […]with parts left out": "quote […] with parts left out", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(addSpaceAfterClosingBrackets(key, new Locale("en-us")), testCase[key]); - }); - }); - - Object.keys(testCase).forEach((key) => { - it("module test", () => { + let testCase = { + "Enclosed (in) the brackets.": "Enclosed (in) the brackets.", // correct + "Enclosed (in)the brackets.": "Enclosed (in) the brackets.", + "Enclosed [in] the brackets.": "Enclosed [in] the brackets.", // correct + "Enclosed [in]the brackets.": "Enclosed [in] the brackets.", + "Enclosed {in} the brackets.": "Enclosed {in} the brackets.", // correct + "Enclosed {in}the brackets.": "Enclosed {in} the brackets.", + "quote […]with parts left out": "quote […] with parts left out", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(addSpaceAfterClosingBrackets(key, new Locale("en-us")), testCase[key]); + }); + }); + + Object.keys(testCase).forEach((key) => { + it("module test", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); - }); - }); + }); + }); }); describe('Remove trailing spaces\n', () => { - let testCase = { - "trailing spaces ": "trailing spaces", - "trailing spaces    ": "trailing spaces", // nbsp - "trailing spaces    ": "trailing spaces", // hair_space + let testCase = { + "trailing spaces ": "trailing spaces", + "trailing spaces    ": "trailing spaces", // nbsp + "trailing spaces    ": "trailing spaces", // hair_space "trailing spaces    ": "trailing spaces", // narrow_nbsp "trailing spaces\t\t": "trailing spaces", // narrow_nbsp - "trailing spaces. ": "trailing spaces.", + "trailing spaces. ": "trailing spaces.", "trailing spaces; ": "trailing spaces;", "first line \nsecond line ": "first line\nsecond line", "first line \nsecond line \nthird line ": "first line\nsecond line\nthird line", - "Радостна комната —  ": "Радостна комната —", - }; + "Радостна комната —  ": "Радостна комната —", + }; - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(removeSpacesAtParagraphEnd(key, new Locale("en-us")), testCase[key]); + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(removeSpacesAtParagraphEnd(key, new Locale("en-us")), testCase[key]); }); it("module test", () => { assert.strictEqual(fixSpaces(key, new Locale("en-us"), configRemoveWhitespacesBeforeParagraphs), testCase[key]); }); - }); + }); }); describe('Add space before a symbol, e.g. ©\n', () => { - let testCase = { - "© 2017": "© 2017", - "(© 2017)": "(© 2017)", - "Company© 2017": "Company © 2017", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual( - addSpaceBeforeSymbol( - key, - "©", - new Locale("en-us") - ), testCase[key]); - }); - }); + let testCase = { + "© 2017": "© 2017", + "(© 2017)": "(© 2017)", + "Company© 2017": "Company © 2017", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual( + addSpaceBeforeSymbol( + key, + "©", + new Locale("en-us") + ), testCase[key]); + }); + }); }); diff --git a/tests/words/abbreviations.test.js b/tests/words/abbreviations.test.js index 16c26b8..d454953 100644 --- a/tests/words/abbreviations.test.js +++ b/tests/words/abbreviations.test.js @@ -1,239 +1,239 @@ import {fixAbbreviations, - fixInitials, - fixMultipleWordAbbreviations, - fixSingleWordAbbreviations} from "../../src/modules/words/abbreviations"; + fixInitials, + fixMultipleWordAbbreviations, + fixSingleWordAbbreviations} from "../../src/modules/words/abbreviations"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix Initials (sk, cs, rue, de-de)\n', () => { - let testCase = { - // test cases for first name initials - "J. Novak": "J. Novak", // essential case, nbsp missing - "J.Novak": "J. Novak", // space missing - "J. Novak": "J. Novak", // double-check NBSP in the middle - "Ch. Lambert" : "Ch. Lambert", //double-letter as a first name initial - "CH. Lambert" : "CH. Lambert", //double-letter initialized as a first name initial - "Philip K. Dick": "Philip K. Dick", // one middle initial - "Philip K.Dick": "Philip K. Dick", // one middle initials - - // test cases for two-letter initials - "F. X. Šalda" : "F. X. Šalda", //nbsp after 1st letter, normal space after 2nd one - "F.X. Šalda" : "F. X. Šalda", - "Ch.Ch. Šalda" : "Ch. Ch. Šalda", - "CH.CH. Šalda" : "CH. CH. Šalda", - - // test cases for three-letter initials - "Ch. G. D. Lambert" : "Ch. G. D. Lambert", // nbsp after 2 letter, normal space after third one - "Ch. Ch. Ch. Lambert" : "Ch. Ch. Ch. Lambert", - "CH. CH. CH. Lambert" : "CH. CH. CH. Lambert", - - // false positives, this function should leave them as they are - "F. X." : "F. X.", - "F.X." : "F.X.", - "F. X. R." : "F. X. R.", - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixInitials(key, new Locale("sk")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixAbbreviations(key, new Locale("sk")), testCase[key]); - }); - }); + let testCase = { + // test cases for first name initials + "J. Novak": "J. Novak", // essential case, nbsp missing + "J.Novak": "J. Novak", // space missing + "J. Novak": "J. Novak", // double-check NBSP in the middle + "Ch. Lambert" : "Ch. Lambert", //double-letter as a first name initial + "CH. Lambert" : "CH. Lambert", //double-letter initialized as a first name initial + "Philip K. Dick": "Philip K. Dick", // one middle initial + "Philip K.Dick": "Philip K. Dick", // one middle initials + + // test cases for two-letter initials + "F. X. Šalda" : "F. X. Šalda", //nbsp after 1st letter, normal space after 2nd one + "F.X. Šalda" : "F. X. Šalda", + "Ch.Ch. Šalda" : "Ch. Ch. Šalda", + "CH.CH. Šalda" : "CH. CH. Šalda", + + // test cases for three-letter initials + "Ch. G. D. Lambert" : "Ch. G. D. Lambert", // nbsp after 2 letter, normal space after third one + "Ch. Ch. Ch. Lambert" : "Ch. Ch. Ch. Lambert", + "CH. CH. CH. Lambert" : "CH. CH. CH. Lambert", + + // false positives, this function should leave them as they are + "F. X." : "F. X.", + "F.X." : "F.X.", + "F. X. R." : "F. X. R.", + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixInitials(key, new Locale("sk")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixAbbreviations(key, new Locale("sk")), testCase[key]); + }); + }); }); describe('Fix Initials (en-us)\n', () => { - let testCase = { - // test cases for first name initials - "J. Novak": "J. Novak", // essential case, nbsp missing - "J.Novak": "J. Novak", // space missing - "J. Novak": "J. Novak", // double-check NBSP in the middle - "Ch. Lambert" : "Ch. Lambert", //double-letter as a first name initial - "CH. Lambert" : "CH. Lambert", //double-letter initialized as a first name initial - "Philip K. Dick": "Philip K. Dick", // one middle initial - "Philip K.Dick": "Philip K. Dick", // one middle initials - - // test cases for two-letter initials - "F. X. Šalda" : "F.X. Šalda", //nbsp after 1st letter, normal space after 2nd one - "F.X. Šalda" : "F.X. Šalda", - "Ch.Ch. Šalda" : "Ch.Ch. Šalda", - "CH.CH. Šalda" : "CH.CH. Šalda", - - // test cases for three-letter initials - "Ch. G. D. Lambert" : "Ch.G.D. Lambert", // nbsp after 2 letter, normal space after third one - "Ch. Ch. Ch. Lambert" : "Ch.Ch.Ch. Lambert", - "CH. CH. CH. Lambert" : "CH.CH.CH. Lambert", - - // false positives, this function should leave them as they are - "F. X." : "F. X.", - "F.X." : "F.X.", - "F. X. R." : "F. X. R.", - "the U.S." : "the U.S.", - }; - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixInitials(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixAbbreviations(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + // test cases for first name initials + "J. Novak": "J. Novak", // essential case, nbsp missing + "J.Novak": "J. Novak", // space missing + "J. Novak": "J. Novak", // double-check NBSP in the middle + "Ch. Lambert" : "Ch. Lambert", //double-letter as a first name initial + "CH. Lambert" : "CH. Lambert", //double-letter initialized as a first name initial + "Philip K. Dick": "Philip K. Dick", // one middle initial + "Philip K.Dick": "Philip K. Dick", // one middle initials + + // test cases for two-letter initials + "F. X. Šalda" : "F.X. Šalda", //nbsp after 1st letter, normal space after 2nd one + "F.X. Šalda" : "F.X. Šalda", + "Ch.Ch. Šalda" : "Ch.Ch. Šalda", + "CH.CH. Šalda" : "CH.CH. Šalda", + + // test cases for three-letter initials + "Ch. G. D. Lambert" : "Ch.G.D. Lambert", // nbsp after 2 letter, normal space after third one + "Ch. Ch. Ch. Lambert" : "Ch.Ch.Ch. Lambert", + "CH. CH. CH. Lambert" : "CH.CH.CH. Lambert", + + // false positives, this function should leave them as they are + "F. X." : "F. X.", + "F.X." : "F.X.", + "F. X. R." : "F. X. R.", + "the U.S." : "the U.S.", + }; + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixInitials(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixAbbreviations(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix multiple-word abbreviations (sk, cs, rue, de-de)\n', () => { - let testCase = { - /* General pattern for these locales assumes: - * dots after each abbreviated word - * non-breaking spaces between abbreviated words - * normal space after the last abbreviated word - */ - // double-word abbreviations - "hl. m. Praha" : "hl. m. Praha", // set proper nbsp - "hl.m.Praha" : "hl. m. Praha", // include proper spaces - "Hl.m.Praha" : "Hl. m. Praha", // catch capitalized exception - "Je to hl. m. Praha." : "Je to hl. m. Praha.", // in a sentence - "Praha, hl. m." : "Praha, hl. m.", // check for abbr at the end of statement - "(hl. m. Praha)" : "(hl. m. Praha)", // bracket & quotes variations - "(Praha, hl. m.)" : "(Praha, hl. m.)", // bracket & quotes variations - "(hl. m.)" : "(hl. m.)", // bracket & quotes variations - "hl. m." : "hl. m.", // plain abbreviation - "č., s., hl. m., str.," : "č., s., hl. m., str.,", // in a list of abbreviations - "Dave Grohl. m. Praha" : "Dave Grohl. m. Praha", // false positive for not catching abbr. in a word - "Sliačhl. m. Praha" : "Sliačhl. m. Praha", // false positive for not catching abbr. in a non-latin word - - // triple word abbreviations - "im Jahr 200 v. u. Z. als der Hunger" : "im Jahr 200 v. u. Z. als der Hunger", - "im Jahr 200 v.u.Z. als der Hunger" : "im Jahr 200 v. u. Z. als der Hunger", - "im Jahr 200 v. u. Z." : "im Jahr 200 v. u. Z.", - "im Jahr 200 v.u.Z." : "im Jahr 200 v. u. Z.", - "v. u. Z." : "v. u. Z.", - "v.u.Z." : "v. u. Z.", - - // random abbreviations to randomly check various localization - "1000 pr. n. l." : "1000 pr. n. l.", - "im Jahr 200 v. Chr." : "im Jahr 200 v. Chr.", - "Das Tier, d. h. der Fisch, lebte noch lange." : "Das Tier, d. h. der Fisch, lebte noch lange.", - "Das Tier – d. i. der Fisch – lebte noch lange." : "Das Tier – d. i. der Fisch – lebte noch lange.", - "Das Tier (d. h. der Fisch) lebte noch lange." : "Das Tier (d. h. der Fisch) lebte noch lange.", - "т. зн. незвыкле" : "т. зн. незвыкле" - }; - - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixMultipleWordAbbreviations(key, new Locale("sk")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixAbbreviations(key, new Locale("sk")), testCase[key]); - }); - }); + let testCase = { + /* General pattern for these locales assumes: + * dots after each abbreviated word + * non-breaking spaces between abbreviated words + * normal space after the last abbreviated word + */ + // double-word abbreviations + "hl. m. Praha" : "hl. m. Praha", // set proper nbsp + "hl.m.Praha" : "hl. m. Praha", // include proper spaces + "Hl.m.Praha" : "Hl. m. Praha", // catch capitalized exception + "Je to hl. m. Praha." : "Je to hl. m. Praha.", // in a sentence + "Praha, hl. m." : "Praha, hl. m.", // check for abbr at the end of statement + "(hl. m. Praha)" : "(hl. m. Praha)", // bracket & quotes variations + "(Praha, hl. m.)" : "(Praha, hl. m.)", // bracket & quotes variations + "(hl. m.)" : "(hl. m.)", // bracket & quotes variations + "hl. m." : "hl. m.", // plain abbreviation + "č., s., hl. m., str.," : "č., s., hl. m., str.,", // in a list of abbreviations + "Dave Grohl. m. Praha" : "Dave Grohl. m. Praha", // false positive for not catching abbr. in a word + "Sliačhl. m. Praha" : "Sliačhl. m. Praha", // false positive for not catching abbr. in a non-latin word + + // triple word abbreviations + "im Jahr 200 v. u. Z. als der Hunger" : "im Jahr 200 v. u. Z. als der Hunger", + "im Jahr 200 v.u.Z. als der Hunger" : "im Jahr 200 v. u. Z. als der Hunger", + "im Jahr 200 v. u. Z." : "im Jahr 200 v. u. Z.", + "im Jahr 200 v.u.Z." : "im Jahr 200 v. u. Z.", + "v. u. Z." : "v. u. Z.", + "v.u.Z." : "v. u. Z.", + + // random abbreviations to randomly check various localization + "1000 pr. n. l." : "1000 pr. n. l.", + "im Jahr 200 v. Chr." : "im Jahr 200 v. Chr.", + "Das Tier, d. h. der Fisch, lebte noch lange." : "Das Tier, d. h. der Fisch, lebte noch lange.", + "Das Tier – d. i. der Fisch – lebte noch lange." : "Das Tier – d. i. der Fisch – lebte noch lange.", + "Das Tier (d. h. der Fisch) lebte noch lange." : "Das Tier (d. h. der Fisch) lebte noch lange.", + "т. зн. незвыкле" : "т. зн. незвыкле" + }; + + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixMultipleWordAbbreviations(key, new Locale("sk")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixAbbreviations(key, new Locale("sk")), testCase[key]); + }); + }); }); describe('Fix multiple-word abbreviations (en-us)\n', () => { - let testCase = { - /* General pattern for these locales assumes: - * dots after each abbreviated word - * no spaces between abbreviated words - * normal space after the last abbreviated word - */ - "the U.S.": "the U.S.", - "the U. S.": "the U.S.", - - ", e.g. something": ", e.g. something", - "(e.g. something": "(e.g. something", - "a e.g. something": "a e.g. something", - "abc\ne.g. something": "abc\ne.g. something", - "e.g. 100 km": "e.g. 100 km", - "(e.g.)": "(e.g.)", - "(e.g. )": "(e.g.)", - "“e. g.”": "“e.g.”", - "‘e. g.’": "‘e.g.’", - "e. g.": "e.g.", - "č., s., fol., e. g., i.e., str.,": "č., s., fol., e.g., i.e., str.,", - - "e.g. “something”": "e.g. “something”", - "e.g. ‘something’": "e.g. ‘something’", - - "e.g. ```something```": "e.g. ```something```", - "e.g. `something`": "e.g. `something`", - - "e.g. 🥳": "e.g. 🥳", - "i. e. 🥳": "i.e. 🥳", - "a i.e. something": "a i.e. something", - "i.e. 100 km": "i.e. 100 km", - "brie cheese": "brie cheese", // false positive - "Pam Grier": "Pam Grier", // false positive - "najkrajšie": "najkrajšie", // false positive for non-latin boundaries - "nevieš": "nevieš", // false positive for non-latin boundaries - "ieš": "ieš", // false positive for non-latin boundaries - "či e-mail marketing": "či e-mail marketing", // false positive for non-latin boundaries - "(i.e.)": "(i.e.)", - - "4.20 p.m.": "4.20 p.m.", - "4.20 p.m. in the afternoon": "4.20 p.m. in the afternoon", - "She is the PM of the UK.": "She is the PM of the UK.", // false positive - "2 PMs": "2 PMs", - - // Throwing extra space - "“We will continue tomorrow at 8:00 a.m.”": - "“We will continue tomorrow at 8:00 a.m.”", - "We will continue tomorrow at 8:00 a.m.!": - "We will continue tomorrow at 8:00 a.m.!", - "8 a.m. is the right time": "8 a.m. is the right time", - }; - - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixMultipleWordAbbreviations(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixAbbreviations(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + /* General pattern for these locales assumes: + * dots after each abbreviated word + * no spaces between abbreviated words + * normal space after the last abbreviated word + */ + "the U.S.": "the U.S.", + "the U. S.": "the U.S.", + + ", e.g. something": ", e.g. something", + "(e.g. something": "(e.g. something", + "a e.g. something": "a e.g. something", + "abc\ne.g. something": "abc\ne.g. something", + "e.g. 100 km": "e.g. 100 km", + "(e.g.)": "(e.g.)", + "(e.g. )": "(e.g.)", + "“e. g.”": "“e.g.”", + "‘e. g.’": "‘e.g.’", + "e. g.": "e.g.", + "č., s., fol., e. g., i.e., str.,": "č., s., fol., e.g., i.e., str.,", + + "e.g. “something”": "e.g. “something”", + "e.g. ‘something’": "e.g. ‘something’", + + "e.g. ```something```": "e.g. ```something```", + "e.g. `something`": "e.g. `something`", + + "e.g. 🥳": "e.g. 🥳", + "i. e. 🥳": "i.e. 🥳", + "a i.e. something": "a i.e. something", + "i.e. 100 km": "i.e. 100 km", + "brie cheese": "brie cheese", // false positive + "Pam Grier": "Pam Grier", // false positive + "najkrajšie": "najkrajšie", // false positive for non-latin boundaries + "nevieš": "nevieš", // false positive for non-latin boundaries + "ieš": "ieš", // false positive for non-latin boundaries + "či e-mail marketing": "či e-mail marketing", // false positive for non-latin boundaries + "(i.e.)": "(i.e.)", + + "4.20 p.m.": "4.20 p.m.", + "4.20 p.m. in the afternoon": "4.20 p.m. in the afternoon", + "She is the PM of the UK.": "She is the PM of the UK.", // false positive + "2 PMs": "2 PMs", + + // Throwing extra space + "“We will continue tomorrow at 8:00 a.m.”": + "“We will continue tomorrow at 8:00 a.m.”", + "We will continue tomorrow at 8:00 a.m.!": + "We will continue tomorrow at 8:00 a.m.!", + "8 a.m. is the right time": "8 a.m. is the right time", + }; + + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixMultipleWordAbbreviations(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixAbbreviations(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix Single-word abbreviations (sk, cs, rue, de-de, en-us)\n', () => { - let testCase = { - /* General pattern for these locales assumes nbsp after abbreviation - */ - "č. 5 žije" : "č. 5 žije", // set nbsp - "č.5 žije" : "č. 5 žije", // add nbsp - "preč č. 5 žije" : "preč č. 5 žije", // identify abbreviation word ending in non-latin character - "áno, č. 5 žije" : "áno, č. 5 žije", // identify abbreviation after sentence punctuation - "Prines kvetináč. 5 je super číslo." : "Prines kvetináč. 5 je super číslo.", //false positive where abbreviation is part of the previous sentence - "(pp. 10–25)" : "(pp. 10–25)", // abbr. in brackets - "t. č. 555-729-458" : "t. č. 555-729-458", // false positive, do not correct single-word abbr. that's part of the multiple-word abbr - "t. č. dačo" : "t. č. dačo", // false positive, do not correct single-word abbr. that's part of the multiple-word abbr (word variation) - "4.20 p.m." : "4.20 p.m.", // false positive - - "str. 38" : "str. 38", // other abbreviation example - "str. 7" : "str. 7", // other abbreviation example - "str. p" : "str. p", // other abbreviation example - "tzv. rýč" : "tzv. rýč", // other abbreviation example - - "10 č." : "10 č.", // abbreviation at the end of the word - "10 p." : "10 p.", // abbreviation at the end of the word - "10 str." : "10 str.", // abbreviation at the end of the word - "(10 p.)" : "(10 p.)", // abbreviation at the end of the word & in brackets - - "the U.S. and" : "the U.S. and", //false positive - }; - - - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixSingleWordAbbreviations(key, new Locale("sk")), testCase[key]); - }); - }); + let testCase = { + /* General pattern for these locales assumes nbsp after abbreviation + */ + "č. 5 žije" : "č. 5 žije", // set nbsp + "č.5 žije" : "č. 5 žije", // add nbsp + "preč č. 5 žije" : "preč č. 5 žije", // identify abbreviation word ending in non-latin character + "áno, č. 5 žije" : "áno, č. 5 žije", // identify abbreviation after sentence punctuation + "Prines kvetináč. 5 je super číslo." : "Prines kvetináč. 5 je super číslo.", //false positive where abbreviation is part of the previous sentence + "(pp. 10–25)" : "(pp. 10–25)", // abbr. in brackets + "t. č. 555-729-458" : "t. č. 555-729-458", // false positive, do not correct single-word abbr. that's part of the multiple-word abbr + "t. č. dačo" : "t. č. dačo", // false positive, do not correct single-word abbr. that's part of the multiple-word abbr (word variation) + "4.20 p.m." : "4.20 p.m.", // false positive + + "str. 38" : "str. 38", // other abbreviation example + "str. 7" : "str. 7", // other abbreviation example + "str. p" : "str. p", // other abbreviation example + "tzv. rýč" : "tzv. rýč", // other abbreviation example + + "10 č." : "10 č.", // abbreviation at the end of the word + "10 p." : "10 p.", // abbreviation at the end of the word + "10 str." : "10 str.", // abbreviation at the end of the word + "(10 p.)" : "(10 p.)", // abbreviation at the end of the word & in brackets + + "the U.S. and" : "the U.S. and", //false positive + }; + + + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixSingleWordAbbreviations(key, new Locale("sk")), testCase[key]); + }); + }); }); diff --git a/tests/words/case.test.js b/tests/words/case.test.js index 466149c..be10c5e 100644 --- a/tests/words/case.test.js +++ b/tests/words/case.test.js @@ -3,7 +3,7 @@ import {fixCase} from "../../src/modules/words/case"; import Locale from "../../src/locale/locale"; describe('Fix accidental uPPERCASE\n', () => { - let testCase = { + let testCase = { // Accidental uPPERCASE at the beginning of sentence "cAPSLOCK and what else.": "Capslock and what else.", "Previous sentence. cAPSLOCK and what else.": "Previous sentence. Capslock and what else.", @@ -11,35 +11,35 @@ describe('Fix accidental uPPERCASE\n', () => { // Accidental uPPERCASE in the middle of a sentence "Press cAPSLOCK.": "Press Capslock.", - "Central Europe and Cyrillic tests: aĎIÉUБUГ": "Central Europe and Cyrillic tests: Aďiéuбuг", + "Central Europe and Cyrillic tests: aĎIÉUБUГ": "Central Europe and Cyrillic tests: Aďiéuбuг", // Accidental uPPERCASE in the brackets "There is (cAPSLOCK) in the brackets.": "There is (Capslock) in the brackets.", "There is [cAPSLOCK] in the brackets.": "There is [Capslock] in the brackets.", "There is {cAPSLOCK} in the brackets.": "There is {Capslock} in the brackets.", - "Hey, JEnnifer!": "Hey, Jennifer!", + "Hey, JEnnifer!": "Hey, Jennifer!", - // false positives - "CMSko" : "CMSko", - "FPs": "FPs", - "ČSNka" : "ČSNka", - "BigONE" : "BigONE", // specific brand names - "two Panzer IVs" : "two Panzer IVs", - "How about ABC?": "How about ABC?", // all caps - "iPhone": "iPhone", // mixed case brand + // false positives + "CMSko" : "CMSko", + "FPs": "FPs", + "ČSNka" : "ČSNka", + "BigONE" : "BigONE", // specific brand names + "two Panzer IVs" : "two Panzer IVs", + "How about ABC?": "How about ABC?", // all caps + "iPhone": "iPhone", // mixed case brand - "iOS" : "iOS", // desired case for a given brand name + "iOS" : "iOS", // desired case for a given brand name "macOS": "macOS", // desired case for a given brand name - "kW" : "kW", // kilowatts - "mA" : "mA", //milli amperes - }; + "kW" : "kW", // kilowatts + "mA" : "mA", //milli amperes + }; - Object.keys(testCase).forEach((key) => { - it("module test", () => { - assert.strictEqual(fixCase(key, new Locale("en-us")), testCase[key]); - }); - }); + Object.keys(testCase).forEach((key) => { + it("module test", () => { + assert.strictEqual(fixCase(key, new Locale("en-us")), testCase[key]); + }); + }); }); diff --git a/tests/words/pub-id.test.js b/tests/words/pub-id.test.js index ffba604..33fcdf0 100644 --- a/tests/words/pub-id.test.js +++ b/tests/words/pub-id.test.js @@ -1,107 +1,107 @@ import {fixPubId, - fixISSN, - fixISBN10, - fixISBN13, - fixISBNnumber} from "../../src/modules/words/pub-id"; + fixISSN, + fixISBN10, + fixISBN13, + fixISBNnumber} from "../../src/modules/words/pub-id"; import assert from 'assert'; import Locale from "../../src/locale/locale"; describe('Fix ISSN format\n', () => { - let testCase = { - "ISSN 0000 - 0000" : "ISSN 0000-0000", - "Issn 0000 - 0000" : "ISSN 0000-0000", - "issn 0000 - 0000" : "ISSN 0000-0000", - "ISSN 0000—0000" : "ISSN 0000-0000", - "ISSN: 0000 - 0000" : "ISSN: 0000-0000", - "ISSN:0000 - 0000" : "ISSN: 0000-0000", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixISSN(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "ISSN 0000 - 0000" : "ISSN 0000-0000", + "Issn 0000 - 0000" : "ISSN 0000-0000", + "issn 0000 - 0000" : "ISSN 0000-0000", + "ISSN 0000—0000" : "ISSN 0000-0000", + "ISSN: 0000 - 0000" : "ISSN: 0000-0000", + "ISSN:0000 - 0000" : "ISSN: 0000-0000", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixISSN(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix ISBN10 format\n', () => { - let testCase = { - "ISBN 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", - "Isbn 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", - "isbn 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", - "ISBN 80—902734—1—6" : "ISBN 80-902734-1-6", - "ISBN: 80 - 902734 - 1 - 6" : "ISBN: 80-902734-1-6", - "ISBN:80 - 902734 - 1 - 6" : "ISBN: 80-902734-1-6", - "ISBN:0-9752298-0-X" : "ISBN: 0-9752298-0-X", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixISBN10(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "ISBN 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", + "Isbn 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", + "isbn 80 - 902734 - 1 - 6" : "ISBN 80-902734-1-6", + "ISBN 80—902734—1—6" : "ISBN 80-902734-1-6", + "ISBN: 80 - 902734 - 1 - 6" : "ISBN: 80-902734-1-6", + "ISBN:80 - 902734 - 1 - 6" : "ISBN: 80-902734-1-6", + "ISBN:0-9752298-0-X" : "ISBN: 0-9752298-0-X", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixISBN10(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix ISBN13 format\n', () => { - let testCase = { - "ISBN 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", - "Isbn 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", - "isbn 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", - "ISBN 978 - 80—902734—1—6" : "ISBN 978-80-902734-1-6", - "ISBN: 978 - 80 - 902734 - 1 - 6" : "ISBN: 978-80-902734-1-6", - "ISBN:978 - 80 - 902734 - 1 - 6" : "ISBN: 978-80-902734-1-6", - "ISBN:978 - 0-9752298-0-X" : "ISBN: 978-0-9752298-0-X", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixISBN13(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "ISBN 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", + "Isbn 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", + "isbn 978 - 80 - 902734 - 1 - 6" : "ISBN 978-80-902734-1-6", + "ISBN 978 - 80—902734—1—6" : "ISBN 978-80-902734-1-6", + "ISBN: 978 - 80 - 902734 - 1 - 6" : "ISBN: 978-80-902734-1-6", + "ISBN:978 - 80 - 902734 - 1 - 6" : "ISBN: 978-80-902734-1-6", + "ISBN:978 - 0-9752298-0-X" : "ISBN: 978-0-9752298-0-X", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixISBN13(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); + }); + }); }); describe('Fix ISBN number\n', () => { - let testCase = { - "978 - 80 - 902734 - 1 - 6": "978-80-902734-1-6", - "978- 80- 902734- 1- 6": "978-80-902734-1-6", - "978 -80 -902734 -1 -6" : "978-80-902734-1-6", - "978 - 80—902734—1—6" : "978-80-902734-1-6", - "978 - 0-9752298-0-X" : "978-0-9752298-0-X", - "978 - 99921 - 58 - 10 - 7" : "978-99921-58-10-7", - "978 - 9971 - 5 - 0210 - 0" : "978-9971-5-0210-0", - "978 - 960 - 425 - 059 - 0" : "978-960-425-059-0", - "978 - 85 - 359 - 0277 - 5" : "978-85-359-0277-5", - "978 - 1 - 84356 - 028 - 3" : "978-1-84356-028-3", - "978 - 0 - 684 - 84328 - 5" : "978-0-684-84328-5", - "978 - 0 - 8044 - 2957 - X" : "978-0-8044-2957-X", - "978 - 0 - 85131 - 041 - 9" : "978-0-85131-041-9", - "978 - 93 - 86954 - 21 - 4" : "978-93-86954-21-4", - "978 - 0 - 943396 - 04 - 2" : "978-0-943396-04-2", - "978 - 0 - 9752298 - 0 - X" : "978-0-9752298-0-X", - }; - - Object.keys(testCase).forEach((key) => { - it("unit test", () => { - assert.strictEqual(fixISBNnumber(key, new Locale("en-us")), testCase[key]); - }); - it("module test", () => { - assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); - }); - }); + let testCase = { + "978 - 80 - 902734 - 1 - 6": "978-80-902734-1-6", + "978- 80- 902734- 1- 6": "978-80-902734-1-6", + "978 -80 -902734 -1 -6" : "978-80-902734-1-6", + "978 - 80—902734—1—6" : "978-80-902734-1-6", + "978 - 0-9752298-0-X" : "978-0-9752298-0-X", + "978 - 99921 - 58 - 10 - 7" : "978-99921-58-10-7", + "978 - 9971 - 5 - 0210 - 0" : "978-9971-5-0210-0", + "978 - 960 - 425 - 059 - 0" : "978-960-425-059-0", + "978 - 85 - 359 - 0277 - 5" : "978-85-359-0277-5", + "978 - 1 - 84356 - 028 - 3" : "978-1-84356-028-3", + "978 - 0 - 684 - 84328 - 5" : "978-0-684-84328-5", + "978 - 0 - 8044 - 2957 - X" : "978-0-8044-2957-X", + "978 - 0 - 85131 - 041 - 9" : "978-0-85131-041-9", + "978 - 93 - 86954 - 21 - 4" : "978-93-86954-21-4", + "978 - 0 - 943396 - 04 - 2" : "978-0-943396-04-2", + "978 - 0 - 9752298 - 0 - X" : "978-0-9752298-0-X", + }; + + Object.keys(testCase).forEach((key) => { + it("unit test", () => { + assert.strictEqual(fixISBNnumber(key, new Locale("en-us")), testCase[key]); + }); + it("module test", () => { + assert.strictEqual(fixPubId(key, new Locale("en-us")), testCase[key]); + }); + }); }); From 2b472c3d975d4f5b1e60522af961b5d6c1aa02f6 Mon Sep 17 00:00:00 2001 From: brano Date: Fri, 1 Nov 2024 18:07:01 +0100 Subject: [PATCH 3/3] Add test cases --- tests/whitespace/nbsp.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/whitespace/nbsp.test.js b/tests/whitespace/nbsp.test.js index f680e40..448b66f 100644 --- a/tests/whitespace/nbsp.test.js +++ b/tests/whitespace/nbsp.test.js @@ -189,14 +189,15 @@ describe('Add non-breaking space after ordinal number (en)\n', () => { "3rd amendment": "3rd amendment", "4th amendment": "4th amendment", "18th amendment": "18th amendment", + "1st March": "1st March", + "2nd March": "2nd March", + "3rd March": "3rd March", "15th March": "15th March", // false positive, 3+ digits "158th amendment": "158th amendment", "1158th amendment": "1158th amendment", - - }; Object.keys(testCase).forEach((key) => {