From 71be1a9f273ea1cbaa3e80427c89fdcc23fb1630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 31 Jan 2024 18:30:26 +0100 Subject: [PATCH 1/2] Set up ESLint --- eslint.config.js | 12 + package-lock.json | 937 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 5 +- 3 files changed, 943 insertions(+), 11 deletions(-) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..c9017f6c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,12 @@ +import jsdoc from "eslint-plugin-jsdoc"; + +export default [ + jsdoc.configs["flat/recommended"], + { + rules: { + "jsdoc/require-param-description": "off", + "jsdoc/require-returns-description": "off", + "jsdoc/tag-lines": ["error", "any", { startLines: 1 }], + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index 9897e045..b3410299 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,8 @@ "@web/test-runner": "^0.18.0", "@web/test-runner-playwright": "^0.11.0", "esbuild": "^0.19.10", + "eslint": "^8.56.0", + "eslint-plugin-jsdoc": "^48.0.4", "mocha": "^10.2.0" }, "engines": { @@ -49,6 +51,15 @@ "node": ">=12.17" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.23.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", @@ -85,6 +96,20 @@ "node": ">=6.9.0" } }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.41.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", + "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", + "dev": true, + "dependencies": { + "comment-parser": "1.4.1", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.19.10", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.10.tgz", @@ -453,6 +478,139 @@ "node": ">=12" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "dev": true + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", @@ -1136,6 +1294,12 @@ "@types/node": "*" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@web/browser-logs": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.4.0.tgz", @@ -1397,6 +1561,27 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", @@ -1409,6 +1594,22 @@ "node": ">= 14" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -1467,6 +1668,15 @@ "node": ">= 8" } }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1696,6 +1906,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -2051,6 +2270,15 @@ "node": ">=12.17" } }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2112,6 +2340,20 @@ "node-fetch": "^2.6.12" } }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/data-uri-to-buffer": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", @@ -2170,6 +2412,12 @@ "integrity": "sha512-bHtC0iYvWhyaTzvV3CZgPeZQqCOBGyGsVV7v4eevpdkLHfiSrXUdBG+qAuSz4RI70sszvjQ1QSZ98An1yNwpSw==", "dev": true }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -2277,6 +2525,18 @@ "node": ">=8" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2396,20 +2656,271 @@ "esgenerate": "bin/esgenerate.js" }, "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-jsdoc": { + "version": "48.0.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.0.4.tgz", + "integrity": "sha512-A0cH+5svWPXzGZszBjXA1t0aAqVGS+/x3i02KFmb73rU0iMLnadEcVWcD/dGBZHIfAMKr3YpWh58f6wn4N909w==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.41.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/escodegen/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, - "optional": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, "engines": { - "node": ">=0.10.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esprima": { @@ -2425,6 +2936,30 @@ "node": ">=4" } }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, "node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", @@ -2493,6 +3028,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -2515,6 +3056,18 @@ "node": ">=8.6.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "node_modules/fastq": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", @@ -2533,6 +3086,18 @@ "pend": "~1.2.0" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2582,6 +3147,26 @@ "flat": "cli.js" } }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", @@ -2724,6 +3309,33 @@ "node": ">= 6" } }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -2762,6 +3374,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2954,6 +3572,31 @@ "node": ">= 4" } }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inflation": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.1.0.tgz", @@ -3099,6 +3742,15 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -3165,6 +3817,12 @@ "url": "https://github.com/sponsors/gjtorikian/" } }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -3240,6 +3898,33 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -3261,6 +3946,15 @@ "node": ">= 0.6" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/koa": { "version": "2.14.2", "resolved": "https://registry.npmjs.org/koa/-/koa-2.14.2.tgz", @@ -3359,6 +4053,19 @@ "ms": "^2.1.1" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lighthouse-logger": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz", @@ -3417,6 +4124,12 @@ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -3864,6 +4577,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -4001,6 +4720,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -4064,6 +4800,18 @@ "node": ">= 14" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", @@ -4097,6 +4845,15 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -4217,6 +4974,15 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -4453,6 +5219,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/resolve-path": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz", @@ -4525,6 +5300,63 @@ "node": ">=0.10.0" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/rollup": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.1.tgz", @@ -4660,6 +5492,27 @@ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -4792,6 +5645,28 @@ "node": ">= 8" } }, + "node_modules/spdx-exceptions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.4.0.tgz", + "integrity": "sha512-hcjppoJ68fhxA/cjbN4T8N6uCUejN8yFw69ttpqtBeCbF3u13n7mb31NB9jKwGTTWWnt9IbRA/mf1FprYS8wfw==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz", + "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", + "dev": true + }, "node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -4943,6 +5818,12 @@ "streamx": "^2.15.0" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4997,6 +5878,18 @@ "node": ">=0.6.x" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -5065,6 +5958,15 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", @@ -5110,6 +6012,21 @@ "node": ">=12" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/wordwrapjs": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz", diff --git a/package.json b/package.json index be668933..f2f9aad1 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,11 @@ "prebuild": "npm run clean", "build": "npm run build:esm", "build:esm": "esbuild --bundle --format=esm --keep-names --outfile=chai.js index.js", - "pretest": "npm run build", + "pretest": "npm run lint && npm run build", "test": "npm run test-node && npm run test-chrome", "test-node": "mocha --require ./test/bootstrap/index.js --reporter dot test/*.js", "test-chrome": "web-test-runner --playwright", + "lint": "eslint lib/", "clean": "rm -f chai.js coverage" }, "engines": { @@ -53,6 +54,8 @@ "@web/test-runner": "^0.18.0", "@web/test-runner-playwright": "^0.11.0", "esbuild": "^0.19.10", + "eslint": "^8.56.0", + "eslint-plugin-jsdoc": "^48.0.4", "mocha": "^10.2.0" } } From b4439f6ab4546f20a4550cce59a8b9ad9bf9b05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 31 Jan 2024 18:30:34 +0100 Subject: [PATCH 2/2] Fix violations --- lib/chai.js | 4 +- lib/chai/assertion.js | 56 +- lib/chai/config.js | 42 +- lib/chai/core/assertions.js | 408 +++++---- lib/chai/interface/assert.js | 803 +++++++++--------- lib/chai/interface/expect.js | 9 +- lib/chai/interface/should.js | 50 +- lib/chai/utils/addChainableMethod.js | 11 +- lib/chai/utils/addLengthGuard.js | 6 +- lib/chai/utils/addMethod.js | 11 +- lib/chai/utils/addProperty.js | 11 +- lib/chai/utils/compareByInspect.js | 9 +- lib/chai/utils/expectTypes.js | 15 +- lib/chai/utils/flag.js | 10 +- lib/chai/utils/getActual.js | 6 +- lib/chai/utils/getEnumerableProperties.js | 5 +- lib/chai/utils/getMessage.js | 8 +- lib/chai/utils/getOperator.js | 12 +- lib/chai/utils/getOwnEnumerableProperties.js | 5 +- .../utils/getOwnEnumerablePropertySymbols.js | 5 +- lib/chai/utils/getProperties.js | 8 +- lib/chai/utils/index.js | 7 +- lib/chai/utils/inspect.js | 9 +- lib/chai/utils/isNaN.js | 6 +- lib/chai/utils/isProxyEnabled.js | 2 +- lib/chai/utils/objDisplay.js | 5 +- lib/chai/utils/overwriteChainableMethod.js | 15 +- lib/chai/utils/overwriteMethod.js | 21 +- lib/chai/utils/overwriteProperty.js | 22 +- lib/chai/utils/proxify.js | 18 +- lib/chai/utils/test.js | 6 +- lib/chai/utils/transferFlags.js | 10 +- lib/chai/utils/type-detect.js | 4 + 33 files changed, 810 insertions(+), 809 deletions(-) diff --git a/lib/chai.js b/lib/chai.js index ca7be863..507d9c76 100644 --- a/lib/chai.js +++ b/lib/chai.js @@ -23,9 +23,9 @@ export {AssertionError}; * * Provides a way to extend the internals of Chai. * - * @param {Function} + * @param {Function} fn * @returns {this} for chaining - * @api public + * @public */ export function use(fn) { const exports = { diff --git a/lib/chai/assertion.js b/lib/chai/assertion.js index e8e1e597..7cc17cda 100644 --- a/lib/chai/assertion.js +++ b/lib/chai/assertion.js @@ -18,37 +18,37 @@ import * as util from './utils/index.js'; * be assigned during instantiation by passing arguments to this constructor: * * - `object`: This flag contains the target of the assertion. For example, in - * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will - * contain `numKittens` so that the `equal` assertion can reference it when - * needed. + * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will + * contain `numKittens` so that the `equal` assertion can reference it when + * needed. * * - `message`: This flag contains an optional custom error message to be - * prepended to the error message that's generated by the assertion when it - * fails. + * prepended to the error message that's generated by the assertion when it + * fails. * * - `ssfi`: This flag stands for "start stack function indicator". It - * contains a function reference that serves as the starting point for - * removing frames from the stack trace of the error that's created by the - * assertion when it fails. The goal is to provide a cleaner stack trace to - * end users by removing Chai's internal functions. Note that it only works - * in environments that support `Error.captureStackTrace`, and only when - * `Chai.config.includeStack` hasn't been set to `false`. + * contains a function reference that serves as the starting point for + * removing frames from the stack trace of the error that's created by the + * assertion when it fails. The goal is to provide a cleaner stack trace to + * end users by removing Chai's internal functions. Note that it only works + * in environments that support `Error.captureStackTrace`, and only when + * `Chai.config.includeStack` hasn't been set to `false`. * * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag - * should retain its current value, even as assertions are chained off of - * this object. This is usually set to `true` when creating a new assertion - * from within another assertion. It's also temporarily set to `true` before - * an overwritten assertion gets called by the overwriting assertion. + * should retain its current value, even as assertions are chained off of + * this object. This is usually set to `true` when creating a new assertion + * from within another assertion. It's also temporarily set to `true` before + * an overwritten assertion gets called by the overwriting assertion. * * - `eql`: This flag contains the deepEqual function to be used by the assertion. * - * @param {Mixed} obj target of the assertion - * @param {String} msg (optional) custom error message + * @param {unknown} obj target of the assertion + * @param {string} msg (optional) custom error message * @param {Function} ssfi (optional) starting point for removing stack frames - * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked - * @api private + * @param {boolean} lockSsfi (optional) whether or not the ssfi flag is locked + * @returns {unknown} + * @private */ - export function Assertion (obj, msg, ssfi, lockSsfi) { util.flag(this, 'ssfi', ssfi || Assertion); util.flag(this, 'lockSsfi', lockSsfi); @@ -111,13 +111,13 @@ Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. * * @name assert - * @param {Philosophical} expression to be tested - * @param {String|Function} message or function that returns message to display if expression fails - * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails - * @param {Mixed} expected value (remember to check for negation) - * @param {Mixed} actual (optional) will default to `this.obj` - * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @api private + * @param {unknown} expression to be tested + * @param {string | Function} message or function that returns message to display if expression fails + * @param {string | Function} negatedMessage or function that returns negatedMessage to display if negated expression fails + * @param {unknown} expected value (remember to check for negation) + * @param {unknown} actual (optional) will default to `this.obj` + * @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails + * @private */ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { @@ -152,7 +152,7 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, * * Quick reference to stored `actual` value for plugin developers. * - * @api private + * @private */ Object.defineProperty(Assertion.prototype, '_obj', { get: function () { diff --git a/lib/chai/config.js b/lib/chai/config.js index 60257ab8..afeae596 100644 --- a/lib/chai/config.js +++ b/lib/chai/config.js @@ -9,10 +9,9 @@ export const config = { * * chai.config.includeStack = true; // enable stack on error * - * @param {Boolean} - * @api public + * @param {boolean} + * @public */ - includeStack: false, /** @@ -24,10 +23,9 @@ export const config = { * will be true when the assertion has requested a diff * be shown. * - * @param {Boolean} - * @api public + * @param {boolean} + * @public */ - showDiff: true, /** @@ -46,10 +44,9 @@ export const config = { * * chai.config.truncateThreshold = 0; // disable truncating * - * @param {Number} - * @api public + * @param {number} + * @public */ - truncateThreshold: 40, /** @@ -66,10 +63,9 @@ export const config = { * This feature is automatically disabled regardless of this config value * in environments that don't support proxies. * - * @param {Boolean} - * @api public + * @param {boolean} + * @public */ - useProxy: true, /** @@ -87,9 +83,8 @@ export const config = { * chai.config.proxyExcludedKeys = ['then', 'inspect']; * * @param {Array} - * @api public + * @public */ - proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'], /** @@ -101,20 +96,19 @@ export const config = { * * // use a custom comparator * chai.config.deepEqual = (expected, actual) => { - * return chai.util.eql(expected, actual, { - * comparator: (expected, actual) => { - * // for non number comparison, use the default behavior - * if(typeof expected !== 'number') return null; - * // allow a difference of 10 between compared numbers - * return typeof actual === 'number' && Math.abs(actual - expected) < 10 - * } - * }) + * return chai.util.eql(expected, actual, { + * comparator: (expected, actual) => { + * // for non number comparison, use the default behavior + * if(typeof expected !== 'number') return null; + * // allow a difference of 10 between compared numbers + * return typeof actual === 'number' && Math.abs(actual - expected) < 10 + * } + * }) * }; * * @param {Function} - * @api public + * @public */ - deepEqual: null }; diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index 7b3b1a4b..7d72b068 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -39,7 +39,7 @@ const {flag} = _; * * @name language chains * @namespace BDD - * @api public + * @public */ [ 'to', 'be', 'been', 'is' @@ -69,7 +69,7 @@ const {flag} = _; * * @name not * @namespace BDD - * @api public + * @public */ Assertion.addProperty('not', function () { @@ -110,7 +110,7 @@ Assertion.addProperty('not', function () { * * @name deep * @namespace BDD - * @api public + * @public */ Assertion.addProperty('deep', function () { @@ -136,7 +136,7 @@ Assertion.addProperty('deep', function () { * * @name nested * @namespace BDD - * @api public + * @public */ Assertion.addProperty('nested', function () { @@ -162,7 +162,7 @@ Assertion.addProperty('nested', function () { * * @name own * @namespace BDD - * @api public + * @public */ Assertion.addProperty('own', function () { @@ -186,7 +186,7 @@ Assertion.addProperty('own', function () { * * @name ordered * @namespace BDD - * @api public + * @public */ Assertion.addProperty('ordered', function () { @@ -206,7 +206,7 @@ Assertion.addProperty('ordered', function () { * * @name any * @namespace BDD - * @api public + * @public */ Assertion.addProperty('any', function () { @@ -231,7 +231,7 @@ Assertion.addProperty('any', function () { * * @name all * @namespace BDD - * @api public + * @public */ Assertion.addProperty('all', function () { @@ -265,7 +265,7 @@ const functionTypes = { * `.a` supports objects that have a custom type set via `Symbol.toStringTag`. * * var myObj = { - * [Symbol.toStringTag]: 'myCustomType' + * [Symbol.toStringTag]: 'myCustomType' * }; * * expect(myObj).to.be.a('myCustomType').but.not.an('object'); @@ -300,10 +300,10 @@ const functionTypes = { * * @name a * @alias an - * @param {String} type - * @param {String} msg _optional_ + * @param {string} type + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ function an (type, msg) { if (msg) flag(this, 'message', msg); @@ -331,6 +331,23 @@ function an (type, msg) { Assertion.addChainableMethod('an', an); Assertion.addChainableMethod('a', an); +/** + * + * @param {unknown} a + * @param {unknown} b + * @returns {boolean} + */ +function SameValueZero(a, b) { + return (_.isNaN(a) && _.isNaN(b)) || a === b; +} + +/** + * + */ +function includeChainingBehavior () { + flag(this, 'contains', true); +} + /** * ### .include(val[, msg]) * @@ -472,20 +489,11 @@ Assertion.addChainableMethod('a', an); * @alias contain * @alias includes * @alias contains - * @param {Mixed} val - * @param {String} msg _optional_ + * @param {unknown} val + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - -function SameValueZero(a, b) { - return (_.isNaN(a) && _.isNaN(b)) || a === b; -} - -function includeChainingBehavior () { - flag(this, 'contains', true); -} - function include (val, msg) { if (msg) flag(this, 'message', msg); @@ -643,9 +651,8 @@ Assertion.addChainableMethod('includes', include, includeChainingBehavior); * * @name ok * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('ok', function () { this.assert( flag(this, 'object') @@ -676,9 +683,8 @@ Assertion.addProperty('ok', function () { * * @name true * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('true', function () { this.assert( true === flag(this, 'object') @@ -701,7 +707,7 @@ Assertion.addProperty('true', function () { * * @name callable * @namespace BDD - * @api public + * @public */ Assertion.addProperty('callable', function () { const val = flag(this, 'object') @@ -748,9 +754,8 @@ Assertion.addProperty('callable', function () { * * @name false * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('false', function () { this.assert( false === flag(this, 'object') @@ -780,9 +785,8 @@ Assertion.addProperty('false', function () { * * @name null * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('null', function () { this.assert( null === flag(this, 'object') @@ -811,9 +815,8 @@ Assertion.addProperty('null', function () { * * @name undefined * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('undefined', function () { this.assert( undefined === flag(this, 'object') @@ -842,9 +845,8 @@ Assertion.addProperty('undefined', function () { * * @name NaN * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('NaN', function () { this.assert( _.isNaN(flag(this, 'object')) @@ -883,9 +885,8 @@ Assertion.addProperty('NaN', function () { * @name exist * @alias exists * @namespace BDD - * @api public + * @public */ - function assertExist () { var val = flag(this, 'object'); this.assert( @@ -944,9 +945,8 @@ Assertion.addProperty('exists', assertExist); * * @name empty * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('empty', function () { var val = flag(this, 'object') , ssfi = flag(this, 'ssfi') @@ -998,7 +998,7 @@ Assertion.addProperty('empty', function () { * Asserts that the target is an `arguments` object. * * function test () { - * expect(arguments).to.be.arguments; + * expect(arguments).to.be.arguments; * } * * test(); @@ -1019,9 +1019,8 @@ Assertion.addProperty('empty', function () { * @name arguments * @alias Arguments * @namespace BDD - * @api public + * @public */ - function checkArguments () { var obj = flag(this, 'object') , type = _.type(obj); @@ -1074,12 +1073,11 @@ Assertion.addProperty('Arguments', checkArguments); * @name equal * @alias equals * @alias eq - * @param {Mixed} val - * @param {String} msg _optional_ + * @param {unknown} val + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertEqual (val, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object'); @@ -1139,12 +1137,11 @@ Assertion.addMethod('eq', assertEqual); * * @name eql * @alias eqls - * @param {Mixed} obj - * @param {String} msg _optional_ + * @param {unknown} obj + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertEql(obj, msg) { if (msg) flag(this, 'message', msg); var eql = flag(this, 'eql'); @@ -1198,12 +1195,11 @@ Assertion.addMethod('eqls', assertEql); * @name above * @alias gt * @alias greaterThan - * @param {Number} n - * @param {String} msg _optional_ + * @param {number} n + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertAbove (n, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -1303,12 +1299,11 @@ Assertion.addMethod('greaterThan', assertAbove); * @name least * @alias gte * @alias greaterThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ + * @param {number} n + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertLeast (n, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -1407,12 +1402,11 @@ Assertion.addMethod('greaterThanOrEqual', assertLeast); * @name below * @alias lt * @alias lessThan - * @param {Number} n - * @param {String} msg _optional_ + * @param {number} n + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertBelow (n, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -1512,12 +1506,11 @@ Assertion.addMethod('lessThan', assertBelow); * @name most * @alias lte * @alias lessThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ + * @param {number} n + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertMost (n, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -1615,13 +1608,12 @@ Assertion.addMethod('lessThanOrEqual', assertMost); * expect(4, 'nooo why fail??').to.be.within(1, 3); * * @name within - * @param {Number} start lower bound inclusive - * @param {Number} finish upper bound inclusive - * @param {String} msg _optional_ + * @param {number} start lower bound inclusive + * @param {number} finish upper bound inclusive + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - Assertion.addMethod('within', function (start, finish, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -1712,13 +1704,12 @@ Assertion.addMethod('within', function (start, finish, msg) { * The alias `.instanceOf` can be used interchangeably with `.instanceof`. * * @name instanceof - * @param {Constructor} constructor - * @param {String} msg _optional_ + * @param {unknown} constructor + * @param {string} msg _optional_ * @alias instanceOf * @namespace BDD - * @api public + * @public */ - function assertInstanceOf (constructor, msg) { if (msg) flag(this, 'message', msg); @@ -1860,14 +1851,12 @@ Assertion.addMethod('instanceOf', assertInstanceOf); * interchangeably with `.own.property`. * * @name property - * @param {String} name - * @param {Mixed} val (optional) - * @param {String} msg _optional_ - * @returns value of property for chaining + * @param {string} name + * @param {unknown} val (optional) + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertProperty (name, val, msg) { if (msg) flag(this, 'message', msg); @@ -1958,6 +1947,12 @@ function assertProperty (name, val, msg) { Assertion.addMethod('property', assertProperty); +/** + * + * @param {unknown} name + * @param {unknown} value + * @param {string} msg + */ function assertOwnProperty (name, value, msg) { flag(this, 'own', true); assertProperty.apply(this, arguments); @@ -1981,10 +1976,10 @@ Assertion.addMethod('haveOwnProperty', assertOwnProperty); * https://github.com/chaijs/deep-eql. * * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, * }); * * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`. @@ -2007,10 +2002,10 @@ Assertion.addMethod('haveOwnProperty', assertOwnProperty); * * // Not recommended * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, * }); * * When the target is expected to have a property descriptor with the given @@ -2020,18 +2015,18 @@ Assertion.addMethod('haveOwnProperty', assertOwnProperty); * * // Recommended * expect({a: 3}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 3, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 3, * }); * * // Not recommended * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, * }); * * `.ownPropertyDescriptor` changes the target of any assertions that follow @@ -2048,18 +2043,18 @@ Assertion.addMethod('haveOwnProperty', assertOwnProperty); * * // Recommended * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 2, * }, 'nooo why fail??'); * * // Recommended * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, + * configurable: true, + * enumerable: true, + * writable: true, + * value: 2, * }); * * // Recommended @@ -2078,13 +2073,12 @@ Assertion.addMethod('haveOwnProperty', assertOwnProperty); * * @name ownPropertyDescriptor * @alias haveOwnPropertyDescriptor - * @param {String} name - * @param {Object} descriptor _optional_ - * @param {String} msg _optional_ + * @param {string} name + * @param {object} descriptor _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertOwnPropertyDescriptor (name, descriptor, msg) { if (typeof descriptor === 'string') { msg = descriptor; @@ -2116,6 +2110,13 @@ function assertOwnPropertyDescriptor (name, descriptor, msg) { Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); +/** + * + */ +function assertLengthChain () { + flag(this, 'doLength', true); +} + /** * ### .lengthOf(n[, msg]) * @@ -2168,16 +2169,11 @@ Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); * * @name lengthOf * @alias length - * @param {Number} n - * @param {String} msg _optional_ + * @param {number} n + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - -function assertLengthChain () { - flag(this, 'doLength', true); -} - function assertLength (n, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -2233,9 +2229,9 @@ Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain); * @name match * @alias matches * @param {RegExp} re - * @param {String} msg _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ function assertMatch(re, msg) { if (msg) flag(this, 'message', msg); @@ -2269,12 +2265,11 @@ Assertion.addMethod('matches', assertMatch); * expect('foobar', 'nooo why fail??').to.have.string('taco'); * * @name string - * @param {String} str - * @param {String} msg _optional_ + * @param {string} str + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - Assertion.addMethod('string', function (str, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -2388,11 +2383,10 @@ Assertion.addMethod('string', function (str, msg) { * * @name keys * @alias key - * @param {...String|Array|Object} keys + * @param {...string | Array | object} keys * @namespace BDD - * @api public + * @public */ - function assertKeys (keys) { var obj = flag(this, 'object') , objType = _.type(obj) @@ -2522,7 +2516,6 @@ Assertion.addMethod('key', assertKeys); * asserts that an error is thrown. * * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * * expect(badFn).to.throw(); * * When one argument is provided, and it's an error constructor, `.throw` @@ -2530,7 +2523,6 @@ Assertion.addMethod('key', assertKeys); * instance of that error constructor. * * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * * expect(badFn).to.throw(TypeError); * * When one argument is provided, and it's an error instance, `.throw` invokes @@ -2547,7 +2539,6 @@ Assertion.addMethod('key', assertKeys); * contains that string. * * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * * expect(badFn).to.throw('salmon'); * * When one argument is provided, and it's a regular expression, `.throw` @@ -2555,7 +2546,6 @@ Assertion.addMethod('key', assertKeys); * message that matches that regular expression. * * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * * expect(badFn).to.throw(/salmon/); * * When two arguments are provided, and the first is an error instance or @@ -2574,7 +2564,6 @@ Assertion.addMethod('key', assertKeys); * Add `.not` earlier in the chain to negate `.throw`. * * var goodFn = function () {}; - * * expect(goodFn).to.not.throw(); * * However, it's dangerous to negate `.throw` when providing any arguments. @@ -2671,15 +2660,14 @@ Assertion.addMethod('key', assertKeys); * @name throw * @alias throws * @alias Throw - * @param {Error|ErrorConstructor} errorLike - * @param {String|RegExp} errMsgMatcher error message - * @param {String} msg _optional_ + * @param {Error} errorLike + * @param {string | RegExp} errMsgMatcher error message + * @param {string} msg _optional_ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @returns error for chaining (null if no error) + * @returns {void} error for chaining (null if no error) * @namespace BDD - * @api public + * @public */ - function assertThrows (errorLike, errMsgMatcher, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -2869,12 +2857,11 @@ Assertion.addMethod('Throw', assertThrows); * * @name respondTo * @alias respondsTo - * @param {String} method - * @param {String} msg _optional_ + * @param {string} method + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function respondTo (method, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -2910,9 +2897,8 @@ Assertion.addMethod('respondsTo', respondTo); * * @name itself * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('itself', function () { flag(this, 'itself', true); }); @@ -2924,13 +2910,13 @@ Assertion.addProperty('itself', function () { * first argument, and asserts that the value returned is truthy. * * expect(1).to.satisfy(function(num) { - * return num > 0; + * return num > 0; * }); * * Add `.not` earlier in the chain to negate `.satisfy`. * * expect(1).to.not.satisfy(function(num) { - * return num > 2; + * return num > 2; * }); * * `.satisfy` accepts an optional `msg` argument which is a custom error @@ -2938,11 +2924,11 @@ Assertion.addProperty('itself', function () { * the second argument to `expect`. * * expect(1).to.satisfy(function(num) { - * return num > 2; + * return num > 2; * }, 'nooo why fail??'); * * expect(1, 'nooo why fail??').to.satisfy(function(num) { - * return num > 2; + * return num > 2; * }); * * The alias `.satisfies` can be used interchangeably with `.satisfy`. @@ -2950,11 +2936,10 @@ Assertion.addProperty('itself', function () { * @name satisfy * @alias satisfies * @param {Function} matcher - * @param {String} msg _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function satisfy (matcher, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object'); @@ -3002,13 +2987,12 @@ Assertion.addMethod('satisfies', satisfy); * * @name closeTo * @alias approximately - * @param {Number} expected - * @param {Number} delta - * @param {String} msg _optional_ + * @param {number} expected + * @param {number} delta + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function closeTo(expected, delta, msg) { if (msg) flag(this, 'message', msg); var obj = flag(this, 'object') @@ -3036,7 +3020,14 @@ function closeTo(expected, delta, msg) { Assertion.addMethod('closeTo', closeTo); Assertion.addMethod('approximately', closeTo); -// Note: Duplicates are ignored if testing for inclusion instead of sameness. +/** + * @param {unknown} _subset + * @param {unknown} _superset + * @param {unknown} cmp + * @param {unknown} contains + * @param {unknown} ordered + * @returns {boolean} + */ function isSubsetOf(_subset, _superset, cmp, contains, ordered) { let superset = Array.from(_superset); let subset = Array.from(_subset); @@ -3131,9 +3122,9 @@ function isSubsetOf(_subset, _superset, cmp, contains, ordered) { * * @name members * @param {Array} set - * @param {String} msg _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ Assertion.addMethod('members', function (subset, msg) { if (msg) flag(this, 'message', msg); @@ -3190,7 +3181,7 @@ Assertion.addMethod('members', function (subset, msg) { * * @name iterable * @namespace BDD - * @api public + * @public */ Assertion.addProperty('iterable', function(msg) { if (msg) flag(this, 'message', msg); @@ -3237,11 +3228,10 @@ Assertion.addProperty('iterable', function(msg) { * * @name oneOf * @param {Array<*>} list - * @param {String} msg _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function oneOf (list, msg) { if (msg) flag(this, 'message', msg); var expected = flag(this, 'object') @@ -3292,8 +3282,8 @@ Assertion.addMethod('oneOf', oneOf); * to assert that `subject` is equal to its expected value. * * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; + * , addDot = function () { dots += '.'; } + * , getDots = function () { return dots; }; * * // Recommended * expect(getDots()).to.equal(''); @@ -3308,7 +3298,7 @@ Assertion.addMethod('oneOf', oneOf); * target function compared to afterward. * * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; + * , addDot = function () { myObj.dots += '.'; }; * * // Recommended * expect(myObj).to.have.property('dots', ''); @@ -3323,13 +3313,13 @@ Assertion.addMethod('oneOf', oneOf); * Add `.not` earlier in the chain to negate `.change`. * * var dots = '' - * , noop = function () {} - * , getDots = function () { return dots; }; + * , noop = function () {} + * , getDots = function () { return dots; }; * * expect(noop).to.not.change(getDots); * * var myObj = {dots: ''} - * , noop = function () {}; + * , noop = function () {}; * * expect(noop).to.not.change(myObj, 'dots'); * @@ -3339,13 +3329,13 @@ Assertion.addMethod('oneOf', oneOf); * use the second form. * * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; + * , addDot = function () { myObj.dots += '.'; }; * * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??'); * * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; + * , addDot = function () { dots += '.'; } + * , getDots = function () { return dots; }; * * expect(addDot, 'nooo why fail??').to.not.change(getDots); * @@ -3358,8 +3348,8 @@ Assertion.addMethod('oneOf', oneOf); * that only accepts that exact output. * * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; } - * , subtractTwo = function () { myObj.val -= 2; }; + * , addTwo = function () { myObj.val += 2; } + * , subtractTwo = function () { myObj.val -= 2; }; * * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended @@ -3371,13 +3361,12 @@ Assertion.addMethod('oneOf', oneOf); * * @name change * @alias changes - * @param {String} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ + * @param {string} subject + * @param {string} prop name _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertChanges (subject, prop, msg) { if (msg) flag(this, 'message', msg); var fn = flag(this, 'object') @@ -3428,8 +3417,8 @@ Assertion.addMethod('changes', assertChanges); * by any amount. * * var val = 1 - * , addTwo = function () { val += 2; } - * , getVal = function () { return val; }; + * , addTwo = function () { val += 2; } + * , getVal = function () { return val; }; * * expect(addTwo).to.increase(getVal).by(2); // Recommended * expect(addTwo).to.increase(getVal); // Not recommended @@ -3439,7 +3428,7 @@ Assertion.addMethod('changes', assertChanges); * target function compared to beforehand. * * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; + * , addTwo = function () { myObj.val += 2; }; * * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended * expect(addTwo).to.increase(myObj, 'val'); // Not recommended @@ -3454,7 +3443,7 @@ Assertion.addMethod('changes', assertChanges); * decreased by the expected amount. * * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; + * , subtractTwo = function () { myObj.val -= 2; }; * * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended @@ -3463,7 +3452,7 @@ Assertion.addMethod('changes', assertChanges); * exactly that. * * var myObj = {val: 1} - * , noop = function () {}; + * , noop = function () {}; * * expect(noop).to.not.change(myObj, 'val'); // Recommended * expect(noop).to.not.increase(myObj, 'val'); // Not recommended @@ -3474,13 +3463,13 @@ Assertion.addMethod('changes', assertChanges); * use the second form. * * var myObj = {val: 1} - * , noop = function () {}; + * , noop = function () {}; * * expect(noop).to.increase(myObj, 'val', 'nooo why fail??'); * * var val = 1 - * , noop = function () {} - * , getVal = function () { return val; }; + * , noop = function () {} + * , getVal = function () { return val; }; * * expect(noop, 'nooo why fail??').to.increase(getVal); * @@ -3488,13 +3477,12 @@ Assertion.addMethod('changes', assertChanges); * * @name increase * @alias increases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ + * @param {string | Function} subject + * @param {string} prop name _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertIncreases (subject, prop, msg) { if (msg) flag(this, 'message', msg); var fn = flag(this, 'object') @@ -3607,13 +3595,12 @@ Assertion.addMethod('increases', assertIncreases); * * @name decrease * @alias decreases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ + * @param {string | Function} subject + * @param {string} prop name _optional_ + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertDecreases (subject, prop, msg) { if (msg) flag(this, 'message', msg); var fn = flag(this, 'object') @@ -3714,12 +3701,11 @@ Assertion.addMethod('decreases', assertDecreases); * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3); * * @name by - * @param {Number} delta - * @param {String} msg _optional_ + * @param {number} delta + * @param {string} msg _optional_ * @namespace BDD - * @api public + * @public */ - function assertDelta(delta, msg) { if (msg) flag(this, 'message', msg); @@ -3756,8 +3742,8 @@ Assertion.addMethod('by', assertDelta); * Add `.not` earlier in the chain to negate `.extensible`. * * var nonExtensibleObject = Object.preventExtensions({}) - * , sealedObject = Object.seal({}) - * , frozenObject = Object.freeze({}); + * , sealedObject = Object.seal({}) + * , frozenObject = Object.freeze({}); * * expect(nonExtensibleObject).to.not.be.extensible; * expect(sealedObject).to.not.be.extensible; @@ -3770,9 +3756,8 @@ Assertion.addMethod('by', assertDelta); * * @name extensible * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('extensible', function() { var obj = flag(this, 'object'); @@ -3815,9 +3800,8 @@ Assertion.addProperty('extensible', function() { * * @name sealed * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('sealed', function() { var obj = flag(this, 'object'); @@ -3857,9 +3841,8 @@ Assertion.addProperty('sealed', function() { * * @name frozen * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('frozen', function() { var obj = flag(this, 'object'); @@ -3923,9 +3906,8 @@ Assertion.addProperty('frozen', function() { * * @name finite * @namespace BDD - * @api public + * @public */ - Assertion.addProperty('finite', function(msg) { var obj = flag(this, 'object'); diff --git a/lib/chai/interface/assert.js b/lib/chai/interface/assert.js index 2d9fd9a3..c31784f0 100644 --- a/lib/chai/interface/assert.js +++ b/lib/chai/interface/assert.js @@ -17,13 +17,13 @@ import {AssertionError} from 'assertion-error'; * assert('foo' !== 'bar', 'foo is not bar'); * assert(Array.isArray([]), 'empty arrays are arrays'); * - * @param {unknown} expression to test for truthiness - * @param {String} message to display on error + * @param {unknown} express - expression to test for truthiness + * @param {string} errmsg - message to display on error * @name assert * @namespace Assert * @public */ -function assert(express, errmsg) { +export function assert(express, errmsg) { var test = new Assertion(null, null, chai.assert, true); test.assert( express @@ -32,8 +32,6 @@ function assert(express, errmsg) { ); } -export {assert}; - /** * ### .fail([message]) * ### .fail(actual, expected, [message], [operator]) @@ -50,8 +48,8 @@ export {assert}; * @name fail * @param {unknown} actual * @param {unknown} expected - * @param {String} message - * @param {String} operator + * @param {string} message + * @param {string} operator * @namespace Assert * @public */ @@ -81,8 +79,8 @@ assert.fail = function (actual, expected, message, operator) { * * @name isOk * @alias ok - * @param {unknown} object to test - * @param {String} message + * @param {unknown} val object to test + * @param {string} msg * @namespace Assert * @public */ @@ -100,8 +98,8 @@ assert.isOk = function (val, msg) { * * @name isNotOk * @alias notOk - * @param {unknown} object to test - * @param {String} message + * @param {unknown} val object to test + * @param {string} msg * @namespace Assert * @public */ @@ -117,9 +115,9 @@ assert.isNotOk = function (val, msg) { * assert.equal(3, '3', '== coerces values to strings'); * * @name equal - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @namespace Assert * @public */ @@ -144,9 +142,9 @@ assert.equal = function (act, exp, msg) { * assert.notEqual(3, 4, 'these numbers are not equal'); * * @name notEqual - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @namespace Assert * @public */ @@ -171,9 +169,9 @@ assert.notEqual = function (act, exp, msg) { * assert.strictEqual(true, true, 'these booleans are strictly equal'); * * @name strictEqual - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @namespace Assert * @public */ @@ -189,9 +187,9 @@ assert.strictEqual = function (act, exp, msg) { * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); * * @name notStrictEqual - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @namespace Assert * @public */ @@ -207,9 +205,9 @@ assert.notStrictEqual = function (act, exp, msg) { * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); * * @name deepEqual - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @alias deepStrictEqual * @namespace Assert * @public @@ -226,9 +224,9 @@ assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) { * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); * * @name notDeepEqual - * @param {unknown} actual - * @param {unknown} expected - * @param {String} message + * @param {unknown} act + * @param {unknown} exp + * @param {string} msg * @namespace Assert * @public */ @@ -236,7 +234,7 @@ assert.notDeepEqual = function (act, exp, msg) { new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); }; - /** +/** * ### .isAbove(valueToCheck, valueToBeAbove, [message]) * * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`. @@ -244,9 +242,9 @@ assert.notDeepEqual = function (act, exp, msg) { * assert.isAbove(5, 2, '5 is strictly greater than 2'); * * @name isAbove - * @param {unknown} valueToCheck - * @param {unknown} valueToBeAbove - * @param {String} message + * @param {unknown} val + * @param {unknown} abv + * @param {string} msg * @namespace Assert * @public */ @@ -254,7 +252,7 @@ assert.isAbove = function (val, abv, msg) { new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); }; - /** +/** * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message]) * * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`. @@ -263,9 +261,9 @@ assert.isAbove = function (val, abv, msg) { * assert.isAtLeast(3, 3, '3 is greater or equal to 3'); * * @name isAtLeast - * @param {unknown} valueToCheck - * @param {unknown} valueToBeAtLeast - * @param {String} message + * @param {unknown} val + * @param {unknown} atlst + * @param {string} msg * @namespace Assert * @public */ @@ -273,7 +271,7 @@ assert.isAtLeast = function (val, atlst, msg) { new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); }; - /** +/** * ### .isBelow(valueToCheck, valueToBeBelow, [message]) * * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`. @@ -281,9 +279,9 @@ assert.isAtLeast = function (val, atlst, msg) { * assert.isBelow(3, 6, '3 is strictly less than 6'); * * @name isBelow - * @param {unknown} valueToCheck - * @param {unknown} valueToBeBelow - * @param {String} message + * @param {unknown} val + * @param {unknown} blw + * @param {string} msg * @namespace Assert * @public */ @@ -291,7 +289,7 @@ assert.isBelow = function (val, blw, msg) { new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); }; - /** +/** * ### .isAtMost(valueToCheck, valueToBeAtMost, [message]) * * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`. @@ -300,9 +298,9 @@ assert.isBelow = function (val, blw, msg) { * assert.isAtMost(4, 4, '4 is less than or equal to 4'); * * @name isAtMost - * @param {unknown} valueToCheck - * @param {unknown} valueToBeAtMost - * @param {String} message + * @param {unknown} val + * @param {unknown} atmst + * @param {string} msg * @namespace Assert * @public */ @@ -319,8 +317,8 @@ assert.isAtMost = function (val, atmst, msg) { * assert.isTrue(teaServed, 'the tea has been served'); * * @name isTrue - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -337,8 +335,8 @@ assert.isTrue = function (val, msg) { * assert.isNotTrue(tea, 'great, time for tea!'); * * @name isNotTrue - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -355,8 +353,8 @@ assert.isNotTrue = function (val, msg) { * assert.isFalse(teaServed, 'no tea yet? hmm...'); * * @name isFalse - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -373,8 +371,8 @@ assert.isFalse = function (val, msg) { * assert.isNotFalse(tea, 'great, time for tea!'); * * @name isNotFalse - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -390,8 +388,8 @@ assert.isNotFalse = function (val, msg) { * assert.isNull(err, 'there was no error'); * * @name isNull - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -408,8 +406,8 @@ assert.isNull = function (val, msg) { * assert.isNotNull(tea, 'great, time for tea!'); * * @name isNotNull - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -425,8 +423,8 @@ assert.isNotNull = function (val, msg) { * assert.isNaN(NaN, 'NaN is NaN'); * * @name isNaN - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -443,11 +441,12 @@ assert.isNaN = function (val, msg) { * * @name isNotNaN * @param {unknown} value - * @param {String} message + * @param {string} message * @namespace Assert * @public - */assert.isNotNaN = function (val, msg) { - new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN; + */ +assert.isNotNaN = function (value, message) { + new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN; }; /** @@ -456,12 +455,11 @@ assert.isNaN = function (val, msg) { * Asserts that the target is neither `null` nor `undefined`. * * var foo = 'hi'; - * * assert.exists(foo, 'foo is neither `null` nor `undefined`'); * * @name exists - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -475,14 +473,14 @@ assert.exists = function (val, msg) { * Asserts that the target is either `null` or `undefined`. * * var bar = null - * , baz; + * , baz; * * assert.notExists(bar); * assert.notExists(baz, 'baz is either null or undefined'); * * @name notExists - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -499,8 +497,8 @@ assert.notExists = function (val, msg) { * assert.isUndefined(tea, 'no tea defined'); * * @name isUndefined - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -517,8 +515,8 @@ assert.isUndefined = function (val, msg) { * assert.isDefined(tea, 'tea has been defined'); * * @name isDefined - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -536,11 +534,12 @@ assert.isDefined = function (val, msg) { * * @name isCallable * @param {unknown} value - * @param {String} message + * @param {string} message * @namespace Assert * @public - */assert.isCallable = function (val, msg) { - new Assertion(val, msg, assert.isCallable, true).is.callable; + */ +assert.isCallable = function (value, message) { + new Assertion(value, message, assert.isCallable, true).is.callable; } /** @@ -553,11 +552,12 @@ assert.isDefined = function (val, msg) { * * @name isNotCallable * @param {unknown} value - * @param {String} message + * @param {string} message * @namespace Assert * @public - */assert.isNotCallable = function (val, msg) { - new Assertion(val, msg, assert.isNotCallable, true).is.not.callable; + */ +assert.isNotCallable = function (value, message) { + new Assertion(value, message, assert.isNotCallable, true).is.not.callable; }; /** @@ -570,8 +570,8 @@ assert.isDefined = function (val, msg) { * assert.isObject(selection, 'tea selection is an object'); * * @name isObject - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -589,8 +589,8 @@ assert.isObject = function (val, msg) { * assert.isNotObject(null, 'null is not an object'); * * @name isNotObject - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -607,8 +607,8 @@ assert.isNotObject = function (val, msg) { * assert.isArray(menu, 'what kind of tea do we want?'); * * @name isArray - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -625,8 +625,8 @@ assert.isArray = function (val, msg) { * assert.isNotArray(menu, 'what kind of tea do we want?'); * * @name isNotArray - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -643,8 +643,8 @@ assert.isNotArray = function (val, msg) { * assert.isString(teaOrder, 'order placed'); * * @name isString - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -661,8 +661,8 @@ assert.isString = function (val, msg) { * assert.isNotString(teaOrder, 'order placed'); * * @name isNotString - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -679,8 +679,8 @@ assert.isNotString = function (val, msg) { * assert.isNumber(cups, 'how many cups'); * * @name isNumber - * @param {Number} value - * @param {String} message + * @param {number} val + * @param {string} msg * @namespace Assert * @public */ @@ -697,8 +697,8 @@ assert.isNumber = function (val, msg) { * assert.isNotNumber(cups, 'how many cups'); * * @name isNotNumber - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -707,21 +707,20 @@ assert.isNotNumber = function (val, msg) { }; /** - * ### .isFinite(value, [message]) - * - * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. - * - * var cups = 2; - * assert.isFinite(cups, 'how many cups'); - * - * assert.isFinite(NaN); // throws - * - * @name isFinite - * @param {Number} value - * @param {String} message - * @namespace Assert - * @public - */ + * ### .isFinite(value, [message]) + * + * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. + * + * var cups = 2; + * assert.isFinite(cups, 'how many cups'); + * assert.isFinite(NaN); // throws + * + * @name isFinite + * @param {number} val + * @param {string} msg + * @namespace Assert + * @public + */ assert.isFinite = function (val, msg) { new Assertion(val, msg, assert.isFinite, true).to.be.finite; }; @@ -732,14 +731,14 @@ assert.isFinite = function (val, msg) { * Asserts that `value` is a boolean. * * var teaReady = true - * , teaServed = false; + * , teaServed = false; * * assert.isBoolean(teaReady, 'is the tea ready'); * assert.isBoolean(teaServed, 'has tea been served'); * * @name isBoolean - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -753,14 +752,14 @@ assert.isBoolean = function (val, msg) { * Asserts that `value` is _not_ a boolean. * * var teaReady = 'yep' - * , teaServed = 'nope'; + * , teaServed = 'nope'; * * assert.isNotBoolean(teaReady, 'is the tea ready'); * assert.isNotBoolean(teaServed, 'has tea been served'); * * @name isNotBoolean - * @param {unknown} value - * @param {String} message + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -782,9 +781,9 @@ assert.isNotBoolean = function (val, msg) { * assert.typeOf(undefined, 'undefined', 'we have an undefined'); * * @name typeOf - * @param {unknown} value - * @param {String} name - * @param {String} message + * @param {unknown} val + * @param {string} type + * @param {string} msg * @namespace Assert * @public */ @@ -802,13 +801,13 @@ assert.typeOf = function (val, type, msg) { * * @name notTypeOf * @param {unknown} value - * @param {String} typeof name - * @param {String} message + * @param {string} type + * @param {string} message * @namespace Assert * @public */ -assert.notTypeOf = function (val, type, msg) { - new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type); +assert.notTypeOf = function (value, type, message) { + new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type); }; /** @@ -817,14 +816,14 @@ assert.notTypeOf = function (val, type, msg) { * Asserts that `value` is an instance of `constructor`. * * var Tea = function (name) { this.name = name; } - * , chai = new Tea('chai'); + * , chai = new Tea('chai'); * * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); * * @name instanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message + * @param {object} val + * @param {object} type + * @param {string} msg * @namespace Assert * @public */ @@ -838,14 +837,14 @@ assert.instanceOf = function (val, type, msg) { * Asserts `value` is not an instance of `constructor`. * * var Tea = function (name) { this.name = name; } - * , chai = new String('chai'); + * , chai = new String('chai'); * * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); * * @name notInstanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message + * @param {object} val + * @param {object} type + * @param {string} msg * @namespace Assert * @public */ @@ -872,15 +871,15 @@ assert.notInstanceOf = function (val, type, msg) { * and strictly equal to the given property value. For instance: * * var obj1 = {a: 1} - * , obj2 = {b: 2}; + * , obj2 = {b: 2}; * assert.include([obj1, obj2], obj1); * assert.include({foo: obj1, bar: obj2}, {foo: obj1}); * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2}); * * @name include - * @param {Array|String} haystack - * @param {unknown} needle - * @param {String} message + * @param {Array | string} exp + * @param {unknown} inc + * @param {string} msg * @namespace Assert * @public */ @@ -907,15 +906,15 @@ assert.include = function (exp, inc, msg) { * property value. For instance: * * var obj1 = {a: 1} - * , obj2 = {b: 2}; + * , obj2 = {b: 2}; * assert.notInclude([obj1, obj2], {a: 1}); * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}}); * * @name notInclude - * @param {Array|String} haystack - * @param {unknown} needle - * @param {String} message + * @param {Array | string} exp + * @param {unknown} inc + * @param {string} msg * @namespace Assert * @public */ @@ -931,15 +930,15 @@ assert.notInclude = function (exp, inc, msg) { * Deep equality is used. * * var obj1 = {a: 1} - * , obj2 = {b: 2}; + * , obj2 = {b: 2}; * assert.deepInclude([obj1, obj2], {a: 1}); * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}}); * * @name deepInclude - * @param {Array|String} haystack - * @param {unknown} needle - * @param {String} message + * @param {Array | string} exp + * @param {unknown} inc + * @param {string} msg * @namespace Assert * @public */ @@ -955,15 +954,15 @@ assert.deepInclude = function (exp, inc, msg) { * Deep equality is used. * * var obj1 = {a: 1} - * , obj2 = {b: 2}; + * , obj2 = {b: 2}; * assert.notDeepInclude([obj1, obj2], {a: 9}); * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}}); * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}}); * * @name notDeepInclude - * @param {Array|String} haystack - * @param {unknown} needle - * @param {String} message + * @param {Array | string} exp + * @param {unknown} inc + * @param {string} msg * @namespace Assert * @public */ @@ -985,9 +984,9 @@ assert.notDeepInclude = function (exp, inc, msg) { * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); * * @name nestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1009,9 +1008,9 @@ assert.nestedInclude = function (exp, inc, msg) { * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); * * @name notNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1034,9 +1033,9 @@ assert.notNestedInclude = function (exp, inc, msg) { * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); * * @name deepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1059,9 +1058,9 @@ assert.deepNestedInclude = function(exp, inc, msg) { * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); * * @name notDeepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1080,9 +1079,9 @@ assert.notDeepNestedInclude = function(exp, inc, msg) { * assert.ownInclude({ a: 1 }, { a: 1 }); * * @name ownInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1098,13 +1097,12 @@ assert.ownInclude = function(exp, inc, msg) { * object while ignoring inherited properties. * * Object.prototype.b = 2; - * * assert.notOwnInclude({ a: 1 }, { b: 2 }); * * @name notOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1119,12 +1117,12 @@ assert.notOwnInclude = function(exp, inc, msg) { * Can be used to assert the inclusion of a subset of properties in an * object while ignoring inherited properties and checking for deep equality. * - * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); + * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); * * @name deepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1133,19 +1131,19 @@ assert.deepOwnInclude = function(exp, inc, msg) { .deep.own.include(inc); }; - /** +/** * ### .notDeepOwnInclude(haystack, needle, [message]) * - * Asserts that 'haystack' does not include 'needle'. + * Asserts that 'haystack' includes 'needle'. * Can be used to assert the absence of a subset of properties in an * object while ignoring inherited properties and checking for deep equality. * - * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); + * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); * * @name notDeepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message + * @param {object} exp + * @param {object} inc + * @param {string} msg * @namespace Assert * @public */ @@ -1162,9 +1160,9 @@ assert.notDeepOwnInclude = function(exp, inc, msg) { * assert.match('foobar', /^foo/, 'regexp matches'); * * @name match - * @param {unknown} value - * @param {RegExp} regexp - * @param {String} message + * @param {unknown} exp + * @param {RegExp} re + * @param {string} msg * @namespace Assert * @public */ @@ -1180,9 +1178,9 @@ assert.match = function (exp, re, msg) { * assert.notMatch('foobar', /^foo/, 'regexp does not match'); * * @name notMatch - * @param {unknown} value - * @param {RegExp} regexp - * @param {String} message + * @param {unknown} exp + * @param {RegExp} re + * @param {string} msg * @namespace Assert * @public */ @@ -1200,9 +1198,9 @@ assert.notMatch = function (exp, re, msg) { * assert.property({ tea: { green: 'matcha' }}, 'toString'); * * @name property - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @namespace Assert * @public */ @@ -1219,9 +1217,9 @@ assert.property = function (obj, prop, msg) { * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); * * @name notProperty - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @namespace Assert * @public */ @@ -1240,10 +1238,10 @@ assert.notProperty = function (obj, prop, msg) { * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); * * @name propertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1263,10 +1261,10 @@ assert.propertyVal = function (obj, prop, val, msg) { * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good'); * * @name notPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1284,10 +1282,10 @@ assert.notPropertyVal = function (obj, prop, val, msg) { * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); * * @name deepPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1307,10 +1305,10 @@ assert.deepPropertyVal = function (obj, prop, val, msg) { * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); * * @name notDeepPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1328,9 +1326,9 @@ assert.notDeepPropertyVal = function (obj, prop, val, msg) { * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea'); * * @name ownProperty - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @public */ assert.ownProperty = function (obj, prop, msg) { @@ -1348,9 +1346,9 @@ assert.ownProperty = function (obj, prop, msg) { * assert.notOwnProperty({}, 'toString'); * * @name notOwnProperty - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @public */ assert.notOwnProperty = function (obj, prop, msg) { @@ -1368,10 +1366,10 @@ assert.notOwnProperty = function (obj, prop, msg) { * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good'); * * @name ownPropertyVal - * @param {Object} object - * @param {String} property + * @param {object} obj + * @param {string} prop * @param {unknown} value - * @param {String} message + * @param {string} msg * @public */ assert.ownPropertyVal = function (obj, prop, value, msg) { @@ -1390,10 +1388,10 @@ assert.ownPropertyVal = function (obj, prop, value, msg) { * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString); * * @name notOwnPropertyVal - * @param {Object} object - * @param {String} property + * @param {object} obj + * @param {string} prop * @param {unknown} value - * @param {String} message + * @param {string} msg * @public */ assert.notOwnPropertyVal = function (obj, prop, value, msg) { @@ -1411,10 +1409,10 @@ assert.notOwnPropertyVal = function (obj, prop, value, msg) { * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); * * @name deepOwnPropertyVal - * @param {Object} object - * @param {String} property + * @param {object} obj + * @param {string} prop * @param {unknown} value - * @param {String} message + * @param {string} msg * @public */ assert.deepOwnPropertyVal = function (obj, prop, value, msg) { @@ -1435,10 +1433,10 @@ assert.deepOwnPropertyVal = function (obj, prop, value, msg) { * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString); * * @name notDeepOwnPropertyVal - * @param {Object} object - * @param {String} property + * @param {object} obj + * @param {string} prop * @param {unknown} value - * @param {String} message + * @param {string} msg * @public */ assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) { @@ -1456,9 +1454,9 @@ assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) { * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green'); * * @name nestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @namespace Assert * @public */ @@ -1477,9 +1475,9 @@ assert.nestedProperty = function (obj, prop, msg) { * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); * * @name notNestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {string} msg * @namespace Assert * @public */ @@ -1498,10 +1496,10 @@ assert.notNestedProperty = function (obj, prop, msg) { * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); * * @name nestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1521,10 +1519,10 @@ assert.nestedPropertyVal = function (obj, prop, val, msg) { * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha'); * * @name notNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1543,10 +1541,10 @@ assert.notNestedPropertyVal = function (obj, prop, val, msg) { * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' }); * * @name deepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1567,10 +1565,10 @@ assert.deepNestedPropertyVal = function (obj, prop, val, msg) { * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' }); * * @name notDeepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {unknown} value - * @param {String} message + * @param {object} obj + * @param {string} prop + * @param {unknown} val + * @param {string} msg * @namespace Assert * @public */ @@ -1590,9 +1588,9 @@ assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) { * assert.lengthOf(new Map([['a',1],['b',2],['c',3]]), 3, 'map has size of 3'); * * @name lengthOf - * @param {unknown} object - * @param {Number} length - * @param {String} message + * @param {unknown} exp + * @param {number} len + * @param {string} msg * @namespace Assert * @public */ @@ -1613,9 +1611,9 @@ assert.lengthOf = function (exp, len, msg) { * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); * * @name hasAnyKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1636,9 +1634,9 @@ assert.hasAnyKeys = function (obj, keys, msg) { * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); * * @name hasAllKeys - * @param {unknown} object - * @param {String[]} keys - * @param {String} message + * @param {unknown} obj + * @param {string[]} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1663,9 +1661,9 @@ assert.hasAllKeys = function (obj, keys, msg) { * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); * * @name containsAllKeys - * @param {unknown} object - * @param {String[]} keys - * @param {String} message + * @param {unknown} obj + * @param {string[]} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1687,9 +1685,9 @@ assert.containsAllKeys = function (obj, keys, msg) { * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']); * * @name doesNotHaveAnyKeys - * @param {unknown} object - * @param {String[]} keys - * @param {String} message + * @param {unknown} obj + * @param {string[]} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1711,9 +1709,9 @@ assert.doesNotHaveAnyKeys = function (obj, keys, msg) { * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']); * * @name doesNotHaveAllKeys - * @param {unknown} object - * @param {String[]} keys - * @param {String} message + * @param {unknown} obj + * @param {string[]} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1739,9 +1737,9 @@ assert.doesNotHaveAllKeys = function (obj, keys, msg) { * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); * * @name hasAnyDeepKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1765,9 +1763,9 @@ assert.hasAnyDeepKeys = function (obj, keys, msg) { * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); * * @name hasAllDeepKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1791,9 +1789,9 @@ assert.hasAllDeepKeys = function (obj, keys, msg) { * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); * * @name containsAllDeepKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1817,9 +1815,9 @@ assert.containsAllDeepKeys = function (obj, keys, msg) { * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); * * @name doesNotHaveAnyDeepKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1843,9 +1841,9 @@ assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) { * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]); * * @name doesNotHaveAllDeepKeys - * @param {unknown} object - * @param {Array|Object} keys - * @param {String} message + * @param {unknown} obj + * @param {Array | object} keys + * @param {string} msg * @namespace Assert * @public */ @@ -1877,9 +1875,10 @@ assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) { * @alias throw * @alias Throw * @param {Function} fn - * @param {ErrorConstructor|Error} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message + * @param {Error} errorLike + * @param {RegExp | string} errMsgMatcher + * @param {string} msg + * @returns {unknown} * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types * @namespace Assert * @public @@ -1916,20 +1915,20 @@ assert.throws = function (fn, errorLike, errMsgMatcher, msg) { * * @name doesNotThrow * @param {Function} fn - * @param {ErrorConstructor} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message + * @param {Error} errorLike + * @param {RegExp | string} errMsgMatcher + * @param {string} message * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types * @namespace Assert * @public */ -assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) { +assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, message) { if ('string' === typeof errorLike || errorLike instanceof RegExp) { errMsgMatcher = errorLike; errorLike = null; } - new Assertion(fn, msg, assert.doesNotThrow, true) + new Assertion(fn, message, assert.doesNotThrow, true) .to.not.throw(errorLike, errMsgMatcher); }; @@ -1942,10 +1941,10 @@ assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) { * assert.operator(1, '>', 2, 'this will fail'); * * @name operator - * @param {unknown} val1 - * @param {String} operator + * @param {unknown} val + * @param {string} operator * @param {unknown} val2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -1999,10 +1998,10 @@ assert.operator = function (val, operator, val2, msg) { * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); * * @name closeTo - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message + * @param {number} act + * @param {number} exp + * @param {number} delta + * @param {string} msg * @namespace Assert * @public */ @@ -2018,10 +2017,10 @@ assert.closeTo = function (act, exp, delta, msg) { * assert.approximately(1.5, 1, 0.5, 'numbers are close'); * * @name approximately - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message + * @param {number} act + * @param {number} exp + * @param {number} delta + * @param {string} msg * @namespace Assert * @public */ @@ -2041,7 +2040,7 @@ assert.approximately = function (act, exp, delta, msg) { * @name sameMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2061,7 +2060,7 @@ assert.sameMembers = function (set1, set2, msg) { * @name notSameMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2081,7 +2080,7 @@ assert.notSameMembers = function (set1, set2, msg) { * @name sameDeepMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2101,7 +2100,7 @@ assert.sameDeepMembers = function (set1, set2, msg) { * @name notSameDeepMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2121,7 +2120,7 @@ assert.notSameDeepMembers = function (set1, set2, msg) { * @name sameOrderedMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2141,7 +2140,7 @@ assert.sameOrderedMembers = function (set1, set2, msg) { * @name notSameOrderedMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2161,7 +2160,7 @@ assert.notSameOrderedMembers = function (set1, set2, msg) { * @name sameDeepOrderedMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2182,7 +2181,7 @@ assert.sameDeepOrderedMembers = function (set1, set2, msg) { * @name notSameDeepOrderedMembers * @param {Array} set1 * @param {Array} set2 - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2202,7 +2201,7 @@ assert.notSameDeepOrderedMembers = function (set1, set2, msg) { * @name includeMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2222,7 +2221,7 @@ assert.includeMembers = function (superset, subset, msg) { * @name notIncludeMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2242,7 +2241,7 @@ assert.notIncludeMembers = function (superset, subset, msg) { * @name includeDeepMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2262,7 +2261,7 @@ assert.includeDeepMembers = function (superset, subset, msg) { * @name notIncludeDeepMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2283,7 +2282,7 @@ assert.notIncludeDeepMembers = function (superset, subset, msg) { * @name includeOrderedMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2305,7 +2304,7 @@ assert.includeOrderedMembers = function (superset, subset, msg) { * @name notIncludeOrderedMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2326,7 +2325,7 @@ assert.notIncludeOrderedMembers = function (superset, subset, msg) { * @name includeDeepOrderedMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2349,7 +2348,7 @@ assert.includeDeepOrderedMembers = function (superset, subset, msg) { * @name notIncludeDeepOrderedMembers * @param {Array} superset * @param {Array} subset - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2368,7 +2367,7 @@ assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) { * @name oneOf * @param {*} inList * @param {Array<*>} list - * @param {String} message + * @param {string} msg * @namespace Assert * @public */ @@ -2387,7 +2386,7 @@ assert.oneOf = function (inList, list, msg) { * @param {unknown} obj * @param {string} [msg] * @namespace Assert - * @api public + * @public */ assert.isIterable = function(obj, msg) { if (obj == undefined || !obj[Symbol.iterator]) { @@ -2413,10 +2412,10 @@ assert.isIterable = function(obj, msg) { * assert.changes(fn, obj, 'val'); * * @name changes - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2429,7 +2428,7 @@ assert.changes = function (fn, obj, prop, msg) { new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); } - /** +/** * ### .changesBy(function, object, property, delta, [message]) * * Asserts that a function changes the value of a property by an amount (delta). @@ -2439,11 +2438,11 @@ assert.changes = function (fn, obj, prop, msg) { * assert.changesBy(fn, obj, 'val', 2); * * @name changesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {number} delta msg change amount (delta) + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2461,20 +2460,21 @@ assert.changesBy = function (fn, obj, prop, delta, msg) { .to.change(obj, prop).by(delta); } - /** +/** * ### .doesNotChange(function, object, property, [message]) * * Asserts that a function does not change the value of a property. * - * var obj = { val: 10 }; - * var fn = function() { console.log('foo'); }; - * assert.doesNotChange(fn, obj, 'val'); + * var obj = { val: 10 }; + * var fn = function() { console.log('foo'); }; + * assert.doesNotChange(fn, obj, 'val'); * * @name doesNotChange - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {string} msg _optional_ + * @returns {unknown} * @namespace Assert * @public */ @@ -2498,11 +2498,11 @@ assert.doesNotChange = function (fn, obj, prop, msg) { * assert.changesButNotBy(fn, obj, 'val', 5); * * @name changesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn - modifier function + * @param {object} obj - object or getter function + * @param {string} prop - property name _optional_ + * @param {number} delta - change amount (delta) + * @param {string} msg - message _optional_ * @namespace Assert * @public */ @@ -2529,13 +2529,14 @@ assert.changesButNotBy = function (fn, obj, prop, delta, msg) { * var fn = function() { obj.val = 13 }; * assert.increases(fn, obj, 'val'); * - * @name increases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert * @public + * @namespace Assert + * @name increases + * @param {Function} fn - modifier function + * @param {object} obj - object or getter function + * @param {string} prop - property name _optional_ + * @param {string} msg - message _optional_ + * @returns {unknown} */ assert.increases = function (fn, obj, prop, msg) { if (arguments.length === 3 && typeof obj === 'function') { @@ -2556,14 +2557,14 @@ assert.increases = function (fn, obj, prop, msg) { * var fn = function() { obj.val += 10 }; * assert.increasesBy(fn, obj, 'val', 10); * + * @public * @name increasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ * @namespace Assert - * @public + * @param {Function} fn - modifier function + * @param {object} obj - object or getter function + * @param {string} prop - property name _optional_ + * @param {number} delta - change amount (delta) + * @param {string} msg - message _optional_ */ assert.increasesBy = function (fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === 'function') { @@ -2589,10 +2590,11 @@ assert.increasesBy = function (fn, obj, prop, delta, msg) { * assert.doesNotIncrease(fn, obj, 'val'); * * @name doesNotIncrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @returns {Assertion} + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2616,11 +2618,11 @@ assert.doesNotIncrease = function (fn, obj, prop, msg) { * assert.increasesButNotBy(fn, obj, 'val', 10); * * @name increasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {number} delta change amount (delta) + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2648,10 +2650,11 @@ assert.increasesButNotBy = function (fn, obj, prop, delta, msg) { * assert.decreases(fn, obj, 'val'); * * @name decreases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @returns {Assertion} + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2675,11 +2678,11 @@ assert.decreases = function (fn, obj, prop, msg) { * assert.decreasesBy(fn, obj, 'val', 5); * * @name decreasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {number} delta change amount (delta) + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2707,10 +2710,11 @@ assert.decreasesBy = function (fn, obj, prop, delta, msg) { * assert.doesNotDecrease(fn, obj, 'val'); * * @name doesNotDecrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @returns {Assertion} + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2734,11 +2738,12 @@ assert.doesNotDecrease = function (fn, obj, prop, msg) { * assert.doesNotDecreaseBy(fn, obj, 'val', 1); * * @name doesNotDecreaseBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {number} delta change amount (delta) + * @returns {Assertion} + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2766,11 +2771,11 @@ assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) { * assert.decreasesButNotBy(fn, obj, 'val', 1); * * @name decreasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ + * @param {Function} fn modifier function + * @param {object} obj object or getter function + * @param {string} prop property name _optional_ + * @param {number} delta change amount (delta) + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2799,7 +2804,7 @@ assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) { * assert.ifError(err); // Rethrows err! * * @name ifError - * @param {Object} object + * @param {object} val * @namespace Assert * @public */ @@ -2818,8 +2823,8 @@ assert.ifError = function (val) { * * @name isExtensible * @alias extensible - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2842,8 +2847,8 @@ assert.isExtensible = function (obj, msg) { * * @name isNotExtensible * @alias notExtensible - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2865,8 +2870,8 @@ assert.isNotExtensible = function (obj, msg) { * * @name isSealed * @alias sealed - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2883,8 +2888,8 @@ assert.isSealed = function (obj, msg) { * * @name isNotSealed * @alias notSealed - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2903,8 +2908,8 @@ assert.isNotSealed = function (obj, msg) { * * @name isFrozen * @alias frozen - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2921,8 +2926,8 @@ assert.isFrozen = function (obj, msg) { * * @name isNotFrozen * @alias notFrozen - * @param {Object} object - * @param {String} message _optional_ + * @param {object} obj + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2946,8 +2951,8 @@ assert.isNotFrozen = function (obj, msg) { * * @name isEmpty * @alias empty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ + * @param {object | Array | string | Map | Set} val + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2971,8 +2976,8 @@ assert.isEmpty = function(val, msg) { * * @name isNotEmpty * @alias notEmpty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ + * @param {object | Array | string | Map | Set} val + * @param {string} msg _optional_ * @namespace Assert * @public */ @@ -2982,6 +2987,10 @@ assert.isNotEmpty = function(val, msg) { /** * Aliases. + * + * @param {unknown} name + * @param {unknown} as + * @returns {unknown} */ (function alias(name, as){ assert[as] = assert[name]; diff --git a/lib/chai/interface/expect.js b/lib/chai/interface/expect.js index 286044a1..fbaabf84 100644 --- a/lib/chai/interface/expect.js +++ b/lib/chai/interface/expect.js @@ -8,6 +8,11 @@ import * as chai from '../../../index.js'; import {Assertion} from '../assertion.js'; import {AssertionError} from 'assertion-error'; +/** + * @param {unknown} val + * @param {string} message + * @returns {Assertion} + */ function expect(val, message) { return new Assertion(val, message); } @@ -30,8 +35,8 @@ export {expect}; * @name fail * @param {unknown} actual * @param {unknown} expected - * @param {String} message - * @param {String} operator + * @param {string} message + * @param {string} operator * @namespace expect * @public */ diff --git a/lib/chai/interface/should.js b/lib/chai/interface/should.js index 3a2c235d..0efef3c6 100644 --- a/lib/chai/interface/should.js +++ b/lib/chai/interface/should.js @@ -7,8 +7,14 @@ import {Assertion} from '../assertion.js'; import {AssertionError} from 'assertion-error'; +/** + * @returns {void} + */ function loadShould () { // explicitly define this method as function as to have it's name to include as `ssfi` + /** + * @returns {Assertion} + */ function shouldGetter() { if (this instanceof String || this instanceof Number @@ -19,6 +25,9 @@ function loadShould () { } return new Assertion(this, null, shouldGetter); } + /** + * @param {unknown} value + */ function shouldSetter(value) { // See https://github.com/chaijs/chai/issues/86: this makes // `whatever.should = someValue` actually set `someValue`, which is @@ -55,12 +64,11 @@ function loadShould () { * should.fail(1, 2, "custom error message", ">"); * should.fail(1, 2, undefined, ">"); * - * * @name fail * @param {unknown} actual * @param {unknown} expected - * @param {String} message - * @param {String} operator + * @param {string} message + * @param {string} operator * @namespace BDD * @public */ @@ -88,12 +96,12 @@ function loadShould () { * @name equal * @param {unknown} actual * @param {unknown} expected - * @param {String} message + * @param {string} message * @namespace Should * @public */ - should.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.equal(val2); + should.equal = function (actual, expected, message) { + new Assertion(actual, message).to.equal(expected); }; /** @@ -111,10 +119,10 @@ function loadShould () { * * @name throw * @alias Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message + * @param {Function} fn + * @param {Error} errt + * @param {RegExp} errs + * @param {string} msg * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types * @namespace Should * @public @@ -129,9 +137,10 @@ function loadShould () { * Asserts that the target is neither `null` nor `undefined`. * * var foo = 'hi'; - * * should.exist(foo, 'foo exists'); * + * @param {unknown} val + * @param {string} msg * @name exist * @namespace Should * @public @@ -153,12 +162,12 @@ function loadShould () { * @name not.equal * @param {unknown} actual * @param {unknown} expected - * @param {String} message + * @param {string} msg * @namespace Should * @public */ - should.not.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.not.equal(val2); + should.not.equal = function (actual, expected, msg) { + new Assertion(actual, msg).to.not.equal(expected); }; /** @@ -172,10 +181,10 @@ function loadShould () { * * @name not.throw * @alias not.Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message + * @param {Function} fn + * @param {Error} errt + * @param {RegExp} errs + * @param {string} msg * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types * @namespace Should * @public @@ -190,11 +199,12 @@ function loadShould () { * Asserts that the target is neither `null` nor `undefined`. * * var bar = null; - * * should.not.exist(bar, 'bar does not exist'); * - * @name not.exist * @namespace Should + * @name not.exist + * @param {unknown} val + * @param {string} msg * @public */ should.not.exist = function (val, msg) { diff --git a/lib/chai/utils/addChainableMethod.js b/lib/chai/utils/addChainableMethod.js index 2205b5ea..8de2b21a 100644 --- a/lib/chai/utils/addChainableMethod.js +++ b/lib/chai/utils/addChainableMethod.js @@ -43,8 +43,8 @@ var call = Function.prototype.call, * Adds a method to an object, such that the method can also be chained. * * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); + * var obj = utils.flag(this, 'object'); + * new chai.Assertion(obj).to.be.equal(str); * }); * * Can also be accessed directly from `chai.Assertion`. @@ -57,15 +57,14 @@ var call = Function.prototype.call, * expect(fooStr).to.be.foo('bar'); * expect(fooStr).to.be.foo.equal('foo'); * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add + * @param {object} ctx object to which the method is added + * @param {string} name of method to add * @param {Function} method function to be used for `name`, when called * @param {Function} chainingBehavior function to be called every time the property is accessed * @namespace Utils * @name addChainableMethod - * @api public + * @public */ - export function addChainableMethod(ctx, name, method, chainingBehavior) { if (typeof chainingBehavior !== 'function') { chainingBehavior = function () { }; diff --git a/lib/chai/utils/addLengthGuard.js b/lib/chai/utils/addLengthGuard.js index 630b64ae..621d7400 100644 --- a/lib/chai/utils/addLengthGuard.js +++ b/lib/chai/utils/addLengthGuard.js @@ -34,12 +34,12 @@ const fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); * environments is the priority. * * @param {Function} fn - * @param {String} assertionName - * @param {Boolean} isChainable + * @param {string} assertionName + * @param {boolean} isChainable + * @returns {unknown} * @namespace Utils * @name addLengthGuard */ - export function addLengthGuard(fn, assertionName, isChainable) { if (!fnLengthDesc.configurable) return fn; diff --git a/lib/chai/utils/addMethod.js b/lib/chai/utils/addMethod.js index 02fc7bdb..90b9546c 100644 --- a/lib/chai/utils/addMethod.js +++ b/lib/chai/utils/addMethod.js @@ -16,8 +16,8 @@ import {Assertion} from '../assertion.js'; * Adds a method to the prototype of an object. * * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); + * var obj = utils.flag(this, 'object'); + * new chai.Assertion(obj).to.be.equal(str); * }); * * Can also be accessed directly from `chai.Assertion`. @@ -28,14 +28,13 @@ import {Assertion} from '../assertion.js'; * * expect(fooStr).to.be.foo('bar'); * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add + * @param {object} ctx object to which the method is added + * @param {string} name of method to add * @param {Function} method function to be used for name * @namespace Utils * @name addMethod - * @api public + * @public */ - export function addMethod(ctx, name, method) { var methodWrapper = function () { // Setting the `ssfi` flag to `methodWrapper` causes this function to be the diff --git a/lib/chai/utils/addProperty.js b/lib/chai/utils/addProperty.js index 7bdfb520..fa59d23e 100644 --- a/lib/chai/utils/addProperty.js +++ b/lib/chai/utils/addProperty.js @@ -15,8 +15,8 @@ import {transferFlags} from './transferFlags.js'; * Adds a property to the prototype of an object. * * utils.addProperty(chai.Assertion.prototype, 'foo', function () { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.instanceof(Foo); + * var obj = utils.flag(this, 'object'); + * new chai.Assertion(obj).to.be.instanceof(Foo); * }); * * Can also be accessed directly from `chai.Assertion`. @@ -27,14 +27,13 @@ import {transferFlags} from './transferFlags.js'; * * expect(myFoo).to.be.foo; * - * @param {Object} ctx object to which the property is added - * @param {String} name of property to add + * @param {object} ctx object to which the property is added + * @param {string} name of property to add * @param {Function} getter function to be used for name * @namespace Utils * @name addProperty - * @api public + * @public */ - export function addProperty(ctx, name, getter) { getter = getter === undefined ? function () {} : getter; diff --git a/lib/chai/utils/compareByInspect.js b/lib/chai/utils/compareByInspect.js index 829de728..5ab27a20 100644 --- a/lib/chai/utils/compareByInspect.js +++ b/lib/chai/utils/compareByInspect.js @@ -14,14 +14,13 @@ import {inspect} from './inspect.js'; * and objects with irregular/missing toString can still be sorted without a * TypeError. * - * @param {Mixed} first element to compare - * @param {Mixed} second element to compare - * @returns {Number} -1 if 'a' should come before 'b'; otherwise 1 + * @param {unknown} a first element to compare + * @param {unknown} b second element to compare + * @returns {number} -1 if 'a' should come before 'b'; otherwise 1 * @name compareByInspect * @namespace Utils - * @api public + * @public */ - export function compareByInspect(a, b) { return inspect(a) < inspect(b) ? -1 : 1; } diff --git a/lib/chai/utils/expectTypes.js b/lib/chai/utils/expectTypes.js index 4a80d06a..4f99532f 100644 --- a/lib/chai/utils/expectTypes.js +++ b/lib/chai/utils/expectTypes.js @@ -4,6 +4,10 @@ * MIT Licensed */ +import {AssertionError} from 'assertion-error'; +import {flag} from './flag.js'; +import {type} from './type-detect.js'; + /** * ### .expectTypes(obj, types) * @@ -11,17 +15,12 @@ * * utils.expectTypes(this, ['array', 'object', 'string']); * - * @param {Mixed} obj constructed Assertion - * @param {Array} type A list of allowed types for this assertion + * @param {unknown} obj constructed Assertion + * @param {Array} types A list of allowed types for this assertion * @namespace Utils * @name expectTypes - * @api public + * @public */ - -import {AssertionError} from 'assertion-error'; -import {flag} from './flag.js'; -import {type} from './type-detect.js'; - export function expectTypes(obj, types) { var flagMsg = flag(obj, 'message'); var ssfi = flag(obj, 'ssfi'); diff --git a/lib/chai/utils/flag.js b/lib/chai/utils/flag.js index 79637ad3..89434b71 100644 --- a/lib/chai/utils/flag.js +++ b/lib/chai/utils/flag.js @@ -15,14 +15,14 @@ * utils.flag(this, 'foo', 'bar'); // setter * utils.flag(this, 'foo'); // getter, returns `bar` * - * @param {Object} object constructed Assertion - * @param {String} key - * @param {Mixed} value (optional) + * @param {object} obj object constructed Assertion + * @param {string} key + * @param {unknown} value (optional) * @namespace Utils * @name flag - * @api private + * @returns {unknown | undefined} + * @private */ - export function flag(obj, key, value) { var flags = obj.__flags || (obj.__flags = Object.create(null)); if (arguments.length === 3) { diff --git a/lib/chai/utils/getActual.js b/lib/chai/utils/getActual.js index e9604679..1b4b3aa2 100644 --- a/lib/chai/utils/getActual.js +++ b/lib/chai/utils/getActual.js @@ -9,12 +9,12 @@ * * Returns the `actual` value for an Assertion. * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments + * @param {object} obj object (constructed Assertion) + * @param {unknown} args chai.Assertion.prototype.assert arguments + * @returns {unknown} * @namespace Utils * @name getActual */ - export function getActual(obj, args) { return args.length > 4 ? args[4] : obj._obj; } diff --git a/lib/chai/utils/getEnumerableProperties.js b/lib/chai/utils/getEnumerableProperties.js index a84252cf..46960524 100644 --- a/lib/chai/utils/getEnumerableProperties.js +++ b/lib/chai/utils/getEnumerableProperties.js @@ -10,13 +10,12 @@ * This allows the retrieval of enumerable property names of an object, * inherited or not. * - * @param {Object} object + * @param {object} object * @returns {Array} * @namespace Utils * @name getEnumerableProperties - * @api public + * @public */ - module.exports = function getEnumerableProperties(object) { var result = []; for (var name in object) { diff --git a/lib/chai/utils/getMessage.js b/lib/chai/utils/getMessage.js index 83e59974..b184c990 100644 --- a/lib/chai/utils/getMessage.js +++ b/lib/chai/utils/getMessage.js @@ -20,13 +20,13 @@ import {objDisplay} from './objDisplay.js'; * - `#{act}` actual value * - `#{exp}` expected value * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments + * @param {object} obj object (constructed Assertion) + * @param {unknown} args chai.Assertion.prototype.assert arguments + * @returns {unknown} * @namespace Utils * @name getMessage - * @api public + * @public */ - export function getMessage(obj, args) { var negate = flag(obj, 'negate') , val = flag(obj, 'object') diff --git a/lib/chai/utils/getOperator.js b/lib/chai/utils/getOperator.js index a2afa505..7a57d786 100644 --- a/lib/chai/utils/getOperator.js +++ b/lib/chai/utils/getOperator.js @@ -1,6 +1,10 @@ import {flag} from './flag.js'; import {type} from './type-detect.js'; +/** + * @param {unknown} obj + * @returns {boolean} + */ function isObjectType(obj) { var objectType = type(obj); var objectTypes = ['Array', 'Object', 'Function']; @@ -17,13 +21,13 @@ function isObjectType(obj) { * * Returns the `operator` or `undefined` value for an Assertion. * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments + * @param {object} obj object (constructed Assertion) + * @param {unknown} args chai.Assertion.prototype.assert arguments + * @returns {unknown} * @namespace Utils * @name getOperator - * @api public + * @public */ - export function getOperator(obj, args) { var operator = flag(obj, 'operator'); var negate = flag(obj, 'negate'); diff --git a/lib/chai/utils/getOwnEnumerableProperties.js b/lib/chai/utils/getOwnEnumerableProperties.js index ac69b502..9e8e830b 100644 --- a/lib/chai/utils/getOwnEnumerableProperties.js +++ b/lib/chai/utils/getOwnEnumerableProperties.js @@ -13,13 +13,12 @@ import {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols * symbols of an object. This function is necessary because Object.keys only * returns enumerable property names, not enumerable property symbols. * - * @param {Object} object + * @param {object} obj * @returns {Array} * @namespace Utils * @name getOwnEnumerableProperties - * @api public + * @public */ - export function getOwnEnumerableProperties(obj) { return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); } diff --git a/lib/chai/utils/getOwnEnumerablePropertySymbols.js b/lib/chai/utils/getOwnEnumerablePropertySymbols.js index 99571c64..d8d6d096 100644 --- a/lib/chai/utils/getOwnEnumerablePropertySymbols.js +++ b/lib/chai/utils/getOwnEnumerablePropertySymbols.js @@ -11,13 +11,12 @@ * object. This function is necessary because Object.getOwnPropertySymbols * returns both enumerable and non-enumerable property symbols. * - * @param {Object} object + * @param {object} obj * @returns {Array} * @namespace Utils * @name getOwnEnumerablePropertySymbols - * @api public + * @public */ - export function getOwnEnumerablePropertySymbols(obj) { if (typeof Object.getOwnPropertySymbols !== 'function') return []; diff --git a/lib/chai/utils/getProperties.js b/lib/chai/utils/getProperties.js index 99f40a44..b43c7104 100644 --- a/lib/chai/utils/getProperties.js +++ b/lib/chai/utils/getProperties.js @@ -10,16 +10,18 @@ * This allows the retrieval of property names of an object, enumerable or not, * inherited or not. * - * @param {Object} object + * @param {object} object * @returns {Array} * @namespace Utils * @name getProperties - * @api public + * @public */ - export function getProperties(object) { var result = Object.getOwnPropertyNames(object); + /** + * @param {unknown} property + */ function addProperty(property) { if (result.indexOf(property) === -1) { result.push(property); diff --git a/lib/chai/utils/index.js b/lib/chai/utils/index.js index 5f52828c..0602997a 100644 --- a/lib/chai/utils/index.js +++ b/lib/chai/utils/index.js @@ -40,7 +40,12 @@ export {default as eql} from 'deep-eql'; // Deep path info export {getPathInfo, hasProperty} from 'pathval'; -// Function name +/** + * Function name + * + * @param {Function} fn + * @returns {string} + */ export function getName(fn) { return fn.name } diff --git a/lib/chai/utils/inspect.js b/lib/chai/utils/inspect.js index 3100c1aa..dcd9ad79 100644 --- a/lib/chai/utils/inspect.js +++ b/lib/chai/utils/inspect.js @@ -10,12 +10,13 @@ import {config} from '../config.js'; * Echoes the value of a value. Tries to print the value out * in the best way possible given the different types. * - * @param {Object} obj The object to print out. - * @param {Boolean} showHidden Flag that shows hidden (not enumerable) + * @param {object} obj The object to print out. + * @param {boolean} showHidden Flag that shows hidden (not enumerable) * properties of objects. Default is false. - * @param {Number} depth Depth in which to descend in object. Default is 2. - * @param {Boolean} colors Flag to turn on ANSI escape codes to color the + * @param {number} depth Depth in which to descend in object. Default is 2. + * @param {boolean} colors Flag to turn on ANSI escape codes to color the * output. Default is false (no coloring). + * @returns {string} * @namespace Utils * @name inspect */ diff --git a/lib/chai/utils/isNaN.js b/lib/chai/utils/isNaN.js index 7b1e0f06..acc10d6f 100644 --- a/lib/chai/utils/isNaN.js +++ b/lib/chai/utils/isNaN.js @@ -11,11 +11,11 @@ * * utils.isNaN(NaN); // true * - * @param {Value} The value which has to be checked if it is NaN + * @param {unknown} value The value which has to be checked if it is NaN + * @returns {boolean} * @name isNaN - * @api private + * @private */ - function _isNaN(value) { // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number // section's NOTE. diff --git a/lib/chai/utils/isProxyEnabled.js b/lib/chai/utils/isProxyEnabled.js index 780c2a27..5b6b62aa 100644 --- a/lib/chai/utils/isProxyEnabled.js +++ b/lib/chai/utils/isProxyEnabled.js @@ -15,8 +15,8 @@ import {config} from '../config.js'; * * @namespace Utils * @name isProxyEnabled + * @returns {boolean} */ - export function isProxyEnabled() { return config.useProxy && typeof Proxy !== 'undefined' && diff --git a/lib/chai/utils/objDisplay.js b/lib/chai/utils/objDisplay.js index c04f12df..76f014a8 100644 --- a/lib/chai/utils/objDisplay.js +++ b/lib/chai/utils/objDisplay.js @@ -14,13 +14,12 @@ import {config} from '../config.js'; * criteria to be inspected in-line for error * messages or should be truncated. * - * @param {Mixed} javascript object to inspect + * @param {unknown} obj javascript object to inspect * @returns {string} stringified object * @name objDisplay * @namespace Utils - * @api public + * @public */ - export function objDisplay(obj) { var str = inspect(obj) , type = Object.prototype.toString.call(obj); diff --git a/lib/chai/utils/overwriteChainableMethod.js b/lib/chai/utils/overwriteChainableMethod.js index a7f3f6a1..68fc89f6 100644 --- a/lib/chai/utils/overwriteChainableMethod.js +++ b/lib/chai/utils/overwriteChainableMethod.js @@ -16,10 +16,10 @@ import {transferFlags} from './transferFlags.js'; * name. * * utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf', - * function (_super) { - * } - * , function (_super) { - * } + * function (_super) { + * } + * , function (_super) { + * } * ); * * Can also be accessed directly from `chai.Assertion`. @@ -31,15 +31,14 @@ import {transferFlags} from './transferFlags.js'; * expect(myFoo).to.have.lengthOf(3); * expect(myFoo).to.have.lengthOf.above(3); * - * @param {Object} ctx object whose method / property is to be overwritten - * @param {String} name of method / property to overwrite + * @param {object} ctx object whose method / property is to be overwritten + * @param {string} name of method / property to overwrite * @param {Function} method function that returns a function to be used for name * @param {Function} chainingBehavior function that returns a function to be used for property * @namespace Utils * @name overwriteChainableMethod - * @api public + * @public */ - export function overwriteChainableMethod(ctx, name, method, chainingBehavior) { var chainableBehavior = ctx.__methods[name]; diff --git a/lib/chai/utils/overwriteMethod.js b/lib/chai/utils/overwriteMethod.js index 17cb0d91..d101f3b0 100644 --- a/lib/chai/utils/overwriteMethod.js +++ b/lib/chai/utils/overwriteMethod.js @@ -18,14 +18,14 @@ import {transferFlags} from './transferFlags.js'; * to be used for name. * * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) { - * return function (str) { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.value).to.equal(str); - * } else { - * _super.apply(this, arguments); + * return function (str) { + * var obj = utils.flag(this, 'object'); + * if (obj instanceof Foo) { + * new chai.Assertion(obj.value).to.equal(str); + * } else { + * _super.apply(this, arguments); + * } * } - * } * }); * * Can also be accessed directly from `chai.Assertion`. @@ -36,14 +36,13 @@ import {transferFlags} from './transferFlags.js'; * * expect(myFoo).to.equal('bar'); * - * @param {Object} ctx object whose method is to be overwritten - * @param {String} name of method to overwrite + * @param {object} ctx object whose method is to be overwritten + * @param {string} name of method to overwrite * @param {Function} method function that returns a function to be used for name * @namespace Utils * @name overwriteMethod - * @api public + * @public */ - export function overwriteMethod(ctx, name, method) { var _method = ctx[name] , _super = function () { diff --git a/lib/chai/utils/overwriteProperty.js b/lib/chai/utils/overwriteProperty.js index defeee25..97f3486a 100644 --- a/lib/chai/utils/overwriteProperty.js +++ b/lib/chai/utils/overwriteProperty.js @@ -16,17 +16,16 @@ import {transferFlags} from './transferFlags.js'; * access to previous value. Must return function to use as getter. * * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) { - * return function () { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.name).to.equal('bar'); - * } else { - * _super.call(this); + * return function () { + * var obj = utils.flag(this, 'object'); + * if (obj instanceof Foo) { + * new chai.Assertion(obj.name).to.equal('bar'); + * } else { + * _super.call(this); + * } * } - * } * }); * - * * Can also be accessed directly from `chai.Assertion`. * * chai.Assertion.overwriteProperty('foo', fn); @@ -35,14 +34,13 @@ import {transferFlags} from './transferFlags.js'; * * expect(myFoo).to.be.ok; * - * @param {Object} ctx object whose property is to be overwritten - * @param {String} name of property to overwrite + * @param {object} ctx object whose property is to be overwritten + * @param {string} name of property to overwrite * @param {Function} getter function that returns a getter function to be used for name * @namespace Utils * @name overwriteProperty - * @api public + * @public */ - export function overwriteProperty(ctx, name, getter) { var _get = Object.getOwnPropertyDescriptor(ctx, name) , _super = function () {}; diff --git a/lib/chai/utils/proxify.js b/lib/chai/utils/proxify.js index ca1a2c2b..3789892f 100644 --- a/lib/chai/utils/proxify.js +++ b/lib/chai/utils/proxify.js @@ -9,6 +9,8 @@ import {isProxyEnabled} from './isProxyEnabled.js'; * MIT Licensed */ +const builtins = ['__flags', '__methods', '_obj', 'assert']; + /** * ### .proxify(object) * @@ -22,14 +24,12 @@ import {isProxyEnabled} from './isProxyEnabled.js'; * If proxies are unsupported or disabled via the user's Chai config, then * return object without modification. * - * @param {Object} obj - * @param {String} nonChainableMethodName + * @param {object} obj + * @param {string} nonChainableMethodName + * @returns {unknown} * @namespace Utils * @name proxify */ - -const builtins = ['__flags', '__methods', '_obj', 'assert']; - export function proxify(obj ,nonChainableMethodName) { if (!isProxyEnabled()) return obj; @@ -103,13 +103,13 @@ export function proxify(obj ,nonChainableMethodName) { /** * # stringDistanceCapped(strA, strB, cap) * Return the Levenshtein distance between two strings, but no more than cap. + * * @param {string} strA * @param {string} strB - * @param {number} number - * @return {number} min(string distance between strA and strB, cap) - * @api private + * @param {number} cap + * @returns {number} min(string distance between strA and strB, cap) + * @private */ - function stringDistanceCapped(strA, strB, cap) { if (Math.abs(strA.length - strB.length) >= cap) { return cap; diff --git a/lib/chai/utils/test.js b/lib/chai/utils/test.js index 5a400bdb..2fc98cec 100644 --- a/lib/chai/utils/test.js +++ b/lib/chai/utils/test.js @@ -11,12 +11,12 @@ import {flag} from './flag.js'; * * Test an object for expression. * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments + * @param {object} obj (constructed Assertion) + * @param {unknown} args + * @returns {unknown} * @namespace Utils * @name test */ - export function test(obj, args) { var negate = flag(obj, 'negate') , expr = args[0]; diff --git a/lib/chai/utils/transferFlags.js b/lib/chai/utils/transferFlags.js index a1a7d3ef..2669941c 100644 --- a/lib/chai/utils/transferFlags.js +++ b/lib/chai/utils/transferFlags.js @@ -12,21 +12,19 @@ * assertion flags (namely `object`, `ssfi`, `lockSsfi`, * and `message`) will not be transferred. * - * * var newAssertion = new Assertion(); * utils.transferFlags(assertion, newAssertion); * * var anotherAssertion = new Assertion(myObj); * utils.transferFlags(assertion, anotherAssertion, false); * - * @param {Assertion} assertion the assertion to transfer the flags from - * @param {Object} object the object to transfer the flags to; usually a new assertion - * @param {Boolean} includeAll + * @param {import('../assertion.js').Assertion} assertion the assertion to transfer the flags from + * @param {object} object the object to transfer the flags to; usually a new assertion + * @param {boolean} includeAll * @namespace Utils * @name transferFlags - * @api private + * @private */ - export function transferFlags(assertion, object, includeAll) { var flags = assertion.__flags || (assertion.__flags = Object.create(null)); diff --git a/lib/chai/utils/type-detect.js b/lib/chai/utils/type-detect.js index 5a86a6ab..995332b2 100644 --- a/lib/chai/utils/type-detect.js +++ b/lib/chai/utils/type-detect.js @@ -1,3 +1,7 @@ +/** + * @param {unknown} obj + * @returns {string} + */ export function type(obj) { if (typeof obj === 'undefined') { return 'undefined';