diff --git a/package-lock.json b/package-lock.json index 5f38f21..7e86357 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,11 +21,10 @@ "globals": "~17.11.0", "jsdoc": "~4.0.5", "rollup": "~4.62.5", - "tap-min": "~3.0.0", - "tape": "~5.10.2", "typedoc-plugin-markdown": "~4.12.0", "typescript": "~5.9.3", - "typescript-eslint": "~8.68.0" + "typescript-eslint": "~8.68.0", + "vitest": "~4.1.11" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -1907,58 +1906,146 @@ "node": ">=v12.0.0" } }, - "node_modules/@ljharb/now": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@ljharb/now/-/now-1.0.1.tgz", - "integrity": "sha512-yRQ3B8l2v4vTLQ2l+4kBu6EsXaX7czuLB7fvUz0vkHHziHje75R2t/0Mm/vIo31tlZVCEvCoXHkNKW+ugv3uSA==", + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 0.4" - }, + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.146.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.146.0.tgz", + "integrity": "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA==", + "dev": true, + "license": "MIT", "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/Boshen" } }, - "node_modules/@ljharb/resumer": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.1.3.tgz", - "integrity": "sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==", + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.5.tgz", + "integrity": "sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "@ljharb/through": "^2.3.13", - "call-bind": "^1.0.7" - }, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 0.4" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@ljharb/through": { - "version": "2.3.14", - "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.14.tgz", - "integrity": "sha512-ajBvlKpWucBB17FuQYUShqpqy8GRgYEpJW0vWJbUu1CV9lWyrDCapy0lScU8T8Z6qn49sSwJB3+M+evYIdGg+A==", + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.5.tgz", + "integrity": "sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 0.4" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@napi-rs/lzma-linux-x64-gnu": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", - "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.5.tgz", + "integrity": "sha512-dK4QakI42nzWgJT5sm4y4y/O//D4OxM75/cH28RLV+nzIN9AY+YsbuUVrUTjlLjXR6vpyxFbSsbmNuJ6BP9sww==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.5.tgz", + "integrity": "sha512-fqSALaUu1Wjd1nK2uW2kJDWdLCc8lx1IcY+MTY26Aurfdx19anlzhqXOgCFbBFQnlFDTn4TC1/7Nz4Bl2mLP3A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.5.tgz", + "integrity": "sha512-/vCnNxlkxs9tKxNDcyWUePpJ/PgTzxIaVhoM5SmG8UV+GR/IcPam4VYxi7GIMo7PSDuNqlJqvprqii9NqqVCMw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.5.tgz", + "integrity": "sha512-abk0NLA519LxRCszmbE0jYKuQ9YPocOXTiOXOo6Yr+YAT95VH+PtqYAjOJvGKt3viEd/x4qzabAlwd5bHOOARg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.5.tgz", + "integrity": "sha512-Y7eALiJ8lr0M2HH103Js+g7V34wf6snlpZLAsHI90uLhr3PVlNsbFVAXJC9d/V6BnPyKtpSwI+NcB/RLxsQxuA==", + "cpu": [ + "arm64" + ], + "dev": true, "libc": [ "glibc" ], @@ -1968,9 +2055,167 @@ "linux" ], "engines": { - "node": "^22.20 || ^24.12 || >=25" + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.5.tgz", + "integrity": "sha512-xMvZgnbZg4YVnR/AX2b3oOPDTFYJvUVaJg5FedA/LuvexAtXibZQej4cnTkw3rjsJ/ggUROB64TdtETiim+FYA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.5.tgz", + "integrity": "sha512-GRjeqTUDHTo5GwntsLaAMcBahG3nlpjftXWZLN73HiYQlhwEowvarFgQnRnQZtIp4keXX7quXFbG38uPZBa2EA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.5.tgz", + "integrity": "sha512-vLNTR45F2Uwc8AufkNXPmB4VliaXs+FvcheEogIzOXzO4l+LzieXF5A/TWxLy5HtqpsRCHUfd0lPVrrdgXdLHQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.5.tgz", + "integrity": "sha512-Mgj59/HTuYeK9Gz2MA+mBWKnHsAgkBSec15ZMb1st3oIfFbX7gCjOae7GydHhzcyQi9Z/7M1QuN9bR3oFqF0jQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.5.tgz", + "integrity": "sha512-mY8AP0/ichsbhAxGnLa3d3+MwV0EfgrPND2bplI3Ym8T6R2pJ0N87bvrKVwNXmdy3jnr6eQBecdqx/HMknBmpA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.5.tgz", + "integrity": "sha512-8SLssA2oweAxyRgDp789ACfRb/3P+zNRJpzZxSizxF9m8NUDQ4+3xjo8ttjhVGGw6Qxb70oZiEtIjaKikCO7Yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.5.tgz", + "integrity": "sha512-vGbruD5zquhoc8D9SViXgN2FBJtNdTyQ4DtG+SWiEGlJiAzoKcZ2xp+xuXCffhubVdt0NJlTZqkeRuERy7g8Cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.5.tgz", + "integrity": "sha512-e/SXpgISz+IoqVcSSI0rx/d/he8zqLex+/rCWpnHpmVfmPIUjag9H6P7zotf0gJHwPUhQxZ/mF8tr6acebT9yw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, "node_modules/@rollup/plugin-babel": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-7.1.0.tgz", @@ -2487,6 +2732,13 @@ "license": "MIT", "peer": true }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, "node_modules/@stylistic/eslint-plugin": { "version": "5.9.0", "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-5.9.0.tgz", @@ -2521,6 +2773,24 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -2888,153 +3158,183 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", + "node_modules/@vitest/expect": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", + "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", "dev": true, "license": "MIT", - "bin": { - "acorn": "bin/acorn" + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" }, - "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, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/ajv": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", - "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "node_modules/@vitest/mocker": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", + "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", "dev": true, "license": "MIT", "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" + "@vitest/spy": "4.1.11", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } }, - "node_modules/array-buffer-byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", - "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "node_modules/@vitest/pretty-format": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", + "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", "dev": true, "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "is-array-buffer": "^3.0.5" - }, - "engines": { - "node": ">= 0.4" + "tinyrainbow": "^3.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/vitest" } }, - "node_modules/array.prototype.every": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.7.tgz", - "integrity": "sha512-BIP72rKvrKd08ptbetLb4qvrlGjkv30yOKgKcTtOIbHyQt3shr/jyOzdApiCOh3LPYrpJo5M6i0zmVldOF2pUw==", + "node_modules/@vitest/runner": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", + "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", "dev": true, "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-object-atoms": "^1.0.0", - "is-string": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" + "@vitest/utils": "4.1.11", + "pathe": "^2.0.3" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/vitest" } }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", - "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "node_modules/@vitest/snapshot": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", + "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-shim-unscopables": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" + "@vitest/pretty-format": "4.1.11", + "@vitest/utils": "4.1.11", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/vitest" } }, - "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", - "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "node_modules/@vitest/spy": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", + "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", + "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", "dev": true, "license": "MIT", "dependencies": { - "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "is-array-buffer": "^3.0.4" - }, - "engines": { - "node": ">= 0.4" + "@vitest/pretty-format": "4.1.11", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/vitest" } }, - "node_modules/async-function": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", - "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "node_modules/acorn": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">= 0.4" + "node": ">=0.4.0" } }, - "node_modules/available-typed-arrays": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", - "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "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, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", "dev": true, + "license": "MIT", "dependencies": { - "possible-typed-array-names": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" + "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": { - "url": "https://github.com/sponsors/ljharb" + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" } }, "node_modules/babel-plugin-polyfill-corejs2": { @@ -3079,12 +3379,6 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, "node_modules/baseline-browser-mapping": { "version": "2.9.19", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz", @@ -3101,17 +3395,6 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", "dev": true }, - "node_modules/brace-expansion": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", - "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/browserslist": { "version": "4.28.1", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", @@ -3152,56 +3435,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/call-bind": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", - "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "get-intrinsic": "^1.3.0", - "set-function-length": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001769", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz", @@ -3235,18 +3468,22 @@ "node": ">= 10" } }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -3281,60 +3518,6 @@ "node": ">= 8" } }, - "node_modules/data-view-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", - "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/data-view-byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", - "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/inspect-js" - } - }, - "node_modules/data-view-byte-offset": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", - "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -3353,124 +3536,20 @@ } } }, - "node_modules/deep-equal": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.3.tgz", - "integrity": "sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.5", - "es-get-iterator": "^1.1.3", - "get-intrinsic": "^1.2.2", - "is-arguments": "^1.1.1", - "is-array-buffer": "^3.0.2", - "is-date-object": "^1.0.5", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "isarray": "^2.0.5", - "object-is": "^1.1.5", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.1", - "side-channel": "^1.0.4", - "which-boxed-primitive": "^1.0.2", - "which-collection": "^1.0.1", - "which-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "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/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/defined": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", - "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/dotignore": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", - "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", - "dev": true, - "dependencies": { - "minimatch": "^3.0.4" - }, - "bin": { - "ignored": "bin/ignored" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/duplexer3": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-1.0.0.tgz", - "integrity": "sha512-6O5ndCyJ9CGF9cR2Yi3VFq1OvXXLEgX848InIOl8xUBPYwb8jn/93j10lGaZyLnMRa71IT5OHhURlOiVjH9OVg==", + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/electron-to-chromium": { @@ -3492,210 +3571,27 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/es-abstract": { - "version": "1.24.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.2.tgz", - "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", - "dev": true, - "license": "MIT", - "dependencies": { - "array-buffer-byte-length": "^1.0.2", - "arraybuffer.prototype.slice": "^1.0.4", - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "data-view-buffer": "^1.0.2", - "data-view-byte-length": "^1.0.2", - "data-view-byte-offset": "^1.0.1", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "es-set-tostringtag": "^2.1.0", - "es-to-primitive": "^1.3.0", - "function.prototype.name": "^1.1.8", - "get-intrinsic": "^1.3.0", - "get-proto": "^1.0.1", - "get-symbol-description": "^1.1.0", - "globalthis": "^1.0.4", - "gopd": "^1.2.0", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "internal-slot": "^1.1.0", - "is-array-buffer": "^3.0.5", - "is-callable": "^1.2.7", - "is-data-view": "^1.0.2", - "is-negative-zero": "^2.0.3", - "is-regex": "^1.2.1", - "is-set": "^2.0.3", - "is-shared-array-buffer": "^1.0.4", - "is-string": "^1.1.1", - "is-typed-array": "^1.1.15", - "is-weakref": "^1.1.1", - "math-intrinsics": "^1.1.0", - "object-inspect": "^1.13.4", - "object-keys": "^1.1.1", - "object.assign": "^4.1.7", - "own-keys": "^1.0.1", - "regexp.prototype.flags": "^1.5.4", - "safe-array-concat": "^1.1.3", - "safe-push-apply": "^1.0.0", - "safe-regex-test": "^1.1.0", - "set-proto": "^1.0.0", - "stop-iteration-iterator": "^1.1.0", - "string.prototype.trim": "^1.2.10", - "string.prototype.trimend": "^1.0.9", - "string.prototype.trimstart": "^1.0.8", - "typed-array-buffer": "^1.0.3", - "typed-array-byte-length": "^1.0.3", - "typed-array-byte-offset": "^1.0.4", - "typed-array-length": "^1.0.7", - "unbox-primitive": "^1.1.0", - "which-typed-array": "^1.1.19" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" }, - "node_modules/es-abstract-get": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz", - "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.2", - "is-callable": "^1.2.7", - "object-inspect": "^1.13.4" - }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=6" } }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-get-iterator": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", - "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "has-symbols": "^1.0.3", - "is-arguments": "^1.1.1", - "is-map": "^2.0.2", - "is-set": "^2.0.2", - "is-string": "^1.0.7", - "isarray": "^2.0.5", - "stop-iteration-iterator": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", - "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-set-tostringtag": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", - "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-shim-unscopables": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", - "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-to-primitive": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz", - "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-abstract-get": "^1.0.0", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "is-callable": "^1.2.7", - "is-date-object": "^1.1.0", - "is-symbol": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/eslint": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.9.1.tgz", - "integrity": "sha512-9VaAkDURekixUQJy0oJYl2DcN6oKMfxay7XzaGYAWQwsb6qfKf+x76R2k1L8kb1boc+FyCAaTA9GmiKaaiaF+A==", + "node_modules/eslint": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.9.1.tgz", + "integrity": "sha512-9VaAkDURekixUQJy0oJYl2DcN6oKMfxay7XzaGYAWQwsb6qfKf+x76R2k1L8kb1boc+FyCAaTA9GmiKaaiaF+A==", "dev": true, "license": "MIT", "workspaces": [ @@ -3934,13 +3830,14 @@ "node": ">=0.10.0" } }, - "node_modules/events-to-array": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-2.0.3.tgz", - "integrity": "sha512-f/qE2gImHRa4Cp2y1stEOSgw8wTFyUdVJX7G//bMwbaV9JqISFxg99NbmVQeP7YLnDUZ2un851jlaDrlpmGehQ==", + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=12.0.0" } }, "node_modules/fast-deep-equal": { @@ -4022,28 +3919,6 @@ "dev": true, "license": "ISC" }, - "node_modules/for-each": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", - "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-callable": "^1.2.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -4067,49 +3942,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function.prototype.name": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.2.0.tgz", - "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2", - "hasown": "^2.0.4", - "is-callable": "^1.2.7", - "is-document.all": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/generator-function": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", - "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -4119,92 +3951,6 @@ "node": ">=6.9.0" } }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/get-symbol-description": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", - "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -4230,125 +3976,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globalthis": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", - "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "define-properties": "^1.2.1", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-dynamic-import": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.1.1.tgz", - "integrity": "sha512-DuTCn6K/RW8S27npDMumGKsjG6HE7MxzedZka5tJP+9dqfxks+UMqKBmeCijHtIhsBEZPlbMg0qMHi2nKYVtKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", - "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -4362,15 +3995,6 @@ "node": ">= 0.4" } }, - "node_modules/hirestime": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/hirestime/-/hirestime-7.0.3.tgz", - "integrity": "sha512-XmjAwwjLJlDjVVljWht/+Pb6vTfs6A0z2ZpaCkVmzEkwiZcO/+lbj1DsxpsDvkVprYHCmNBxTr7tUohdlxG2Hw==", - "dev": true, - "engines": { - "node": ">=6.0" - } - }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -4390,45 +4014,14 @@ "node": ">=0.8.19" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/internal-slot": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", - "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", "dev": true, "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "hasown": "^2.0.2", - "side-channel": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "hasown": "^2.0.3" }, "engines": { "node": ">= 0.4" @@ -4437,550 +4030,447 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-array-buffer": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", - "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-async-function": { + "node_modules/is-extglob": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", - "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "async-function": "^1.0.0", - "call-bound": "^1.0.3", - "get-proto": "^1.0.1", - "has-tostringtag": "^1.0.2", - "safe-regex-test": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-bigint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", - "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true, - "license": "MIT", - "dependencies": { - "has-bigints": "^1.0.2" - }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/is-boolean-object": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", - "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" + "is-extglob": "^2.1.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, - "node_modules/is-core-module": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", - "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, - "node_modules/is-data-view": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", - "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "node_modules/js2xmlparser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", "dev": true, - "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "get-intrinsic": "^1.2.6", - "is-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "xmlcreate": "^2.0.4" } }, - "node_modules/is-date-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", - "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "node_modules/jsdoc": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.5.tgz", + "integrity": "sha512-P4C6MWP9yIlMiK8nwoZvxN84vb6MsnXcHuy7XzVOvQoCizWX5JFCBsWIIWKXBltpoRZXddUOVQmCTOZt9yDj9g==", "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", + "@types/markdown-it": "^14.1.1", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^3.0.0", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^8.6.7", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "underscore": "~1.13.2" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-document.all": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz", - "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.4" + "bin": { + "jsdoc": "jsdoc.js" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=12.0.0" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "node_modules/jsdoc/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/is-finalizationregistry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", - "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "node_modules/jsdoctypeparser": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz", + "integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==", "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3" + "bin": { + "jsdoctypeparser": "bin/jsdoctypeparser" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=10" } }, - "node_modules/is-generator-function": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", - "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, "license": "MIT", - "dependencies": { - "call-bound": "^1.0.4", - "generator-function": "^2.0.0", - "get-proto": "^1.0.1", - "has-tostringtag": "^1.0.2", - "safe-regex-test": "^1.1.0" + "bin": { + "jsesc": "bin/jsesc" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=6" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "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, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/is-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", - "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "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, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "MIT" }, - "node_modules/is-negative-zero": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "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": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true }, - "node_modules/is-number-object": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", - "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" + "bin": { + "json5": "lib/cli.js" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=6" } }, - "node_modules/is-regex": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", - "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "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, "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-set": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", - "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "json-buffer": "3.0.1" } }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", - "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "node_modules/klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", "dev": true, - "license": "MIT", "dependencies": { - "call-bound": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "graceful-fs": "^4.1.9" } }, - "node_modules/is-string": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", - "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "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, - "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8.0" } }, - "node_modules/is-symbol": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", - "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", "dev": true, - "license": "MIT", + "license": "MPL-2.0", "dependencies": { - "call-bound": "^1.0.2", - "has-symbols": "^1.1.0", - "safe-regex-test": "^1.1.0" + "detect-libc": "^2.0.3" }, "engines": { - "node": ">= 0.4" + "node": ">= 12.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", - "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "which-typed-array": "^1.1.16" - }, - "engines": { - "node": ">= 0.4" + "type": "opencollective", + "url": "https://opencollective.com/parcel" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-weakmap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", - "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 0.4" + "node": ">= 12.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/is-weakref": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", - "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">= 0.4" + "node": ">= 12.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/is-weakset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", - "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">= 0.4" + "node": ">= 12.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js2xmlparser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", - "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", - "dev": true, - "dependencies": { - "xmlcreate": "^2.0.4" - } - }, - "node_modules/jsdoc": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.5.tgz", - "integrity": "sha512-P4C6MWP9yIlMiK8nwoZvxN84vb6MsnXcHuy7XzVOvQoCizWX5JFCBsWIIWKXBltpoRZXddUOVQmCTOZt9yDj9g==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@babel/parser": "^7.20.15", - "@jsdoc/salty": "^0.2.1", - "@types/markdown-it": "^14.1.1", - "bluebird": "^3.7.2", - "catharsis": "^0.9.0", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.2", - "klaw": "^3.0.0", - "markdown-it": "^14.1.0", - "markdown-it-anchor": "^8.6.7", - "marked": "^4.0.10", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "underscore": "~1.13.2" - }, - "bin": { - "jsdoc": "jsdoc.js" - }, - "engines": { - "node": ">=12.0.0" + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/jsdoc/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=8" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/jsdoctypeparser": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz", - "integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==", + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], "dev": true, - "bin": { - "jsdoctypeparser": "bin/jsdoctypeparser" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=10" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "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, - "license": "MIT" - }, - "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==", + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT" - }, - "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": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], "dev": true, - "bin": { - "json5": "lib/cli.js" - }, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=6" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "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==", + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "graceful-fs": "^4.1.9" + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "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==", + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">= 0.8.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, "node_modules/linkify-it": { @@ -5050,6 +4540,16 @@ "license": "MIT", "peer": true }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/markdown-it": { "version": "14.3.0", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.0.tgz", @@ -5100,44 +4600,12 @@ "node": ">= 12" } }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dev": true }, - "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -5150,148 +4618,57 @@ "node": ">=10" } }, - "node_modules/mock-property": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mock-property/-/mock-property-1.1.0.tgz", - "integrity": "sha512-1/JjbLoGwv87xVsutkX0XJc0M0W4kb40cZl/K41xtTViBOD9JuFPKfyMNTrLJ/ivYAd0aPqu/vduamXO0emTFQ==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "functions-have-names": "^1.2.3", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2", - "hasown": "^2.0.2", - "isarray": "^2.0.5", - "object-inspect": "^1.13.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node_modules/node-exports-info": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz", - "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", - "dev": true, - "license": "MIT", - "dependencies": { - "array.prototype.flatmap": "^1.3.3", - "es-errors": "^1.3.0", - "object.entries": "^1.1.9", - "semver": "^6.3.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-is": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", - "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", - "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0", - "has-symbols": "^1.1.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, - "node_modules/object.entries": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", - "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "node_modules/nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.1.1" + "bin": { + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">= 0.4" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/once": { + "node_modules/natural-compare": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", "dev": true, - "dependencies": { - "wrappy": "1" + "license": "MIT" + }, + "node_modules/obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" } }, "node_modules/optionator": { @@ -5311,25 +4688,6 @@ "node": ">= 0.8.0" } }, - "node_modules/own-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.2.tgz", - "integrity": "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0", - "object-keys": "^1.1.1", - "safe-push-apply": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/p-locate": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", @@ -5360,27 +4718,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse-ms": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", - "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "engines": { - "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", @@ -5396,6 +4733,13 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -5415,14 +4759,33 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/possible-typed-array-names": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", - "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "node_modules/postcss": { + "version": "8.5.26", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz", + "integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", + "dependencies": { + "nanoid": "^3.3.17", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, "engines": { - "node": ">= 0.4" + "node": "^10 || ^12 || >=14" } }, "node_modules/prelude-ls": { @@ -5434,21 +4797,6 @@ "node": ">= 0.8.0" } }, - "node_modules/pretty-ms": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", - "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", - "dev": true, - "dependencies": { - "parse-ms": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -5468,29 +4816,6 @@ "node": ">=6" } }, - "node_modules/reflect.getprototypeof": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", - "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.9", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.7", - "get-proto": "^1.0.1", - "which-builtin-type": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -5511,27 +4836,6 @@ "node": ">=4" } }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", - "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-errors": "^1.3.0", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "set-function-name": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/regexpu-core": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", @@ -5600,6 +4904,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/rolldown": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.5.tgz", + "integrity": "sha512-VD2IE5PUG4Oj8zz2VGykiYd5wbnjdIiSsNQb8Qu5B+noEp+A78mu2iVvpp27g8es14Tk9rofNs5Tku9iQCS4fA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.146.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.5", + "@rolldown/binding-android-arm64": "1.2.5", + "@rolldown/binding-darwin-arm64": "1.2.5", + "@rolldown/binding-darwin-x64": "1.2.5", + "@rolldown/binding-freebsd-x64": "1.2.5", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.5", + "@rolldown/binding-linux-arm64-gnu": "1.2.5", + "@rolldown/binding-linux-arm64-musl": "1.2.5", + "@rolldown/binding-linux-ppc64-gnu": "1.2.5", + "@rolldown/binding-linux-s390x-gnu": "1.2.5", + "@rolldown/binding-linux-x64-gnu": "1.2.5", + "@rolldown/binding-linux-x64-musl": "1.2.5", + "@rolldown/binding-openharmony-arm64": "1.2.5", + "@rolldown/binding-win32-arm64-msvc": "1.2.5", + "@rolldown/binding-win32-x64-msvc": "1.2.5" + } + }, "node_modules/rollup": { "version": "4.62.5", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.5.tgz", @@ -5646,61 +4984,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/safe-array-concat": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", - "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0", - "has-symbols": "^1.1.0", - "isarray": "^2.0.5" - }, - "engines": { - "node": ">=0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/safe-push-apply": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", - "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "isarray": "^2.0.5" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/safe-regex-test": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", - "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-regex": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -5720,53 +5003,6 @@ "node": ">=20.0.0" } }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/set-function-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", - "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/set-proto": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", - "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5788,81 +5024,12 @@ "node": ">=8" } }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "ISC" }, "node_modules/smob": { "version": "1.5.0", @@ -5879,90 +5046,40 @@ "node": ">=0.10.0" } }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/stop-iteration-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", - "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "internal-slot": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/string.prototype.trim": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", - "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "define-data-property": "^1.1.4", - "define-properties": "^1.2.1", - "es-abstract": "^1.24.2", - "es-object-atoms": "^1.1.2", - "has-property-descriptors": "^1.0.2", - "safe-regex-test": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", - "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.1.2" - }, + "license": "BSD-3-Clause", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", - "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, - "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true, + "license": "MIT" + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -5987,127 +5104,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tap-min": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tap-min/-/tap-min-3.0.0.tgz", - "integrity": "sha512-oEhFyYCUEmRLYwtlIkRgeVkX538yEQfoSg6BcWXMq05TFsnpsi3vtQZJeEBkXzMWlj1h/rKaRMaWPCvCTmIIXg==", - "dev": true, - "dependencies": { - "chalk": "^5.3.0", - "duplexer3": "^1.0.0", - "hirestime": "^7.0.3", - "pretty-ms": "^8.0.0", - "tap-parser": "^13.0.2-1" - }, - "bin": { - "tap-min": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/tap-min/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/tap-parser": { - "version": "13.0.2-1", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-13.0.2-1.tgz", - "integrity": "sha512-A6U6TvfwEUFVivyZFiTth3LVrGw9aa4j4cSU8W6ui3sfrZBRNzE1y5YhBomz0+RIRURdspFJdaJvVgSXI68h0Q==", - "dev": true, - "dependencies": { - "events-to-array": "^2.0.3", - "tap-yaml": "2.1.1-1" - }, - "bin": { - "tap-parser": "bin/cmd.js" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/tap-yaml": { - "version": "2.1.1-1", - "resolved": "https://registry.npmjs.org/tap-yaml/-/tap-yaml-2.1.1-1.tgz", - "integrity": "sha512-acWZWpwstr0YMms30FW2nlFkJ0hSm/o2x32Hq5v10IKqYKwnRXARSx6TKbz/gzcSoODPi9PkFQYGYBgowxKDfA==", - "dev": true, - "dependencies": { - "yaml": "^2.3.0", - "yaml-types": "^0.3.0" - } - }, - "node_modules/tape": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.10.2.tgz", - "integrity": "sha512-MfhVVAWa834kfYL4KgrqHblWfwkjaQvfaQhAX/bBTNQsK8oJ4ztpUe7jiemR2Vegw4pYwpnQMy51MhEmRzbbsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ljharb/now": "^1.0.1", - "@ljharb/resumer": "^0.1.3", - "@ljharb/through": "^2.3.14", - "array.prototype.every": "^1.1.7", - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "deep-equal": "^2.2.3", - "defined": "^1.0.1", - "dotignore": "^0.1.2", - "es-object-atoms": "^1.1.2", - "for-each": "^0.3.5", - "get-package-type": "^0.1.0", - "glob": "^7.2.3", - "has-dynamic-import": "^2.1.1", - "hasown": "^2.0.4", - "inherits": "^2.0.4", - "is-regex": "^1.2.1", - "minimist": "^1.2.8", - "mock-property": "^1.1.0", - "object-inspect": "^1.13.4", - "object-is": "^1.1.6", - "object-keys": "^1.1.1", - "object.assign": "^4.1.7", - "resolve": "^2.0.0-next.7", - "string.prototype.trim": "^1.2.11" - }, - "bin": { - "tape": "bin/tape" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tape/node_modules/resolve": { - "version": "2.0.0-next.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", - "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "is-core-module": "^2.16.2", - "node-exports-info": "^1.6.0", - "object-keys": "^1.1.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/terser": { "version": "5.31.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz", @@ -6126,6 +5122,23 @@ "node": ">=10" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", + "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -6174,6 +5187,16 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tinyrainbow": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/ts-api-utils": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", @@ -6199,84 +5222,6 @@ "node": ">= 0.8.0" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", - "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-typed-array": "^1.1.14" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/typed-array-byte-length": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", - "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.14" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-byte-offset": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", - "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.15", - "reflect.getprototypeof": "^1.0.9" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-length": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.8.tgz", - "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.9", - "for-each": "^0.3.5", - "gopd": "^1.2.0", - "is-typed-array": "^1.1.15", - "possible-typed-array-names": "^1.1.0", - "reflect.getprototypeof": "^1.0.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/typedoc": { "version": "0.28.18", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.18.tgz", @@ -6402,25 +5347,6 @@ "dev": true, "license": "MIT" }, - "node_modules/unbox-primitive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", - "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.3", - "has-bigints": "^1.0.2", - "has-symbols": "^1.1.0", - "which-boxed-primitive": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/underscore": { "version": "1.13.8", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz", @@ -6520,107 +5446,230 @@ "punycode": "^2.1.0" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "node_modules/vite": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", "dev": true, + "license": "MIT", "dependencies": { - "isexe": "^2.0.0" + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", + "tinyglobby": "^0.2.17" }, "bin": { - "node-which": "bin/node-which" + "vite": "bin/vite.js" }, "engines": { - "node": ">= 8" + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0 || ^0.5.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } } }, - "node_modules/which-boxed-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", - "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", - "dependencies": { - "is-bigint": "^1.1.0", - "is-boolean-object": "^1.2.1", - "is-number-object": "^1.1.1", - "is-string": "^1.1.1", - "is-symbol": "^1.1.1" + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/vitest": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", + "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.11", + "@vitest/mocker": "4.1.11", + "@vitest/pretty-format": "4.1.11", + "@vitest/runner": "4.1.11", + "@vitest/snapshot": "4.1.11", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" }, "engines": { - "node": ">= 0.4" + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.11", + "@vitest/browser-preview": "4.1.11", + "@vitest/browser-webdriverio": "4.1.11", + "@vitest/coverage-istanbul": "4.1.11", + "@vitest/coverage-v8": "4.1.11", + "@vitest/ui": "4.1.11", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } } }, - "node_modules/which-builtin-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", - "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "node_modules/vitest/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "function.prototype.name": "^1.1.6", - "has-tostringtag": "^1.0.2", - "is-async-function": "^2.0.0", - "is-date-object": "^1.1.0", - "is-finalizationregistry": "^1.1.0", - "is-generator-function": "^1.0.10", - "is-regex": "^1.2.1", - "is-weakref": "^1.0.2", - "isarray": "^2.0.5", - "which-boxed-primitive": "^1.1.0", - "which-collection": "^1.0.2", - "which-typed-array": "^1.1.16" - }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/which-collection": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", - "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "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": { - "is-map": "^2.0.3", - "is-set": "^2.0.3", - "is-weakmap": "^2.0.2", - "is-weakset": "^2.0.3" + "isexe": "^2.0.0" }, - "engines": { - "node": ">= 0.4" + "bin": { + "node-which": "bin/node-which" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 8" } }, - "node_modules/which-typed-array": { - "version": "1.1.20", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", - "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "for-each": "^0.3.5", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2" + "siginfo": "^2.0.0", + "stackback": "0.0.2" }, - "engines": { - "node": ">= 0.4" + "bin": { + "why-is-node-running": "cli.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8" } }, "node_modules/workerpool": { @@ -6630,12 +5679,6 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, "node_modules/xmlcreate": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", @@ -6655,6 +5698,7 @@ "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", "dev": true, "license": "ISC", + "peer": true, "bin": { "yaml": "bin.mjs" }, @@ -6665,19 +5709,6 @@ "url": "https://github.com/sponsors/eemeli" } }, - "node_modules/yaml-types": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/yaml-types/-/yaml-types-0.3.0.tgz", - "integrity": "sha512-i9RxAO/LZBiE0NJUy9pbN5jFz5EasYDImzRkj8Y81kkInTi1laia3P3K/wlMKzOxFQutZip8TejvQP/DwgbU7A==", - "dev": true, - "engines": { - "node": ">= 16", - "npm": ">= 7" - }, - "peerDependencies": { - "yaml": "^2.3.0" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -7894,43 +6925,130 @@ "lodash": "^4.17.21" } }, - "@ljharb/now": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@ljharb/now/-/now-1.0.1.tgz", - "integrity": "sha512-yRQ3B8l2v4vTLQ2l+4kBu6EsXaX7czuLB7fvUz0vkHHziHje75R2t/0Mm/vIo31tlZVCEvCoXHkNKW+ugv3uSA==", + "@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", "dev": true, - "requires": { - "call-bind-apply-helpers": "^1.0.2", - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0" - } + "optional": true }, - "@ljharb/resumer": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.1.3.tgz", - "integrity": "sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==", + "@oxc-project/types": { + "version": "0.146.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.146.0.tgz", + "integrity": "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA==", + "dev": true + }, + "@rolldown/binding-android-arm-eabi": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.5.tgz", + "integrity": "sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA==", "dev": true, - "requires": { - "@ljharb/through": "^2.3.13", - "call-bind": "^1.0.7" - } + "optional": true }, - "@ljharb/through": { - "version": "2.3.14", - "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.14.tgz", - "integrity": "sha512-ajBvlKpWucBB17FuQYUShqpqy8GRgYEpJW0vWJbUu1CV9lWyrDCapy0lScU8T8Z6qn49sSwJB3+M+evYIdGg+A==", + "@rolldown/binding-android-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.5.tgz", + "integrity": "sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig==", "dev": true, - "requires": { - "call-bind": "^1.0.8" - } + "optional": true }, - "@napi-rs/lzma-linux-x64-gnu": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", - "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "@rolldown/binding-darwin-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.5.tgz", + "integrity": "sha512-dK4QakI42nzWgJT5sm4y4y/O//D4OxM75/cH28RLV+nzIN9AY+YsbuUVrUTjlLjXR6vpyxFbSsbmNuJ6BP9sww==", + "dev": true, + "optional": true + }, + "@rolldown/binding-darwin-x64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.5.tgz", + "integrity": "sha512-fqSALaUu1Wjd1nK2uW2kJDWdLCc8lx1IcY+MTY26Aurfdx19anlzhqXOgCFbBFQnlFDTn4TC1/7Nz4Bl2mLP3A==", + "dev": true, + "optional": true + }, + "@rolldown/binding-freebsd-x64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.5.tgz", + "integrity": "sha512-/vCnNxlkxs9tKxNDcyWUePpJ/PgTzxIaVhoM5SmG8UV+GR/IcPam4VYxi7GIMo7PSDuNqlJqvprqii9NqqVCMw==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.5.tgz", + "integrity": "sha512-abk0NLA519LxRCszmbE0jYKuQ9YPocOXTiOXOo6Yr+YAT95VH+PtqYAjOJvGKt3viEd/x4qzabAlwd5bHOOARg==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.5.tgz", + "integrity": "sha512-Y7eALiJ8lr0M2HH103Js+g7V34wf6snlpZLAsHI90uLhr3PVlNsbFVAXJC9d/V6BnPyKtpSwI+NcB/RLxsQxuA==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-arm64-musl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.5.tgz", + "integrity": "sha512-xMvZgnbZg4YVnR/AX2b3oOPDTFYJvUVaJg5FedA/LuvexAtXibZQej4cnTkw3rjsJ/ggUROB64TdtETiim+FYA==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.5.tgz", + "integrity": "sha512-GRjeqTUDHTo5GwntsLaAMcBahG3nlpjftXWZLN73HiYQlhwEowvarFgQnRnQZtIp4keXX7quXFbG38uPZBa2EA==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.5.tgz", + "integrity": "sha512-vLNTR45F2Uwc8AufkNXPmB4VliaXs+FvcheEogIzOXzO4l+LzieXF5A/TWxLy5HtqpsRCHUfd0lPVrrdgXdLHQ==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-x64-gnu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.5.tgz", + "integrity": "sha512-Mgj59/HTuYeK9Gz2MA+mBWKnHsAgkBSec15ZMb1st3oIfFbX7gCjOae7GydHhzcyQi9Z/7M1QuN9bR3oFqF0jQ==", + "dev": true, + "optional": true + }, + "@rolldown/binding-linux-x64-musl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.5.tgz", + "integrity": "sha512-mY8AP0/ichsbhAxGnLa3d3+MwV0EfgrPND2bplI3Ym8T6R2pJ0N87bvrKVwNXmdy3jnr6eQBecdqx/HMknBmpA==", + "dev": true, + "optional": true + }, + "@rolldown/binding-openharmony-arm64": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.5.tgz", + "integrity": "sha512-8SLssA2oweAxyRgDp789ACfRb/3P+zNRJpzZxSizxF9m8NUDQ4+3xjo8ttjhVGGw6Qxb70oZiEtIjaKikCO7Yw==", + "dev": true, + "optional": true + }, + "@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.5.tgz", + "integrity": "sha512-vGbruD5zquhoc8D9SViXgN2FBJtNdTyQ4DtG+SWiEGlJiAzoKcZ2xp+xuXCffhubVdt0NJlTZqkeRuERy7g8Cw==", + "dev": true, + "optional": true + }, + "@rolldown/binding-win32-x64-msvc": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.5.tgz", + "integrity": "sha512-e/SXpgISz+IoqVcSSI0rx/d/he8zqLex+/rCWpnHpmVfmPIUjag9H6P7zotf0gJHwPUhQxZ/mF8tr6acebT9yw==", "dev": true, "optional": true }, + "@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true + }, "@rollup/plugin-babel": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-7.1.0.tgz", @@ -8188,6 +7306,12 @@ "dev": true, "peer": true }, + "@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true + }, "@stylistic/eslint-plugin": { "version": "5.9.0", "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-5.9.0.tgz", @@ -8210,6 +7334,22 @@ } } }, + "@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "requires": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true + }, "@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -8439,6 +7579,90 @@ } } }, + "@vitest/expect": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", + "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", + "dev": true, + "requires": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + } + }, + "@vitest/mocker": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", + "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", + "dev": true, + "requires": { + "@vitest/spy": "4.1.11", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "dependencies": { + "estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0" + } + } + } + }, + "@vitest/pretty-format": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", + "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", + "dev": true, + "requires": { + "tinyrainbow": "^3.1.0" + } + }, + "@vitest/runner": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", + "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", + "dev": true, + "requires": { + "@vitest/utils": "4.1.11", + "pathe": "^2.0.3" + } + }, + "@vitest/snapshot": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", + "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", + "dev": true, + "requires": { + "@vitest/pretty-format": "4.1.11", + "@vitest/utils": "4.1.11", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + } + }, + "@vitest/spy": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", + "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", + "dev": true + }, + "@vitest/utils": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", + "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", + "dev": true, + "requires": { + "@vitest/pretty-format": "4.1.11", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + } + }, "acorn": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", @@ -8470,71 +7694,12 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "array-buffer-byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", - "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "is-array-buffer": "^3.0.5" - } - }, - "array.prototype.every": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.7.tgz", - "integrity": "sha512-BIP72rKvrKd08ptbetLb4qvrlGjkv30yOKgKcTtOIbHyQt3shr/jyOzdApiCOh3LPYrpJo5M6i0zmVldOF2pUw==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-object-atoms": "^1.0.0", - "is-string": "^1.1.0" - } - }, - "array.prototype.flatmap": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", - "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-shim-unscopables": "^1.0.2" - } - }, - "arraybuffer.prototype.slice": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", - "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", - "dev": true, - "requires": { - "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "is-array-buffer": "^3.0.4" - } - }, - "async-function": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", - "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true }, - "available-typed-arrays": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", - "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", - "dev": true, - "requires": { - "possible-typed-array-names": "^1.0.0" - } - }, "babel-plugin-polyfill-corejs2": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.15.tgz", @@ -8565,12 +7730,6 @@ "@babel/helper-define-polyfill-provider": "^0.6.6" } }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, "baseline-browser-mapping": { "version": "2.9.19", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz", @@ -8583,16 +7742,6 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", "dev": true }, - "brace-expansion": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", - "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "browserslist": { "version": "4.28.1", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", @@ -8612,38 +7761,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "call-bind": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", - "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", - "dev": true, - "requires": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "get-intrinsic": "^1.3.0", - "set-function-length": "^1.2.2" - } - }, - "call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - } - }, - "call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dev": true, - "requires": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - } - }, "caniuse-lite": { "version": "1.0.30001769", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz", @@ -8659,18 +7776,18 @@ "lodash": "^4.17.15" } }, + "chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, "convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -8697,292 +7814,44 @@ "which": "^2.0.1" } }, - "data-view-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", - "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" - } - }, - "data-view-byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", - "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" - } - }, - "data-view-byte-offset": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", - "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" - } - }, "debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "requires": { - "ms": "^2.1.3" - } - }, - "deep-equal": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.3.tgz", - "integrity": "sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==", - "dev": true, - "requires": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.5", - "es-get-iterator": "^1.1.3", - "get-intrinsic": "^1.2.2", - "is-arguments": "^1.1.1", - "is-array-buffer": "^3.0.2", - "is-date-object": "^1.0.5", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "isarray": "^2.0.5", - "object-is": "^1.1.5", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.1", - "side-channel": "^1.0.4", - "which-boxed-primitive": "^1.0.2", - "which-collection": "^1.0.1", - "which-typed-array": "^1.1.13" - } - }, - "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 - }, - "define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, - "requires": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - } - }, - "define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, - "requires": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - } - }, - "defined": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", - "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", - "dev": true - }, - "dotignore": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", - "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", - "dev": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dev": true, - "requires": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - } - }, - "duplexer3": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-1.0.0.tgz", - "integrity": "sha512-6O5ndCyJ9CGF9cR2Yi3VFq1OvXXLEgX848InIOl8xUBPYwb8jn/93j10lGaZyLnMRa71IT5OHhURlOiVjH9OVg==", - "dev": true - }, - "electron-to-chromium": { - "version": "1.5.286", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz", - "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==", - "dev": true - }, - "entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true - }, - "es-abstract": { - "version": "1.24.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.2.tgz", - "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", - "dev": true, - "requires": { - "array-buffer-byte-length": "^1.0.2", - "arraybuffer.prototype.slice": "^1.0.4", - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "data-view-buffer": "^1.0.2", - "data-view-byte-length": "^1.0.2", - "data-view-byte-offset": "^1.0.1", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "es-set-tostringtag": "^2.1.0", - "es-to-primitive": "^1.3.0", - "function.prototype.name": "^1.1.8", - "get-intrinsic": "^1.3.0", - "get-proto": "^1.0.1", - "get-symbol-description": "^1.1.0", - "globalthis": "^1.0.4", - "gopd": "^1.2.0", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "internal-slot": "^1.1.0", - "is-array-buffer": "^3.0.5", - "is-callable": "^1.2.7", - "is-data-view": "^1.0.2", - "is-negative-zero": "^2.0.3", - "is-regex": "^1.2.1", - "is-set": "^2.0.3", - "is-shared-array-buffer": "^1.0.4", - "is-string": "^1.1.1", - "is-typed-array": "^1.1.15", - "is-weakref": "^1.1.1", - "math-intrinsics": "^1.1.0", - "object-inspect": "^1.13.4", - "object-keys": "^1.1.1", - "object.assign": "^4.1.7", - "own-keys": "^1.0.1", - "regexp.prototype.flags": "^1.5.4", - "safe-array-concat": "^1.1.3", - "safe-push-apply": "^1.0.0", - "safe-regex-test": "^1.1.0", - "set-proto": "^1.0.0", - "stop-iteration-iterator": "^1.1.0", - "string.prototype.trim": "^1.2.10", - "string.prototype.trimend": "^1.0.9", - "string.prototype.trimstart": "^1.0.8", - "typed-array-buffer": "^1.0.3", - "typed-array-byte-length": "^1.0.3", - "typed-array-byte-offset": "^1.0.4", - "typed-array-length": "^1.0.7", - "unbox-primitive": "^1.1.0", - "which-typed-array": "^1.1.19" - } - }, - "es-abstract-get": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz", - "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.2", - "is-callable": "^1.2.7", - "object-inspect": "^1.13.4" - } - }, - "es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "dev": true - }, - "es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true - }, - "es-get-iterator": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", - "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "has-symbols": "^1.0.3", - "is-arguments": "^1.1.1", - "is-map": "^2.0.2", - "is-set": "^2.0.2", - "is-string": "^1.0.7", - "isarray": "^2.0.5", - "stop-iteration-iterator": "^1.0.0" - } - }, - "es-object-atoms": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", - "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", - "dev": true, - "requires": { - "es-errors": "^1.3.0" - } - }, - "es-set-tostringtag": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", - "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - } - }, - "es-shim-unscopables": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", - "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", - "dev": true, - "requires": { - "hasown": "^2.0.2" + "ms": "^2.1.3" } }, - "es-to-primitive": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz", - "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", - "dev": true, - "requires": { - "es-abstract-get": "^1.0.0", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "is-callable": "^1.2.7", - "is-date-object": "^1.1.0", - "is-symbol": "^1.1.1" - } + "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 + }, + "detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.5.286", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz", + "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==", + "dev": true + }, + "entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true + }, + "es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true }, "escalade": { "version": "3.2.0", @@ -9142,10 +8011,10 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "events-to-array": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-2.0.3.tgz", - "integrity": "sha512-f/qE2gImHRa4Cp2y1stEOSgw8wTFyUdVJX7G//bMwbaV9JqISFxg99NbmVQeP7YLnDUZ2un851jlaDrlpmGehQ==", + "expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true }, "fast-deep-equal": { @@ -9209,21 +8078,6 @@ "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", "dev": true }, - "for-each": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", - "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", - "dev": true, - "requires": { - "is-callable": "^1.2.7" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, "fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -9237,100 +8091,12 @@ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, - "function.prototype.name": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.2.0.tgz", - "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", - "dev": true, - "requires": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2", - "hasown": "^2.0.4", - "is-callable": "^1.2.7", - "is-document.all": "^1.0.0" - } - }, - "functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true - }, - "generator-function": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", - "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", - "dev": true - }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true }, - "get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dev": true, - "requires": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - } - }, - "get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true - }, - "get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dev": true, - "requires": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - } - }, - "get-symbol-description": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", - "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6" - } - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "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" - } - }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -9346,78 +8112,12 @@ "integrity": "sha512-Z2I8hM+PbJDXQDq3Icgpzv+mPdwr68iZUU9d5WW4FuXfDUQfkZaZuvjMv42/5crNyw154+9+VWXbYrUgDXbxNw==", "dev": true }, - "globalthis": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", - "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", - "dev": true, - "requires": { - "define-properties": "^1.2.1", - "gopd": "^1.0.1" - } - }, - "gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "dev": true - }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true - }, - "has-dynamic-import": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.1.1.tgz", - "integrity": "sha512-DuTCn6K/RW8S27npDMumGKsjG6HE7MxzedZka5tJP+9dqfxks+UMqKBmeCijHtIhsBEZPlbMg0qMHi2nKYVtKQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" - } - }, - "has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, - "requires": { - "es-define-property": "^1.0.0" - } - }, - "has-proto": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", - "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", - "dev": true, - "requires": { - "dunder-proto": "^1.0.0" - } - }, - "has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, - "requires": { - "has-symbols": "^1.0.3" - } - }, "hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -9427,12 +8127,6 @@ "function-bind": "^1.1.2" } }, - "hirestime": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/hirestime/-/hirestime-7.0.3.tgz", - "integrity": "sha512-XmjAwwjLJlDjVVljWht/+Pb6vTfs6A0z2ZpaCkVmzEkwiZcO/+lbj1DsxpsDvkVprYHCmNBxTr7tUohdlxG2Hw==", - "dev": true - }, "ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -9445,92 +8139,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "internal-slot": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", - "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "hasown": "^2.0.2", - "side-channel": "^1.1.0" - } - }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-array-buffer": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", - "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" - } - }, - "is-async-function": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", - "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", - "dev": true, - "requires": { - "async-function": "^1.0.0", - "call-bound": "^1.0.3", - "get-proto": "^1.0.1", - "has-tostringtag": "^1.0.2", - "safe-regex-test": "^1.1.0" - } - }, - "is-bigint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", - "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", - "dev": true, - "requires": { - "has-bigints": "^1.0.2" - } - }, - "is-boolean-object": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", - "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" - } - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, "is-core-module": { "version": "2.16.2", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", @@ -9540,64 +8148,12 @@ "hasown": "^2.0.3" } }, - "is-data-view": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", - "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "get-intrinsic": "^1.2.6", - "is-typed-array": "^1.1.13" - } - }, - "is-date-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", - "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" - } - }, - "is-document.all": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz", - "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", - "dev": true, - "requires": { - "call-bound": "^1.0.4" - } - }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, - "is-finalizationregistry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", - "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", - "dev": true, - "requires": { - "call-bound": "^1.0.3" - } - }, - "is-generator-function": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", - "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", - "dev": true, - "requires": { - "call-bound": "^1.0.4", - "generator-function": "^2.0.0", - "get-proto": "^1.0.1", - "has-tostringtag": "^1.0.2", - "safe-regex-test": "^1.1.0" - } - }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -9607,116 +8163,6 @@ "is-extglob": "^2.1.1" } }, - "is-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", - "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", - "dev": true - }, - "is-negative-zero": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", - "dev": true - }, - "is-number-object": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", - "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" - } - }, - "is-regex": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", - "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - } - }, - "is-set": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", - "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", - "dev": true - }, - "is-shared-array-buffer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", - "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", - "dev": true, - "requires": { - "call-bound": "^1.0.3" - } - }, - "is-string": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", - "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" - } - }, - "is-symbol": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", - "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "has-symbols": "^1.1.0", - "safe-regex-test": "^1.1.0" - } - }, - "is-typed-array": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", - "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", - "dev": true, - "requires": { - "which-typed-array": "^1.1.16" - } - }, - "is-weakmap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", - "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", - "dev": true - }, - "is-weakref": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", - "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", - "dev": true, - "requires": { - "call-bound": "^1.0.3" - } - }, - "is-weakset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", - "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4" - } - }, - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -9823,15 +8269,112 @@ "graceful-fs": "^4.1.9" } }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "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, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "requires": { + "detect-libc": "^2.0.3", + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "dev": true, + "optional": true + }, + "lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "dev": true, + "optional": true + }, + "lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "dev": true, + "optional": true + }, + "lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "dev": true, + "optional": true + }, + "lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "dev": true, + "optional": true + }, + "lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "dev": true, + "optional": true + }, + "lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "dev": true, + "optional": true + }, + "lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "dev": true, + "optional": true + }, + "lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "dev": true, + "optional": true + }, + "lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "dev": true, + "optional": true + }, + "lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } + "optional": true }, "linkify-it": { "version": "5.0.2", @@ -9879,6 +8422,15 @@ "dev": true, "peer": true }, + "magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "requires": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "markdown-it": { "version": "14.3.0", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.0.tgz", @@ -9906,141 +8458,48 @@ "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true }, - "math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "dev": true - }, "mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dev": true }, - "minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true - }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, - "mock-property": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mock-property/-/mock-property-1.1.0.tgz", - "integrity": "sha512-1/JjbLoGwv87xVsutkX0XJc0M0W4kb40cZl/K41xtTViBOD9JuFPKfyMNTrLJ/ivYAd0aPqu/vduamXO0emTFQ==", - "dev": true, - "requires": { - "define-data-property": "^1.1.4", - "functions-have-names": "^1.2.3", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2", - "hasown": "^2.0.2", - "isarray": "^2.0.5", - "object-inspect": "^1.13.2" - } - }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "dev": true + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node-exports-info": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz", - "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", - "dev": true, - "requires": { - "array.prototype.flatmap": "^1.3.3", - "es-errors": "^1.3.0", - "object.entries": "^1.1.9", - "semver": "^6.3.1" - } - }, "node-releases": { "version": "2.0.27", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", "dev": true }, - "object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "dev": true - }, - "object-is": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", - "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", - "dev": true, - "requires": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", "dev": true }, - "object.assign": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", - "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0", - "has-symbols": "^1.1.0", - "object-keys": "^1.1.1" - } - }, - "object.entries": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", - "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, "optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -10055,18 +8514,6 @@ "type-check": "^0.4.0" } }, - "own-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.2.tgz", - "integrity": "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==", - "dev": true, - "requires": { - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0", - "object-keys": "^1.1.1", - "safe-push-apply": "^1.0.0" - } - }, "p-locate": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", @@ -10087,18 +8534,6 @@ } } }, - "parse-ms": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", - "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -10111,6 +8546,12 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true + }, "picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -10123,11 +8564,16 @@ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true }, - "possible-typed-array-names": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", - "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", - "dev": true + "postcss": { + "version": "8.5.26", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz", + "integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==", + "dev": true, + "requires": { + "nanoid": "^3.3.17", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + } }, "prelude-ls": { "version": "1.2.1", @@ -10135,15 +8581,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "pretty-ms": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", - "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", - "dev": true, - "requires": { - "parse-ms": "^3.0.0" - } - }, "punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -10156,22 +8593,6 @@ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", "dev": true }, - "reflect.getprototypeof": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", - "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.9", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.7", - "get-proto": "^1.0.1", - "which-builtin-type": "^1.2.1" - } - }, "regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -10187,20 +8608,6 @@ "regenerate": "^1.4.2" } }, - "regexp.prototype.flags": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", - "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-errors": "^1.3.0", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "set-function-name": "^2.0.2" - } - }, "regexpu-core": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", @@ -10250,6 +8657,31 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, + "rolldown": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.5.tgz", + "integrity": "sha512-VD2IE5PUG4Oj8zz2VGykiYd5wbnjdIiSsNQb8Qu5B+noEp+A78mu2iVvpp27g8es14Tk9rofNs5Tku9iQCS4fA==", + "dev": true, + "requires": { + "@oxc-project/types": "=0.146.0", + "@rolldown/binding-android-arm-eabi": "1.2.5", + "@rolldown/binding-android-arm64": "1.2.5", + "@rolldown/binding-darwin-arm64": "1.2.5", + "@rolldown/binding-darwin-x64": "1.2.5", + "@rolldown/binding-freebsd-x64": "1.2.5", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.5", + "@rolldown/binding-linux-arm64-gnu": "1.2.5", + "@rolldown/binding-linux-arm64-musl": "1.2.5", + "@rolldown/binding-linux-ppc64-gnu": "1.2.5", + "@rolldown/binding-linux-s390x-gnu": "1.2.5", + "@rolldown/binding-linux-x64-gnu": "1.2.5", + "@rolldown/binding-linux-x64-musl": "1.2.5", + "@rolldown/binding-openharmony-arm64": "1.2.5", + "@rolldown/binding-win32-arm64-msvc": "1.2.5", + "@rolldown/binding-win32-x64-msvc": "1.2.5", + "@rolldown/pluginutils": "^1.0.0" + } + }, "rollup": { "version": "4.62.5", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.5.tgz", @@ -10286,40 +8718,6 @@ "fsevents": "~2.3.2" } }, - "safe-array-concat": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", - "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", - "dev": true, - "requires": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "get-intrinsic": "^1.3.0", - "has-symbols": "^1.1.0", - "isarray": "^2.0.5" - } - }, - "safe-push-apply": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", - "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "isarray": "^2.0.5" - } - }, - "safe-regex-test": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", - "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-regex": "^1.2.1" - } - }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -10332,43 +8730,6 @@ "integrity": "sha512-F4LcB0UqUl1zErq+1nYEEzSHJnIwb3AF2XWB94b+afhrekOUijwooAYqFyRbjYkm2PAKBabx6oYv/xDxNi8IBw==", "dev": true }, - "set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dev": true, - "requires": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - } - }, - "set-function-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", - "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", - "dev": true, - "requires": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2" - } - }, - "set-proto": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", - "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", - "dev": true, - "requires": { - "dunder-proto": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0" - } - }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -10384,53 +8745,11 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - } - }, - "side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - } - }, - "side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - } - }, - "side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - } + "siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true }, "smob": { "version": "1.5.0", @@ -10444,6 +8763,12 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true + }, "source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -10454,54 +8779,17 @@ "source-map": "^0.6.0" } }, - "stop-iteration-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", - "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "internal-slot": "^1.1.0" - } - }, - "string.prototype.trim": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", - "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", - "dev": true, - "requires": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "define-data-property": "^1.1.4", - "define-properties": "^1.2.1", - "es-abstract": "^1.24.2", - "es-object-atoms": "^1.1.2", - "has-property-descriptors": "^1.0.2", - "safe-regex-test": "^1.1.0" - } - }, - "string.prototype.trimend": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", - "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", - "dev": true, - "requires": { - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.1.2" - } + "stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true }, - "string.prototype.trimstart": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", - "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", - "dev": true, - "requires": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - } + "std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true }, "strip-json-comments": { "version": "3.1.1", @@ -10515,96 +8803,6 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, - "tap-min": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tap-min/-/tap-min-3.0.0.tgz", - "integrity": "sha512-oEhFyYCUEmRLYwtlIkRgeVkX538yEQfoSg6BcWXMq05TFsnpsi3vtQZJeEBkXzMWlj1h/rKaRMaWPCvCTmIIXg==", - "dev": true, - "requires": { - "chalk": "^5.3.0", - "duplexer3": "^1.0.0", - "hirestime": "^7.0.3", - "pretty-ms": "^8.0.0", - "tap-parser": "^13.0.2-1" - }, - "dependencies": { - "chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true - } - } - }, - "tap-parser": { - "version": "13.0.2-1", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-13.0.2-1.tgz", - "integrity": "sha512-A6U6TvfwEUFVivyZFiTth3LVrGw9aa4j4cSU8W6ui3sfrZBRNzE1y5YhBomz0+RIRURdspFJdaJvVgSXI68h0Q==", - "dev": true, - "requires": { - "events-to-array": "^2.0.3", - "tap-yaml": "2.1.1-1" - } - }, - "tap-yaml": { - "version": "2.1.1-1", - "resolved": "https://registry.npmjs.org/tap-yaml/-/tap-yaml-2.1.1-1.tgz", - "integrity": "sha512-acWZWpwstr0YMms30FW2nlFkJ0hSm/o2x32Hq5v10IKqYKwnRXARSx6TKbz/gzcSoODPi9PkFQYGYBgowxKDfA==", - "dev": true, - "requires": { - "yaml": "^2.3.0", - "yaml-types": "^0.3.0" - } - }, - "tape": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.10.2.tgz", - "integrity": "sha512-MfhVVAWa834kfYL4KgrqHblWfwkjaQvfaQhAX/bBTNQsK8oJ4ztpUe7jiemR2Vegw4pYwpnQMy51MhEmRzbbsg==", - "dev": true, - "requires": { - "@ljharb/now": "^1.0.1", - "@ljharb/resumer": "^0.1.3", - "@ljharb/through": "^2.3.14", - "array.prototype.every": "^1.1.7", - "call-bind": "^1.0.9", - "call-bound": "^1.0.4", - "deep-equal": "^2.2.3", - "defined": "^1.0.1", - "dotignore": "^0.1.2", - "es-object-atoms": "^1.1.2", - "for-each": "^0.3.5", - "get-package-type": "^0.1.0", - "glob": "^7.2.3", - "has-dynamic-import": "^2.1.1", - "hasown": "^2.0.4", - "inherits": "^2.0.4", - "is-regex": "^1.2.1", - "minimist": "^1.2.8", - "mock-property": "^1.1.0", - "object-inspect": "^1.13.4", - "object-is": "^1.1.6", - "object-keys": "^1.1.1", - "object.assign": "^4.1.7", - "resolve": "^2.0.0-next.7", - "string.prototype.trim": "^1.2.11" - }, - "dependencies": { - "resolve": { - "version": "2.0.0-next.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", - "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "is-core-module": "^2.16.2", - "node-exports-info": "^1.6.0", - "object-keys": "^1.1.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - } - } - }, "terser": { "version": "5.31.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz", @@ -10617,6 +8815,18 @@ "source-map-support": "~0.5.20" } }, + "tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true + }, + "tinyexec": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz", + "integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==", + "dev": true + }, "tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -10642,6 +8852,12 @@ } } }, + "tinyrainbow": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", + "dev": true + }, "ts-api-utils": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", @@ -10658,59 +8874,6 @@ "prelude-ls": "^1.2.1" } }, - "typed-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", - "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-typed-array": "^1.1.14" - } - }, - "typed-array-byte-length": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", - "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", - "dev": true, - "requires": { - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.14" - } - }, - "typed-array-byte-offset": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", - "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.15", - "reflect.getprototypeof": "^1.0.9" - } - }, - "typed-array-length": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.8.tgz", - "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", - "dev": true, - "requires": { - "call-bind": "^1.0.9", - "for-each": "^0.3.5", - "gopd": "^1.2.0", - "is-typed-array": "^1.1.15", - "possible-typed-array-names": "^1.1.0", - "reflect.getprototypeof": "^1.0.10" - } - }, "typedoc": { "version": "0.28.18", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.18.tgz", @@ -10785,18 +8948,6 @@ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true }, - "unbox-primitive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", - "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", - "dev": true, - "requires": { - "call-bound": "^1.0.3", - "has-bigints": "^1.0.2", - "has-symbols": "^1.1.0", - "which-boxed-primitive": "^1.1.1" - } - }, "underscore": { "version": "1.13.8", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz", @@ -10856,74 +9007,81 @@ "punycode": "^2.1.0" } }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", - "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "vite": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", "dev": true, "requires": { - "is-bigint": "^1.1.0", - "is-boolean-object": "^1.2.1", - "is-number-object": "^1.1.1", - "is-string": "^1.1.1", - "is-symbol": "^1.1.1" + "fsevents": "~2.3.3", + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", + "tinyglobby": "^0.2.17" + }, + "dependencies": { + "picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true + } } }, - "which-builtin-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", - "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", - "dev": true, - "requires": { - "call-bound": "^1.0.2", - "function.prototype.name": "^1.1.6", - "has-tostringtag": "^1.0.2", - "is-async-function": "^2.0.0", - "is-date-object": "^1.1.0", - "is-finalizationregistry": "^1.1.0", - "is-generator-function": "^1.0.10", - "is-regex": "^1.2.1", - "is-weakref": "^1.0.2", - "isarray": "^2.0.5", - "which-boxed-primitive": "^1.1.0", - "which-collection": "^1.0.2", - "which-typed-array": "^1.1.16" + "vitest": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", + "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", + "dev": true, + "requires": { + "@vitest/expect": "4.1.11", + "@vitest/mocker": "4.1.11", + "@vitest/pretty-format": "4.1.11", + "@vitest/runner": "4.1.11", + "@vitest/snapshot": "4.1.11", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "dependencies": { + "picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true + } } }, - "which-collection": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", - "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "requires": { - "is-map": "^2.0.3", - "is-set": "^2.0.3", - "is-weakmap": "^2.0.2", - "is-weakset": "^2.0.3" + "isexe": "^2.0.0" } }, - "which-typed-array": { - "version": "1.1.20", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", - "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, "requires": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "for-each": "^0.3.5", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2" + "siginfo": "^2.0.0", + "stackback": "0.0.2" } }, "workerpool": { @@ -10932,12 +9090,6 @@ "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", "dev": true }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, "xmlcreate": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", @@ -10954,14 +9106,8 @@ "version": "2.8.3", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", - "dev": true - }, - "yaml-types": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/yaml-types/-/yaml-types-0.3.0.tgz", - "integrity": "sha512-i9RxAO/LZBiE0NJUy9pbN5jFz5EasYDImzRkj8Y81kkInTi1laia3P3K/wlMKzOxFQutZip8TejvQP/DwgbU7A==", "dev": true, - "requires": {} + "peer": true }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index 5785622..3b58491 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "check": "npm run test && npm run lint && npm run typecheck", "lint": "eslint lib test", "release": "git diff --exit-code && PACKAGE_VERSION=$(jq -r .version package.json) && echo \"About to tag and push v$PACKAGE_VERSION. Continue? (y/n)\" && read -r REPLY && [ \"$REPLY\" = \"y\" ] && git tag --annotate v$PACKAGE_VERSION --message=v$PACKAGE_VERSION && git push origin v$PACKAGE_VERSION", - "test": "SKIPTABLES=1 tape './{lib,test}/*{.spec,-test}.js'|tap-min", - "test-all": "tape test/*-test.js", + "test": "SKIPTABLES=1 vitest run", + "test-all": "vitest run", "typecheck": "tsc --noEmit" }, "main": "dist/numfmt.js", @@ -58,11 +58,10 @@ "globals": "~17.11.0", "jsdoc": "~4.0.5", "rollup": "~4.62.5", - "tap-min": "~3.0.0", - "tape": "~5.10.2", "typedoc-plugin-markdown": "~4.12.0", "typescript": "~5.9.3", - "typescript-eslint": "~8.68.0" + "typescript-eslint": "~8.68.0", + "vitest": "~4.1.11" }, "allowScripts": { "fsevents@2.3.3": true diff --git a/test/bigint-test.js b/test/bigint-test.js deleted file mode 100644 index 810f983..0000000 --- a/test/bigint-test.js +++ /dev/null @@ -1,30 +0,0 @@ -import test from './utils.js'; - -test('bigint', t => { - t.format('0', Number.MAX_SAFE_INTEGER, String(Number.MAX_SAFE_INTEGER)); - t.format('0', 10n, '10'); - - t.format('General', 10n, '10'); - t.format('General', 9007199254740991n, '9.0072E+15'); - - t.format('0.0', 9007199254740991n, '9007199254740990.0'); - - t.format('#,##0.0', 9007199254740991n, '9,007,199,254,740,990.0'); - t.format('#,##0.0', 9007199254750000n, '######'); - t.format('#,##0.0', -9007199254750000n, '######'); - - t.format('#0-000-00', 9007199254750000n, '######'); - t.format('0%', 9007199254750000n, '######'); - - t.format('#0-000-00', 9007199254750000n, '9007199254750000', { bigintErrorNumber: true }); - t.format('0%', 9007199254750000n, '9007199254750000', { bigintErrorNumber: true }); - - // preferably we should support bigint throughout: - // t.format('#0-000-00', 9007199254750000n, '90071992547-500-00'); - // t.format('0%', 9007199254750000n, '900719925475000000%'); - - t.format('0.000E+00', 999990000, '1.000E+09'); - t.format('0.000E+00', 999990000n, '1.000E+09'); - - t.end(); -}); diff --git a/test/bigint.spec.ts b/test/bigint.spec.ts new file mode 100644 index 0000000..e817e9f --- /dev/null +++ b/test/bigint.spec.ts @@ -0,0 +1,29 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('bigint', () => { + expect(format('0', Number.MAX_SAFE_INTEGER)).toBe(String(Number.MAX_SAFE_INTEGER)); + expect(format('0', 10n)).toBe('10'); + + expect(format('General', 10n)).toBe('10'); + expect(format('General', 9007199254740991n)).toBe('9.0072E+15'); + + expect(format('0.0', 9007199254740991n)).toBe('9007199254740990.0'); + + expect(format('#,##0.0', 9007199254740991n)).toBe('9,007,199,254,740,990.0'); + expect(format('#,##0.0', 9007199254750000n)).toBe('######'); + expect(format('#,##0.0', -9007199254750000n)).toBe('######'); + + expect(format('#0-000-00', 9007199254750000n)).toBe('######'); + expect(format('0%', 9007199254750000n)).toBe('######'); + + expect(format('#0-000-00', 9007199254750000n, { bigintErrorNumber: true })).toBe('9007199254750000'); + expect(format('0%', 9007199254750000n, { bigintErrorNumber: true })).toBe('9007199254750000'); + + // preferably we should support bigint throughout: + // expect(format('#0-000-00', 9007199254750000n)).toBe('90071992547-500-00'); + // expect(format('0%', 9007199254750000n)).toBe('900719925475000000%'); + + expect(format('0.000E+00', 999990000)).toBe('1.000E+09'); + expect(format('0.000E+00', 999990000n)).toBe('1.000E+09'); +}); diff --git a/test/color-test.js b/test/color-test.js deleted file mode 100644 index 6ee5517..0000000 --- a/test/color-test.js +++ /dev/null @@ -1,44 +0,0 @@ -import test from './utils.js'; - -test('formatColor', t => { - // color works the same across number sections, but not text - t.formatColor('0', 123, null); - t.formatColor('0', 0, null); - t.formatColor('0', -123, null); - t.formatColor('0', 'foo', null); - t.formatColor('[blue]0', 123, 'blue'); - t.formatColor('[blue]0', 0, 'blue'); - t.formatColor('[blue]0', -123, 'blue'); - t.formatColor('[blue]0', 'foo', null); - // can define separate colors per section - t.formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 1, 'blue'); - t.formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', -1, 'green'); - t.formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 0, 'magenta'); - t.formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 'foo', 'cyan'); - // color is case insensitive - t.formatColor('[red]0', 0, 'red'); - t.formatColor('[Red]0', 0, 'red'); - t.formatColor('[RED]0', 0, 'red'); - // all known primaries work - t.formatColor('[black]0', 0, 'black'); - t.formatColor('[blue]0', 0, 'blue'); - t.formatColor('[cyan]0', 0, 'cyan'); - t.formatColor('[green]0', 0, 'green'); - t.formatColor('[magenta]0', 0, 'magenta'); - t.formatColor('[red]0', 0, 'red'); - t.formatColor('[white]0', 0, 'white'); - t.formatColor('[yellow]0', 0, 'yellow'); - // 1-based index color resolutions - t.formatColor('[color 0]0', 0, null); - t.formatColor('[color 1]0', 0, '#000000'); - t.formatColor('[color 2]0', 0, '#FFFFFF'); - t.formatColor('[color3]0', 0, '#FF0000'); - // numbers are returned when indexColors is off - t.formatColor('[color 0]0', 0, null, { indexColors: false }); - t.formatColor('[color 1]0', 0, 1, { indexColors: false }); - t.formatColor('[color 2]0', 0, 2, { indexColors: false }); - t.formatColor('[color3]0', 0, 3, { indexColors: false }); - // keywords are still returned when indexColors is off - t.formatColor('[yellow]0', 0, 'yellow', { indexColors: false }); - t.end(); -}); diff --git a/test/color.spec.ts b/test/color.spec.ts new file mode 100644 index 0000000..50320e6 --- /dev/null +++ b/test/color.spec.ts @@ -0,0 +1,44 @@ +import { expect, test } from 'vitest'; +import { formatColor } from '../lib/index.js'; + +test('formatColor', () => { + // color works the same across number sections, but not text + expect(formatColor('0', 123)).toBe(null); + expect(formatColor('0', 0)).toBe(null); + expect(formatColor('0', -123)).toBe(null); + expect(formatColor('0', 'foo')).toBe(null); + expect(formatColor('[blue]0', 123)).toBe('blue'); + expect(formatColor('[blue]0', 0)).toBe('blue'); + expect(formatColor('[blue]0', -123)).toBe('blue'); + expect(formatColor('[blue]0', 'foo')).toBe(null); + // can define separate colors per section + expect(formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 1)).toBe('blue'); + expect(formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', -1)).toBe('green'); + expect(formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 0)).toBe('magenta'); + expect(formatColor('[blue]0;[green]-0;[magenta]0;[cyan]@', 'foo')).toBe('cyan'); + // color is case insensitive + expect(formatColor('[red]0', 0)).toBe('red'); + expect(formatColor('[Red]0', 0)).toBe('red'); + expect(formatColor('[RED]0', 0)).toBe('red'); + // all known primaries work + expect(formatColor('[black]0', 0)).toBe('black'); + expect(formatColor('[blue]0', 0)).toBe('blue'); + expect(formatColor('[cyan]0', 0)).toBe('cyan'); + expect(formatColor('[green]0', 0)).toBe('green'); + expect(formatColor('[magenta]0', 0)).toBe('magenta'); + expect(formatColor('[red]0', 0)).toBe('red'); + expect(formatColor('[white]0', 0)).toBe('white'); + expect(formatColor('[yellow]0', 0)).toBe('yellow'); + // 1-based index color resolutions + expect(formatColor('[color 0]0', 0)).toBe(null); + expect(formatColor('[color 1]0', 0)).toBe('#000000'); + expect(formatColor('[color 2]0', 0)).toBe('#FFFFFF'); + expect(formatColor('[color3]0', 0)).toBe('#FF0000'); + // numbers are returned when indexColors is off + expect(formatColor('[color 0]0', 0, { indexColors: false })).toBe(null); + expect(formatColor('[color 1]0', 0, { indexColors: false })).toBe(1); + expect(formatColor('[color 2]0', 0, { indexColors: false })).toBe(2); + expect(formatColor('[color3]0', 0, { indexColors: false })).toBe(3); + // keywords are still returned when indexColors is off + expect(formatColor('[yellow]0', 0, { indexColors: false })).toBe('yellow'); +}); diff --git a/test/comma-test.js b/test/comma-test.js deleted file mode 100644 index 576dee1..0000000 --- a/test/comma-test.js +++ /dev/null @@ -1,46 +0,0 @@ -import test from './utils.js'; - -test('Correct handling of the comma operator', t => { - t.format('0,', 1234567.89, '1235'); - t.format('0,,', 1234567.89, '1'); - t.format('0,,,', 1234567.89, '0'); - t.format('0,0', 1234567.89, '1,234,568'); - t.format('0,00', 1234567.89, '1,234,568'); - t.format('0,000', 1234567.89, '1,234,568'); - t.format('0,0,0', 1234567.89, '1,234,568'); - t.format('0,,0', 1234567.89, '1,234,568'); - t.format('0,,,0', 1234567.89, '1,234,568'); - t.format('0,x', 1234567.89, '1235x'); - t.format('0,x,', 1234567.89, '1235x,'); - t.format('0x,', 1234567.89, '1234568x,'); - t.format('0,,x', 1234567.89, '1x'); - t.format('0,x0', 1234567.89, '123456x8'); - t.format('0 , 0', 1234567.89, '123456 , 8'); - t.format('0, ,0', 1234567.89, '123456 ,8'); - t.format('0.,', 1234567.89, '1235.'); - t.format('0.0,', 1234567.89, '1234.6'); - t.format('0.0,0', 1234567.89, '1234567.89'); - t.format('0,0 0/0', 1234567.89, '1,234,567 8/9'); - t.format('0,0,,0', 1234567.89, '1,234,568'); - t.format('0.0,0,', 1234567.89, '1234.57'); - t.format('0.0 , 0 ,', 1234567.89, '1234567.8 , 9 ,'); - t.format('0 ,', 1234567.89, '1234568 ,'); - t.format('0x,', 1234567.89, '1234568x,'); - t.format('0 ,', 1234567.89, '1234568 ,'); - t.format('0 ,,', 1234567.89, '1234568 ,'); - t.format('0x,', 1234567.89, '1234568x,'); - t.format('x,0', 1234567.89, 'x,1234568'); - - // Still unsolved by the formatter: digit interplay with 0#? - t.format('01,', 1234567.89, '12351'); - t.format('09,', 1234567.89, '12359'); - // t.format('01,0', 1234567.89, '1,234,5618'); - // t.format('09,0', 1234567.89, '1,234,5698'); - // t.format('0, 9', 1234567.89, '1234568 9'); - - t.formatInvalid('0,0/0'); - t.formatInvalid('0/0,0'); - // t.formatInvalid('0 0/0,'); "1234 4/7" gets emitted, same as Sheets - - t.end(); -}); diff --git a/test/comma.spec.ts b/test/comma.spec.ts new file mode 100644 index 0000000..4cc6fa9 --- /dev/null +++ b/test/comma.spec.ts @@ -0,0 +1,45 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Correct handling of the comma operator', () => { + expect(format('0,', 1234567.89)).toBe('1235'); + expect(format('0,,', 1234567.89)).toBe('1'); + expect(format('0,,,', 1234567.89)).toBe('0'); + expect(format('0,0', 1234567.89)).toBe('1,234,568'); + expect(format('0,00', 1234567.89)).toBe('1,234,568'); + expect(format('0,000', 1234567.89)).toBe('1,234,568'); + expect(format('0,0,0', 1234567.89)).toBe('1,234,568'); + expect(format('0,,0', 1234567.89)).toBe('1,234,568'); + expect(format('0,,,0', 1234567.89)).toBe('1,234,568'); + expect(format('0,x', 1234567.89)).toBe('1235x'); + expect(format('0,x,', 1234567.89)).toBe('1235x,'); + expect(format('0x,', 1234567.89)).toBe('1234568x,'); + expect(format('0,,x', 1234567.89)).toBe('1x'); + expect(format('0,x0', 1234567.89)).toBe('123456x8'); + expect(format('0 , 0', 1234567.89)).toBe('123456 , 8'); + expect(format('0, ,0', 1234567.89)).toBe('123456 ,8'); + expect(format('0.,', 1234567.89)).toBe('1235.'); + expect(format('0.0,', 1234567.89)).toBe('1234.6'); + expect(format('0.0,0', 1234567.89)).toBe('1234567.89'); + expect(format('0,0 0/0', 1234567.89)).toBe('1,234,567 8/9'); + expect(format('0,0,,0', 1234567.89)).toBe('1,234,568'); + expect(format('0.0,0,', 1234567.89)).toBe('1234.57'); + expect(format('0.0 , 0 ,', 1234567.89)).toBe('1234567.8 , 9 ,'); + expect(format('0 ,', 1234567.89)).toBe('1234568 ,'); + expect(format('0x,', 1234567.89)).toBe('1234568x,'); + expect(format('0 ,', 1234567.89)).toBe('1234568 ,'); + expect(format('0 ,,', 1234567.89)).toBe('1234568 ,'); + expect(format('0x,', 1234567.89)).toBe('1234568x,'); + expect(format('x,0', 1234567.89)).toBe('x,1234568'); + + // Still unsolved by the formatter: digit interplay with 0#? + expect(format('01,', 1234567.89)).toBe('12351'); + expect(format('09,', 1234567.89)).toBe('12359'); + // expect(format('01,0', 1234567.89)).toBe('1,234,5618'); + // expect(format('09,0', 1234567.89)).toBe('1,234,5698'); + // expect(format('0, 9', 1234567.89)).toBe('1234568 9'); + + expect(() => format('0,0/0', '')).toThrow(); + expect(() => format('0/0,0', '')).toThrow(); + // expect(() => format('0 0/0,', '')).toThrow(); // "1234 4/7" gets emitted, same as Sheets +}); diff --git a/test/conditionals-test.js b/test/conditionals-test.js deleted file mode 100644 index 542c581..0000000 --- a/test/conditionals-test.js +++ /dev/null @@ -1,582 +0,0 @@ -import test from './utils.js'; - -test('conditional parts', t => { - t.format('[>=100]"A"0;[<=-100]"B"0;"C"0', 6.3, 'C6'); - t.format('[>=100]"A"0;[<=-100]"B"0;"C"0', -6.3, '-C6'); - t.format('[>=100]"A"0;[<=0]"B"0;"C"0', 6.3, 'C6'); - t.format('[>=100]"A"0;[<=0]"B"0;"C"0', -6.3, '-B6'); - t.format('[>=0]"A"0;[<=-100]"B"0;"C"0', 6.3, 'A6'); - t.format('[>=0]"A"0;[<=-100]"B"0;"C"0', -6.3, '-C6'); - t.format('[>=0]"A"0;[<=0]"B"0;"C"0', 6.3, 'A6'); - t.format('[>=0]"A"0;[<=0]"B"0;"C"0', -6.3, '-B6'); - t.format('[>=0]"A"0;[<=-100]"B"0', 6.3, 'A6'); - t.format('[>=100]"A"0;[<=0]"B"0', -6.3, '-B6'); - t.format('[<=-100]"B"0;"C"0', 6.3, 'C6'); - t.format('[<=-100]"B"0;"C"0', -6.3, 'C6'); - t.format('[<=0]"B"0', 6.3, '6.3'); - t.format('[<=0]"B"0', -6.3, '-B6'); - t.format('[=6.3]"B"0', 6.3, 'B6'); - t.format('[=6.3]"B"0', -6.3, '-6.3'); - t.format('[<>6]"B"0', 6.3, 'B6'); - t.format('[<>6]"B"0', -6.3, '-B6'); - t.format('[=6.3]"B"0', 6.3, 'B6'); - t.format('[=6.3]"B"0', -6.3, '-6.3'); - t.format('[>6]"A"0;[<-6]"B"0', 6.3, 'A6'); - t.format('[>6]"A"0;[<-6]"B"0', -6.3, 'B6'); - t.format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"@', 6.3, 'C6'); - t.format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"@', -6.3, '-C6'); - t.format('[>=100]"A"-0;[<=-100]"B"-0;"C"-0', 6.3, 'C-6'); - t.format('[>=100]"A"-0;[<=-100]"B"-0;"C"-0', -6.3, '-C-6'); - t.format('[>=100]"A"-#,##0;[<=0]"B"-#,##0;"C"-#,##0', 6.3, 'C-6'); - t.format('[>=100]"A"-#,##0;[<=0]"B"-#,##0;"C"-#,##0', -6.3, '-B-6'); - t.format('[>=0]"A"-0;[<=-100]"B"-0;"C"-0', 6.3, 'A-6'); - t.format('[>=0]"A"-0;[<=-100]"B"-0;"C"-0', -6.3, '-C-6'); - t.format('[>=0]"A"-0;[<=0]"B"-0;"C"-0', 6.3, 'A-6'); - t.format('[>=0]"A"-0;[<=0]"B"-0;"C"-0', -6.3, '-B-6'); - - t.format('[>=100]"A"0;[<=-100]"B"0', 6.3, '######'); - t.format('[>=100]"A"0;[<=-100]"B"0', -6.3, '######'); - t.format('[>=0]"A"0;[<=-100]"B"0', -6.3, '######'); - t.format('[>=100]"A"0;[<=0]"B"0', 6.3, '######'); - t.formatInvalid('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"0'); - t.formatInvalid('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"0'); - t.formatInvalid('[<-25]0;[>25]0;0;"foo".#'); - - t.end(); -}); - -test('conditional parts vs negative numbers', t => { - t.format('[<>-6]\\A0', -5, '-A5'); - t.format('[<-4]\\A0', -5, 'A5'); - t.format('[<=-4]\\A0', -5, 'A5'); - t.format('[=-5]\\A0', -5, 'A5'); - t.format('[>-6]\\A0', -5, '-A5'); - t.format('[>=-6]\\A0', -5, '-A5'); - t.format('[<>-5]\\A0', -5, '5'); - t.format('[<-6]\\A0', -5, '5'); - t.format('[<=-6]\\A0', -5, '5'); - t.format('[=-6]\\A0', -5, '-5'); - t.format('[>2]\\A0', -5, '-5'); - t.format('[>=2]\\A0', -5, '-5'); - - t.format('[<>-6]\\A0;\\B0', -5, '-A5'); - t.format('[<-4]\\A0;\\B0', -5, 'A5'); - t.format('[<=-4]\\A0;\\B0', -5, 'A5'); - t.format('[=-5]\\A0;\\B0', -5, 'A5'); - t.format('[>-6]\\A0;\\B0', -5, '-A5'); - t.format('[>=-6]\\A0;\\B0', -5, '-A5'); - t.format('[<>-5]\\A0;\\B0', -5, 'B5'); - t.format('[<-6]\\A0;\\B0', -5, 'B5'); - t.format('[<=-6]\\A0;\\B0', -5, 'B5'); - t.format('[=-6]\\A0;\\B0', -5, '-B5'); - t.format('[>2]\\A0;\\B0', -5, '-B5'); - t.format('[>=2]\\A0;\\B0', -5, '-B5'); - - t.format('[<>-6]\\A0;[<>-6]\\B0;\\C0', -5, '-A5'); - t.format('[<>-6]\\A0;[<-4]\\B0;\\C0', -5, '-A5'); - t.format('[<>-6]\\A0;[<=-4]\\B0;\\C0', -5, '-A5'); - t.format('[<>-6]\\A0;[=-5]\\B0;\\C0', -5, '-A5'); - t.format('[<>-6]\\A0;[>-6]\\B0;\\C0', -5, '-A5'); - t.format('[<>-6]\\A0;[>=-6]\\B0;\\C0', -5, '-A5'); - t.format('[<-4]\\A0;[<>-6]\\B0;\\C0', -5, 'A5'); - t.format('[<-4]\\A0;[<-4]\\B0;\\C0', -5, 'A5'); - t.format('[<-4]\\A0;[<=-4]\\B0;\\C0', -5, 'A5'); - t.format('[<-4]\\A0;[=-5]\\B0;\\C0', -5, 'A5'); - t.format('[<-4]\\A0;[>-6]\\B0;\\C0', -5, 'A5'); - t.format('[<-4]\\A0;[>=-6]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[<>-6]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[<-4]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[<=-4]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[=-5]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[>-6]\\B0;\\C0', -5, 'A5'); - t.format('[<=-4]\\A0;[>=-6]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[<>-6]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[<-4]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[<=-4]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[=-5]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[>-6]\\B0;\\C0', -5, 'A5'); - t.format('[=-5]\\A0;[>=-6]\\B0;\\C0', -5, 'A5'); - t.format('[>-6]\\A0;[<>-6]\\B0;\\C0', -5, '-A5'); - t.format('[>-6]\\A0;[<-4]\\B0;\\C0', -5, '-A5'); - t.format('[>-6]\\A0;[<=-4]\\B0;\\C0', -5, '-A5'); - t.format('[>-6]\\A0;[=-5]\\B0;\\C0', -5, '-A5'); - t.format('[>-6]\\A0;[>-6]\\B0;\\C0', -5, '-A5'); - t.format('[>-6]\\A0;[>=-6]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[<>-6]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[<-4]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[<=-4]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[=-5]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[>-6]\\B0;\\C0', -5, '-A5'); - t.format('[>=-6]\\A0;[>=-6]\\B0;\\C0', -5, '-A5'); - - t.format('[<>-5]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<>-5]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[<>-5]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[<>-5]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[<>-5]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<>-5]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - t.format('[<-6]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<-6]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[<-6]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[<-6]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[<-6]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<-6]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - t.format('[<=-6]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<=-6]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[<=-6]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[<=-6]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[<=-6]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[<=-6]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - t.format('[=-6]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[=-6]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[=-6]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[=-6]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[=-6]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[=-6]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - t.format('[>2]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[>2]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[>2]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[>2]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[>2]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[>2]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - t.format('[>=2]\\A0;[<>-6]\\B0;\\C0', -5, '-B5'); - t.format('[>=2]\\A0;[<-4]\\B0;\\C0', -5, 'B5'); - t.format('[>=2]\\A0;[<=-4]\\B0;\\C0', -5, 'B5'); - t.format('[>=2]\\A0;[=-5]\\B0;\\C0', -5, 'B5'); - t.format('[>=2]\\A0;[>-6]\\B0;\\C0', -5, '-B5'); - t.format('[>=2]\\A0;[>=-6]\\B0;\\C0', -5, '-B5'); - - t.format('[<>-5]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[<>-5]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[<>-5]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<>-5]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<>-5]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[<>-5]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[<-6]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[<=-6]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[=-6]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[>2]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[<>-5]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[<-6]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[<=-6]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[=-6]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[>2]\\B0;\\C0', -5, '-C5'); - t.format('[>=2]\\A0;[>=2]\\B0;\\C0', -5, '-C5'); - - t.end(); -}); - -test('secondary only conditional', t => { - t.format('"A-"0;[=-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=-11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=-11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-10]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[=-10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=-10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=-5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=-5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=-2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=-2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=-1]"B-"0;"C-"0', -1, 'B-1'); - t.format('"A-"0;[=-1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=-0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=-0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=-0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=0]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=0]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=0]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[=0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[=11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[=11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[=11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[=11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[=11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[<-11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<-11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[<-10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<-10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-5]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<-5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<-5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-2]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<-2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<-2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-1]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<-1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<-1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<-0.5]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<-0.5]"B-"0;"C-"0', -1, 'B-1'); - t.format('"A-"0;[<-0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<0]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<0]"B-"0;"C-"0', -1, 'B-1'); - t.format('"A-"0;[<0]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<0.5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<0.5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<1]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<1]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<2]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<10]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<11]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[>-11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>-11]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>-10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>-10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>-5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>-5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>-2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>-2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>-1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>-1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>-0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>-0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>-0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>0]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>0]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>0]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[<=-11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<=-11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-10]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<=-10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<=-10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-5]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<=-5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<=-5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-2]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<=-2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<=-2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-1]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<=-1]"B-"0;"C-"0', -1, 'B-1'); - t.format('"A-"0;[<=-1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=-0.5]"B-"0;"C-"0', -10, 'B-10'); - t.format('"A-"0;[<=-0.5]"B-"0;"C-"0', -1, 'B-1'); - t.format('"A-"0;[<=-0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<=0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=0]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=0]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=0]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=0.5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=0.5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=1]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=1]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=2]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=10]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<=11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<=11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<=11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<=11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<=11]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[>=-11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>=-11]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-10]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[>=-10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>=-10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=-5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>=-5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=-2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>=-2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=-1]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[>=-1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=-0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=-0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=-0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=0]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=0]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=0]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[>=0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=0.5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=0.5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=0.5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>=1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=1]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=1]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>=2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=2]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=2]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=2]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>=5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=5]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=5]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=5]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>=10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=10]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=10]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[>=11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[>=11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[>=11]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[>=11]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[>=11]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<>-11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>-11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>-11]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>-10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-10]"B-"0;"C-"0', -10, '-C-10'); - t.format('"A-"0;[<>-10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>-10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>-5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>-5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>-5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>-2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-2]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>-2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>-2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>-1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-1]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>-1]"B-"0;"C-"0', -1, '-C-1'); - t.format('"A-"0;[<>-1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>-0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>-0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>-0.5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>-0.5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>-0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>0]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>0]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>0]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>0]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>0]"B-"0;"C-"0', 0, 'C-0'); - t.format('"A-"0;[<>0.5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>0.5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>0.5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>0.5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>0.5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>1]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>1]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>1]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>1]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>1]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>2]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>2]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>2]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>2]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>2]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>5]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>5]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>5]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>5]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>5]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>10]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>10]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>10]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>10]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>10]"B-"0;"C-"0', 0, 'B-0'); - t.format('"A-"0;[<>11]"B-"0;"C-"0', 10, 'A-10'); - t.format('"A-"0;[<>11]"B-"0;"C-"0', 1, 'A-1'); - t.format('"A-"0;[<>11]"B-"0;"C-"0', -10, '-B-10'); - t.format('"A-"0;[<>11]"B-"0;"C-"0', -1, '-B-1'); - t.format('"A-"0;[<>11]"B-"0;"C-"0', 0, 'B-0'); - - t.end(); -}); diff --git a/test/conditionals.spec.ts b/test/conditionals.spec.ts new file mode 100644 index 0000000..cec19fc --- /dev/null +++ b/test/conditionals.spec.ts @@ -0,0 +1,577 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('conditional parts', () => { + expect(format('[>=100]"A"0;[<=-100]"B"0;"C"0', 6.3)).toBe('C6'); + expect(format('[>=100]"A"0;[<=-100]"B"0;"C"0', -6.3)).toBe('-C6'); + expect(format('[>=100]"A"0;[<=0]"B"0;"C"0', 6.3)).toBe('C6'); + expect(format('[>=100]"A"0;[<=0]"B"0;"C"0', -6.3)).toBe('-B6'); + expect(format('[>=0]"A"0;[<=-100]"B"0;"C"0', 6.3)).toBe('A6'); + expect(format('[>=0]"A"0;[<=-100]"B"0;"C"0', -6.3)).toBe('-C6'); + expect(format('[>=0]"A"0;[<=0]"B"0;"C"0', 6.3)).toBe('A6'); + expect(format('[>=0]"A"0;[<=0]"B"0;"C"0', -6.3)).toBe('-B6'); + expect(format('[>=0]"A"0;[<=-100]"B"0', 6.3)).toBe('A6'); + expect(format('[>=100]"A"0;[<=0]"B"0', -6.3)).toBe('-B6'); + expect(format('[<=-100]"B"0;"C"0', 6.3)).toBe('C6'); + expect(format('[<=-100]"B"0;"C"0', -6.3)).toBe('C6'); + expect(format('[<=0]"B"0', 6.3)).toBe('6.3'); + expect(format('[<=0]"B"0', -6.3)).toBe('-B6'); + expect(format('[=6.3]"B"0', 6.3)).toBe('B6'); + expect(format('[=6.3]"B"0', -6.3)).toBe('-6.3'); + expect(format('[<>6]"B"0', 6.3)).toBe('B6'); + expect(format('[<>6]"B"0', -6.3)).toBe('-B6'); + expect(format('[=6.3]"B"0', 6.3)).toBe('B6'); + expect(format('[=6.3]"B"0', -6.3)).toBe('-6.3'); + expect(format('[>6]"A"0;[<-6]"B"0', 6.3)).toBe('A6'); + expect(format('[>6]"A"0;[<-6]"B"0', -6.3)).toBe('B6'); + expect(format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"@', 6.3)).toBe('C6'); + expect(format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"@', -6.3)).toBe('-C6'); + expect(format('[>=100]"A"-0;[<=-100]"B"-0;"C"-0', 6.3)).toBe('C-6'); + expect(format('[>=100]"A"-0;[<=-100]"B"-0;"C"-0', -6.3)).toBe('-C-6'); + expect(format('[>=100]"A"-#,##0;[<=0]"B"-#,##0;"C"-#,##0', 6.3)).toBe('C-6'); + expect(format('[>=100]"A"-#,##0;[<=0]"B"-#,##0;"C"-#,##0', -6.3)).toBe('-B-6'); + expect(format('[>=0]"A"-0;[<=-100]"B"-0;"C"-0', 6.3)).toBe('A-6'); + expect(format('[>=0]"A"-0;[<=-100]"B"-0;"C"-0', -6.3)).toBe('-C-6'); + expect(format('[>=0]"A"-0;[<=0]"B"-0;"C"-0', 6.3)).toBe('A-6'); + expect(format('[>=0]"A"-0;[<=0]"B"-0;"C"-0', -6.3)).toBe('-B-6'); + + expect(format('[>=100]"A"0;[<=-100]"B"0', 6.3)).toBe('######'); + expect(format('[>=100]"A"0;[<=-100]"B"0', -6.3)).toBe('######'); + expect(format('[>=0]"A"0;[<=-100]"B"0', -6.3)).toBe('######'); + expect(format('[>=100]"A"0;[<=0]"B"0', 6.3)).toBe('######'); + expect(() => format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"0', '')).toThrow(); + expect(() => format('[>=100]"A"0;[<=-100]"B"0;"C"0;"D"0', '')).toThrow(); + expect(() => format('[<-25]0;[>25]0;0;"foo".#', '')).toThrow(); +}); + +test('conditional parts vs negative numbers', () => { + expect(format('[<>-6]\\A0', -5)).toBe('-A5'); + expect(format('[<-4]\\A0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0', -5)).toBe('A5'); + expect(format('[=-5]\\A0', -5)).toBe('A5'); + expect(format('[>-6]\\A0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0', -5)).toBe('-A5'); + expect(format('[<>-5]\\A0', -5)).toBe('5'); + expect(format('[<-6]\\A0', -5)).toBe('5'); + expect(format('[<=-6]\\A0', -5)).toBe('5'); + expect(format('[=-6]\\A0', -5)).toBe('-5'); + expect(format('[>2]\\A0', -5)).toBe('-5'); + expect(format('[>=2]\\A0', -5)).toBe('-5'); + + expect(format('[<>-6]\\A0;\\B0', -5)).toBe('-A5'); + expect(format('[<-4]\\A0;\\B0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;\\B0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;\\B0', -5)).toBe('A5'); + expect(format('[>-6]\\A0;\\B0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;\\B0', -5)).toBe('-A5'); + expect(format('[<>-5]\\A0;\\B0', -5)).toBe('B5'); + expect(format('[<-6]\\A0;\\B0', -5)).toBe('B5'); + expect(format('[<=-6]\\A0;\\B0', -5)).toBe('B5'); + expect(format('[=-6]\\A0;\\B0', -5)).toBe('-B5'); + expect(format('[>2]\\A0;\\B0', -5)).toBe('-B5'); + expect(format('[>=2]\\A0;\\B0', -5)).toBe('-B5'); + + expect(format('[<>-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<>-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<>-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<>-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<>-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<>-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[<-4]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<-4]\\A0;[<-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<-4]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<-4]\\A0;[=-5]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<-4]\\A0;[>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<-4]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[<-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[=-5]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[<=-4]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[<-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[=-5]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[>-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[=-5]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('A5'); + expect(format('[>-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-A5'); + expect(format('[>=-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-A5'); + + expect(format('[<>-5]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<>-5]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<>-5]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<>-5]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<>-5]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<>-5]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<=-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<=-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<=-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<=-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[<=-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[<=-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[=-6]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[=-6]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[=-6]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[=-6]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[=-6]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[=-6]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>2]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>2]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>2]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>2]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>2]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>2]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>=2]\\A0;[<>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>=2]\\A0;[<-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>=2]\\A0;[<=-4]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>=2]\\A0;[=-5]\\B0;\\C0', -5)).toBe('B5'); + expect(format('[>=2]\\A0;[>-6]\\B0;\\C0', -5)).toBe('-B5'); + expect(format('[>=2]\\A0;[>=-6]\\B0;\\C0', -5)).toBe('-B5'); + + expect(format('[<>-5]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<>-5]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<>-5]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<>-5]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<>-5]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<>-5]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<-6]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[<=-6]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[=-6]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>2]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[<>-5]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[<-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[<=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[=-6]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[>2]\\B0;\\C0', -5)).toBe('-C5'); + expect(format('[>=2]\\A0;[>=2]\\B0;\\C0', -5)).toBe('-C5'); +}); + +test('secondary only conditional', () => { + expect(format('"A-"0;[=-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=-11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=-11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-10]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[=-10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=-10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=-5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=-5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=-2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=-2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=-1]"B-"0;"C-"0', -1)).toBe('B-1'); + expect(format('"A-"0;[=-1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=-0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=-0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=-0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=0]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=0]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=0]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[=0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[=11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[=11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[=11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[=11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[=11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[<-11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<-11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[<-10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<-10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-5]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<-5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<-5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-2]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<-2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<-2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-1]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<-1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<-1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<-0.5]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<-0.5]"B-"0;"C-"0', -1)).toBe('B-1'); + expect(format('"A-"0;[<-0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<0]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<0]"B-"0;"C-"0', -1)).toBe('B-1'); + expect(format('"A-"0;[<0]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<0.5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<0.5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<1]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<1]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<2]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<10]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<11]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[>-11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>-11]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>-10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>-10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>-5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>-5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>-2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>-2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>-1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>-1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>-0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>-0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>-0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>0]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>0]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>0]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[<=-11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<=-11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-10]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<=-10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<=-10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-5]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<=-5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<=-5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-2]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<=-2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<=-2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-1]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<=-1]"B-"0;"C-"0', -1)).toBe('B-1'); + expect(format('"A-"0;[<=-1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=-0.5]"B-"0;"C-"0', -10)).toBe('B-10'); + expect(format('"A-"0;[<=-0.5]"B-"0;"C-"0', -1)).toBe('B-1'); + expect(format('"A-"0;[<=-0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<=0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=0]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=0]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=0]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=0.5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=0.5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=1]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=1]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=2]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=10]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<=11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<=11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<=11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<=11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<=11]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[>=-11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>=-11]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-10]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[>=-10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>=-10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=-5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>=-5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=-2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>=-2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=-1]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[>=-1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=-0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=-0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=-0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=0]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=0]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=0]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[>=0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=0.5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=0.5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=0.5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>=1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=1]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=1]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>=2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=2]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=2]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=2]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>=5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=5]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=5]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=5]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>=10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=10]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=10]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[>=11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[>=11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[>=11]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[>=11]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[>=11]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<>-11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>-11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>-11]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>-10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-10]"B-"0;"C-"0', -10)).toBe('-C-10'); + expect(format('"A-"0;[<>-10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>-10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>-5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>-5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>-5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>-2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-2]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>-2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>-2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>-1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-1]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>-1]"B-"0;"C-"0', -1)).toBe('-C-1'); + expect(format('"A-"0;[<>-1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>-0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>-0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>-0.5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>-0.5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>-0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>0]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>0]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>0]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>0]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>0]"B-"0;"C-"0', 0)).toBe('C-0'); + expect(format('"A-"0;[<>0.5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>0.5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>0.5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>0.5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>0.5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>1]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>1]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>1]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>1]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>1]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>2]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>2]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>2]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>2]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>2]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>5]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>5]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>5]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>5]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>5]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>10]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>10]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>10]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>10]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>10]"B-"0;"C-"0', 0)).toBe('B-0'); + expect(format('"A-"0;[<>11]"B-"0;"C-"0', 10)).toBe('A-10'); + expect(format('"A-"0;[<>11]"B-"0;"C-"0', 1)).toBe('A-1'); + expect(format('"A-"0;[<>11]"B-"0;"C-"0', -10)).toBe('-B-10'); + expect(format('"A-"0;[<>11]"B-"0;"C-"0', -1)).toBe('-B-1'); + expect(format('"A-"0;[<>11]"B-"0;"C-"0', 0)).toBe('B-0'); +}); diff --git a/test/date-parsing-test.js b/test/date-parsing-test.js deleted file mode 100644 index c83821b..0000000 --- a/test/date-parsing-test.js +++ /dev/null @@ -1,167 +0,0 @@ -import test from './utils.js'; - -const date = 3290.1278435; // 1909-01-02 03:04:05.678 - -test('Date specifiers:', t => { - t.format('s', date, '6'); - t.format('ss', date, '06'); - t.format('sss', date, '06'); - t.format('ssss', date, '06'); - t.format('sssss', date, '06'); - t.format('ssssss', date, '06'); - t.format('S', date, '6'); - t.format('SS', date, '06'); - t.format('SSS', date, '06'); - t.format('SSSS', date, '06'); - t.format('SSSSS', date, '06'); - t.format('SSSSSS', date, '06'); - t.format('m', date, '1'); - t.format('mm', date, '01'); - t.format('mmm', date, 'Jan'); - t.format('mmmm', date, 'January'); - t.format('mmmmm', date, 'J'); - t.format('mmmmmm', date, 'January'); - t.format('M', date, '1'); - t.format('MM', date, '01'); - t.format('MMM', date, 'Jan'); - t.format('MMMM', date, 'January'); - t.format('MMMMM', date, 'J'); - t.format('MMMMMM', date, 'January'); - t.format('h', date, '3'); - t.format('hh', date, '03'); - t.format('hhh', date, '03'); - t.format('hhhh', date, '03'); - t.format('hhhhh', date, '03'); - t.format('hhhhhh', date, '03'); - t.format('H', date, '3'); - t.format('HH', date, '03'); - t.format('HHH', date, '03'); - t.format('HHHH', date, '03'); - t.format('HHHHH', date, '03'); - t.format('HHHHHH', date, '03'); - t.format('a', date, 'a'); - t.format('aa', date, 'aa'); - t.format('aaa', date, 'Sat'); - t.format('aaaa', date, 'Saturday'); - t.format('aaaaa', date, 'Saturday'); - t.format('aaaaaa', date, 'Saturday'); - t.format('d', date, '2'); - t.format('dd', date, '02'); - t.format('ddd', date, 'Sat'); - t.format('dddd', date, 'Saturday'); - t.format('ddddd', date, 'Saturday'); - t.format('dddddd', date, 'Saturday'); - t.format('D', date, '2'); - t.format('DD', date, '02'); - t.format('DDD', date, 'Sat'); - t.format('DDDD', date, 'Saturday'); - t.format('DDDDD', date, 'Saturday'); - t.format('DDDDDD', date, 'Saturday'); - t.format('y', date, '09'); - t.format('yy', date, '09'); - t.format('yyy', date, '1909'); - t.format('yyyy', date, '1909'); - t.format('yyyyy', date, '1909'); - t.format('yyyyyy', date, '1909'); - t.format('Y', date, '09'); - t.format('YY', date, '09'); - t.format('YYY', date, '1909'); - t.format('YYYY', date, '1909'); - t.format('YYYYY', date, '1909'); - t.format('YYYYYY', date, '1909'); - // elapsed - t.format('[h]', date, '78963'); - t.format('[hh]', date, '78963'); - t.format('[hhh]', date, '78963'); - t.format('[hhhh]', date, '78963'); - t.format('[hhhhh]', date, '78963'); - t.format('[m]', date, '4737784'); - t.format('[mm]', date, '4737784'); - t.format('[mmm]', date, '4737784'); - t.format('[mmmm]', date, '4737784'); - t.format('[s]', date, '284267046'); - t.format('[ss]', date, '284267046'); - t.format('[sss]', date, '284267046'); - t.format('[ssss]', date, '284267046'); - // fractional seconds - t.format('[s].0', date, '284267045.7'); - t.format('[s].00', date, '284267045.68'); - t.format('[s].000', date, '284267045.678'); - t.format('s.0', date, '5.7'); - t.format('s.00', date, '5.68'); - t.format('s.000', date, '5.678'); - t.end(); -}); - -test('Date specifiers: month vs. minute', t => { - t.format('h', date, '3'); - t.format('m', date, '1'); - t.format('s', date, '6'); - - t.format('h-h', date, '3-3'); - t.format('h-m', date, '3-4'); - t.format('h-s', date, '3-6'); - t.format('m-h', date, '1-3'); - t.format('m-m', date, '1-1'); - t.format('m-s', date, '4-6'); - t.format('s-h', date, '6-3'); - t.format('s-m', date, '6-4'); - t.format('s-s', date, '6-6'); - - t.format('h-h-m', date, '3-3-4'); - t.format('h-h-s', date, '3-3-6'); - t.format('h-m-h', date, '3-4-3'); - t.format('h-m-m', date, '3-4-1'); - t.format('h-m-s', date, '3-4-6'); - t.format('h-s-h', date, '3-6-3'); - t.format('h-s-m', date, '3-6-4'); - t.format('h-s-s', date, '3-6-6'); - t.format('m-h-h', date, '1-3-3'); - t.format('m-h-m', date, '1-3-4'); - t.format('m-h-s', date, '1-3-6'); - t.format('m-m-h', date, '1-1-3'); - t.format('m-m-m', date, '1-1-1'); - t.format('m-m-s', date, '1-4-6'); - t.format('m-s-h', date, '4-6-3'); - t.format('m-s-m', date, '4-6-1'); - t.format('m-s-s', date, '4-6-6'); - t.format('s-h-h', date, '6-3-3'); - t.format('s-h-m', date, '6-3-4'); - t.format('s-h-s', date, '6-3-6'); - t.format('s-m-h', date, '6-4-3'); - t.format('s-m-m', date, '6-4-1'); - t.format('s-m-s', date, '6-4-6'); - t.format('s-s-h', date, '6-6-3'); - t.format('s-s-m', date, '6-6-4'); - - t.format('h-m-m-s', date, '3-4-4-6'); - t.format('h-m-s-m', date, '3-4-6-1'); - t.format('h-s-m-m', date, '3-6-4-1'); - t.format('m-h-m-s', date, '1-3-4-6'); - t.format('m-h-s-m', date, '1-3-6-4'); - t.format('m-m-h-s', date, '1-1-3-6'); - t.format('m-m-s-h', date, '1-4-6-3'); - t.format('m-s-h-m', date, '4-6-3-4'); - t.format('m-s-m-h', date, '4-6-1-3'); - t.format('s-h-m-m', date, '6-3-4-1'); - t.format('s-m-h-m', date, '6-4-3-4'); - t.format('s-m-m-h', date, '6-4-1-3'); - - t.format('y-m-d', date, '09-1-2'); - t.format('d-m-y', date, '2-1-09'); - t.format('yy-mm-dd', date, '09-01-02'); - - t.format('yyyy', date, '1909'); - t.format('yyyy-mm', date, '1909-01'); - t.format('yyyy-mm-dd', date, '1909-01-02'); - t.format('yyyy-mm-dd\\Thh', date, '1909-01-02T03'); - t.format('yyyy-mm-dd\\Thh-mm', date, '1909-01-02T03-04'); - t.format('yyyy-mm-dd\\Thh-mm-ss', date, '1909-01-02T03-04-06'); - t.format('yyyy-mm-dd\\Thh-mm-ss.000', date, '1909-01-02T03-04-05.678'); - - t.format('yyyy-mm-dd\\Thh-mm-ss.000', 60, '1900-02-29T00-00-00.000'); - t.format('yyyy-mm-dd\\Thh-mm-ss.000', 61, '1900-03-01T00-00-00.000'); - - t.end(); -}); - diff --git a/test/date-parsing.spec.ts b/test/date-parsing.spec.ts new file mode 100644 index 0000000..f555450 --- /dev/null +++ b/test/date-parsing.spec.ts @@ -0,0 +1,165 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +const date = 3290.1278435; // 1909-01-02 03:04:05.678 + +test('Date specifiers:', () => { + expect(format('s', date)).toBe('6'); + expect(format('ss', date)).toBe('06'); + expect(format('sss', date)).toBe('06'); + expect(format('ssss', date)).toBe('06'); + expect(format('sssss', date)).toBe('06'); + expect(format('ssssss', date)).toBe('06'); + expect(format('S', date)).toBe('6'); + expect(format('SS', date)).toBe('06'); + expect(format('SSS', date)).toBe('06'); + expect(format('SSSS', date)).toBe('06'); + expect(format('SSSSS', date)).toBe('06'); + expect(format('SSSSSS', date)).toBe('06'); + expect(format('m', date)).toBe('1'); + expect(format('mm', date)).toBe('01'); + expect(format('mmm', date)).toBe('Jan'); + expect(format('mmmm', date)).toBe('January'); + expect(format('mmmmm', date)).toBe('J'); + expect(format('mmmmmm', date)).toBe('January'); + expect(format('M', date)).toBe('1'); + expect(format('MM', date)).toBe('01'); + expect(format('MMM', date)).toBe('Jan'); + expect(format('MMMM', date)).toBe('January'); + expect(format('MMMMM', date)).toBe('J'); + expect(format('MMMMMM', date)).toBe('January'); + expect(format('h', date)).toBe('3'); + expect(format('hh', date)).toBe('03'); + expect(format('hhh', date)).toBe('03'); + expect(format('hhhh', date)).toBe('03'); + expect(format('hhhhh', date)).toBe('03'); + expect(format('hhhhhh', date)).toBe('03'); + expect(format('H', date)).toBe('3'); + expect(format('HH', date)).toBe('03'); + expect(format('HHH', date)).toBe('03'); + expect(format('HHHH', date)).toBe('03'); + expect(format('HHHHH', date)).toBe('03'); + expect(format('HHHHHH', date)).toBe('03'); + expect(format('a', date)).toBe('a'); + expect(format('aa', date)).toBe('aa'); + expect(format('aaa', date)).toBe('Sat'); + expect(format('aaaa', date)).toBe('Saturday'); + expect(format('aaaaa', date)).toBe('Saturday'); + expect(format('aaaaaa', date)).toBe('Saturday'); + expect(format('d', date)).toBe('2'); + expect(format('dd', date)).toBe('02'); + expect(format('ddd', date)).toBe('Sat'); + expect(format('dddd', date)).toBe('Saturday'); + expect(format('ddddd', date)).toBe('Saturday'); + expect(format('dddddd', date)).toBe('Saturday'); + expect(format('D', date)).toBe('2'); + expect(format('DD', date)).toBe('02'); + expect(format('DDD', date)).toBe('Sat'); + expect(format('DDDD', date)).toBe('Saturday'); + expect(format('DDDDD', date)).toBe('Saturday'); + expect(format('DDDDDD', date)).toBe('Saturday'); + expect(format('y', date)).toBe('09'); + expect(format('yy', date)).toBe('09'); + expect(format('yyy', date)).toBe('1909'); + expect(format('yyyy', date)).toBe('1909'); + expect(format('yyyyy', date)).toBe('1909'); + expect(format('yyyyyy', date)).toBe('1909'); + expect(format('Y', date)).toBe('09'); + expect(format('YY', date)).toBe('09'); + expect(format('YYY', date)).toBe('1909'); + expect(format('YYYY', date)).toBe('1909'); + expect(format('YYYYY', date)).toBe('1909'); + expect(format('YYYYYY', date)).toBe('1909'); + // elapsed + expect(format('[h]', date)).toBe('78963'); + expect(format('[hh]', date)).toBe('78963'); + expect(format('[hhh]', date)).toBe('78963'); + expect(format('[hhhh]', date)).toBe('78963'); + expect(format('[hhhhh]', date)).toBe('78963'); + expect(format('[m]', date)).toBe('4737784'); + expect(format('[mm]', date)).toBe('4737784'); + expect(format('[mmm]', date)).toBe('4737784'); + expect(format('[mmmm]', date)).toBe('4737784'); + expect(format('[s]', date)).toBe('284267046'); + expect(format('[ss]', date)).toBe('284267046'); + expect(format('[sss]', date)).toBe('284267046'); + expect(format('[ssss]', date)).toBe('284267046'); + // fractional seconds + expect(format('[s].0', date)).toBe('284267045.7'); + expect(format('[s].00', date)).toBe('284267045.68'); + expect(format('[s].000', date)).toBe('284267045.678'); + expect(format('s.0', date)).toBe('5.7'); + expect(format('s.00', date)).toBe('5.68'); + expect(format('s.000', date)).toBe('5.678'); +}); + +test('Date specifiers: month vs. minute', () => { + expect(format('h', date)).toBe('3'); + expect(format('m', date)).toBe('1'); + expect(format('s', date)).toBe('6'); + + expect(format('h-h', date)).toBe('3-3'); + expect(format('h-m', date)).toBe('3-4'); + expect(format('h-s', date)).toBe('3-6'); + expect(format('m-h', date)).toBe('1-3'); + expect(format('m-m', date)).toBe('1-1'); + expect(format('m-s', date)).toBe('4-6'); + expect(format('s-h', date)).toBe('6-3'); + expect(format('s-m', date)).toBe('6-4'); + expect(format('s-s', date)).toBe('6-6'); + + expect(format('h-h-m', date)).toBe('3-3-4'); + expect(format('h-h-s', date)).toBe('3-3-6'); + expect(format('h-m-h', date)).toBe('3-4-3'); + expect(format('h-m-m', date)).toBe('3-4-1'); + expect(format('h-m-s', date)).toBe('3-4-6'); + expect(format('h-s-h', date)).toBe('3-6-3'); + expect(format('h-s-m', date)).toBe('3-6-4'); + expect(format('h-s-s', date)).toBe('3-6-6'); + expect(format('m-h-h', date)).toBe('1-3-3'); + expect(format('m-h-m', date)).toBe('1-3-4'); + expect(format('m-h-s', date)).toBe('1-3-6'); + expect(format('m-m-h', date)).toBe('1-1-3'); + expect(format('m-m-m', date)).toBe('1-1-1'); + expect(format('m-m-s', date)).toBe('1-4-6'); + expect(format('m-s-h', date)).toBe('4-6-3'); + expect(format('m-s-m', date)).toBe('4-6-1'); + expect(format('m-s-s', date)).toBe('4-6-6'); + expect(format('s-h-h', date)).toBe('6-3-3'); + expect(format('s-h-m', date)).toBe('6-3-4'); + expect(format('s-h-s', date)).toBe('6-3-6'); + expect(format('s-m-h', date)).toBe('6-4-3'); + expect(format('s-m-m', date)).toBe('6-4-1'); + expect(format('s-m-s', date)).toBe('6-4-6'); + expect(format('s-s-h', date)).toBe('6-6-3'); + expect(format('s-s-m', date)).toBe('6-6-4'); + + expect(format('h-m-m-s', date)).toBe('3-4-4-6'); + expect(format('h-m-s-m', date)).toBe('3-4-6-1'); + expect(format('h-s-m-m', date)).toBe('3-6-4-1'); + expect(format('m-h-m-s', date)).toBe('1-3-4-6'); + expect(format('m-h-s-m', date)).toBe('1-3-6-4'); + expect(format('m-m-h-s', date)).toBe('1-1-3-6'); + expect(format('m-m-s-h', date)).toBe('1-4-6-3'); + expect(format('m-s-h-m', date)).toBe('4-6-3-4'); + expect(format('m-s-m-h', date)).toBe('4-6-1-3'); + expect(format('s-h-m-m', date)).toBe('6-3-4-1'); + expect(format('s-m-h-m', date)).toBe('6-4-3-4'); + expect(format('s-m-m-h', date)).toBe('6-4-1-3'); + + expect(format('y-m-d', date)).toBe('09-1-2'); + expect(format('d-m-y', date)).toBe('2-1-09'); + expect(format('yy-mm-dd', date)).toBe('09-01-02'); + + expect(format('yyyy', date)).toBe('1909'); + expect(format('yyyy-mm', date)).toBe('1909-01'); + expect(format('yyyy-mm-dd', date)).toBe('1909-01-02'); + expect(format('yyyy-mm-dd\\Thh', date)).toBe('1909-01-02T03'); + expect(format('yyyy-mm-dd\\Thh-mm', date)).toBe('1909-01-02T03-04'); + expect(format('yyyy-mm-dd\\Thh-mm-ss', date)).toBe('1909-01-02T03-04-06'); + expect(format('yyyy-mm-dd\\Thh-mm-ss.000', date)).toBe('1909-01-02T03-04-05.678'); + + expect(format('yyyy-mm-dd\\Thh-mm-ss.000', 60)).toBe('1900-02-29T00-00-00.000'); + expect(format('yyyy-mm-dd\\Thh-mm-ss.000', 61)).toBe('1900-03-01T00-00-00.000'); +}); + diff --git a/test/datebounds-test.js b/test/datebounds-test.js deleted file mode 100644 index bf93c6b..0000000 --- a/test/datebounds-test.js +++ /dev/null @@ -1,243 +0,0 @@ -import test from './utils.js'; -import { format } from '../lib/index.js'; - -const ISODATE = 'yyyy-mm-dd'; -const ISODATETIME = 'yyyy-mm-dd\\Thh:mm:ss'; - -test('dateSpanLarge: OFF', t => { - const opts = { leap1900: false, dateSpanLarge: false, dateErrorThrows: true }; - - t.throws(() => format(ISODATE, -0.1, opts), '-0.1'); - t.throws(() => format(ISODATE, -0.01, opts), '-0.01'); - t.throws(() => format(ISODATE, -0.001, opts), '-0.001'); - t.throws(() => format(ISODATE, -0.0001, opts), '-0.0001'); - t.throws(() => format(ISODATE, -0.00001, opts), '-0.00001'); - t.throws(() => format(ISODATE, -0.000001, opts), '-0.000001'); - t.equal(format(ISODATE, 0, opts), '1899-12-30', '0'); - - t.throws(() => format(ISODATE, 2958465.99999422, opts), '2958465.99999422'); - t.equal(format(ISODATE, 2958465.99999421, opts), '9999-12-31', '2958465.99999421'); - - const dt = 'yyyy-mm-dd/hh:mm:ss'; - t.throws(() => format(dt, 2958465.99999422, opts), '2958465.99999422'); - t.equal(format(dt, 2958465.99999421, opts), '9999-12-31/23:59:59', '2958465.99999421'); - - const dt0 = 'yyyy-mm-dd/hh:mm:ss.0'; - t.throws(() => format(dt0, 2958465.99999943, opts), '2958465.99999943'); - t.equal(format(dt0, 2958465.99999942, opts), '9999-12-31/23:59:59.9', '2958465.99999942'); - - const dt00 = ISODATE + '/hh:mm:ss.00'; - t.throws(() => format(dt00, 2958465.99999995, opts), '2958465.99999995'); - t.equal(format(dt00, 2958465.99999994, opts), '9999-12-31/23:59:59.99', '2958465.99999994'); - - const dt000 = ISODATE + '/hh:mm:ss.000'; - // Excel can't really represent 2958465.999999995 so this never happens, but: - t.throws(() => format(dt000, 2958465.999999995, opts), '2958465.99999999'); - t.equal(format(dt000, 2958465.99999999, opts), '9999-12-31/23:59:59.999', '2958465.99999999'); - - t.end(); -}); - -test('dateSpanLarge: ON', t => { - t.format(ISODATETIME, 0.1, '1899-12-30T02:24:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.00001157407, '1899-12-29T23:59:59', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, 0, '1899-12-30T00:00:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.1, '1899-12-29T21:36:00', { leap1900: false, dateSpanLarge: true }); - - t.format('[s]', -0.1, '-8640', { leap1900: false, dateSpanLarge: true }); - t.format('[m]', -0.1, '-144', { leap1900: false, dateSpanLarge: true }); - t.format('[h]', -0.1, '-2', { leap1900: false, dateSpanLarge: true }); - t.format('[s]', -2, '-172800', { leap1900: false, dateSpanLarge: true }); - t.format('[m]', -2, '-2880', { leap1900: false, dateSpanLarge: true }); - t.format('[h]', -2, '-48', { leap1900: false, dateSpanLarge: true }); - - t.format(ISODATETIME, -0.2, '1899-12-29T19:12:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.3, '1899-12-29T16:48:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.4, '1899-12-29T14:24:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.5, '1899-12-29T12:00:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.6, '1899-12-29T09:36:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.7, '1899-12-29T07:12:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.8, '1899-12-29T04:48:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -0.9, '1899-12-29T02:24:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1, '1899-12-29T00:00:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.1, '1899-12-28T21:36:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.2, '1899-12-28T19:12:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.3, '1899-12-28T16:48:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.4, '1899-12-28T14:24:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.5, '1899-12-28T12:00:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.6, '1899-12-28T09:36:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.7, '1899-12-28T07:12:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.8, '1899-12-28T04:48:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -1.9, '1899-12-28T02:24:00', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, -2, '1899-12-28T00:00:00', { leap1900: false, dateSpanLarge: true }); - - // negative dates should not be affected by the leap year bug - t.format(ISODATETIME, -0.2, '1899-12-29T19:12:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.3, '1899-12-29T16:48:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.4, '1899-12-29T14:24:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.5, '1899-12-29T12:00:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.6, '1899-12-29T09:36:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.7, '1899-12-29T07:12:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.8, '1899-12-29T04:48:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -0.9, '1899-12-29T02:24:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1, '1899-12-29T00:00:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.1, '1899-12-28T21:36:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.2, '1899-12-28T19:12:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.3, '1899-12-28T16:48:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.4, '1899-12-28T14:24:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.5, '1899-12-28T12:00:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.6, '1899-12-28T09:36:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.7, '1899-12-28T07:12:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.8, '1899-12-28T04:48:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -1.9, '1899-12-28T02:24:00', { dateSpanLarge: true }); - t.format(ISODATETIME, -2, '1899-12-28T00:00:00', { dateSpanLarge: true }); - - t.format(ISODATE, -45000, '1776-10-15', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATE, 35830289, '99999-12-30', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATE, 35830290, '99999-12-31', { leap1900: false, dateSpanLarge: true }); - t.format(ISODATETIME, 35830290.9, '99999-12-31T21:36:00', { leap1900: false, dateSpanLarge: true }); - // out of bounds - t.format(ISODATETIME, 35830291, '######', { leap1900: false, dateSpanLarge: true, dateErrorNumber: false }); - t.format(ISODATETIME, 35830291, '35830291', { leap1900: false, dateSpanLarge: true, dateErrorNumber: true }); - - // Google Sheets emits "00-1-01-02" for TEXT(-694324, ISODATE) - // this is does not seem all that useful to anyone - t.format(ISODATE, -694323, '-0001-01-02', { leap1900: false, dateSpanLarge: true, dateErrorNumber: false }); - t.format(ISODATE, -694324, '-0001-01-01', { leap1900: false, dateSpanLarge: true, dateErrorNumber: false }); - t.format(ISODATETIME, -694324.1, '######', { leap1900: false, dateSpanLarge: true, dateErrorNumber: false }); - t.format(ISODATETIME, -694324.1, '-694324.1', { leap1900: false, dateSpanLarge: true, dateErrorNumber: true }); - - t.end(); -}); - -test('Excel leap 1900 bug: ON', t => { - t.format(ISODATE, 61, '1900-03-01', { leap1900: true }); - t.format(ISODATE, 60, '1900-02-29', { leap1900: true }); - t.format(ISODATE, 59, '1900-02-28', { leap1900: true }); - t.format(ISODATE, 58, '1900-02-27', { leap1900: true }); - t.format(ISODATE, 57, '1900-02-26', { leap1900: true }); - t.format(ISODATE, 56, '1900-02-25', { leap1900: true }); - t.format(ISODATE, 55, '1900-02-24', { leap1900: true }); - t.format(ISODATE, 54, '1900-02-23', { leap1900: true }); - t.format(ISODATE, 53, '1900-02-22', { leap1900: true }); - t.format(ISODATE, 52, '1900-02-21', { leap1900: true }); - t.format(ISODATE, 51, '1900-02-20', { leap1900: true }); - t.format(ISODATE, 50, '1900-02-19', { leap1900: true }); - t.format(ISODATE, 49, '1900-02-18', { leap1900: true }); - t.format(ISODATE, 48, '1900-02-17', { leap1900: true }); - t.format(ISODATE, 47, '1900-02-16', { leap1900: true }); - t.format(ISODATE, 46, '1900-02-15', { leap1900: true }); - t.format(ISODATE, 45, '1900-02-14', { leap1900: true }); - t.format(ISODATE, 44, '1900-02-13', { leap1900: true }); - t.format(ISODATE, 43, '1900-02-12', { leap1900: true }); - t.format(ISODATE, 42, '1900-02-11', { leap1900: true }); - t.format(ISODATE, 41, '1900-02-10', { leap1900: true }); - t.format(ISODATE, 40, '1900-02-09', { leap1900: true }); - t.format(ISODATE, 39, '1900-02-08', { leap1900: true }); - t.format(ISODATE, 38, '1900-02-07', { leap1900: true }); - t.format(ISODATE, 37, '1900-02-06', { leap1900: true }); - t.format(ISODATE, 36, '1900-02-05', { leap1900: true }); - t.format(ISODATE, 35, '1900-02-04', { leap1900: true }); - t.format(ISODATE, 34, '1900-02-03', { leap1900: true }); - t.format(ISODATE, 33, '1900-02-02', { leap1900: true }); - t.format(ISODATE, 32, '1900-02-01', { leap1900: true }); - t.format(ISODATE, 31, '1900-01-31', { leap1900: true }); - t.format(ISODATE, 30, '1900-01-30', { leap1900: true }); - t.format(ISODATE, 29, '1900-01-29', { leap1900: true }); - t.format(ISODATE, 28, '1900-01-28', { leap1900: true }); - t.format(ISODATE, 27, '1900-01-27', { leap1900: true }); - t.format(ISODATE, 26, '1900-01-26', { leap1900: true }); - t.format(ISODATE, 25, '1900-01-25', { leap1900: true }); - t.format(ISODATE, 24, '1900-01-24', { leap1900: true }); - t.format(ISODATE, 23, '1900-01-23', { leap1900: true }); - t.format(ISODATE, 22, '1900-01-22', { leap1900: true }); - t.format(ISODATE, 21, '1900-01-21', { leap1900: true }); - t.format(ISODATE, 20, '1900-01-20', { leap1900: true }); - t.format(ISODATE, 19, '1900-01-19', { leap1900: true }); - t.format(ISODATE, 18, '1900-01-18', { leap1900: true }); - t.format(ISODATE, 17, '1900-01-17', { leap1900: true }); - t.format(ISODATE, 16, '1900-01-16', { leap1900: true }); - t.format(ISODATE, 15, '1900-01-15', { leap1900: true }); - t.format(ISODATE, 14, '1900-01-14', { leap1900: true }); - t.format(ISODATE, 13, '1900-01-13', { leap1900: true }); - t.format(ISODATE, 12, '1900-01-12', { leap1900: true }); - t.format(ISODATE, 11, '1900-01-11', { leap1900: true }); - t.format(ISODATE, 10, '1900-01-10', { leap1900: true }); - t.format(ISODATE, 9, '1900-01-09', { leap1900: true }); - t.format(ISODATE, 8, '1900-01-08', { leap1900: true }); - t.format(ISODATE, 7, '1900-01-07', { leap1900: true }); - t.format(ISODATE, 6, '1900-01-06', { leap1900: true }); - t.format(ISODATE, 5, '1900-01-05', { leap1900: true }); - t.format(ISODATE, 4, '1900-01-04', { leap1900: true }); - t.format(ISODATE, 3, '1900-01-03', { leap1900: true }); - t.format(ISODATE, 2, '1900-01-02', { leap1900: true }); - t.format(ISODATE, 1, '1900-01-01', { leap1900: true }); - t.format(ISODATE, 0, '1900-01-00', { leap1900: true }); - t.end(); -}); - -test('Excel 1900 bug: OFF', t => { - t.format(ISODATE, 61, '1900-03-01', { leap1900: false }); - t.format(ISODATE, 60, '1900-02-28', { leap1900: false }); - t.format(ISODATE, 59, '1900-02-27', { leap1900: false }); - t.format(ISODATE, 58, '1900-02-26', { leap1900: false }); - t.format(ISODATE, 57, '1900-02-25', { leap1900: false }); - t.format(ISODATE, 56, '1900-02-24', { leap1900: false }); - t.format(ISODATE, 55, '1900-02-23', { leap1900: false }); - t.format(ISODATE, 54, '1900-02-22', { leap1900: false }); - t.format(ISODATE, 53, '1900-02-21', { leap1900: false }); - t.format(ISODATE, 52, '1900-02-20', { leap1900: false }); - t.format(ISODATE, 51, '1900-02-19', { leap1900: false }); - t.format(ISODATE, 50, '1900-02-18', { leap1900: false }); - t.format(ISODATE, 49, '1900-02-17', { leap1900: false }); - t.format(ISODATE, 48, '1900-02-16', { leap1900: false }); - t.format(ISODATE, 47, '1900-02-15', { leap1900: false }); - t.format(ISODATE, 46, '1900-02-14', { leap1900: false }); - t.format(ISODATE, 45, '1900-02-13', { leap1900: false }); - t.format(ISODATE, 44, '1900-02-12', { leap1900: false }); - t.format(ISODATE, 43, '1900-02-11', { leap1900: false }); - t.format(ISODATE, 42, '1900-02-10', { leap1900: false }); - t.format(ISODATE, 41, '1900-02-09', { leap1900: false }); - t.format(ISODATE, 40, '1900-02-08', { leap1900: false }); - t.format(ISODATE, 39, '1900-02-07', { leap1900: false }); - t.format(ISODATE, 38, '1900-02-06', { leap1900: false }); - t.format(ISODATE, 37, '1900-02-05', { leap1900: false }); - t.format(ISODATE, 36, '1900-02-04', { leap1900: false }); - t.format(ISODATE, 35, '1900-02-03', { leap1900: false }); - t.format(ISODATE, 34, '1900-02-02', { leap1900: false }); - t.format(ISODATE, 33, '1900-02-01', { leap1900: false }); - t.format(ISODATE, 32, '1900-01-31', { leap1900: false }); - t.format(ISODATE, 31, '1900-01-30', { leap1900: false }); - t.format(ISODATE, 30, '1900-01-29', { leap1900: false }); - t.format(ISODATE, 29, '1900-01-28', { leap1900: false }); - t.format(ISODATE, 28, '1900-01-27', { leap1900: false }); - t.format(ISODATE, 27, '1900-01-26', { leap1900: false }); - t.format(ISODATE, 26, '1900-01-25', { leap1900: false }); - t.format(ISODATE, 25, '1900-01-24', { leap1900: false }); - t.format(ISODATE, 24, '1900-01-23', { leap1900: false }); - t.format(ISODATE, 23, '1900-01-22', { leap1900: false }); - t.format(ISODATE, 22, '1900-01-21', { leap1900: false }); - t.format(ISODATE, 21, '1900-01-20', { leap1900: false }); - t.format(ISODATE, 20, '1900-01-19', { leap1900: false }); - t.format(ISODATE, 19, '1900-01-18', { leap1900: false }); - t.format(ISODATE, 18, '1900-01-17', { leap1900: false }); - t.format(ISODATE, 17, '1900-01-16', { leap1900: false }); - t.format(ISODATE, 16, '1900-01-15', { leap1900: false }); - t.format(ISODATE, 15, '1900-01-14', { leap1900: false }); - t.format(ISODATE, 14, '1900-01-13', { leap1900: false }); - t.format(ISODATE, 13, '1900-01-12', { leap1900: false }); - t.format(ISODATE, 12, '1900-01-11', { leap1900: false }); - t.format(ISODATE, 11, '1900-01-10', { leap1900: false }); - t.format(ISODATE, 10, '1900-01-09', { leap1900: false }); - t.format(ISODATE, 9, '1900-01-08', { leap1900: false }); - t.format(ISODATE, 8, '1900-01-07', { leap1900: false }); - t.format(ISODATE, 7, '1900-01-06', { leap1900: false }); - t.format(ISODATE, 6, '1900-01-05', { leap1900: false }); - t.format(ISODATE, 5, '1900-01-04', { leap1900: false }); - t.format(ISODATE, 4, '1900-01-03', { leap1900: false }); - t.format(ISODATE, 3, '1900-01-02', { leap1900: false }); - t.format(ISODATE, 2, '1900-01-01', { leap1900: false }); - t.format(ISODATE, 1, '1899-12-31', { leap1900: false }); - t.format(ISODATE, 0, '1899-12-30', { leap1900: false }); - t.end(); -}); diff --git a/test/datebounds.spec.ts b/test/datebounds.spec.ts new file mode 100644 index 0000000..41e6d05 --- /dev/null +++ b/test/datebounds.spec.ts @@ -0,0 +1,237 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +const ISODATE = 'yyyy-mm-dd'; +const ISODATETIME = 'yyyy-mm-dd\\Thh:mm:ss'; + +test('dateSpanLarge: OFF', () => { + const opts = { leap1900: false, dateSpanLarge: false, dateErrorThrows: true }; + + expect(() => format(ISODATE, -0.1, opts), '-0.1').toThrow(); + expect(() => format(ISODATE, -0.01, opts), '-0.01').toThrow(); + expect(() => format(ISODATE, -0.001, opts), '-0.001').toThrow(); + expect(() => format(ISODATE, -0.0001, opts), '-0.0001').toThrow(); + expect(() => format(ISODATE, -0.00001, opts), '-0.00001').toThrow(); + expect(() => format(ISODATE, -0.000001, opts), '-0.000001').toThrow(); + expect(format(ISODATE, 0, opts), '0').toBe('1899-12-30'); + + expect(() => format(ISODATE, 2958465.99999422, opts), '2958465.99999422').toThrow(); + expect(format(ISODATE, 2958465.99999421, opts), '2958465.99999421').toBe('9999-12-31'); + + const dt = 'yyyy-mm-dd/hh:mm:ss'; + expect(() => format(dt, 2958465.99999422, opts), '2958465.99999422').toThrow(); + expect(format(dt, 2958465.99999421, opts), '2958465.99999421').toBe('9999-12-31/23:59:59'); + + const dt0 = 'yyyy-mm-dd/hh:mm:ss.0'; + expect(() => format(dt0, 2958465.99999943, opts), '2958465.99999943').toThrow(); + expect(format(dt0, 2958465.99999942, opts), '2958465.99999942').toBe('9999-12-31/23:59:59.9'); + + const dt00 = ISODATE + '/hh:mm:ss.00'; + expect(() => format(dt00, 2958465.99999995, opts), '2958465.99999995').toThrow(); + expect(format(dt00, 2958465.99999994, opts), '2958465.99999994').toBe('9999-12-31/23:59:59.99'); + + const dt000 = ISODATE + '/hh:mm:ss.000'; + // Excel can't really represent 2958465.999999995 so this never happens, but: + expect(() => format(dt000, 2958465.999999995, opts), '2958465.99999999').toThrow(); + expect(format(dt000, 2958465.99999999, opts), '2958465.99999999').toBe('9999-12-31/23:59:59.999'); +}); + +test('dateSpanLarge: ON', () => { + expect(format(ISODATETIME, 0.1, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-30T02:24:00'); + expect(format(ISODATETIME, -0.00001157407, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T23:59:59'); + expect(format(ISODATETIME, 0, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-30T00:00:00'); + expect(format(ISODATETIME, -0.1, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T21:36:00'); + + expect(format('[s]', -0.1, { leap1900: false, dateSpanLarge: true })).toBe('-8640'); + expect(format('[m]', -0.1, { leap1900: false, dateSpanLarge: true })).toBe('-144'); + expect(format('[h]', -0.1, { leap1900: false, dateSpanLarge: true })).toBe('-2'); + expect(format('[s]', -2, { leap1900: false, dateSpanLarge: true })).toBe('-172800'); + expect(format('[m]', -2, { leap1900: false, dateSpanLarge: true })).toBe('-2880'); + expect(format('[h]', -2, { leap1900: false, dateSpanLarge: true })).toBe('-48'); + + expect(format(ISODATETIME, -0.2, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T19:12:00'); + expect(format(ISODATETIME, -0.3, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T16:48:00'); + expect(format(ISODATETIME, -0.4, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T14:24:00'); + expect(format(ISODATETIME, -0.5, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T12:00:00'); + expect(format(ISODATETIME, -0.6, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T09:36:00'); + expect(format(ISODATETIME, -0.7, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T07:12:00'); + expect(format(ISODATETIME, -0.8, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T04:48:00'); + expect(format(ISODATETIME, -0.9, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T02:24:00'); + expect(format(ISODATETIME, -1, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-29T00:00:00'); + expect(format(ISODATETIME, -1.1, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T21:36:00'); + expect(format(ISODATETIME, -1.2, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T19:12:00'); + expect(format(ISODATETIME, -1.3, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T16:48:00'); + expect(format(ISODATETIME, -1.4, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T14:24:00'); + expect(format(ISODATETIME, -1.5, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T12:00:00'); + expect(format(ISODATETIME, -1.6, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T09:36:00'); + expect(format(ISODATETIME, -1.7, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T07:12:00'); + expect(format(ISODATETIME, -1.8, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T04:48:00'); + expect(format(ISODATETIME, -1.9, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T02:24:00'); + expect(format(ISODATETIME, -2, { leap1900: false, dateSpanLarge: true })).toBe('1899-12-28T00:00:00'); + + // negative dates should not be affected by the leap year bug + expect(format(ISODATETIME, -0.2, { dateSpanLarge: true })).toBe('1899-12-29T19:12:00'); + expect(format(ISODATETIME, -0.3, { dateSpanLarge: true })).toBe('1899-12-29T16:48:00'); + expect(format(ISODATETIME, -0.4, { dateSpanLarge: true })).toBe('1899-12-29T14:24:00'); + expect(format(ISODATETIME, -0.5, { dateSpanLarge: true })).toBe('1899-12-29T12:00:00'); + expect(format(ISODATETIME, -0.6, { dateSpanLarge: true })).toBe('1899-12-29T09:36:00'); + expect(format(ISODATETIME, -0.7, { dateSpanLarge: true })).toBe('1899-12-29T07:12:00'); + expect(format(ISODATETIME, -0.8, { dateSpanLarge: true })).toBe('1899-12-29T04:48:00'); + expect(format(ISODATETIME, -0.9, { dateSpanLarge: true })).toBe('1899-12-29T02:24:00'); + expect(format(ISODATETIME, -1, { dateSpanLarge: true })).toBe('1899-12-29T00:00:00'); + expect(format(ISODATETIME, -1.1, { dateSpanLarge: true })).toBe('1899-12-28T21:36:00'); + expect(format(ISODATETIME, -1.2, { dateSpanLarge: true })).toBe('1899-12-28T19:12:00'); + expect(format(ISODATETIME, -1.3, { dateSpanLarge: true })).toBe('1899-12-28T16:48:00'); + expect(format(ISODATETIME, -1.4, { dateSpanLarge: true })).toBe('1899-12-28T14:24:00'); + expect(format(ISODATETIME, -1.5, { dateSpanLarge: true })).toBe('1899-12-28T12:00:00'); + expect(format(ISODATETIME, -1.6, { dateSpanLarge: true })).toBe('1899-12-28T09:36:00'); + expect(format(ISODATETIME, -1.7, { dateSpanLarge: true })).toBe('1899-12-28T07:12:00'); + expect(format(ISODATETIME, -1.8, { dateSpanLarge: true })).toBe('1899-12-28T04:48:00'); + expect(format(ISODATETIME, -1.9, { dateSpanLarge: true })).toBe('1899-12-28T02:24:00'); + expect(format(ISODATETIME, -2, { dateSpanLarge: true })).toBe('1899-12-28T00:00:00'); + + expect(format(ISODATE, -45000, { leap1900: false, dateSpanLarge: true })).toBe('1776-10-15'); + expect(format(ISODATE, 35830289, { leap1900: false, dateSpanLarge: true })).toBe('99999-12-30'); + expect(format(ISODATE, 35830290, { leap1900: false, dateSpanLarge: true })).toBe('99999-12-31'); + expect(format(ISODATETIME, 35830290.9, { leap1900: false, dateSpanLarge: true })).toBe('99999-12-31T21:36:00'); + // out of bounds + expect(format(ISODATETIME, 35830291, { leap1900: false, dateSpanLarge: true, dateErrorNumber: false })).toBe('######'); + expect(format(ISODATETIME, 35830291, { leap1900: false, dateSpanLarge: true, dateErrorNumber: true })).toBe('35830291'); + + // Google Sheets emits "00-1-01-02" for TEXT(-694324, ISODATE) + // this is does not seem all that useful to anyone + expect(format(ISODATE, -694323, { leap1900: false, dateSpanLarge: true, dateErrorNumber: false })).toBe('-0001-01-02'); + expect(format(ISODATE, -694324, { leap1900: false, dateSpanLarge: true, dateErrorNumber: false })).toBe('-0001-01-01'); + expect(format(ISODATETIME, -694324.1, { leap1900: false, dateSpanLarge: true, dateErrorNumber: false })).toBe('######'); + expect(format(ISODATETIME, -694324.1, { leap1900: false, dateSpanLarge: true, dateErrorNumber: true })).toBe('-694324.1'); +}); + +test('Excel leap 1900 bug: ON', () => { + expect(format(ISODATE, 61, { leap1900: true })).toBe('1900-03-01'); + expect(format(ISODATE, 60, { leap1900: true })).toBe('1900-02-29'); + expect(format(ISODATE, 59, { leap1900: true })).toBe('1900-02-28'); + expect(format(ISODATE, 58, { leap1900: true })).toBe('1900-02-27'); + expect(format(ISODATE, 57, { leap1900: true })).toBe('1900-02-26'); + expect(format(ISODATE, 56, { leap1900: true })).toBe('1900-02-25'); + expect(format(ISODATE, 55, { leap1900: true })).toBe('1900-02-24'); + expect(format(ISODATE, 54, { leap1900: true })).toBe('1900-02-23'); + expect(format(ISODATE, 53, { leap1900: true })).toBe('1900-02-22'); + expect(format(ISODATE, 52, { leap1900: true })).toBe('1900-02-21'); + expect(format(ISODATE, 51, { leap1900: true })).toBe('1900-02-20'); + expect(format(ISODATE, 50, { leap1900: true })).toBe('1900-02-19'); + expect(format(ISODATE, 49, { leap1900: true })).toBe('1900-02-18'); + expect(format(ISODATE, 48, { leap1900: true })).toBe('1900-02-17'); + expect(format(ISODATE, 47, { leap1900: true })).toBe('1900-02-16'); + expect(format(ISODATE, 46, { leap1900: true })).toBe('1900-02-15'); + expect(format(ISODATE, 45, { leap1900: true })).toBe('1900-02-14'); + expect(format(ISODATE, 44, { leap1900: true })).toBe('1900-02-13'); + expect(format(ISODATE, 43, { leap1900: true })).toBe('1900-02-12'); + expect(format(ISODATE, 42, { leap1900: true })).toBe('1900-02-11'); + expect(format(ISODATE, 41, { leap1900: true })).toBe('1900-02-10'); + expect(format(ISODATE, 40, { leap1900: true })).toBe('1900-02-09'); + expect(format(ISODATE, 39, { leap1900: true })).toBe('1900-02-08'); + expect(format(ISODATE, 38, { leap1900: true })).toBe('1900-02-07'); + expect(format(ISODATE, 37, { leap1900: true })).toBe('1900-02-06'); + expect(format(ISODATE, 36, { leap1900: true })).toBe('1900-02-05'); + expect(format(ISODATE, 35, { leap1900: true })).toBe('1900-02-04'); + expect(format(ISODATE, 34, { leap1900: true })).toBe('1900-02-03'); + expect(format(ISODATE, 33, { leap1900: true })).toBe('1900-02-02'); + expect(format(ISODATE, 32, { leap1900: true })).toBe('1900-02-01'); + expect(format(ISODATE, 31, { leap1900: true })).toBe('1900-01-31'); + expect(format(ISODATE, 30, { leap1900: true })).toBe('1900-01-30'); + expect(format(ISODATE, 29, { leap1900: true })).toBe('1900-01-29'); + expect(format(ISODATE, 28, { leap1900: true })).toBe('1900-01-28'); + expect(format(ISODATE, 27, { leap1900: true })).toBe('1900-01-27'); + expect(format(ISODATE, 26, { leap1900: true })).toBe('1900-01-26'); + expect(format(ISODATE, 25, { leap1900: true })).toBe('1900-01-25'); + expect(format(ISODATE, 24, { leap1900: true })).toBe('1900-01-24'); + expect(format(ISODATE, 23, { leap1900: true })).toBe('1900-01-23'); + expect(format(ISODATE, 22, { leap1900: true })).toBe('1900-01-22'); + expect(format(ISODATE, 21, { leap1900: true })).toBe('1900-01-21'); + expect(format(ISODATE, 20, { leap1900: true })).toBe('1900-01-20'); + expect(format(ISODATE, 19, { leap1900: true })).toBe('1900-01-19'); + expect(format(ISODATE, 18, { leap1900: true })).toBe('1900-01-18'); + expect(format(ISODATE, 17, { leap1900: true })).toBe('1900-01-17'); + expect(format(ISODATE, 16, { leap1900: true })).toBe('1900-01-16'); + expect(format(ISODATE, 15, { leap1900: true })).toBe('1900-01-15'); + expect(format(ISODATE, 14, { leap1900: true })).toBe('1900-01-14'); + expect(format(ISODATE, 13, { leap1900: true })).toBe('1900-01-13'); + expect(format(ISODATE, 12, { leap1900: true })).toBe('1900-01-12'); + expect(format(ISODATE, 11, { leap1900: true })).toBe('1900-01-11'); + expect(format(ISODATE, 10, { leap1900: true })).toBe('1900-01-10'); + expect(format(ISODATE, 9, { leap1900: true })).toBe('1900-01-09'); + expect(format(ISODATE, 8, { leap1900: true })).toBe('1900-01-08'); + expect(format(ISODATE, 7, { leap1900: true })).toBe('1900-01-07'); + expect(format(ISODATE, 6, { leap1900: true })).toBe('1900-01-06'); + expect(format(ISODATE, 5, { leap1900: true })).toBe('1900-01-05'); + expect(format(ISODATE, 4, { leap1900: true })).toBe('1900-01-04'); + expect(format(ISODATE, 3, { leap1900: true })).toBe('1900-01-03'); + expect(format(ISODATE, 2, { leap1900: true })).toBe('1900-01-02'); + expect(format(ISODATE, 1, { leap1900: true })).toBe('1900-01-01'); + expect(format(ISODATE, 0, { leap1900: true })).toBe('1900-01-00'); +}); + +test('Excel 1900 bug: OFF', () => { + expect(format(ISODATE, 61, { leap1900: false })).toBe('1900-03-01'); + expect(format(ISODATE, 60, { leap1900: false })).toBe('1900-02-28'); + expect(format(ISODATE, 59, { leap1900: false })).toBe('1900-02-27'); + expect(format(ISODATE, 58, { leap1900: false })).toBe('1900-02-26'); + expect(format(ISODATE, 57, { leap1900: false })).toBe('1900-02-25'); + expect(format(ISODATE, 56, { leap1900: false })).toBe('1900-02-24'); + expect(format(ISODATE, 55, { leap1900: false })).toBe('1900-02-23'); + expect(format(ISODATE, 54, { leap1900: false })).toBe('1900-02-22'); + expect(format(ISODATE, 53, { leap1900: false })).toBe('1900-02-21'); + expect(format(ISODATE, 52, { leap1900: false })).toBe('1900-02-20'); + expect(format(ISODATE, 51, { leap1900: false })).toBe('1900-02-19'); + expect(format(ISODATE, 50, { leap1900: false })).toBe('1900-02-18'); + expect(format(ISODATE, 49, { leap1900: false })).toBe('1900-02-17'); + expect(format(ISODATE, 48, { leap1900: false })).toBe('1900-02-16'); + expect(format(ISODATE, 47, { leap1900: false })).toBe('1900-02-15'); + expect(format(ISODATE, 46, { leap1900: false })).toBe('1900-02-14'); + expect(format(ISODATE, 45, { leap1900: false })).toBe('1900-02-13'); + expect(format(ISODATE, 44, { leap1900: false })).toBe('1900-02-12'); + expect(format(ISODATE, 43, { leap1900: false })).toBe('1900-02-11'); + expect(format(ISODATE, 42, { leap1900: false })).toBe('1900-02-10'); + expect(format(ISODATE, 41, { leap1900: false })).toBe('1900-02-09'); + expect(format(ISODATE, 40, { leap1900: false })).toBe('1900-02-08'); + expect(format(ISODATE, 39, { leap1900: false })).toBe('1900-02-07'); + expect(format(ISODATE, 38, { leap1900: false })).toBe('1900-02-06'); + expect(format(ISODATE, 37, { leap1900: false })).toBe('1900-02-05'); + expect(format(ISODATE, 36, { leap1900: false })).toBe('1900-02-04'); + expect(format(ISODATE, 35, { leap1900: false })).toBe('1900-02-03'); + expect(format(ISODATE, 34, { leap1900: false })).toBe('1900-02-02'); + expect(format(ISODATE, 33, { leap1900: false })).toBe('1900-02-01'); + expect(format(ISODATE, 32, { leap1900: false })).toBe('1900-01-31'); + expect(format(ISODATE, 31, { leap1900: false })).toBe('1900-01-30'); + expect(format(ISODATE, 30, { leap1900: false })).toBe('1900-01-29'); + expect(format(ISODATE, 29, { leap1900: false })).toBe('1900-01-28'); + expect(format(ISODATE, 28, { leap1900: false })).toBe('1900-01-27'); + expect(format(ISODATE, 27, { leap1900: false })).toBe('1900-01-26'); + expect(format(ISODATE, 26, { leap1900: false })).toBe('1900-01-25'); + expect(format(ISODATE, 25, { leap1900: false })).toBe('1900-01-24'); + expect(format(ISODATE, 24, { leap1900: false })).toBe('1900-01-23'); + expect(format(ISODATE, 23, { leap1900: false })).toBe('1900-01-22'); + expect(format(ISODATE, 22, { leap1900: false })).toBe('1900-01-21'); + expect(format(ISODATE, 21, { leap1900: false })).toBe('1900-01-20'); + expect(format(ISODATE, 20, { leap1900: false })).toBe('1900-01-19'); + expect(format(ISODATE, 19, { leap1900: false })).toBe('1900-01-18'); + expect(format(ISODATE, 18, { leap1900: false })).toBe('1900-01-17'); + expect(format(ISODATE, 17, { leap1900: false })).toBe('1900-01-16'); + expect(format(ISODATE, 16, { leap1900: false })).toBe('1900-01-15'); + expect(format(ISODATE, 15, { leap1900: false })).toBe('1900-01-14'); + expect(format(ISODATE, 14, { leap1900: false })).toBe('1900-01-13'); + expect(format(ISODATE, 13, { leap1900: false })).toBe('1900-01-12'); + expect(format(ISODATE, 12, { leap1900: false })).toBe('1900-01-11'); + expect(format(ISODATE, 11, { leap1900: false })).toBe('1900-01-10'); + expect(format(ISODATE, 10, { leap1900: false })).toBe('1900-01-09'); + expect(format(ISODATE, 9, { leap1900: false })).toBe('1900-01-08'); + expect(format(ISODATE, 8, { leap1900: false })).toBe('1900-01-07'); + expect(format(ISODATE, 7, { leap1900: false })).toBe('1900-01-06'); + expect(format(ISODATE, 6, { leap1900: false })).toBe('1900-01-05'); + expect(format(ISODATE, 5, { leap1900: false })).toBe('1900-01-04'); + expect(format(ISODATE, 4, { leap1900: false })).toBe('1900-01-03'); + expect(format(ISODATE, 3, { leap1900: false })).toBe('1900-01-02'); + expect(format(ISODATE, 2, { leap1900: false })).toBe('1900-01-01'); + expect(format(ISODATE, 1, { leap1900: false })).toBe('1899-12-31'); + expect(format(ISODATE, 0, { leap1900: false })).toBe('1899-12-30'); +}); diff --git a/test/error-test.js b/test/error-test.js deleted file mode 100644 index 321416f..0000000 --- a/test/error-test.js +++ /dev/null @@ -1,289 +0,0 @@ -import { isDateFormat, isPercentFormat, isTextFormat } from '../lib/index.js'; -import test from './utils.js'; - -const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; - -test('Various format restrictions', t => { - // no more than 4 sections - t.formatInvalid('a;b;c;d;'); - t.formatInvalid('#;#;#;#;#'); - - // no more than 2 conditional sections - t.formatInvalid('[<-2]a;[<-1]b;[>2]c;d;'); - - // can't mix dates and numbers (within a segment) - t.formatInvalid('y 0'); - t.formatInvalid('yyyy 0'); - t.formatInvalid('m 0'); - t.formatInvalid('mmmm 0'); - t.formatInvalid('d 0'); - t.formatInvalid('dddd 0'); - t.formatInvalid('s 0'); - t.formatInvalid('h 0'); - t.formatInvalid('AM/PM 0'); - t.formatInvalid('[h] 0'); - t.formatInvalid('[m] 0'); - t.formatInvalid('[s] 0'); - t.formatInvalid('y #'); - t.formatInvalid('yyyy #'); - t.formatInvalid('m #'); - t.formatInvalid('mmmm #'); - t.formatInvalid('d #'); - t.formatInvalid('dddd #'); - t.formatInvalid('s #'); - t.formatInvalid('h #'); - t.formatInvalid('AM/PM #'); - t.formatInvalid('[h] #'); - t.formatInvalid('[m] #'); - t.formatInvalid('[s] #'); - t.formatInvalid('y ?'); - t.formatInvalid('yyyy ?'); - t.formatInvalid('m ?'); - t.formatInvalid('mmmm ?'); - t.formatInvalid('d ?'); - t.formatInvalid('dddd ?'); - t.formatInvalid('s ?'); - t.formatInvalid('h ?'); - t.formatInvalid('AM/PM ?'); - t.formatInvalid('[h] ?'); - t.formatInvalid('[m] ?'); - t.formatInvalid('[s] ?'); - - t.formatInvalid('d .#'); - t.formatInvalid('mm%'); - t.formatInvalid('mm@'); - - // no out of bounds dates - t.format('dddd, dd. mmmm yyy', -1, '######', excelOpts); - t.format('dddd, dd. mmmm yyy', 2958470, '######', excelOpts); - - // isDate should not throw on malformed input - t.equal(isDateFormat('dddd, dd. mmmm yyy'), true, "isDateFormat('dddd, dd. mmmm yyy')"); - t.equal(isDateFormat('0.0M'), false, "isDateFormat('0.0M')"); - - // utility functions exist and work on error formatters - t.equal(isDateFormat('y 0'), false, "isDateFormat('y 0')"); - t.equal(isPercentFormat('y 0'), false, "isPercentFormat('y 0')"); - t.equal(isTextFormat('y 0'), false, "isTextFormat('y 0')"); - - t.end(); -}); - -test('Single characters', t => { - t.format(' ', 1, ' '); - t.format('!', 1, '!'); - t.formatInvalid('"'); - t.format('#', 1, '1'); - t.format('$', 1, '$'); - t.format('%', 1, '%'); - t.format('&', 1, '&'); - t.format('\'', 1, '\''); - t.format('(', 1, '('); - t.format(')', 1, ')'); - t.formatInvalid('*'); - t.format('+', 1, '+'); - t.format(',', 1, ','); - t.format('-', 1, '-'); - t.format('.', 1, '.'); - // slash is allowed in date formats - t.format('d/', 1, '1/'); - // slash otherwise means vulgar fractions - t.format('0/0', 0, '0/1'); - t.format('0/0', 1, '1/1'); - t.formatInvalid('0/'); - t.formatInvalid('/0'); - t.formatInvalid('/'); - t.format('0', 1, '1'); - t.format('1', 1, '1'); - t.format('2', 1, '2'); - t.format('3', 1, '3'); - t.format('4', 1, '4'); - t.format('5', 1, '5'); - t.format('6', 1, '6'); - t.format('7', 1, '7'); - t.format('8', 1, '8'); - t.format('9', 1, '9'); - t.format(':', 1, ':'); - t.format(';', 1, ''); - t.format('<', 1, '<'); - t.format('=', 1, '='); - t.format('>', 1, '>'); - t.format('?', 1, '1'); - t.format('@', 1, '1'); - t.format('A', 1, 'A'); - // B is not allowed at the end of the pattern - t.formatInvalid('B'); - t.format('B ', 1, '43 '); - t.format('B;', 1, '43'); - t.format('C', 1, 'C'); - t.format('D', 1, '1'); - // E is stricter than e, for whatever reason (see E tests below) - t.formatInvalid('E'); - t.format('F', 1, 'F'); - t.format('G', 1, ''); - t.format('H', 1, '0'); - t.format('I', 1, 'I'); - t.format('J', 1, 'J'); - t.format('K', 1, 'K'); - t.format('L', 1, 'L'); - t.format('M', 1, '1'); - t.formatInvalid('N'); - t.format('O', 1, 'O'); - t.format('P', 1, 'P'); - t.format('Q', 1, 'Q'); - t.format('R', 1, 'R'); - t.format('S', 1, '0'); - t.format('T', 1, 'T'); - t.format('U', 1, 'U'); - t.format('V', 1, 'V'); - t.format('W', 1, 'W'); - t.format('X', 1, 'X'); - t.format('Y', 1, '00'); - t.format('Z', 1, 'Z'); - t.formatInvalid('['); - t.formatInvalid('\\'); - t.format(']', 1, ']'); - t.format('^', 1, '^'); - t.formatInvalid('_'); - t.format('`', 1, '`'); - t.format('a', 1, 'a'); - t.format('b', 1, '43'); - t.format('c', 1, 'c'); - t.format('d', 1, '1'); - t.format('e', 1, '1900'); - t.format('f', 1, 'f'); - t.format('g', 1, ''); - t.format('h', 1, '0'); - t.format('i', 1, 'i'); - t.format('j', 1, 'j'); - t.format('k', 1, 'k'); - t.format('l', 1, 'l'); - t.format('m', 1, '1'); - t.formatInvalid('n'); - t.format('o', 1, 'o'); - t.format('p', 1, 'p'); - t.format('q', 1, 'q'); - t.format('r', 1, 'r'); - t.format('s', 1, '0'); - t.format('t', 1, 't'); - t.format('u', 1, 'u'); - t.format('v', 1, 'v'); - t.format('w', 1, 'w'); - t.format('x', 1, 'x'); - t.format('y', 1, '00'); - t.format('z', 1, 'z'); - t.format('{', 1, '{'); - t.format('|', 1, '|'); - t.format('}', 1, '}'); - t.format('~', 1, '~'); - t.format('', 1, ''); - t.format('Ä', 1, 'Ä'); - t.format('Å', 1, 'Å'); - t.format('Ç', 1, 'Ç'); - t.formatInvalid('É'); - t.formatInvalid('Ñ'); - t.format('Ö', 1, 'Ö'); - t.format('Ü', 1, 'Ü'); - t.format('á', 1, 'á'); - t.format('à', 1, 'à'); - t.format('â', 1, 'â'); - t.format('ä', 1, 'ä'); - t.format('ã', 1, 'ã'); - t.format('å', 1, 'å'); - t.format('ç', 1, 'ç'); - t.formatInvalid('é'); - t.formatInvalid('è'); - t.formatInvalid('ê'); - t.formatInvalid('ë'); - t.format('í', 1, 'í'); - t.format('ì', 1, 'ì'); - t.format('î', 1, 'î'); - t.format('ï', 1, 'ï'); - t.formatInvalid('ñ'); - t.format('ó', 1, 'ó'); - t.format('ò', 1, 'ò'); - t.format('ô', 1, 'ô'); - t.format('ö', 1, 'ö'); - t.format('õ', 1, 'õ'); - t.format('ú', 1, 'ú'); - t.format('ù', 1, 'ù'); - t.format('û', 1, 'û'); - t.format('ü', 1, 'ü'); - t.format('†', 1, '†'); - t.format('°', 1, '°'); - t.format('¢', 1, '¢'); - t.format('£', 1, '£'); - t.format('§', 1, '§'); - t.format('•', 1, '•'); - t.format('¶', 1, '¶'); - t.format('ß', 1, 'ß'); - t.format('®', 1, '®'); - t.format('©', 1, '©'); - t.format('™', 1, '™'); - t.format('´', 1, '´'); - t.format('¨', 1, '¨'); - t.format('≠', 1, '≠'); - t.format('Æ', 1, 'Æ'); - t.format('Ø', 1, 'Ø'); - t.format('∞', 1, '∞'); - t.format('±', 1, '±'); - t.format('≤', 1, '≤'); - t.format('≥', 1, '≥'); - t.format('¥', 1, '¥'); - t.format('µ', 1, 'µ'); - t.format('∂', 1, '∂'); - t.format('∑', 1, '∑'); - t.format('∏', 1, '∏'); - t.format('π', 1, 'π'); - t.format('∫', 1, '∫'); - t.format('ª', 1, 'ª'); - t.format('º', 1, 'º'); - t.format('Ω', 1, 'Ω'); - t.format('æ', 1, 'æ'); - t.format('ø', 1, 'ø'); - t.format('¿', 1, '¿'); - t.format('¡', 1, '¡'); - t.format('¬', 1, '¬'); - t.end(); -}); - -test('The "E" and "e" operators', t => { - t.format('e', 1, '1900'); - t.formatInvalid('0e'); - t.formatInvalid('e0'); - t.formatInvalid('0e0'); - t.format('e+', 1, '1900+'); // Sheets does not allow this - t.formatInvalid('0e+'); - t.formatInvalid('e+0'); - t.formatInvalid('0e+0'); // Sheets emits "1e+0" - t.format('e-', 1, '1900-'); // Sheets emits "1e+0" - t.formatInvalid('0e-'); - t.formatInvalid('e-0'); - t.formatInvalid('0e-0'); // Sheets emits "1e0" - t.formatInvalid('E'); - t.formatInvalid('0E'); - t.formatInvalid('E0'); - t.formatInvalid('0E0'); - t.formatInvalid('E+'); - t.formatInvalid('0E+'); - t.formatInvalid('E+0'); - t.format('0E+0', 1, '1E+0'); - t.formatInvalid('E-'); - t.formatInvalid('0E-'); - t.formatInvalid('E-0'); - t.format('0E-0', 1, '1E0'); - - t.formatInvalid('0 e 0'); - t.formatInvalid('0 e + 0'); - t.formatInvalid('0 e +0'); - t.formatInvalid('0 e+ 0'); // Sheets emits "1 e +4" - - t.formatInvalid('0 E 0'); - t.formatInvalid('0 E + 0'); - t.formatInvalid('0 E +0'); - t.format('0 E+ 0', 1, '1 E +0'); - - t.format('e-m', 1, '1900-1'); - - t.end(); -}); diff --git a/test/error.spec.ts b/test/error.spec.ts new file mode 100644 index 0000000..ee13306 --- /dev/null +++ b/test/error.spec.ts @@ -0,0 +1,284 @@ +import { expect, test } from 'vitest'; +import { format, isDateFormat, isPercentFormat, isTextFormat } from '../lib/index.js'; + +const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; + +test('Various format restrictions', () => { + // no more than 4 sections + expect(() => format('a;b;c;d;', '')).toThrow(); + expect(() => format('#;#;#;#;#', '')).toThrow(); + + // no more than 2 conditional sections + expect(() => format('[<-2]a;[<-1]b;[>2]c;d;', '')).toThrow(); + + // can't mix dates and numbers (within a segment) + expect(() => format('y 0', '')).toThrow(); + expect(() => format('yyyy 0', '')).toThrow(); + expect(() => format('m 0', '')).toThrow(); + expect(() => format('mmmm 0', '')).toThrow(); + expect(() => format('d 0', '')).toThrow(); + expect(() => format('dddd 0', '')).toThrow(); + expect(() => format('s 0', '')).toThrow(); + expect(() => format('h 0', '')).toThrow(); + expect(() => format('AM/PM 0', '')).toThrow(); + expect(() => format('[h] 0', '')).toThrow(); + expect(() => format('[m] 0', '')).toThrow(); + expect(() => format('[s] 0', '')).toThrow(); + expect(() => format('y #', '')).toThrow(); + expect(() => format('yyyy #', '')).toThrow(); + expect(() => format('m #', '')).toThrow(); + expect(() => format('mmmm #', '')).toThrow(); + expect(() => format('d #', '')).toThrow(); + expect(() => format('dddd #', '')).toThrow(); + expect(() => format('s #', '')).toThrow(); + expect(() => format('h #', '')).toThrow(); + expect(() => format('AM/PM #', '')).toThrow(); + expect(() => format('[h] #', '')).toThrow(); + expect(() => format('[m] #', '')).toThrow(); + expect(() => format('[s] #', '')).toThrow(); + expect(() => format('y ?', '')).toThrow(); + expect(() => format('yyyy ?', '')).toThrow(); + expect(() => format('m ?', '')).toThrow(); + expect(() => format('mmmm ?', '')).toThrow(); + expect(() => format('d ?', '')).toThrow(); + expect(() => format('dddd ?', '')).toThrow(); + expect(() => format('s ?', '')).toThrow(); + expect(() => format('h ?', '')).toThrow(); + expect(() => format('AM/PM ?', '')).toThrow(); + expect(() => format('[h] ?', '')).toThrow(); + expect(() => format('[m] ?', '')).toThrow(); + expect(() => format('[s] ?', '')).toThrow(); + + expect(() => format('d .#', '')).toThrow(); + expect(() => format('mm%', '')).toThrow(); + expect(() => format('mm@', '')).toThrow(); + + // no out of bounds dates + expect(format('dddd, dd. mmmm yyy', -1, excelOpts)).toBe('######'); + expect(format('dddd, dd. mmmm yyy', 2958470, excelOpts)).toBe('######'); + + // isDate should not throw on malformed input + expect(isDateFormat('dddd, dd. mmmm yyy'), "isDateFormat('dddd, dd. mmmm yyy')").toBe(true); + expect(isDateFormat('0.0M'), "isDateFormat('0.0M')").toBe(false); + + // utility functions exist and work on error formatters + expect(isDateFormat('y 0'), "isDateFormat('y 0')").toBe(false); + expect(isPercentFormat('y 0'), "isPercentFormat('y 0')").toBe(false); + expect(isTextFormat('y 0'), "isTextFormat('y 0')").toBe(false); +}); + +test('Single characters', () => { + expect(format(' ', 1)).toBe(' '); + expect(format('!', 1)).toBe('!'); + expect(() => format('"', '')).toThrow(); + expect(format('#', 1)).toBe('1'); + expect(format('$', 1)).toBe('$'); + expect(format('%', 1)).toBe('%'); + expect(format('&', 1)).toBe('&'); + expect(format('\'', 1)).toBe('\''); + expect(format('(', 1)).toBe('('); + expect(format(')', 1)).toBe(')'); + expect(() => format('*', '')).toThrow(); + expect(format('+', 1)).toBe('+'); + expect(format(',', 1)).toBe(','); + expect(format('-', 1)).toBe('-'); + expect(format('.', 1)).toBe('.'); + // slash is allowed in date formats + expect(format('d/', 1)).toBe('1/'); + // slash otherwise means vulgar fractions + expect(format('0/0', 0)).toBe('0/1'); + expect(format('0/0', 1)).toBe('1/1'); + expect(() => format('0/', '')).toThrow(); + expect(() => format('/0', '')).toThrow(); + expect(() => format('/', '')).toThrow(); + expect(format('0', 1)).toBe('1'); + expect(format('1', 1)).toBe('1'); + expect(format('2', 1)).toBe('2'); + expect(format('3', 1)).toBe('3'); + expect(format('4', 1)).toBe('4'); + expect(format('5', 1)).toBe('5'); + expect(format('6', 1)).toBe('6'); + expect(format('7', 1)).toBe('7'); + expect(format('8', 1)).toBe('8'); + expect(format('9', 1)).toBe('9'); + expect(format(':', 1)).toBe(':'); + expect(format(';', 1)).toBe(''); + expect(format('<', 1)).toBe('<'); + expect(format('=', 1)).toBe('='); + expect(format('>', 1)).toBe('>'); + expect(format('?', 1)).toBe('1'); + expect(format('@', 1)).toBe('1'); + expect(format('A', 1)).toBe('A'); + // B is not allowed at the end of the pattern + expect(() => format('B', '')).toThrow(); + expect(format('B ', 1)).toBe('43 '); + expect(format('B;', 1)).toBe('43'); + expect(format('C', 1)).toBe('C'); + expect(format('D', 1)).toBe('1'); + // E is stricter than e, for whatever reason (see E tests below) + expect(() => format('E', '')).toThrow(); + expect(format('F', 1)).toBe('F'); + expect(format('G', 1)).toBe(''); + expect(format('H', 1)).toBe('0'); + expect(format('I', 1)).toBe('I'); + expect(format('J', 1)).toBe('J'); + expect(format('K', 1)).toBe('K'); + expect(format('L', 1)).toBe('L'); + expect(format('M', 1)).toBe('1'); + expect(() => format('N', '')).toThrow(); + expect(format('O', 1)).toBe('O'); + expect(format('P', 1)).toBe('P'); + expect(format('Q', 1)).toBe('Q'); + expect(format('R', 1)).toBe('R'); + expect(format('S', 1)).toBe('0'); + expect(format('T', 1)).toBe('T'); + expect(format('U', 1)).toBe('U'); + expect(format('V', 1)).toBe('V'); + expect(format('W', 1)).toBe('W'); + expect(format('X', 1)).toBe('X'); + expect(format('Y', 1)).toBe('00'); + expect(format('Z', 1)).toBe('Z'); + expect(() => format('[', '')).toThrow(); + expect(() => format('\\', '')).toThrow(); + expect(format(']', 1)).toBe(']'); + expect(format('^', 1)).toBe('^'); + expect(() => format('_', '')).toThrow(); + expect(format('`', 1)).toBe('`'); + expect(format('a', 1)).toBe('a'); + expect(format('b', 1)).toBe('43'); + expect(format('c', 1)).toBe('c'); + expect(format('d', 1)).toBe('1'); + expect(format('e', 1)).toBe('1900'); + expect(format('f', 1)).toBe('f'); + expect(format('g', 1)).toBe(''); + expect(format('h', 1)).toBe('0'); + expect(format('i', 1)).toBe('i'); + expect(format('j', 1)).toBe('j'); + expect(format('k', 1)).toBe('k'); + expect(format('l', 1)).toBe('l'); + expect(format('m', 1)).toBe('1'); + expect(() => format('n', '')).toThrow(); + expect(format('o', 1)).toBe('o'); + expect(format('p', 1)).toBe('p'); + expect(format('q', 1)).toBe('q'); + expect(format('r', 1)).toBe('r'); + expect(format('s', 1)).toBe('0'); + expect(format('t', 1)).toBe('t'); + expect(format('u', 1)).toBe('u'); + expect(format('v', 1)).toBe('v'); + expect(format('w', 1)).toBe('w'); + expect(format('x', 1)).toBe('x'); + expect(format('y', 1)).toBe('00'); + expect(format('z', 1)).toBe('z'); + expect(format('{', 1)).toBe('{'); + expect(format('|', 1)).toBe('|'); + expect(format('}', 1)).toBe('}'); + expect(format('~', 1)).toBe('~'); + expect(format('\x7f', 1)).toBe('\x7f'); + expect(format('Ä', 1)).toBe('Ä'); + expect(format('Å', 1)).toBe('Å'); + expect(format('Ç', 1)).toBe('Ç'); + expect(() => format('É', '')).toThrow(); + expect(() => format('Ñ', '')).toThrow(); + expect(format('Ö', 1)).toBe('Ö'); + expect(format('Ü', 1)).toBe('Ü'); + expect(format('á', 1)).toBe('á'); + expect(format('à', 1)).toBe('à'); + expect(format('â', 1)).toBe('â'); + expect(format('ä', 1)).toBe('ä'); + expect(format('ã', 1)).toBe('ã'); + expect(format('å', 1)).toBe('å'); + expect(format('ç', 1)).toBe('ç'); + expect(() => format('é', '')).toThrow(); + expect(() => format('è', '')).toThrow(); + expect(() => format('ê', '')).toThrow(); + expect(() => format('ë', '')).toThrow(); + expect(format('í', 1)).toBe('í'); + expect(format('ì', 1)).toBe('ì'); + expect(format('î', 1)).toBe('î'); + expect(format('ï', 1)).toBe('ï'); + expect(() => format('ñ', '')).toThrow(); + expect(format('ó', 1)).toBe('ó'); + expect(format('ò', 1)).toBe('ò'); + expect(format('ô', 1)).toBe('ô'); + expect(format('ö', 1)).toBe('ö'); + expect(format('õ', 1)).toBe('õ'); + expect(format('ú', 1)).toBe('ú'); + expect(format('ù', 1)).toBe('ù'); + expect(format('û', 1)).toBe('û'); + expect(format('ü', 1)).toBe('ü'); + expect(format('†', 1)).toBe('†'); + expect(format('°', 1)).toBe('°'); + expect(format('¢', 1)).toBe('¢'); + expect(format('£', 1)).toBe('£'); + expect(format('§', 1)).toBe('§'); + expect(format('•', 1)).toBe('•'); + expect(format('¶', 1)).toBe('¶'); + expect(format('ß', 1)).toBe('ß'); + expect(format('®', 1)).toBe('®'); + expect(format('©', 1)).toBe('©'); + expect(format('™', 1)).toBe('™'); + expect(format('´', 1)).toBe('´'); + expect(format('¨', 1)).toBe('¨'); + expect(format('≠', 1)).toBe('≠'); + expect(format('Æ', 1)).toBe('Æ'); + expect(format('Ø', 1)).toBe('Ø'); + expect(format('∞', 1)).toBe('∞'); + expect(format('±', 1)).toBe('±'); + expect(format('≤', 1)).toBe('≤'); + expect(format('≥', 1)).toBe('≥'); + expect(format('¥', 1)).toBe('¥'); + expect(format('µ', 1)).toBe('µ'); + expect(format('∂', 1)).toBe('∂'); + expect(format('∑', 1)).toBe('∑'); + expect(format('∏', 1)).toBe('∏'); + expect(format('π', 1)).toBe('π'); + expect(format('∫', 1)).toBe('∫'); + expect(format('ª', 1)).toBe('ª'); + expect(format('º', 1)).toBe('º'); + expect(format('Ω', 1)).toBe('Ω'); + expect(format('æ', 1)).toBe('æ'); + expect(format('ø', 1)).toBe('ø'); + expect(format('¿', 1)).toBe('¿'); + expect(format('¡', 1)).toBe('¡'); + expect(format('¬', 1)).toBe('¬'); +}); + +test('The "E" and "e" operators', () => { + expect(format('e', 1)).toBe('1900'); + expect(() => format('0e', '')).toThrow(); + expect(() => format('e0', '')).toThrow(); + expect(() => format('0e0', '')).toThrow(); + expect(format('e+', 1)).toBe('1900+'); // Sheets does not allow this + expect(() => format('0e+', '')).toThrow(); + expect(() => format('e+0', '')).toThrow(); + expect(() => format('0e+0', '')).toThrow(); // Sheets emits "1e+0" + expect(format('e-', 1)).toBe('1900-'); // Sheets emits "1e+0" + expect(() => format('0e-', '')).toThrow(); + expect(() => format('e-0', '')).toThrow(); + expect(() => format('0e-0', '')).toThrow(); // Sheets emits "1e0" + expect(() => format('E', '')).toThrow(); + expect(() => format('0E', '')).toThrow(); + expect(() => format('E0', '')).toThrow(); + expect(() => format('0E0', '')).toThrow(); + expect(() => format('E+', '')).toThrow(); + expect(() => format('0E+', '')).toThrow(); + expect(() => format('E+0', '')).toThrow(); + expect(format('0E+0', 1)).toBe('1E+0'); + expect(() => format('E-', '')).toThrow(); + expect(() => format('0E-', '')).toThrow(); + expect(() => format('E-0', '')).toThrow(); + expect(format('0E-0', 1)).toBe('1E0'); + + expect(() => format('0 e 0', '')).toThrow(); + expect(() => format('0 e + 0', '')).toThrow(); + expect(() => format('0 e +0', '')).toThrow(); + expect(() => format('0 e+ 0', '')).toThrow(); // Sheets emits "1 e +4" + + expect(() => format('0 E 0', '')).toThrow(); + expect(() => format('0 E + 0', '')).toThrow(); + expect(() => format('0 E +0', '')).toThrow(); + expect(format('0 E+ 0', 1)).toBe('1 E +0'); + + expect(format('e-m', 1)).toBe('1900-1'); +}); diff --git a/test/expformat-test.js b/test/expformat-test.js deleted file mode 100644 index 94f5486..0000000 --- a/test/expformat-test.js +++ /dev/null @@ -1,402 +0,0 @@ -import test from './utils.js'; - -test('Exponent detection', t => { - t.format('0E+00', 95000000, '1E+08'); - t.format('0E+00', 96000000, '1E+08'); - t.format('0E+00', 97000000, '1E+08'); - t.format('0E+00', 98000000, '1E+08'); - t.format('0E+00', 99000000, '1E+08'); - t.format('0E+00', 100000000, '1E+08'); - t.format('0E+00', 110000000, '1E+08'); - t.format('0E+00', 120000000, '1E+08'); - t.format('0E+00', 130000000, '1E+08'); - t.format('0E+00', 140000000, '1E+08'); - t.format('0E+00', 199999999, '2E+08'); - t.format('0E+00', 899999999, '9E+08'); - t.format('0E+00', 990000000, '1E+09'); - t.format('0E+00', 999000000, '1E+09'); - t.format('0E+00', 999900000, '1E+09'); - t.format('0E+00', 999990000, '1E+09'); - t.format('0.0E+00', 95000000, '9.5E+07'); - t.format('0.0E+00', 96000000, '9.6E+07'); - t.format('0.0E+00', 97000000, '9.7E+07'); - t.format('0.0E+00', 98000000, '9.8E+07'); - t.format('0.0E+00', 99000000, '9.9E+07'); - t.format('0.0E+00', 100000000, '1.0E+08'); - t.format('0.0E+00', 110000000, '1.1E+08'); - t.format('0.0E+00', 120000000, '1.2E+08'); - t.format('0.0E+00', 130000000, '1.3E+08'); - t.format('0.0E+00', 140000000, '1.4E+08'); - t.format('0.0E+00', 199999999, '2.0E+08'); - t.format('0.0E+00', 899999999, '9.0E+08'); - t.format('0.0E+00', 990000000, '9.9E+08'); - t.format('0.0E+00', 999000000, '1.0E+09'); - t.format('0.0E+00', 999900000, '1.0E+09'); - t.format('0.0E+00', 999990000, '1.0E+09'); - t.format('0.00E+00', 95000000, '9.50E+07'); - t.format('0.00E+00', 96000000, '9.60E+07'); - t.format('0.00E+00', 97000000, '9.70E+07'); - t.format('0.00E+00', 98000000, '9.80E+07'); - t.format('0.00E+00', 99000000, '9.90E+07'); - t.format('0.00E+00', 100000000, '1.00E+08'); - t.format('0.00E+00', 110000000, '1.10E+08'); - t.format('0.00E+00', 120000000, '1.20E+08'); - t.format('0.00E+00', 130000000, '1.30E+08'); - t.format('0.00E+00', 140000000, '1.40E+08'); - t.format('0.00E+00', 199999999, '2.00E+08'); - t.format('0.00E+00', 899999999, '9.00E+08'); - t.format('0.00E+00', 990000000, '9.90E+08'); - t.format('0.00E+00', 999000000, '9.99E+08'); - t.format('0.00E+00', 999900000, '1.00E+09'); - t.format('0.00E+00', 999990000, '1.00E+09'); - t.format('0.000E+00', 95000000, '9.500E+07'); - t.format('0.000E+00', 96000000, '9.600E+07'); - t.format('0.000E+00', 97000000, '9.700E+07'); - t.format('0.000E+00', 98000000, '9.800E+07'); - t.format('0.000E+00', 99000000, '9.900E+07'); - t.format('0.000E+00', 100000000, '1.000E+08'); - t.format('0.000E+00', 110000000, '1.100E+08'); - t.format('0.000E+00', 120000000, '1.200E+08'); - t.format('0.000E+00', 130000000, '1.300E+08'); - t.format('0.000E+00', 140000000, '1.400E+08'); - t.format('0.000E+00', 199999999, '2.000E+08'); - t.format('0.000E+00', 899999999, '9.000E+08'); - t.format('0.000E+00', 990000000, '9.900E+08'); - t.format('0.000E+00', 999000000, '9.990E+08'); - t.format('0.000E+00', 999900000, '9.999E+08'); - t.format('0.000E+00', 999990000, '1.000E+09'); - t.end(); -}); - -test('Exponent detection', t => { - t.format('0.E+00', 9, '9.E+00'); - t.format('0.E+00', 9.49999, '9.E+00'); - t.format('0.E+00', 9.59999, '1.E+01'); - t.format('0.E+00', 9.69999, '1.E+01'); - t.format('0.E+00', 10, '1.E+01'); - t.format('0.E+00', 90, '9.E+01'); - t.format('0.E+00', 94.9999, '9.E+01'); - t.format('0.E+00', 95.9999, '1.E+02'); - t.format('0.E+00', 96.9999, '1.E+02'); - t.format('0.E+00', 100, '1.E+02'); - t.format('0.E+00', 900, '9.E+02'); - t.format('0.E+00', 949.999, '9.E+02'); - t.format('0.E+00', 959.999, '1.E+03'); - t.format('0.E+00', 969.999, '1.E+03'); - t.format('0.E+00', 1000, '1.E+03'); - t.format('0.E+00', 9000, '9.E+03'); - t.format('0.E+00', 9499.99, '9.E+03'); - t.format('0.E+00', 9599.99, '1.E+04'); - t.format('0.E+00', 9699.99, '1.E+04'); - t.format('0.E+00', 10000, '1.E+04'); - t.format('0.E+00', 90000, '9.E+04'); - t.format('0.E+00', 94999.9, '9.E+04'); - t.format('0.E+00', 95999.9, '1.E+05'); - t.format('0.E+00', 96999.9, '1.E+05'); - t.format('0.E+00', 100000, '1.E+05'); - t.format('0.0E+00', 9, '9.0E+00'); - t.format('0.0E+00', 9.49999, '9.5E+00'); - t.format('0.0E+00', 9.59999, '9.6E+00'); - t.format('0.0E+00', 9.69999, '9.7E+00'); - t.format('0.0E+00', 10, '1.0E+01'); - t.format('0.0E+00', 90, '9.0E+01'); - t.format('0.0E+00', 94.9999, '9.5E+01'); - t.format('0.0E+00', 95.9999, '9.6E+01'); - t.format('0.0E+00', 96.9999, '9.7E+01'); - t.format('0.0E+00', 100, '1.0E+02'); - t.format('0.0E+00', 900, '9.0E+02'); - t.format('0.0E+00', 949.999, '9.5E+02'); - t.format('0.0E+00', 959.999, '9.6E+02'); - t.format('0.0E+00', 969.999, '9.7E+02'); - t.format('0.0E+00', 1000, '1.0E+03'); - t.format('0.0E+00', 9000, '9.0E+03'); - t.format('0.0E+00', 9499.99, '9.5E+03'); - t.format('0.0E+00', 9599.99, '9.6E+03'); - t.format('0.0E+00', 9699.99, '9.7E+03'); - t.format('0.0E+00', 10000, '1.0E+04'); - t.format('0.0E+00', 90000, '9.0E+04'); - t.format('0.0E+00', 94999.9, '9.5E+04'); - t.format('0.0E+00', 95999.9, '9.6E+04'); - t.format('0.0E+00', 96999.9, '9.7E+04'); - t.format('0.0E+00', 100000, '1.0E+05'); - t.format('0.00E+00', 9, '9.00E+00'); - t.format('0.00E+00', 9.49999, '9.50E+00'); - t.format('0.00E+00', 9.59999, '9.60E+00'); - t.format('0.00E+00', 9.69999, '9.70E+00'); - t.format('0.00E+00', 10, '1.00E+01'); - t.format('0.00E+00', 90, '9.00E+01'); - t.format('0.00E+00', 94.9999, '9.50E+01'); - t.format('0.00E+00', 95.9999, '9.60E+01'); - t.format('0.00E+00', 96.9999, '9.70E+01'); - t.format('0.00E+00', 100, '1.00E+02'); - t.format('0.00E+00', 900, '9.00E+02'); - t.format('0.00E+00', 949.999, '9.50E+02'); - t.format('0.00E+00', 959.999, '9.60E+02'); - t.format('0.00E+00', 969.999, '9.70E+02'); - t.format('0.00E+00', 1000, '1.00E+03'); - t.format('0.00E+00', 9000, '9.00E+03'); - t.format('0.00E+00', 9499.99, '9.50E+03'); - t.format('0.00E+00', 9599.99, '9.60E+03'); - t.format('0.00E+00', 9699.99, '9.70E+03'); - t.format('0.00E+00', 10000, '1.00E+04'); - t.format('0.00E+00', 90000, '9.00E+04'); - t.format('0.00E+00', 94999.9, '9.50E+04'); - t.format('0.00E+00', 95999.9, '9.60E+04'); - t.format('0.00E+00', 96999.9, '9.70E+04'); - t.format('0.00E+00', 100000, '1.00E+05'); - t.format('00.E+00', 9, '09.E+00'); - t.format('00.E+00', 9.49999, '09.E+00'); - t.format('00.E+00', 9.59999, '10.E+00'); - t.format('00.E+00', 9.69999, '10.E+00'); - t.format('00.E+00', 10, '10.E+00'); - t.format('00.E+00', 90, '90.E+00'); - t.format('00.E+00', 94.9999, '95.E+00'); - t.format('00.E+00', 95.9999, '96.E+00'); - t.format('00.E+00', 96.9999, '97.E+00'); - t.format('00.E+00', 100, '01.E+02'); - t.format('00.E+00', 900, '09.E+02'); - t.format('00.E+00', 949.999, '09.E+02'); - t.format('00.E+00', 959.999, '10.E+02'); - t.format('00.E+00', 969.999, '10.E+02'); - t.format('00.E+00', 1000, '10.E+02'); - t.format('00.E+00', 9000, '90.E+02'); - t.format('00.E+00', 9499.99, '95.E+02'); - t.format('00.E+00', 9599.99, '96.E+02'); - t.format('00.E+00', 9699.99, '97.E+02'); - t.format('00.E+00', 10000, '01.E+04'); - t.format('00.E+00', 90000, '09.E+04'); - t.format('00.E+00', 94999.9, '09.E+04'); - t.format('00.E+00', 95999.9, '10.E+04'); - t.format('00.E+00', 96999.9, '10.E+04'); - t.format('00.E+00', 100000, '10.E+04'); - t.format('00.0E+00', 9, '09.0E+00'); - t.format('00.0E+00', 9.49999, '09.5E+00'); - t.format('00.0E+00', 9.59999, '09.6E+00'); - t.format('00.0E+00', 9.69999, '09.7E+00'); - t.format('00.0E+00', 10, '10.0E+00'); - t.format('00.0E+00', 90, '90.0E+00'); - t.format('00.0E+00', 94.9999, '95.0E+00'); - t.format('00.0E+00', 95.9999, '96.0E+00'); - t.format('00.0E+00', 96.9999, '97.0E+00'); - t.format('00.0E+00', 100, '01.0E+02'); - t.format('00.0E+00', 900, '09.0E+02'); - t.format('00.0E+00', 949.999, '09.5E+02'); - t.format('00.0E+00', 959.999, '09.6E+02'); - t.format('00.0E+00', 969.999, '09.7E+02'); - t.format('00.0E+00', 1000, '10.0E+02'); - t.format('00.0E+00', 9000, '90.0E+02'); - t.format('00.0E+00', 9499.99, '95.0E+02'); - t.format('00.0E+00', 9599.99, '96.0E+02'); - t.format('00.0E+00', 9699.99, '97.0E+02'); - t.format('00.0E+00', 10000, '01.0E+04'); - t.format('00.0E+00', 90000, '09.0E+04'); - t.format('00.0E+00', 94999.9, '09.5E+04'); - t.format('00.0E+00', 95999.9, '09.6E+04'); - t.format('00.0E+00', 96999.9, '09.7E+04'); - t.format('00.0E+00', 100000, '10.0E+04'); - t.format('00.00E+00', 9, '09.00E+00'); - t.format('00.00E+00', 9.49999, '09.50E+00'); - t.format('00.00E+00', 9.59999, '09.60E+00'); - t.format('00.00E+00', 9.69999, '09.70E+00'); - t.format('00.00E+00', 10, '10.00E+00'); - t.format('00.00E+00', 90, '90.00E+00'); - t.format('00.00E+00', 94.9999, '95.00E+00'); - t.format('00.00E+00', 95.9999, '96.00E+00'); - t.format('00.00E+00', 96.9999, '97.00E+00'); - t.format('00.00E+00', 100, '01.00E+02'); - t.format('00.00E+00', 900, '09.00E+02'); - t.format('00.00E+00', 949.999, '09.50E+02'); - t.format('00.00E+00', 959.999, '09.60E+02'); - t.format('00.00E+00', 969.999, '09.70E+02'); - t.format('00.00E+00', 1000, '10.00E+02'); - t.format('00.00E+00', 9000, '90.00E+02'); - t.format('00.00E+00', 9499.99, '95.00E+02'); - t.format('00.00E+00', 9599.99, '96.00E+02'); - t.format('00.00E+00', 9699.99, '97.00E+02'); - t.format('00.00E+00', 10000, '01.00E+04'); - t.format('00.00E+00', 90000, '09.00E+04'); - t.format('00.00E+00', 94999.9, '09.50E+04'); - t.format('00.00E+00', 95999.9, '09.60E+04'); - t.format('00.00E+00', 96999.9, '09.70E+04'); - t.format('00.00E+00', 100000, '10.00E+04'); - t.format('000.E+00', 9, '009.E+00'); - t.format('000.E+00', 9.49999, '009.E+00'); - t.format('000.E+00', 9.59999, '010.E+00'); - t.format('000.E+00', 9.69999, '010.E+00'); - t.format('000.E+00', 10, '010.E+00'); - t.format('000.E+00', 90, '090.E+00'); - t.format('000.E+00', 94.9999, '095.E+00'); - t.format('000.E+00', 95.9999, '096.E+00'); - t.format('000.E+00', 96.9999, '097.E+00'); - t.format('000.E+00', 100, '100.E+00'); - t.format('000.E+00', 900, '900.E+00'); - t.format('000.E+00', 949.999, '950.E+00'); - t.format('000.E+00', 959.999, '960.E+00'); - t.format('000.E+00', 969.999, '970.E+00'); - t.format('000.E+00', 1000, '001.E+03'); - t.format('000.E+00', 9000, '009.E+03'); - t.format('000.E+00', 9499.99, '009.E+03'); - t.format('000.E+00', 9599.99, '010.E+03'); - t.format('000.E+00', 9699.99, '010.E+03'); - t.format('000.E+00', 10000, '010.E+03'); - t.format('000.E+00', 90000, '090.E+03'); - t.format('000.E+00', 94999.9, '095.E+03'); - t.format('000.E+00', 95999.9, '096.E+03'); - t.format('000.E+00', 96999.9, '097.E+03'); - t.format('000.E+00', 100000, '100.E+03'); - t.format('000.0E+00', 9, '009.0E+00'); - t.format('000.0E+00', 9.49999, '009.5E+00'); - t.format('000.0E+00', 9.59999, '009.6E+00'); - t.format('000.0E+00', 9.69999, '009.7E+00'); - t.format('000.0E+00', 10, '010.0E+00'); - t.format('000.0E+00', 90, '090.0E+00'); - t.format('000.0E+00', 94.9999, '095.0E+00'); - t.format('000.0E+00', 95.9999, '096.0E+00'); - t.format('000.0E+00', 96.9999, '097.0E+00'); - t.format('000.0E+00', 100, '100.0E+00'); - t.format('000.0E+00', 900, '900.0E+00'); - t.format('000.0E+00', 949.999, '950.0E+00'); - t.format('000.0E+00', 959.999, '960.0E+00'); - t.format('000.0E+00', 969.999, '970.0E+00'); - t.format('000.0E+00', 1000, '001.0E+03'); - t.format('000.0E+00', 9000, '009.0E+03'); - t.format('000.0E+00', 9499.99, '009.5E+03'); - t.format('000.0E+00', 9599.99, '009.6E+03'); - t.format('000.0E+00', 9699.99, '009.7E+03'); - t.format('000.0E+00', 10000, '010.0E+03'); - t.format('000.0E+00', 90000, '090.0E+03'); - t.format('000.0E+00', 94999.9, '095.0E+03'); - t.format('000.0E+00', 95999.9, '096.0E+03'); - t.format('000.0E+00', 96999.9, '097.0E+03'); - t.format('000.0E+00', 100000, '100.0E+03'); - t.format('000.00E+00', 9, '009.00E+00'); - t.format('000.00E+00', 9.49999, '009.50E+00'); - t.format('000.00E+00', 9.59999, '009.60E+00'); - t.format('000.00E+00', 9.69999, '009.70E+00'); - t.format('000.00E+00', 10, '010.00E+00'); - t.format('000.00E+00', 90, '090.00E+00'); - t.format('000.00E+00', 94.9999, '095.00E+00'); - t.format('000.00E+00', 95.9999, '096.00E+00'); - t.format('000.00E+00', 96.9999, '097.00E+00'); - t.format('000.00E+00', 100, '100.00E+00'); - t.format('000.00E+00', 900, '900.00E+00'); - t.format('000.00E+00', 949.999, '950.00E+00'); - t.format('000.00E+00', 959.999, '960.00E+00'); - t.format('000.00E+00', 969.999, '970.00E+00'); - t.format('000.00E+00', 1000, '001.00E+03'); - t.format('000.00E+00', 9000, '009.00E+03'); - t.format('000.00E+00', 9499.99, '009.50E+03'); - t.format('000.00E+00', 9599.99, '009.60E+03'); - t.format('000.00E+00', 9699.99, '009.70E+03'); - t.format('000.00E+00', 10000, '010.00E+03'); - t.format('000.00E+00', 90000, '090.00E+03'); - t.format('000.00E+00', 94999.9, '095.00E+03'); - t.format('000.00E+00', 95999.9, '096.00E+03'); - t.format('000.00E+00', 96999.9, '097.00E+03'); - t.format('000.00E+00', 100000, '100.00E+03'); - - t.end(); -}); - -test('Exponential 0E+00', t => { - t.format('0E+00', 1000000000000, '1E+12'); - t.format('0E+00', 999999999999, '1E+12'); - t.format('0E+00', 950000000000, '1E+12'); - t.format('0E+00', 100000000000, '1E+11'); - t.format('0E+00', 95000000000, '1E+11'); - t.format('0E+00', 10000000000, '1E+10'); - t.format('0E+00', 9500000000, '1E+10'); - t.format('0E+00', 1000000000, '1E+09'); - t.format('0E+00', 950000000, '1E+09'); - t.format('0E+00', 100000000, '1E+08'); - t.format('0E+00', 95000000, '1E+08'); - t.format('0E+00', 10000000, '1E+07'); - t.format('0E+00', 9500000, '1E+07'); - t.format('0E+00', 1000000, '1E+06'); - t.format('0E+00', 950000, '1E+06'); - t.format('0E+00', 100000, '1E+05'); - t.format('0E+00', 95000, '1E+05'); - t.format('0E+00', 10000, '1E+04'); - t.format('0E+00', 9500, '1E+04'); - t.format('0E+00', 1000, '1E+03'); - t.format('0E+00', 950, '1E+03'); - t.format('0E+00', 100, '1E+02'); - t.format('0E+00', 95, '1E+02'); - t.format('0E+00', 10, '1E+01'); - t.format('0E+00', 9.5, '1E+01'); - t.format('0E+00', 1.4999999, '1E+00'); - t.format('0E+00', 1, '1E+00'); - t.format('0E+00', 0.95, '1E+00'); - t.format('0E+00', 0.14999999, '1E-01'); - t.format('0E+00', 0.1, '1E-01'); - t.format('0E+00', 0.014999999, '1E-02'); - t.format('0E+00', 0.01, '1E-02'); - t.format('0E+00', 0.0014999999, '1E-03'); - t.format('0E+00', 0.001, '1E-03'); - t.format('0E+00', 0.00014999999, '1E-04'); - t.format('0E+00', 0.0001, '1E-04'); - t.format('0E+00', 0.000014999999, '1E-05'); - t.format('0E+00', 0.00001, '1E-05'); - t.format('0E+00', 0.00000149999999, '1E-06'); - t.format('0E+00', 0.000001, '1E-06'); - t.format('0E+00', 0.00000014999999, '1E-07'); - t.format('0E+00', 0.0000001, '1E-07'); - t.format('0E+00', 0.000000014999999, '1E-08'); - t.format('0E+00', 0.00000001, '1E-08'); - t.format('0E+00', 0.0000000014999999, '1E-09'); - t.format('0E+00', 0.000000001, '1E-09'); - t.format('0E+00', 0.00000000014999999, '1E-10'); - t.format('0E+00', 0.0000000001, '1E-10'); - t.format('0E+00', 0.000000000014999999, '1E-11'); - t.format('0E+00', 0.00000000001, '1E-11'); - t.format('0E+00', 0.0000000000014999999, '1E-12'); - t.format('0E+00', 0.000000000001, '1E-12'); - t.end(); -}); - -test('Exponential 0.00E+00', t => { - t.format('0.00E+00', 10000000, '1.00E+07'); - t.format('0.00E+00', 20000000, '2.00E+07'); - t.format('0.00E+00', 30000000, '3.00E+07'); - t.format('0.00E+00', 30010000, '3.00E+07'); - t.format('0.00E+00', 30100000, '3.01E+07'); - t.format('0.00E+00', 31000000, '3.10E+07'); - t.format('0.00E+00', 31680000, '3.17E+07'); - t.format('0.00E+00', 31700000, '3.17E+07'); - t.format('0.00E+00', 32500000, '3.25E+07'); - t.format('0.00E+00', 35000000, '3.50E+07'); - t.format('0.00E+00', 40000000, '4.00E+07'); - t.format('0.00E+00', 50000000, '5.00E+07'); - t.format('0.00E+00', 60000000, '6.00E+07'); - t.format('0.00E+00', 70000000, '7.00E+07'); - t.format('0.00E+00', 80000000, '8.00E+07'); - t.format('0.00E+00', 90000000, '9.00E+07'); - t.end(); -}); - -test('Sign is grouped with digit in output', t => { - t.format('0 E+ 0', 10000000, '1 E +7'); - t.format('0 E+ 00', 10000000, '1 E +07'); - t.format('0 E- 0', 10000000, '1 E 7'); - t.format('0 E- 0', 0.0000001, '1 E -7'); - t.format('0 E- 00', 0.0000001, '1 E -07'); - t.end(); -}); - -test('Exponent is shifted when integer part is omitted:', t => { - t.format('.0E+0', 0, '.0E+0'); - t.format('.0E+0', 1, '.1E+1'); - t.format('.0E+0', 10, '.1E+2'); - t.format('.0E+0', 100, '.1E+3'); - t.format('.0E+0', 1000, '.1E+4'); - t.format('.0E+0', 10000, '.1E+5'); - t.format('.0E+0', 100000, '.1E+6'); - t.format('.0E+0', 123456789, '.1E+9'); - t.format('.0E+0', 0.1, '.1E+0'); - t.format('.0E+0', 0.01, '.1E-1'); - t.format('.0E+0', 0.001, '.1E-2'); - t.format('.0E+0', 0.0001, '.1E-3'); - t.format('.0E+0', 0.12345, '.1E+0'); - t.format('.0E+0', 0.012345, '.1E-1'); - t.end(); -}); diff --git a/test/expformat.spec.ts b/test/expformat.spec.ts new file mode 100644 index 0000000..cfc7216 --- /dev/null +++ b/test/expformat.spec.ts @@ -0,0 +1,396 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Exponent detection', () => { + expect(format('0E+00', 95000000)).toBe('1E+08'); + expect(format('0E+00', 96000000)).toBe('1E+08'); + expect(format('0E+00', 97000000)).toBe('1E+08'); + expect(format('0E+00', 98000000)).toBe('1E+08'); + expect(format('0E+00', 99000000)).toBe('1E+08'); + expect(format('0E+00', 100000000)).toBe('1E+08'); + expect(format('0E+00', 110000000)).toBe('1E+08'); + expect(format('0E+00', 120000000)).toBe('1E+08'); + expect(format('0E+00', 130000000)).toBe('1E+08'); + expect(format('0E+00', 140000000)).toBe('1E+08'); + expect(format('0E+00', 199999999)).toBe('2E+08'); + expect(format('0E+00', 899999999)).toBe('9E+08'); + expect(format('0E+00', 990000000)).toBe('1E+09'); + expect(format('0E+00', 999000000)).toBe('1E+09'); + expect(format('0E+00', 999900000)).toBe('1E+09'); + expect(format('0E+00', 999990000)).toBe('1E+09'); + expect(format('0.0E+00', 95000000)).toBe('9.5E+07'); + expect(format('0.0E+00', 96000000)).toBe('9.6E+07'); + expect(format('0.0E+00', 97000000)).toBe('9.7E+07'); + expect(format('0.0E+00', 98000000)).toBe('9.8E+07'); + expect(format('0.0E+00', 99000000)).toBe('9.9E+07'); + expect(format('0.0E+00', 100000000)).toBe('1.0E+08'); + expect(format('0.0E+00', 110000000)).toBe('1.1E+08'); + expect(format('0.0E+00', 120000000)).toBe('1.2E+08'); + expect(format('0.0E+00', 130000000)).toBe('1.3E+08'); + expect(format('0.0E+00', 140000000)).toBe('1.4E+08'); + expect(format('0.0E+00', 199999999)).toBe('2.0E+08'); + expect(format('0.0E+00', 899999999)).toBe('9.0E+08'); + expect(format('0.0E+00', 990000000)).toBe('9.9E+08'); + expect(format('0.0E+00', 999000000)).toBe('1.0E+09'); + expect(format('0.0E+00', 999900000)).toBe('1.0E+09'); + expect(format('0.0E+00', 999990000)).toBe('1.0E+09'); + expect(format('0.00E+00', 95000000)).toBe('9.50E+07'); + expect(format('0.00E+00', 96000000)).toBe('9.60E+07'); + expect(format('0.00E+00', 97000000)).toBe('9.70E+07'); + expect(format('0.00E+00', 98000000)).toBe('9.80E+07'); + expect(format('0.00E+00', 99000000)).toBe('9.90E+07'); + expect(format('0.00E+00', 100000000)).toBe('1.00E+08'); + expect(format('0.00E+00', 110000000)).toBe('1.10E+08'); + expect(format('0.00E+00', 120000000)).toBe('1.20E+08'); + expect(format('0.00E+00', 130000000)).toBe('1.30E+08'); + expect(format('0.00E+00', 140000000)).toBe('1.40E+08'); + expect(format('0.00E+00', 199999999)).toBe('2.00E+08'); + expect(format('0.00E+00', 899999999)).toBe('9.00E+08'); + expect(format('0.00E+00', 990000000)).toBe('9.90E+08'); + expect(format('0.00E+00', 999000000)).toBe('9.99E+08'); + expect(format('0.00E+00', 999900000)).toBe('1.00E+09'); + expect(format('0.00E+00', 999990000)).toBe('1.00E+09'); + expect(format('0.000E+00', 95000000)).toBe('9.500E+07'); + expect(format('0.000E+00', 96000000)).toBe('9.600E+07'); + expect(format('0.000E+00', 97000000)).toBe('9.700E+07'); + expect(format('0.000E+00', 98000000)).toBe('9.800E+07'); + expect(format('0.000E+00', 99000000)).toBe('9.900E+07'); + expect(format('0.000E+00', 100000000)).toBe('1.000E+08'); + expect(format('0.000E+00', 110000000)).toBe('1.100E+08'); + expect(format('0.000E+00', 120000000)).toBe('1.200E+08'); + expect(format('0.000E+00', 130000000)).toBe('1.300E+08'); + expect(format('0.000E+00', 140000000)).toBe('1.400E+08'); + expect(format('0.000E+00', 199999999)).toBe('2.000E+08'); + expect(format('0.000E+00', 899999999)).toBe('9.000E+08'); + expect(format('0.000E+00', 990000000)).toBe('9.900E+08'); + expect(format('0.000E+00', 999000000)).toBe('9.990E+08'); + expect(format('0.000E+00', 999900000)).toBe('9.999E+08'); + expect(format('0.000E+00', 999990000)).toBe('1.000E+09'); +}); + +test('Exponent detection', () => { + expect(format('0.E+00', 9)).toBe('9.E+00'); + expect(format('0.E+00', 9.49999)).toBe('9.E+00'); + expect(format('0.E+00', 9.59999)).toBe('1.E+01'); + expect(format('0.E+00', 9.69999)).toBe('1.E+01'); + expect(format('0.E+00', 10)).toBe('1.E+01'); + expect(format('0.E+00', 90)).toBe('9.E+01'); + expect(format('0.E+00', 94.9999)).toBe('9.E+01'); + expect(format('0.E+00', 95.9999)).toBe('1.E+02'); + expect(format('0.E+00', 96.9999)).toBe('1.E+02'); + expect(format('0.E+00', 100)).toBe('1.E+02'); + expect(format('0.E+00', 900)).toBe('9.E+02'); + expect(format('0.E+00', 949.999)).toBe('9.E+02'); + expect(format('0.E+00', 959.999)).toBe('1.E+03'); + expect(format('0.E+00', 969.999)).toBe('1.E+03'); + expect(format('0.E+00', 1000)).toBe('1.E+03'); + expect(format('0.E+00', 9000)).toBe('9.E+03'); + expect(format('0.E+00', 9499.99)).toBe('9.E+03'); + expect(format('0.E+00', 9599.99)).toBe('1.E+04'); + expect(format('0.E+00', 9699.99)).toBe('1.E+04'); + expect(format('0.E+00', 10000)).toBe('1.E+04'); + expect(format('0.E+00', 90000)).toBe('9.E+04'); + expect(format('0.E+00', 94999.9)).toBe('9.E+04'); + expect(format('0.E+00', 95999.9)).toBe('1.E+05'); + expect(format('0.E+00', 96999.9)).toBe('1.E+05'); + expect(format('0.E+00', 100000)).toBe('1.E+05'); + expect(format('0.0E+00', 9)).toBe('9.0E+00'); + expect(format('0.0E+00', 9.49999)).toBe('9.5E+00'); + expect(format('0.0E+00', 9.59999)).toBe('9.6E+00'); + expect(format('0.0E+00', 9.69999)).toBe('9.7E+00'); + expect(format('0.0E+00', 10)).toBe('1.0E+01'); + expect(format('0.0E+00', 90)).toBe('9.0E+01'); + expect(format('0.0E+00', 94.9999)).toBe('9.5E+01'); + expect(format('0.0E+00', 95.9999)).toBe('9.6E+01'); + expect(format('0.0E+00', 96.9999)).toBe('9.7E+01'); + expect(format('0.0E+00', 100)).toBe('1.0E+02'); + expect(format('0.0E+00', 900)).toBe('9.0E+02'); + expect(format('0.0E+00', 949.999)).toBe('9.5E+02'); + expect(format('0.0E+00', 959.999)).toBe('9.6E+02'); + expect(format('0.0E+00', 969.999)).toBe('9.7E+02'); + expect(format('0.0E+00', 1000)).toBe('1.0E+03'); + expect(format('0.0E+00', 9000)).toBe('9.0E+03'); + expect(format('0.0E+00', 9499.99)).toBe('9.5E+03'); + expect(format('0.0E+00', 9599.99)).toBe('9.6E+03'); + expect(format('0.0E+00', 9699.99)).toBe('9.7E+03'); + expect(format('0.0E+00', 10000)).toBe('1.0E+04'); + expect(format('0.0E+00', 90000)).toBe('9.0E+04'); + expect(format('0.0E+00', 94999.9)).toBe('9.5E+04'); + expect(format('0.0E+00', 95999.9)).toBe('9.6E+04'); + expect(format('0.0E+00', 96999.9)).toBe('9.7E+04'); + expect(format('0.0E+00', 100000)).toBe('1.0E+05'); + expect(format('0.00E+00', 9)).toBe('9.00E+00'); + expect(format('0.00E+00', 9.49999)).toBe('9.50E+00'); + expect(format('0.00E+00', 9.59999)).toBe('9.60E+00'); + expect(format('0.00E+00', 9.69999)).toBe('9.70E+00'); + expect(format('0.00E+00', 10)).toBe('1.00E+01'); + expect(format('0.00E+00', 90)).toBe('9.00E+01'); + expect(format('0.00E+00', 94.9999)).toBe('9.50E+01'); + expect(format('0.00E+00', 95.9999)).toBe('9.60E+01'); + expect(format('0.00E+00', 96.9999)).toBe('9.70E+01'); + expect(format('0.00E+00', 100)).toBe('1.00E+02'); + expect(format('0.00E+00', 900)).toBe('9.00E+02'); + expect(format('0.00E+00', 949.999)).toBe('9.50E+02'); + expect(format('0.00E+00', 959.999)).toBe('9.60E+02'); + expect(format('0.00E+00', 969.999)).toBe('9.70E+02'); + expect(format('0.00E+00', 1000)).toBe('1.00E+03'); + expect(format('0.00E+00', 9000)).toBe('9.00E+03'); + expect(format('0.00E+00', 9499.99)).toBe('9.50E+03'); + expect(format('0.00E+00', 9599.99)).toBe('9.60E+03'); + expect(format('0.00E+00', 9699.99)).toBe('9.70E+03'); + expect(format('0.00E+00', 10000)).toBe('1.00E+04'); + expect(format('0.00E+00', 90000)).toBe('9.00E+04'); + expect(format('0.00E+00', 94999.9)).toBe('9.50E+04'); + expect(format('0.00E+00', 95999.9)).toBe('9.60E+04'); + expect(format('0.00E+00', 96999.9)).toBe('9.70E+04'); + expect(format('0.00E+00', 100000)).toBe('1.00E+05'); + expect(format('00.E+00', 9)).toBe('09.E+00'); + expect(format('00.E+00', 9.49999)).toBe('09.E+00'); + expect(format('00.E+00', 9.59999)).toBe('10.E+00'); + expect(format('00.E+00', 9.69999)).toBe('10.E+00'); + expect(format('00.E+00', 10)).toBe('10.E+00'); + expect(format('00.E+00', 90)).toBe('90.E+00'); + expect(format('00.E+00', 94.9999)).toBe('95.E+00'); + expect(format('00.E+00', 95.9999)).toBe('96.E+00'); + expect(format('00.E+00', 96.9999)).toBe('97.E+00'); + expect(format('00.E+00', 100)).toBe('01.E+02'); + expect(format('00.E+00', 900)).toBe('09.E+02'); + expect(format('00.E+00', 949.999)).toBe('09.E+02'); + expect(format('00.E+00', 959.999)).toBe('10.E+02'); + expect(format('00.E+00', 969.999)).toBe('10.E+02'); + expect(format('00.E+00', 1000)).toBe('10.E+02'); + expect(format('00.E+00', 9000)).toBe('90.E+02'); + expect(format('00.E+00', 9499.99)).toBe('95.E+02'); + expect(format('00.E+00', 9599.99)).toBe('96.E+02'); + expect(format('00.E+00', 9699.99)).toBe('97.E+02'); + expect(format('00.E+00', 10000)).toBe('01.E+04'); + expect(format('00.E+00', 90000)).toBe('09.E+04'); + expect(format('00.E+00', 94999.9)).toBe('09.E+04'); + expect(format('00.E+00', 95999.9)).toBe('10.E+04'); + expect(format('00.E+00', 96999.9)).toBe('10.E+04'); + expect(format('00.E+00', 100000)).toBe('10.E+04'); + expect(format('00.0E+00', 9)).toBe('09.0E+00'); + expect(format('00.0E+00', 9.49999)).toBe('09.5E+00'); + expect(format('00.0E+00', 9.59999)).toBe('09.6E+00'); + expect(format('00.0E+00', 9.69999)).toBe('09.7E+00'); + expect(format('00.0E+00', 10)).toBe('10.0E+00'); + expect(format('00.0E+00', 90)).toBe('90.0E+00'); + expect(format('00.0E+00', 94.9999)).toBe('95.0E+00'); + expect(format('00.0E+00', 95.9999)).toBe('96.0E+00'); + expect(format('00.0E+00', 96.9999)).toBe('97.0E+00'); + expect(format('00.0E+00', 100)).toBe('01.0E+02'); + expect(format('00.0E+00', 900)).toBe('09.0E+02'); + expect(format('00.0E+00', 949.999)).toBe('09.5E+02'); + expect(format('00.0E+00', 959.999)).toBe('09.6E+02'); + expect(format('00.0E+00', 969.999)).toBe('09.7E+02'); + expect(format('00.0E+00', 1000)).toBe('10.0E+02'); + expect(format('00.0E+00', 9000)).toBe('90.0E+02'); + expect(format('00.0E+00', 9499.99)).toBe('95.0E+02'); + expect(format('00.0E+00', 9599.99)).toBe('96.0E+02'); + expect(format('00.0E+00', 9699.99)).toBe('97.0E+02'); + expect(format('00.0E+00', 10000)).toBe('01.0E+04'); + expect(format('00.0E+00', 90000)).toBe('09.0E+04'); + expect(format('00.0E+00', 94999.9)).toBe('09.5E+04'); + expect(format('00.0E+00', 95999.9)).toBe('09.6E+04'); + expect(format('00.0E+00', 96999.9)).toBe('09.7E+04'); + expect(format('00.0E+00', 100000)).toBe('10.0E+04'); + expect(format('00.00E+00', 9)).toBe('09.00E+00'); + expect(format('00.00E+00', 9.49999)).toBe('09.50E+00'); + expect(format('00.00E+00', 9.59999)).toBe('09.60E+00'); + expect(format('00.00E+00', 9.69999)).toBe('09.70E+00'); + expect(format('00.00E+00', 10)).toBe('10.00E+00'); + expect(format('00.00E+00', 90)).toBe('90.00E+00'); + expect(format('00.00E+00', 94.9999)).toBe('95.00E+00'); + expect(format('00.00E+00', 95.9999)).toBe('96.00E+00'); + expect(format('00.00E+00', 96.9999)).toBe('97.00E+00'); + expect(format('00.00E+00', 100)).toBe('01.00E+02'); + expect(format('00.00E+00', 900)).toBe('09.00E+02'); + expect(format('00.00E+00', 949.999)).toBe('09.50E+02'); + expect(format('00.00E+00', 959.999)).toBe('09.60E+02'); + expect(format('00.00E+00', 969.999)).toBe('09.70E+02'); + expect(format('00.00E+00', 1000)).toBe('10.00E+02'); + expect(format('00.00E+00', 9000)).toBe('90.00E+02'); + expect(format('00.00E+00', 9499.99)).toBe('95.00E+02'); + expect(format('00.00E+00', 9599.99)).toBe('96.00E+02'); + expect(format('00.00E+00', 9699.99)).toBe('97.00E+02'); + expect(format('00.00E+00', 10000)).toBe('01.00E+04'); + expect(format('00.00E+00', 90000)).toBe('09.00E+04'); + expect(format('00.00E+00', 94999.9)).toBe('09.50E+04'); + expect(format('00.00E+00', 95999.9)).toBe('09.60E+04'); + expect(format('00.00E+00', 96999.9)).toBe('09.70E+04'); + expect(format('00.00E+00', 100000)).toBe('10.00E+04'); + expect(format('000.E+00', 9)).toBe('009.E+00'); + expect(format('000.E+00', 9.49999)).toBe('009.E+00'); + expect(format('000.E+00', 9.59999)).toBe('010.E+00'); + expect(format('000.E+00', 9.69999)).toBe('010.E+00'); + expect(format('000.E+00', 10)).toBe('010.E+00'); + expect(format('000.E+00', 90)).toBe('090.E+00'); + expect(format('000.E+00', 94.9999)).toBe('095.E+00'); + expect(format('000.E+00', 95.9999)).toBe('096.E+00'); + expect(format('000.E+00', 96.9999)).toBe('097.E+00'); + expect(format('000.E+00', 100)).toBe('100.E+00'); + expect(format('000.E+00', 900)).toBe('900.E+00'); + expect(format('000.E+00', 949.999)).toBe('950.E+00'); + expect(format('000.E+00', 959.999)).toBe('960.E+00'); + expect(format('000.E+00', 969.999)).toBe('970.E+00'); + expect(format('000.E+00', 1000)).toBe('001.E+03'); + expect(format('000.E+00', 9000)).toBe('009.E+03'); + expect(format('000.E+00', 9499.99)).toBe('009.E+03'); + expect(format('000.E+00', 9599.99)).toBe('010.E+03'); + expect(format('000.E+00', 9699.99)).toBe('010.E+03'); + expect(format('000.E+00', 10000)).toBe('010.E+03'); + expect(format('000.E+00', 90000)).toBe('090.E+03'); + expect(format('000.E+00', 94999.9)).toBe('095.E+03'); + expect(format('000.E+00', 95999.9)).toBe('096.E+03'); + expect(format('000.E+00', 96999.9)).toBe('097.E+03'); + expect(format('000.E+00', 100000)).toBe('100.E+03'); + expect(format('000.0E+00', 9)).toBe('009.0E+00'); + expect(format('000.0E+00', 9.49999)).toBe('009.5E+00'); + expect(format('000.0E+00', 9.59999)).toBe('009.6E+00'); + expect(format('000.0E+00', 9.69999)).toBe('009.7E+00'); + expect(format('000.0E+00', 10)).toBe('010.0E+00'); + expect(format('000.0E+00', 90)).toBe('090.0E+00'); + expect(format('000.0E+00', 94.9999)).toBe('095.0E+00'); + expect(format('000.0E+00', 95.9999)).toBe('096.0E+00'); + expect(format('000.0E+00', 96.9999)).toBe('097.0E+00'); + expect(format('000.0E+00', 100)).toBe('100.0E+00'); + expect(format('000.0E+00', 900)).toBe('900.0E+00'); + expect(format('000.0E+00', 949.999)).toBe('950.0E+00'); + expect(format('000.0E+00', 959.999)).toBe('960.0E+00'); + expect(format('000.0E+00', 969.999)).toBe('970.0E+00'); + expect(format('000.0E+00', 1000)).toBe('001.0E+03'); + expect(format('000.0E+00', 9000)).toBe('009.0E+03'); + expect(format('000.0E+00', 9499.99)).toBe('009.5E+03'); + expect(format('000.0E+00', 9599.99)).toBe('009.6E+03'); + expect(format('000.0E+00', 9699.99)).toBe('009.7E+03'); + expect(format('000.0E+00', 10000)).toBe('010.0E+03'); + expect(format('000.0E+00', 90000)).toBe('090.0E+03'); + expect(format('000.0E+00', 94999.9)).toBe('095.0E+03'); + expect(format('000.0E+00', 95999.9)).toBe('096.0E+03'); + expect(format('000.0E+00', 96999.9)).toBe('097.0E+03'); + expect(format('000.0E+00', 100000)).toBe('100.0E+03'); + expect(format('000.00E+00', 9)).toBe('009.00E+00'); + expect(format('000.00E+00', 9.49999)).toBe('009.50E+00'); + expect(format('000.00E+00', 9.59999)).toBe('009.60E+00'); + expect(format('000.00E+00', 9.69999)).toBe('009.70E+00'); + expect(format('000.00E+00', 10)).toBe('010.00E+00'); + expect(format('000.00E+00', 90)).toBe('090.00E+00'); + expect(format('000.00E+00', 94.9999)).toBe('095.00E+00'); + expect(format('000.00E+00', 95.9999)).toBe('096.00E+00'); + expect(format('000.00E+00', 96.9999)).toBe('097.00E+00'); + expect(format('000.00E+00', 100)).toBe('100.00E+00'); + expect(format('000.00E+00', 900)).toBe('900.00E+00'); + expect(format('000.00E+00', 949.999)).toBe('950.00E+00'); + expect(format('000.00E+00', 959.999)).toBe('960.00E+00'); + expect(format('000.00E+00', 969.999)).toBe('970.00E+00'); + expect(format('000.00E+00', 1000)).toBe('001.00E+03'); + expect(format('000.00E+00', 9000)).toBe('009.00E+03'); + expect(format('000.00E+00', 9499.99)).toBe('009.50E+03'); + expect(format('000.00E+00', 9599.99)).toBe('009.60E+03'); + expect(format('000.00E+00', 9699.99)).toBe('009.70E+03'); + expect(format('000.00E+00', 10000)).toBe('010.00E+03'); + expect(format('000.00E+00', 90000)).toBe('090.00E+03'); + expect(format('000.00E+00', 94999.9)).toBe('095.00E+03'); + expect(format('000.00E+00', 95999.9)).toBe('096.00E+03'); + expect(format('000.00E+00', 96999.9)).toBe('097.00E+03'); + expect(format('000.00E+00', 100000)).toBe('100.00E+03'); +}); + +test('Exponential 0E+00', () => { + expect(format('0E+00', 1000000000000)).toBe('1E+12'); + expect(format('0E+00', 999999999999)).toBe('1E+12'); + expect(format('0E+00', 950000000000)).toBe('1E+12'); + expect(format('0E+00', 100000000000)).toBe('1E+11'); + expect(format('0E+00', 95000000000)).toBe('1E+11'); + expect(format('0E+00', 10000000000)).toBe('1E+10'); + expect(format('0E+00', 9500000000)).toBe('1E+10'); + expect(format('0E+00', 1000000000)).toBe('1E+09'); + expect(format('0E+00', 950000000)).toBe('1E+09'); + expect(format('0E+00', 100000000)).toBe('1E+08'); + expect(format('0E+00', 95000000)).toBe('1E+08'); + expect(format('0E+00', 10000000)).toBe('1E+07'); + expect(format('0E+00', 9500000)).toBe('1E+07'); + expect(format('0E+00', 1000000)).toBe('1E+06'); + expect(format('0E+00', 950000)).toBe('1E+06'); + expect(format('0E+00', 100000)).toBe('1E+05'); + expect(format('0E+00', 95000)).toBe('1E+05'); + expect(format('0E+00', 10000)).toBe('1E+04'); + expect(format('0E+00', 9500)).toBe('1E+04'); + expect(format('0E+00', 1000)).toBe('1E+03'); + expect(format('0E+00', 950)).toBe('1E+03'); + expect(format('0E+00', 100)).toBe('1E+02'); + expect(format('0E+00', 95)).toBe('1E+02'); + expect(format('0E+00', 10)).toBe('1E+01'); + expect(format('0E+00', 9.5)).toBe('1E+01'); + expect(format('0E+00', 1.4999999)).toBe('1E+00'); + expect(format('0E+00', 1)).toBe('1E+00'); + expect(format('0E+00', 0.95)).toBe('1E+00'); + expect(format('0E+00', 0.14999999)).toBe('1E-01'); + expect(format('0E+00', 0.1)).toBe('1E-01'); + expect(format('0E+00', 0.014999999)).toBe('1E-02'); + expect(format('0E+00', 0.01)).toBe('1E-02'); + expect(format('0E+00', 0.0014999999)).toBe('1E-03'); + expect(format('0E+00', 0.001)).toBe('1E-03'); + expect(format('0E+00', 0.00014999999)).toBe('1E-04'); + expect(format('0E+00', 0.0001)).toBe('1E-04'); + expect(format('0E+00', 0.000014999999)).toBe('1E-05'); + expect(format('0E+00', 0.00001)).toBe('1E-05'); + expect(format('0E+00', 0.00000149999999)).toBe('1E-06'); + expect(format('0E+00', 0.000001)).toBe('1E-06'); + expect(format('0E+00', 0.00000014999999)).toBe('1E-07'); + expect(format('0E+00', 0.0000001)).toBe('1E-07'); + expect(format('0E+00', 0.000000014999999)).toBe('1E-08'); + expect(format('0E+00', 0.00000001)).toBe('1E-08'); + expect(format('0E+00', 0.0000000014999999)).toBe('1E-09'); + expect(format('0E+00', 0.000000001)).toBe('1E-09'); + expect(format('0E+00', 0.00000000014999999)).toBe('1E-10'); + expect(format('0E+00', 0.0000000001)).toBe('1E-10'); + expect(format('0E+00', 0.000000000014999999)).toBe('1E-11'); + expect(format('0E+00', 0.00000000001)).toBe('1E-11'); + expect(format('0E+00', 0.0000000000014999999)).toBe('1E-12'); + expect(format('0E+00', 0.000000000001)).toBe('1E-12'); +}); + +test('Exponential 0.00E+00', () => { + expect(format('0.00E+00', 10000000)).toBe('1.00E+07'); + expect(format('0.00E+00', 20000000)).toBe('2.00E+07'); + expect(format('0.00E+00', 30000000)).toBe('3.00E+07'); + expect(format('0.00E+00', 30010000)).toBe('3.00E+07'); + expect(format('0.00E+00', 30100000)).toBe('3.01E+07'); + expect(format('0.00E+00', 31000000)).toBe('3.10E+07'); + expect(format('0.00E+00', 31680000)).toBe('3.17E+07'); + expect(format('0.00E+00', 31700000)).toBe('3.17E+07'); + expect(format('0.00E+00', 32500000)).toBe('3.25E+07'); + expect(format('0.00E+00', 35000000)).toBe('3.50E+07'); + expect(format('0.00E+00', 40000000)).toBe('4.00E+07'); + expect(format('0.00E+00', 50000000)).toBe('5.00E+07'); + expect(format('0.00E+00', 60000000)).toBe('6.00E+07'); + expect(format('0.00E+00', 70000000)).toBe('7.00E+07'); + expect(format('0.00E+00', 80000000)).toBe('8.00E+07'); + expect(format('0.00E+00', 90000000)).toBe('9.00E+07'); +}); + +test('Sign is grouped with digit in output', () => { + expect(format('0 E+ 0', 10000000)).toBe('1 E +7'); + expect(format('0 E+ 00', 10000000)).toBe('1 E +07'); + expect(format('0 E- 0', 10000000)).toBe('1 E 7'); + expect(format('0 E- 0', 0.0000001)).toBe('1 E -7'); + expect(format('0 E- 00', 0.0000001)).toBe('1 E -07'); +}); + +test('Exponent is shifted when integer part is omitted:', () => { + expect(format('.0E+0', 0)).toBe('.0E+0'); + expect(format('.0E+0', 1)).toBe('.1E+1'); + expect(format('.0E+0', 10)).toBe('.1E+2'); + expect(format('.0E+0', 100)).toBe('.1E+3'); + expect(format('.0E+0', 1000)).toBe('.1E+4'); + expect(format('.0E+0', 10000)).toBe('.1E+5'); + expect(format('.0E+0', 100000)).toBe('.1E+6'); + expect(format('.0E+0', 123456789)).toBe('.1E+9'); + expect(format('.0E+0', 0.1)).toBe('.1E+0'); + expect(format('.0E+0', 0.01)).toBe('.1E-1'); + expect(format('.0E+0', 0.001)).toBe('.1E-2'); + expect(format('.0E+0', 0.0001)).toBe('.1E-3'); + expect(format('.0E+0', 0.12345)).toBe('.1E+0'); + expect(format('.0E+0', 0.012345)).toBe('.1E-1'); +}); diff --git a/test/fragmented-numbers-test.js b/test/fragmented-numbers-test.js deleted file mode 100644 index edfbe87..0000000 --- a/test/fragmented-numbers-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import test from './utils.js'; - -test('Fragmented number parts', t => { - // exps with fragments - t.format('0.00E+0x0', 123456789, '1.23E+0x8'); - t.format('0.00E+0x0', 123456789, '1.23E+0x8'); - t.format('0.00E+?x?', 123456789, '1.23E+ x8'); - t.format('0.00E+#x#', 123456789, '1.23E+x8'); - t.format('0.0x0E+0', 123456789, '1.2x3E+8'); - t.format('0x0.00E+0', 123456789, '0x1.23E+8'); - t.format('0x0.0x0E+0x0', 1, '0x1.0x0E+0x0'); - t.format('#x#.#x#E+#x#', 1, 'x1.xE+x0'); - t.format('?x?.?x?E+?x?', 1, ' x1. x E+ x0'); - - t.format('00 00/00', 1, '01 00/01'); - t.format('00x00/00', 12345.67, '12345x65/97'); - t.format('0z0 00/00', 12345.67, '1234z5 65/97'); - t.format('00 0z0/00', 12345.67, '1234 5z65/97'); - t.format('00 00/0z0', 12345.67, '12345 02/3z0'); - t.format('00 0/0', 12345.67, '12345 2/3'); - t.format('00 ??/?z?', 12345.67, '12345 2/3z '); - - t.format('000E+00', 12345.67, '012E+03'); - t.format('00x0E+00', 12345.67, '01x2E+03'); - t.format('000E+0x0', 12345.67, '012E+0x3'); - t.format('0.0E+0x00', 1234567890000, '1.2E+0x12'); - - t.end(); -}); diff --git a/test/fragmented-numbers.spec.ts b/test/fragmented-numbers.spec.ts new file mode 100644 index 0000000..8d69df4 --- /dev/null +++ b/test/fragmented-numbers.spec.ts @@ -0,0 +1,28 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Fragmented number parts', () => { + // exps with fragments + expect(format('0.00E+0x0', 123456789)).toBe('1.23E+0x8'); + expect(format('0.00E+0x0', 123456789)).toBe('1.23E+0x8'); + expect(format('0.00E+?x?', 123456789)).toBe('1.23E+ x8'); + expect(format('0.00E+#x#', 123456789)).toBe('1.23E+x8'); + expect(format('0.0x0E+0', 123456789)).toBe('1.2x3E+8'); + expect(format('0x0.00E+0', 123456789)).toBe('0x1.23E+8'); + expect(format('0x0.0x0E+0x0', 1)).toBe('0x1.0x0E+0x0'); + expect(format('#x#.#x#E+#x#', 1)).toBe('x1.xE+x0'); + expect(format('?x?.?x?E+?x?', 1)).toBe(' x1. x E+ x0'); + + expect(format('00 00/00', 1)).toBe('01 00/01'); + expect(format('00x00/00', 12345.67)).toBe('12345x65/97'); + expect(format('0z0 00/00', 12345.67)).toBe('1234z5 65/97'); + expect(format('00 0z0/00', 12345.67)).toBe('1234 5z65/97'); + expect(format('00 00/0z0', 12345.67)).toBe('12345 02/3z0'); + expect(format('00 0/0', 12345.67)).toBe('12345 2/3'); + expect(format('00 ??/?z?', 12345.67)).toBe('12345 2/3z '); + + expect(format('000E+00', 12345.67)).toBe('012E+03'); + expect(format('00x0E+00', 12345.67)).toBe('01x2E+03'); + expect(format('000E+0x0', 12345.67)).toBe('012E+0x3'); + expect(format('0.0E+0x00', 1234567890000)).toBe('1.2E+0x12'); +}); diff --git a/test/info-test.js b/test/info-test.js deleted file mode 100644 index 7235e3c..0000000 --- a/test/info-test.js +++ /dev/null @@ -1,433 +0,0 @@ -import { getFormatInfo } from '../lib/index.js'; -import test from './utils.js'; - -test('numfmt.info', t => { - const i1 = { ...getFormatInfo('0') }; - t.equal(typeof i1, 'object', 'getFormatInfo emits object'); - t.deepEqual(i1, { - type: 'number', - isDate: false, - isText: false, - isPercent: false, - maxDecimals: 0, - color: 0, - scale: 1, - parentheses: 0, - grouped: 0, - code: 'F0', - level: 4 - }, 'numfmt.info object is what we expect'); - - const i2 = { ...getFormatInfo('0') }; - t.equal(typeof i2, 'object', 'formatters have info objects'); - t.deepEqual(i2, { - type: 'number', - isDate: false, - isText: false, - isPercent: false, - maxDecimals: 0, - scale: 1, - color: 0, - parentheses: 0, - grouped: 0, - code: 'F0', - level: 4 - }, 'formatters info is what we expect'); - - const borked = { ...getFormatInfo('y 0') }; - t.deepEqual(borked, { - type: 'error', - isDate: false, - isText: false, - isPercent: false, - maxDecimals: 0, - scale: 1, - color: 0, - parentheses: 0, - grouped: 0, - code: 'G', - level: 0 - }, 'info makes sense even when pattern is bogus'); - - t.end(); -}); - -test('General', t => { - t.assertInfo('General', { - type: 'general', - maxDecimals: 9, - code: 'G' - }); - t.assertInfo('General;-General', { - type: 'general', - maxDecimals: 9, - code: 'G' - }); - t.assertInfo('(General);[blue](-General);0;@', { - type: 'general', - maxDecimals: 9, - code: 'G-()', - color: 1, - parentheses: 1 - }); - t.end(); -}); - -test('Numbers', t => { - t.assertInfo('0', { - type: 'number', - maxDecimals: 0, - code: 'F0', - level: 4 - }); - t.assertInfo('0.0', { - type: 'number', - maxDecimals: 1, - code: 'F1', - level: 4 - }); - t.assertInfo('0.000', { - type: 'number', - maxDecimals: 3, - code: 'F3', - level: 4 - }); - t.assertInfo('0.000000000000000', { - type: 'number', - maxDecimals: 15, - code: 'F15', - level: 4 - }); - t.assertInfo('0.0000000000000000', { - type: 'number', - maxDecimals: 16, - code: 'F15', - level: 4 - }); - - t.assertInfo('#,##0', { - type: 'grouped', - maxDecimals: 0, - code: ',0', - grouped: 1, - level: 10.2 - }); - t.assertInfo('#,##0.00', { - type: 'grouped', - maxDecimals: 2, - code: ',2', - grouped: 1, - level: 10.2 - }); - t.assertInfo('(#,##0.00)', { - type: 'grouped', - maxDecimals: 2, - code: ',2()', - parentheses: 1, - grouped: 1, - level: 10.2 - }); - - t.assertInfo('0.00,"K"', { - type: 'number', - maxDecimals: 2, - code: 'F2', - scale: 0.001, - level: 4 - }); - t.assertInfo('0.00,,"K"', { - type: 'number', - maxDecimals: 2, - code: 'F2', - scale: 0.000001, - level: 4 - }); - - t.end(); -}); - -test('Parentheses', t => { - t.assertInfo('(0)', { - type: 'number', - parentheses: 1, - code: 'F0()', - level: 4 - }); - t.assertInfo('0;(0)', { - type: 'number', - code: 'F0', - level: 4 - }); - t.assertInfo('0;0;(0)', { - type: 'number', - code: 'F0', - level: 4 - }); - t.assertInfo('(General)', { - type: 'general', - parentheses: 1, - code: 'G()', - maxDecimals: 9 - }); - t.assertInfo('(0', { - type: 'number', - parentheses: 1, - code: 'F0()', - level: 4 - }); - t.assertInfo('0)', { - type: 'number', - code: 'F0', - level: 4 - }); - t.end(); -}); - -test('Fractions', t => { - t.assertInfo('# ?/?', { - type: 'fraction', - maxDecimals: 0, - code: 'G', - level: 2 - }); - t.assertInfo('0 ??/??', { - type: 'fraction', - maxDecimals: 0, - code: 'G', - level: 2 - }); - t.end(); -}); - -test('Text', t => { - t.assertInfo('@', { - type: 'text', - isText: true, - code: 'G', - level: 15 - }); - t.assertInfo('(@)', { - type: 'text', - isText: true, - code: 'G', - level: 15 - }); - t.end(); -}); - -test('Text', t => { - t.assertInfo('@', { - type: 'text', - isText: true, - code: 'G', - level: 15 - }); - t.assertInfo('(@)', { - type: 'text', - isText: true, - code: 'G', - level: 15 - }); - t.end(); -}); - -test('Currency', t => { - t.assertInfo('$#,##0;($#,##0)', { - type: 'currency', - code: 'C0', - grouped: 1, - level: 10.4 - }); - t.assertInfo('#,##0.00 €', { - type: 'currency', - code: 'C2', - maxDecimals: 2, - grouped: 1, - level: 10.4 - }); - t.assertInfo('₿ 0.0000', { - type: 'currency', - code: 'C4', - maxDecimals: 4, - level: 10.4 - }); - - // can pass in own currency - const testCurrency = (str, identifier, code) => { - const info = getFormatInfo(str, { currency: identifier }); - t.equal(info.code, code, str); - }; - // Excel doesn't really have a great solution to this: - // It just contorts the string to ensure that the current - // currency identifier is a separate token when parsed. - testCurrency('#,##0.00 "ISK"', 'ISK', 'C2'); - testCurrency('#,##0\\ "fiskur"', 'ISK', ',0'); - testCurrency('#,##0\\ "fISKur"', 'ISK', ',0'); - testCurrency('#,##0\\ "f ISK ur"', 'ISK', ',0'); - testCurrency('#,##0\\ \\f"ISK"\\u\\r', 'ISK', 'C0'); - testCurrency('#,##0\\ "ISK"', 'ISK', 'C0'); - testCurrency('#,##0\\a"ISK"\\a', 'ISK', 'C0'); - testCurrency('#,##0"aISKa"', 'ISK', ',0'); - - t.end(); -}); - -test('Percentages', t => { - t.assertInfo('0%', { - type: 'percent', - isPercent: true, - scale: 100, - code: 'P0', - level: 10.6 - }); - t.assertInfo('0.00%;[red]0.00%', { - type: 'percent', - isPercent: true, - scale: 100, - code: 'P2-', - color: 1, - maxDecimals: 2, - level: 10.6 - }); - t.end(); -}); - -test('Scientific', t => { - t.assertInfo('0E+0', { - type: 'scientific', - code: 'S0', - level: 6 - }); - t.assertInfo('0.00E+00', { - type: 'scientific', - code: 'S2', - maxDecimals: 2, - level: 6 - }); - t.assertInfo('0.0E+0;[red]0.0E+0', { - type: 'scientific', - code: 'S1-', - color: 1, - maxDecimals: 1, - level: 6 - }); - t.end(); -}); - -test('Dates', t => { - const dt = { type: 'date', isDate: true, level: 10.8 }; - const tm = { type: 'time', isDate: true, level: 10.8 }; - // D1 - t.assertInfo('dd-mmm-yyyy h:mm:ss A/P', { ...dt, code: 'D1', type: 'datetime' }); - t.assertInfo('dd-mmm-yyyy h:mm:ss', { ...dt, code: 'D1', type: 'datetime' }); - t.assertInfo('dd-mmm-yyyy', { ...dt, code: 'D1' }); - t.assertInfo('d-mmm-yyyy', { ...dt, code: 'D1' }); - t.assertInfo('d-mm-yyyy', { ...dt, code: 'D1' }); - t.assertInfo('d-m-yyyy', { ...dt, code: 'D1' }); - t.assertInfo('d-m-yy', { ...dt, code: 'D1' }); - t.assertInfo('d-m-b', { ...dt, code: 'D1' }); - // D2 - t.assertInfo('dd-mmmm h:mm A/P', { ...dt, code: 'D2', type: 'datetime' }); - t.assertInfo('dd-mmm h:mm:ss', { ...dt, code: 'D2', type: 'datetime' }); - t.assertInfo('dd-mmm', { ...dt, code: 'D2' }); - t.assertInfo('d-mmm', { ...dt, code: 'D2' }); - t.assertInfo('d-mm', { ...dt, code: 'D2' }); - t.assertInfo('d-m', { ...dt, code: 'D2' }); - t.assertInfo('d-m-m', { ...dt, code: 'D2' }); - t.assertInfo('d-m-d', { ...dt, code: 'D2' }); - // D3 - t.assertInfo('mmmm-yyyy h:mm A/P', { ...dt, code: 'D3', type: 'datetime' }); - t.assertInfo('mmmm-yyyy', { ...dt, code: 'D3' }); - t.assertInfo('m-y', { ...dt, code: 'D3' }); - t.assertInfo('m-y-m', { ...dt, code: 'D3' }); - t.assertInfo('m-y-d', { ...dt, code: 'D3' }); - t.assertInfo('m-b', { ...dt, code: 'D3' }); - // D4 (same as D1 but month first) - t.assertInfo('mmm-dd-yyyy h:mm:ss A/P', { ...dt, code: 'D4', type: 'datetime' }); - t.assertInfo('mmm-dd-yyyy h:mm:ss', { ...dt, code: 'D4', type: 'datetime' }); - t.assertInfo('mmm-dd-yyyy', { ...dt, code: 'D4' }); - t.assertInfo('mmm-d-yyyy', { ...dt, code: 'D4' }); - t.assertInfo('mm-d-yyyy', { ...dt, code: 'D4' }); - t.assertInfo('m-d-yyyy', { ...dt, code: 'D4' }); - t.assertInfo('m-d-yy', { ...dt, code: 'D4' }); - t.assertInfo('m-d-y-m', { ...dt, code: 'D4' }); - t.assertInfo('m-d-b', { ...dt, code: 'D4' }); - // D5 (same as D2 but month first) - t.assertInfo('mmmm-dd h:mm A/P', { ...dt, code: 'D5', type: 'datetime' }); - t.assertInfo('mmm-dd h:mm:ss', { ...dt, code: 'D5', type: 'datetime' }); - t.assertInfo('mmm-dd', { ...dt, code: 'D5' }); - t.assertInfo('mmm-d', { ...dt, code: 'D5' }); - t.assertInfo('mm-d', { ...dt, code: 'D5' }); - t.assertInfo('m-d', { ...dt, code: 'D5' }); - t.assertInfo('m-d-d', { ...dt, code: 'D5' }); - t.assertInfo('m-d-m', { ...dt, code: 'D5' }); - t.assertInfo('m-d-d-y', { ...dt, code: 'D5' }); - // D6 - t.assertInfo('h:mm:ss AM/PM', { ...tm, code: 'D6' }); - t.assertInfo('h:mm:ss "foo" AM/PM', { ...tm, code: 'D6' }); - t.assertInfo('h:m:s A/P', { ...tm, code: 'D6' }); - // D7 - t.assertInfo('h:mm AM/PM', { ...tm, code: 'D7' }); - t.assertInfo('h:mm "foo" AM/PM', { ...tm, code: 'D7' }); - t.assertInfo('h:m A/P', { ...tm, code: 'D7' }); - // D8 - t.assertInfo('h:mm:ss', { ...tm, code: 'D8' }); - t.assertInfo('"foo" h:mm:ss "bar"', { ...tm, code: 'D8' }); - t.assertInfo('h:m:s', { ...tm, code: 'D8' }); - // D9 - t.assertInfo('h:mm', { ...tm, code: 'D9' }); - t.assertInfo('"foo" h:mm "bar"', { ...tm, code: 'D9' }); - t.assertInfo('h:m', { ...tm, code: 'D9' }); - // Non coded dates - t.assertInfo('yyyy', { ...dt, code: 'G' }); - t.assertInfo('yyyy-mm-dd', { ...dt, code: 'G' }); - t.assertInfo('yyyy-mm-dd"T"hh:mm:ss', { ...dt, code: 'G', type: 'datetime' }); - t.assertInfo('dddd h:mm:ss', { ...dt, code: 'G', type: 'datetime' }); - t.end(); -}); - -test('dateInfo', t => { - // numfmt.getDateInfo returns "all off" for non dates - t.assertDateInfo('0', {}); - - // dateInfo makes sense even when pattern is bogus - t.assertDateInfo('y 0', {}); - - t.assertDateInfo('yyyy', { year: true }); - t.assertDateInfo('yyy', { year: true }); - t.assertDateInfo('yy', { year: true }); - t.assertDateInfo('y', { year: true }); - t.assertDateInfo('mmmm', { month: true }); - t.assertDateInfo('mmm', { month: true }); - t.assertDateInfo('mm', { month: true }); - t.assertDateInfo('m', { month: true }); - t.assertDateInfo('dddd', { day: true }); - t.assertDateInfo('ddd', { day: true }); - t.assertDateInfo('dd', { day: true }); - t.assertDateInfo('d', { day: true }); - t.assertDateInfo('hh', { hours: true }); - t.assertDateInfo('h', { hours: true }); - t.assertDateInfo('h:mm', { hours: true, minutes: true }); - t.assertDateInfo('h:m', { hours: true, minutes: true }); - t.assertDateInfo('ss', { seconds: true }); - t.assertDateInfo('s', { seconds: true }); - t.assertDateInfo('hh am/pm', { hours: true, clockType: 12 }); - t.assertDateInfo('hh A/P', { hours: true, clockType: 12 }); - - t.assertDateInfo('yyyy-mm', { year: true, month: true }); - t.assertDateInfo('yyyy-mm-dd', { year: true, month: true, day: true }); - t.assertDateInfo('yyyy-mm-ddThh', { year: true, month: true, day: true, hours: true }); - t.assertDateInfo('yyyy-mm-ddThh:mm', { year: true, month: true, day: true, hours: true, minutes: true }); - t.assertDateInfo('yyyy-mm-ddThh:mm:ss', { year: true, month: true, day: true, hours: true, minutes: true, seconds: true }); - t.assertDateInfo('yyyy-mm-ddThh:mm:ss AM/PM', { year: true, month: true, day: true, hours: true, minutes: true, seconds: true, clockType: 12 }); - - t.assertDateInfo('yy dd mm:ss', { year: true, day: true, month: true, seconds: true }); - - t.assertDateInfo('dd', { year: false, month: false, day: true }); - - t.assertDateInfo('yyyy-mm-dd', { year: true, month: true, day: true }); - t.assertDateInfo('dd-mm-yyyy', { year: true, month: true, day: true }); - t.assertDateInfo('dd yyyy', { year: true, day: true }); - - t.end(); -}); diff --git a/test/info.spec.ts b/test/info.spec.ts new file mode 100644 index 0000000..dd821a8 --- /dev/null +++ b/test/info.spec.ts @@ -0,0 +1,449 @@ +import { expect, test } from 'vitest'; +import { getFormatDateInfo, getFormatInfo } from '../lib/index.js'; + +const commonProps = { + isDate: false, + isText: false, + isPercent: false, + maxDecimals: 0, + grouped: 0, + parentheses: 0, + color: 0, + scale: 1, + level: 0 +}; + +function assertInfo (fmtString: string, expectProps: object) { + expect({ ...getFormatInfo(fmtString) }, fmtString) + .toEqual({ ...commonProps, ...expectProps }); +} + +const commonDateProps = { + year: false, + month: false, + day: false, + hours: false, + minutes: false, + seconds: false, + clockType: 24 +}; + +function assertDateInfo (fmtString: string, expectProps: object) { + expect(getFormatDateInfo(fmtString), fmtString) + .toEqual({ ...commonDateProps, ...expectProps }); +} + +test('numfmt.info', () => { + const i1 = { ...getFormatInfo('0') }; + expect(typeof i1, 'getFormatInfo emits object').toBe('object'); + expect(i1, 'numfmt.info object is what we expect').toEqual({ + type: 'number', + isDate: false, + isText: false, + isPercent: false, + maxDecimals: 0, + color: 0, + scale: 1, + parentheses: 0, + grouped: 0, + code: 'F0', + level: 4 + }); + + const i2 = { ...getFormatInfo('0') }; + expect(typeof i2, 'formatters have info objects').toBe('object'); + expect(i2, 'formatters info is what we expect').toEqual({ + type: 'number', + isDate: false, + isText: false, + isPercent: false, + maxDecimals: 0, + scale: 1, + color: 0, + parentheses: 0, + grouped: 0, + code: 'F0', + level: 4 + }); + + const borked = { ...getFormatInfo('y 0') }; + expect(borked, 'info makes sense even when pattern is bogus').toEqual({ + type: 'error', + isDate: false, + isText: false, + isPercent: false, + maxDecimals: 0, + scale: 1, + color: 0, + parentheses: 0, + grouped: 0, + code: 'G', + level: 0 + }); +}); + +test('General', () => { + assertInfo('General', { + type: 'general', + maxDecimals: 9, + code: 'G' + }); + assertInfo('General;-General', { + type: 'general', + maxDecimals: 9, + code: 'G' + }); + assertInfo('(General);[blue](-General);0;@', { + type: 'general', + maxDecimals: 9, + code: 'G-()', + color: 1, + parentheses: 1 + }); +}); + +test('Numbers', () => { + assertInfo('0', { + type: 'number', + maxDecimals: 0, + code: 'F0', + level: 4 + }); + assertInfo('0.0', { + type: 'number', + maxDecimals: 1, + code: 'F1', + level: 4 + }); + assertInfo('0.000', { + type: 'number', + maxDecimals: 3, + code: 'F3', + level: 4 + }); + assertInfo('0.000000000000000', { + type: 'number', + maxDecimals: 15, + code: 'F15', + level: 4 + }); + assertInfo('0.0000000000000000', { + type: 'number', + maxDecimals: 16, + code: 'F15', + level: 4 + }); + + assertInfo('#,##0', { + type: 'grouped', + maxDecimals: 0, + code: ',0', + grouped: 1, + level: 10.2 + }); + assertInfo('#,##0.00', { + type: 'grouped', + maxDecimals: 2, + code: ',2', + grouped: 1, + level: 10.2 + }); + assertInfo('(#,##0.00)', { + type: 'grouped', + maxDecimals: 2, + code: ',2()', + parentheses: 1, + grouped: 1, + level: 10.2 + }); + + assertInfo('0.00,"K"', { + type: 'number', + maxDecimals: 2, + code: 'F2', + scale: 0.001, + level: 4 + }); + assertInfo('0.00,,"K"', { + type: 'number', + maxDecimals: 2, + code: 'F2', + scale: 0.000001, + level: 4 + }); +}); + +test('Parentheses', () => { + assertInfo('(0)', { + type: 'number', + parentheses: 1, + code: 'F0()', + level: 4 + }); + assertInfo('0;(0)', { + type: 'number', + code: 'F0', + level: 4 + }); + assertInfo('0;0;(0)', { + type: 'number', + code: 'F0', + level: 4 + }); + assertInfo('(General)', { + type: 'general', + parentheses: 1, + code: 'G()', + maxDecimals: 9 + }); + assertInfo('(0', { + type: 'number', + parentheses: 1, + code: 'F0()', + level: 4 + }); + assertInfo('0)', { + type: 'number', + code: 'F0', + level: 4 + }); +}); + +test('Fractions', () => { + assertInfo('# ?/?', { + type: 'fraction', + maxDecimals: 0, + code: 'G', + level: 2 + }); + assertInfo('0 ??/??', { + type: 'fraction', + maxDecimals: 0, + code: 'G', + level: 2 + }); +}); + +test('Text', () => { + assertInfo('@', { + type: 'text', + isText: true, + code: 'G', + level: 15 + }); + assertInfo('(@)', { + type: 'text', + isText: true, + code: 'G', + level: 15 + }); +}); + +test('Text', () => { + assertInfo('@', { + type: 'text', + isText: true, + code: 'G', + level: 15 + }); + assertInfo('(@)', { + type: 'text', + isText: true, + code: 'G', + level: 15 + }); +}); + +test('Currency', () => { + assertInfo('$#,##0;($#,##0)', { + type: 'currency', + code: 'C0', + grouped: 1, + level: 10.4 + }); + assertInfo('#,##0.00 €', { + type: 'currency', + code: 'C2', + maxDecimals: 2, + grouped: 1, + level: 10.4 + }); + assertInfo('₿ 0.0000', { + type: 'currency', + code: 'C4', + maxDecimals: 4, + level: 10.4 + }); + + // can pass in own currency + const testCurrency = (str: string, identifier: string, code: string) => { + const info = getFormatInfo(str, { currency: identifier }); + expect(info.code, str).toBe(code); + }; + // Excel doesn't really have a great solution to this: + // It just contorts the string to ensure that the current + // currency identifier is a separate token when parsed. + testCurrency('#,##0.00 "ISK"', 'ISK', 'C2'); + testCurrency('#,##0\\ "fiskur"', 'ISK', ',0'); + testCurrency('#,##0\\ "fISKur"', 'ISK', ',0'); + testCurrency('#,##0\\ "f ISK ur"', 'ISK', ',0'); + testCurrency('#,##0\\ \\f"ISK"\\u\\r', 'ISK', 'C0'); + testCurrency('#,##0\\ "ISK"', 'ISK', 'C0'); + testCurrency('#,##0\\a"ISK"\\a', 'ISK', 'C0'); + testCurrency('#,##0"aISKa"', 'ISK', ',0'); +}); + +test('Percentages', () => { + assertInfo('0%', { + type: 'percent', + isPercent: true, + scale: 100, + code: 'P0', + level: 10.6 + }); + assertInfo('0.00%;[red]0.00%', { + type: 'percent', + isPercent: true, + scale: 100, + code: 'P2-', + color: 1, + maxDecimals: 2, + level: 10.6 + }); +}); + +test('Scientific', () => { + assertInfo('0E+0', { + type: 'scientific', + code: 'S0', + level: 6 + }); + assertInfo('0.00E+00', { + type: 'scientific', + code: 'S2', + maxDecimals: 2, + level: 6 + }); + assertInfo('0.0E+0;[red]0.0E+0', { + type: 'scientific', + code: 'S1-', + color: 1, + maxDecimals: 1, + level: 6 + }); +}); + +test('Dates', () => { + const dt = { type: 'date', isDate: true, level: 10.8 }; + const tm = { type: 'time', isDate: true, level: 10.8 }; + // D1 + assertInfo('dd-mmm-yyyy h:mm:ss A/P', { ...dt, code: 'D1', type: 'datetime' }); + assertInfo('dd-mmm-yyyy h:mm:ss', { ...dt, code: 'D1', type: 'datetime' }); + assertInfo('dd-mmm-yyyy', { ...dt, code: 'D1' }); + assertInfo('d-mmm-yyyy', { ...dt, code: 'D1' }); + assertInfo('d-mm-yyyy', { ...dt, code: 'D1' }); + assertInfo('d-m-yyyy', { ...dt, code: 'D1' }); + assertInfo('d-m-yy', { ...dt, code: 'D1' }); + assertInfo('d-m-b', { ...dt, code: 'D1' }); + // D2 + assertInfo('dd-mmmm h:mm A/P', { ...dt, code: 'D2', type: 'datetime' }); + assertInfo('dd-mmm h:mm:ss', { ...dt, code: 'D2', type: 'datetime' }); + assertInfo('dd-mmm', { ...dt, code: 'D2' }); + assertInfo('d-mmm', { ...dt, code: 'D2' }); + assertInfo('d-mm', { ...dt, code: 'D2' }); + assertInfo('d-m', { ...dt, code: 'D2' }); + assertInfo('d-m-m', { ...dt, code: 'D2' }); + assertInfo('d-m-d', { ...dt, code: 'D2' }); + // D3 + assertInfo('mmmm-yyyy h:mm A/P', { ...dt, code: 'D3', type: 'datetime' }); + assertInfo('mmmm-yyyy', { ...dt, code: 'D3' }); + assertInfo('m-y', { ...dt, code: 'D3' }); + assertInfo('m-y-m', { ...dt, code: 'D3' }); + assertInfo('m-y-d', { ...dt, code: 'D3' }); + assertInfo('m-b', { ...dt, code: 'D3' }); + // D4 (same as D1 but month first) + assertInfo('mmm-dd-yyyy h:mm:ss A/P', { ...dt, code: 'D4', type: 'datetime' }); + assertInfo('mmm-dd-yyyy h:mm:ss', { ...dt, code: 'D4', type: 'datetime' }); + assertInfo('mmm-dd-yyyy', { ...dt, code: 'D4' }); + assertInfo('mmm-d-yyyy', { ...dt, code: 'D4' }); + assertInfo('mm-d-yyyy', { ...dt, code: 'D4' }); + assertInfo('m-d-yyyy', { ...dt, code: 'D4' }); + assertInfo('m-d-yy', { ...dt, code: 'D4' }); + assertInfo('m-d-y-m', { ...dt, code: 'D4' }); + assertInfo('m-d-b', { ...dt, code: 'D4' }); + // D5 (same as D2 but month first) + assertInfo('mmmm-dd h:mm A/P', { ...dt, code: 'D5', type: 'datetime' }); + assertInfo('mmm-dd h:mm:ss', { ...dt, code: 'D5', type: 'datetime' }); + assertInfo('mmm-dd', { ...dt, code: 'D5' }); + assertInfo('mmm-d', { ...dt, code: 'D5' }); + assertInfo('mm-d', { ...dt, code: 'D5' }); + assertInfo('m-d', { ...dt, code: 'D5' }); + assertInfo('m-d-d', { ...dt, code: 'D5' }); + assertInfo('m-d-m', { ...dt, code: 'D5' }); + assertInfo('m-d-d-y', { ...dt, code: 'D5' }); + // D6 + assertInfo('h:mm:ss AM/PM', { ...tm, code: 'D6' }); + assertInfo('h:mm:ss "foo" AM/PM', { ...tm, code: 'D6' }); + assertInfo('h:m:s A/P', { ...tm, code: 'D6' }); + // D7 + assertInfo('h:mm AM/PM', { ...tm, code: 'D7' }); + assertInfo('h:mm "foo" AM/PM', { ...tm, code: 'D7' }); + assertInfo('h:m A/P', { ...tm, code: 'D7' }); + // D8 + assertInfo('h:mm:ss', { ...tm, code: 'D8' }); + assertInfo('"foo" h:mm:ss "bar"', { ...tm, code: 'D8' }); + assertInfo('h:m:s', { ...tm, code: 'D8' }); + // D9 + assertInfo('h:mm', { ...tm, code: 'D9' }); + assertInfo('"foo" h:mm "bar"', { ...tm, code: 'D9' }); + assertInfo('h:m', { ...tm, code: 'D9' }); + // Non coded dates + assertInfo('yyyy', { ...dt, code: 'G' }); + assertInfo('yyyy-mm-dd', { ...dt, code: 'G' }); + assertInfo('yyyy-mm-dd"T"hh:mm:ss', { ...dt, code: 'G', type: 'datetime' }); + assertInfo('dddd h:mm:ss', { ...dt, code: 'G', type: 'datetime' }); +}); + +test('dateInfo', () => { + // numfmt.getDateInfo returns "all off" for non dates + assertDateInfo('0', {}); + + // dateInfo makes sense even when pattern is bogus + assertDateInfo('y 0', {}); + + assertDateInfo('yyyy', { year: true }); + assertDateInfo('yyy', { year: true }); + assertDateInfo('yy', { year: true }); + assertDateInfo('y', { year: true }); + assertDateInfo('mmmm', { month: true }); + assertDateInfo('mmm', { month: true }); + assertDateInfo('mm', { month: true }); + assertDateInfo('m', { month: true }); + assertDateInfo('dddd', { day: true }); + assertDateInfo('ddd', { day: true }); + assertDateInfo('dd', { day: true }); + assertDateInfo('d', { day: true }); + assertDateInfo('hh', { hours: true }); + assertDateInfo('h', { hours: true }); + assertDateInfo('h:mm', { hours: true, minutes: true }); + assertDateInfo('h:m', { hours: true, minutes: true }); + assertDateInfo('ss', { seconds: true }); + assertDateInfo('s', { seconds: true }); + assertDateInfo('hh am/pm', { hours: true, clockType: 12 }); + assertDateInfo('hh A/P', { hours: true, clockType: 12 }); + + assertDateInfo('yyyy-mm', { year: true, month: true }); + assertDateInfo('yyyy-mm-dd', { year: true, month: true, day: true }); + assertDateInfo('yyyy-mm-ddThh', { year: true, month: true, day: true, hours: true }); + assertDateInfo('yyyy-mm-ddThh:mm', { year: true, month: true, day: true, hours: true, minutes: true }); + assertDateInfo('yyyy-mm-ddThh:mm:ss', { year: true, month: true, day: true, hours: true, minutes: true, seconds: true }); + assertDateInfo('yyyy-mm-ddThh:mm:ss AM/PM', { year: true, month: true, day: true, hours: true, minutes: true, seconds: true, clockType: 12 }); + + assertDateInfo('yy dd mm:ss', { year: true, day: true, month: true, seconds: true }); + + assertDateInfo('dd', { year: false, month: false, day: true }); + + assertDateInfo('yyyy-mm-dd', { year: true, month: true, day: true }); + assertDateInfo('dd-mm-yyyy', { year: true, month: true, day: true }); + assertDateInfo('dd yyyy', { year: true, day: true }); +}); diff --git a/test/leap1900-test.js b/test/leap1900-test.js deleted file mode 100644 index b899ae5..0000000 --- a/test/leap1900-test.js +++ /dev/null @@ -1,136 +0,0 @@ -import test from './utils.js'; - -const ISODATE = 'yyyy-mm-dd'; - -test('Excel leap 1900 bug: ON', t => { - t.format(ISODATE, 61, '1900-03-01', { leap1900: true }); - t.format(ISODATE, 60, '1900-02-29', { leap1900: true }); - t.format(ISODATE, 59, '1900-02-28', { leap1900: true }); - t.format(ISODATE, 58, '1900-02-27', { leap1900: true }); - t.format(ISODATE, 57, '1900-02-26', { leap1900: true }); - t.format(ISODATE, 56, '1900-02-25', { leap1900: true }); - t.format(ISODATE, 55, '1900-02-24', { leap1900: true }); - t.format(ISODATE, 54, '1900-02-23', { leap1900: true }); - t.format(ISODATE, 53, '1900-02-22', { leap1900: true }); - t.format(ISODATE, 52, '1900-02-21', { leap1900: true }); - t.format(ISODATE, 51, '1900-02-20', { leap1900: true }); - t.format(ISODATE, 50, '1900-02-19', { leap1900: true }); - t.format(ISODATE, 49, '1900-02-18', { leap1900: true }); - t.format(ISODATE, 48, '1900-02-17', { leap1900: true }); - t.format(ISODATE, 47, '1900-02-16', { leap1900: true }); - t.format(ISODATE, 46, '1900-02-15', { leap1900: true }); - t.format(ISODATE, 45, '1900-02-14', { leap1900: true }); - t.format(ISODATE, 44, '1900-02-13', { leap1900: true }); - t.format(ISODATE, 43, '1900-02-12', { leap1900: true }); - t.format(ISODATE, 42, '1900-02-11', { leap1900: true }); - t.format(ISODATE, 41, '1900-02-10', { leap1900: true }); - t.format(ISODATE, 40, '1900-02-09', { leap1900: true }); - t.format(ISODATE, 39, '1900-02-08', { leap1900: true }); - t.format(ISODATE, 38, '1900-02-07', { leap1900: true }); - t.format(ISODATE, 37, '1900-02-06', { leap1900: true }); - t.format(ISODATE, 36, '1900-02-05', { leap1900: true }); - t.format(ISODATE, 35, '1900-02-04', { leap1900: true }); - t.format(ISODATE, 34, '1900-02-03', { leap1900: true }); - t.format(ISODATE, 33, '1900-02-02', { leap1900: true }); - t.format(ISODATE, 32, '1900-02-01', { leap1900: true }); - t.format(ISODATE, 31, '1900-01-31', { leap1900: true }); - t.format(ISODATE, 30, '1900-01-30', { leap1900: true }); - t.format(ISODATE, 29, '1900-01-29', { leap1900: true }); - t.format(ISODATE, 28, '1900-01-28', { leap1900: true }); - t.format(ISODATE, 27, '1900-01-27', { leap1900: true }); - t.format(ISODATE, 26, '1900-01-26', { leap1900: true }); - t.format(ISODATE, 25, '1900-01-25', { leap1900: true }); - t.format(ISODATE, 24, '1900-01-24', { leap1900: true }); - t.format(ISODATE, 23, '1900-01-23', { leap1900: true }); - t.format(ISODATE, 22, '1900-01-22', { leap1900: true }); - t.format(ISODATE, 21, '1900-01-21', { leap1900: true }); - t.format(ISODATE, 20, '1900-01-20', { leap1900: true }); - t.format(ISODATE, 19, '1900-01-19', { leap1900: true }); - t.format(ISODATE, 18, '1900-01-18', { leap1900: true }); - t.format(ISODATE, 17, '1900-01-17', { leap1900: true }); - t.format(ISODATE, 16, '1900-01-16', { leap1900: true }); - t.format(ISODATE, 15, '1900-01-15', { leap1900: true }); - t.format(ISODATE, 14, '1900-01-14', { leap1900: true }); - t.format(ISODATE, 13, '1900-01-13', { leap1900: true }); - t.format(ISODATE, 12, '1900-01-12', { leap1900: true }); - t.format(ISODATE, 11, '1900-01-11', { leap1900: true }); - t.format(ISODATE, 10, '1900-01-10', { leap1900: true }); - t.format(ISODATE, 9, '1900-01-09', { leap1900: true }); - t.format(ISODATE, 8, '1900-01-08', { leap1900: true }); - t.format(ISODATE, 7, '1900-01-07', { leap1900: true }); - t.format(ISODATE, 6, '1900-01-06', { leap1900: true }); - t.format(ISODATE, 5, '1900-01-05', { leap1900: true }); - t.format(ISODATE, 4, '1900-01-04', { leap1900: true }); - t.format(ISODATE, 3, '1900-01-03', { leap1900: true }); - t.format(ISODATE, 2, '1900-01-02', { leap1900: true }); - t.format(ISODATE, 1, '1900-01-01', { leap1900: true }); - t.format(ISODATE, 0, '1900-01-00', { leap1900: true }); - t.end(); -}); - -test('Excel 1900 bug: OFF', t => { - t.format(ISODATE, 61, '1900-03-01', { leap1900: false }); - t.format(ISODATE, 60, '1900-02-28', { leap1900: false }); - t.format(ISODATE, 59, '1900-02-27', { leap1900: false }); - t.format(ISODATE, 58, '1900-02-26', { leap1900: false }); - t.format(ISODATE, 57, '1900-02-25', { leap1900: false }); - t.format(ISODATE, 56, '1900-02-24', { leap1900: false }); - t.format(ISODATE, 55, '1900-02-23', { leap1900: false }); - t.format(ISODATE, 54, '1900-02-22', { leap1900: false }); - t.format(ISODATE, 53, '1900-02-21', { leap1900: false }); - t.format(ISODATE, 52, '1900-02-20', { leap1900: false }); - t.format(ISODATE, 51, '1900-02-19', { leap1900: false }); - t.format(ISODATE, 50, '1900-02-18', { leap1900: false }); - t.format(ISODATE, 49, '1900-02-17', { leap1900: false }); - t.format(ISODATE, 48, '1900-02-16', { leap1900: false }); - t.format(ISODATE, 47, '1900-02-15', { leap1900: false }); - t.format(ISODATE, 46, '1900-02-14', { leap1900: false }); - t.format(ISODATE, 45, '1900-02-13', { leap1900: false }); - t.format(ISODATE, 44, '1900-02-12', { leap1900: false }); - t.format(ISODATE, 43, '1900-02-11', { leap1900: false }); - t.format(ISODATE, 42, '1900-02-10', { leap1900: false }); - t.format(ISODATE, 41, '1900-02-09', { leap1900: false }); - t.format(ISODATE, 40, '1900-02-08', { leap1900: false }); - t.format(ISODATE, 39, '1900-02-07', { leap1900: false }); - t.format(ISODATE, 38, '1900-02-06', { leap1900: false }); - t.format(ISODATE, 37, '1900-02-05', { leap1900: false }); - t.format(ISODATE, 36, '1900-02-04', { leap1900: false }); - t.format(ISODATE, 35, '1900-02-03', { leap1900: false }); - t.format(ISODATE, 34, '1900-02-02', { leap1900: false }); - t.format(ISODATE, 33, '1900-02-01', { leap1900: false }); - t.format(ISODATE, 32, '1900-01-31', { leap1900: false }); - t.format(ISODATE, 31, '1900-01-30', { leap1900: false }); - t.format(ISODATE, 30, '1900-01-29', { leap1900: false }); - t.format(ISODATE, 29, '1900-01-28', { leap1900: false }); - t.format(ISODATE, 28, '1900-01-27', { leap1900: false }); - t.format(ISODATE, 27, '1900-01-26', { leap1900: false }); - t.format(ISODATE, 26, '1900-01-25', { leap1900: false }); - t.format(ISODATE, 25, '1900-01-24', { leap1900: false }); - t.format(ISODATE, 24, '1900-01-23', { leap1900: false }); - t.format(ISODATE, 23, '1900-01-22', { leap1900: false }); - t.format(ISODATE, 22, '1900-01-21', { leap1900: false }); - t.format(ISODATE, 21, '1900-01-20', { leap1900: false }); - t.format(ISODATE, 20, '1900-01-19', { leap1900: false }); - t.format(ISODATE, 19, '1900-01-18', { leap1900: false }); - t.format(ISODATE, 18, '1900-01-17', { leap1900: false }); - t.format(ISODATE, 17, '1900-01-16', { leap1900: false }); - t.format(ISODATE, 16, '1900-01-15', { leap1900: false }); - t.format(ISODATE, 15, '1900-01-14', { leap1900: false }); - t.format(ISODATE, 14, '1900-01-13', { leap1900: false }); - t.format(ISODATE, 13, '1900-01-12', { leap1900: false }); - t.format(ISODATE, 12, '1900-01-11', { leap1900: false }); - t.format(ISODATE, 11, '1900-01-10', { leap1900: false }); - t.format(ISODATE, 10, '1900-01-09', { leap1900: false }); - t.format(ISODATE, 9, '1900-01-08', { leap1900: false }); - t.format(ISODATE, 8, '1900-01-07', { leap1900: false }); - t.format(ISODATE, 7, '1900-01-06', { leap1900: false }); - t.format(ISODATE, 6, '1900-01-05', { leap1900: false }); - t.format(ISODATE, 5, '1900-01-04', { leap1900: false }); - t.format(ISODATE, 4, '1900-01-03', { leap1900: false }); - t.format(ISODATE, 3, '1900-01-02', { leap1900: false }); - t.format(ISODATE, 2, '1900-01-01', { leap1900: false }); - t.format(ISODATE, 1, '1899-12-31', { leap1900: false }); - t.format(ISODATE, 0, '1899-12-30', { leap1900: false }); - t.end(); -}); - diff --git a/test/leap1900.spec.ts b/test/leap1900.spec.ts new file mode 100644 index 0000000..e6ab023 --- /dev/null +++ b/test/leap1900.spec.ts @@ -0,0 +1,135 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +const ISODATE = 'yyyy-mm-dd'; + +test('Excel leap 1900 bug: ON', () => { + expect(format(ISODATE, 61, { leap1900: true })).toBe('1900-03-01'); + expect(format(ISODATE, 60, { leap1900: true })).toBe('1900-02-29'); + expect(format(ISODATE, 59, { leap1900: true })).toBe('1900-02-28'); + expect(format(ISODATE, 58, { leap1900: true })).toBe('1900-02-27'); + expect(format(ISODATE, 57, { leap1900: true })).toBe('1900-02-26'); + expect(format(ISODATE, 56, { leap1900: true })).toBe('1900-02-25'); + expect(format(ISODATE, 55, { leap1900: true })).toBe('1900-02-24'); + expect(format(ISODATE, 54, { leap1900: true })).toBe('1900-02-23'); + expect(format(ISODATE, 53, { leap1900: true })).toBe('1900-02-22'); + expect(format(ISODATE, 52, { leap1900: true })).toBe('1900-02-21'); + expect(format(ISODATE, 51, { leap1900: true })).toBe('1900-02-20'); + expect(format(ISODATE, 50, { leap1900: true })).toBe('1900-02-19'); + expect(format(ISODATE, 49, { leap1900: true })).toBe('1900-02-18'); + expect(format(ISODATE, 48, { leap1900: true })).toBe('1900-02-17'); + expect(format(ISODATE, 47, { leap1900: true })).toBe('1900-02-16'); + expect(format(ISODATE, 46, { leap1900: true })).toBe('1900-02-15'); + expect(format(ISODATE, 45, { leap1900: true })).toBe('1900-02-14'); + expect(format(ISODATE, 44, { leap1900: true })).toBe('1900-02-13'); + expect(format(ISODATE, 43, { leap1900: true })).toBe('1900-02-12'); + expect(format(ISODATE, 42, { leap1900: true })).toBe('1900-02-11'); + expect(format(ISODATE, 41, { leap1900: true })).toBe('1900-02-10'); + expect(format(ISODATE, 40, { leap1900: true })).toBe('1900-02-09'); + expect(format(ISODATE, 39, { leap1900: true })).toBe('1900-02-08'); + expect(format(ISODATE, 38, { leap1900: true })).toBe('1900-02-07'); + expect(format(ISODATE, 37, { leap1900: true })).toBe('1900-02-06'); + expect(format(ISODATE, 36, { leap1900: true })).toBe('1900-02-05'); + expect(format(ISODATE, 35, { leap1900: true })).toBe('1900-02-04'); + expect(format(ISODATE, 34, { leap1900: true })).toBe('1900-02-03'); + expect(format(ISODATE, 33, { leap1900: true })).toBe('1900-02-02'); + expect(format(ISODATE, 32, { leap1900: true })).toBe('1900-02-01'); + expect(format(ISODATE, 31, { leap1900: true })).toBe('1900-01-31'); + expect(format(ISODATE, 30, { leap1900: true })).toBe('1900-01-30'); + expect(format(ISODATE, 29, { leap1900: true })).toBe('1900-01-29'); + expect(format(ISODATE, 28, { leap1900: true })).toBe('1900-01-28'); + expect(format(ISODATE, 27, { leap1900: true })).toBe('1900-01-27'); + expect(format(ISODATE, 26, { leap1900: true })).toBe('1900-01-26'); + expect(format(ISODATE, 25, { leap1900: true })).toBe('1900-01-25'); + expect(format(ISODATE, 24, { leap1900: true })).toBe('1900-01-24'); + expect(format(ISODATE, 23, { leap1900: true })).toBe('1900-01-23'); + expect(format(ISODATE, 22, { leap1900: true })).toBe('1900-01-22'); + expect(format(ISODATE, 21, { leap1900: true })).toBe('1900-01-21'); + expect(format(ISODATE, 20, { leap1900: true })).toBe('1900-01-20'); + expect(format(ISODATE, 19, { leap1900: true })).toBe('1900-01-19'); + expect(format(ISODATE, 18, { leap1900: true })).toBe('1900-01-18'); + expect(format(ISODATE, 17, { leap1900: true })).toBe('1900-01-17'); + expect(format(ISODATE, 16, { leap1900: true })).toBe('1900-01-16'); + expect(format(ISODATE, 15, { leap1900: true })).toBe('1900-01-15'); + expect(format(ISODATE, 14, { leap1900: true })).toBe('1900-01-14'); + expect(format(ISODATE, 13, { leap1900: true })).toBe('1900-01-13'); + expect(format(ISODATE, 12, { leap1900: true })).toBe('1900-01-12'); + expect(format(ISODATE, 11, { leap1900: true })).toBe('1900-01-11'); + expect(format(ISODATE, 10, { leap1900: true })).toBe('1900-01-10'); + expect(format(ISODATE, 9, { leap1900: true })).toBe('1900-01-09'); + expect(format(ISODATE, 8, { leap1900: true })).toBe('1900-01-08'); + expect(format(ISODATE, 7, { leap1900: true })).toBe('1900-01-07'); + expect(format(ISODATE, 6, { leap1900: true })).toBe('1900-01-06'); + expect(format(ISODATE, 5, { leap1900: true })).toBe('1900-01-05'); + expect(format(ISODATE, 4, { leap1900: true })).toBe('1900-01-04'); + expect(format(ISODATE, 3, { leap1900: true })).toBe('1900-01-03'); + expect(format(ISODATE, 2, { leap1900: true })).toBe('1900-01-02'); + expect(format(ISODATE, 1, { leap1900: true })).toBe('1900-01-01'); + expect(format(ISODATE, 0, { leap1900: true })).toBe('1900-01-00'); +}); + +test('Excel 1900 bug: OFF', () => { + expect(format(ISODATE, 61, { leap1900: false })).toBe('1900-03-01'); + expect(format(ISODATE, 60, { leap1900: false })).toBe('1900-02-28'); + expect(format(ISODATE, 59, { leap1900: false })).toBe('1900-02-27'); + expect(format(ISODATE, 58, { leap1900: false })).toBe('1900-02-26'); + expect(format(ISODATE, 57, { leap1900: false })).toBe('1900-02-25'); + expect(format(ISODATE, 56, { leap1900: false })).toBe('1900-02-24'); + expect(format(ISODATE, 55, { leap1900: false })).toBe('1900-02-23'); + expect(format(ISODATE, 54, { leap1900: false })).toBe('1900-02-22'); + expect(format(ISODATE, 53, { leap1900: false })).toBe('1900-02-21'); + expect(format(ISODATE, 52, { leap1900: false })).toBe('1900-02-20'); + expect(format(ISODATE, 51, { leap1900: false })).toBe('1900-02-19'); + expect(format(ISODATE, 50, { leap1900: false })).toBe('1900-02-18'); + expect(format(ISODATE, 49, { leap1900: false })).toBe('1900-02-17'); + expect(format(ISODATE, 48, { leap1900: false })).toBe('1900-02-16'); + expect(format(ISODATE, 47, { leap1900: false })).toBe('1900-02-15'); + expect(format(ISODATE, 46, { leap1900: false })).toBe('1900-02-14'); + expect(format(ISODATE, 45, { leap1900: false })).toBe('1900-02-13'); + expect(format(ISODATE, 44, { leap1900: false })).toBe('1900-02-12'); + expect(format(ISODATE, 43, { leap1900: false })).toBe('1900-02-11'); + expect(format(ISODATE, 42, { leap1900: false })).toBe('1900-02-10'); + expect(format(ISODATE, 41, { leap1900: false })).toBe('1900-02-09'); + expect(format(ISODATE, 40, { leap1900: false })).toBe('1900-02-08'); + expect(format(ISODATE, 39, { leap1900: false })).toBe('1900-02-07'); + expect(format(ISODATE, 38, { leap1900: false })).toBe('1900-02-06'); + expect(format(ISODATE, 37, { leap1900: false })).toBe('1900-02-05'); + expect(format(ISODATE, 36, { leap1900: false })).toBe('1900-02-04'); + expect(format(ISODATE, 35, { leap1900: false })).toBe('1900-02-03'); + expect(format(ISODATE, 34, { leap1900: false })).toBe('1900-02-02'); + expect(format(ISODATE, 33, { leap1900: false })).toBe('1900-02-01'); + expect(format(ISODATE, 32, { leap1900: false })).toBe('1900-01-31'); + expect(format(ISODATE, 31, { leap1900: false })).toBe('1900-01-30'); + expect(format(ISODATE, 30, { leap1900: false })).toBe('1900-01-29'); + expect(format(ISODATE, 29, { leap1900: false })).toBe('1900-01-28'); + expect(format(ISODATE, 28, { leap1900: false })).toBe('1900-01-27'); + expect(format(ISODATE, 27, { leap1900: false })).toBe('1900-01-26'); + expect(format(ISODATE, 26, { leap1900: false })).toBe('1900-01-25'); + expect(format(ISODATE, 25, { leap1900: false })).toBe('1900-01-24'); + expect(format(ISODATE, 24, { leap1900: false })).toBe('1900-01-23'); + expect(format(ISODATE, 23, { leap1900: false })).toBe('1900-01-22'); + expect(format(ISODATE, 22, { leap1900: false })).toBe('1900-01-21'); + expect(format(ISODATE, 21, { leap1900: false })).toBe('1900-01-20'); + expect(format(ISODATE, 20, { leap1900: false })).toBe('1900-01-19'); + expect(format(ISODATE, 19, { leap1900: false })).toBe('1900-01-18'); + expect(format(ISODATE, 18, { leap1900: false })).toBe('1900-01-17'); + expect(format(ISODATE, 17, { leap1900: false })).toBe('1900-01-16'); + expect(format(ISODATE, 16, { leap1900: false })).toBe('1900-01-15'); + expect(format(ISODATE, 15, { leap1900: false })).toBe('1900-01-14'); + expect(format(ISODATE, 14, { leap1900: false })).toBe('1900-01-13'); + expect(format(ISODATE, 13, { leap1900: false })).toBe('1900-01-12'); + expect(format(ISODATE, 12, { leap1900: false })).toBe('1900-01-11'); + expect(format(ISODATE, 11, { leap1900: false })).toBe('1900-01-10'); + expect(format(ISODATE, 10, { leap1900: false })).toBe('1900-01-09'); + expect(format(ISODATE, 9, { leap1900: false })).toBe('1900-01-08'); + expect(format(ISODATE, 8, { leap1900: false })).toBe('1900-01-07'); + expect(format(ISODATE, 7, { leap1900: false })).toBe('1900-01-06'); + expect(format(ISODATE, 6, { leap1900: false })).toBe('1900-01-05'); + expect(format(ISODATE, 5, { leap1900: false })).toBe('1900-01-04'); + expect(format(ISODATE, 4, { leap1900: false })).toBe('1900-01-03'); + expect(format(ISODATE, 3, { leap1900: false })).toBe('1900-01-02'); + expect(format(ISODATE, 2, { leap1900: false })).toBe('1900-01-01'); + expect(format(ISODATE, 1, { leap1900: false })).toBe('1899-12-31'); + expect(format(ISODATE, 0, { leap1900: false })).toBe('1899-12-30'); +}); + diff --git a/test/locale-test.js b/test/locale-test.js deleted file mode 100644 index 4c4571c..0000000 --- a/test/locale-test.js +++ /dev/null @@ -1,116 +0,0 @@ -import test from './utils.js'; -import { addLocale } from '../lib/index.js'; - -const date = 3290.1278435; // 1909-01-02 03:04:05.678 - -test('locale options', t => { - // default locale - t.format('dddd, dd. mmmm yyy', date, 'Saturday, 02. January 1909'); - - // General is localized - addLocale({ - decimal: '·', - positive: 'ᐩ', - negative: '÷', - percent: '٪', - exponent: 'X' - }, 'xx'); - t.format('General', 123456700000000, '1·23457Xᐩ14', { locale: 'xx' }); - t.format('General', 10000000000, '10000000000', { locale: 'xx' }); - t.format('General', 0.000000001, '0·000000001', { locale: 'xx' }); - t.format('General', 1234.56, '1234·56', { locale: 'xx' }); - t.format('General', 0.1, '0·1', { locale: 'xx' }); - - // general should respect locale in all cases - t.format('General', 0.0001, '0,0001', { locale: 'de' }); - t.format('General', 10000000000, '10000000000', { locale: 'de' }); - t.format('General', 1.1, '1,1', { locale: 'de' }); - t.format('General', 1.1, '1,1', { locale: 'de' }); - t.format('General', 1000000000.1, '1000000000', { locale: 'de' }); - t.format('General', 1.1111111111, '1,111111111', { locale: 'de' }); - t.format('General', 1.1e-9, '1,1E-09', { locale: 'de' }); - t.format('General', 1.1e-10, '1,1E-10', { locale: 'de' }); - t.format('General', 1.1e-10, '1,1E-10', { locale: 'de' }); - - // #59 - t.format('General', 111.1111111, '111,1111111', { locale: 'de' }); - t.format('General', 111.11111111, '111,1111111', { locale: 'de' }); - t.format('General', 111.111111111, '111,1111111', { locale: 'de' }); - - // different locale address modes (both is-IS and is_IS are supported) - t.format('[$-is]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-is_IS]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-is_IS]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-is_IS]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-is-IS]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-01040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-00040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-0000040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('[$-0101040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909'); - t.format('dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909', { locale: 'is' }); - // setting a locale does not overwrite the format locale - t.format('[$-040F]dddd, dd. mmmm yyy', date, 'laugardagur, 02. janúar 1909', { locale: 'fr' }); - - // all types are present - t.format('d dd ddd dddd ddddd', date, '2 02 lau. laugardagur laugardagur', { locale: 'is' }); - t.format('m mm mmm mmmm mmmmm', date, '1 01 jan. janúar j', { locale: 'is' }); - t.format('#,##0.000', date, '3.290,128', { locale: 'is' }); - t.format('h AM/PM', date, '3 f.h.', { locale: 'is' }); - - t.format('d dd ddd dddd ddddd', date, '2 02 周六 星期六 星期六', { locale: 'zh-CH' }); - t.format('m mm mmm mmmm mmmmm', date, '1 01 1月 一月 一', { locale: 'zh-CH' }); - t.format('#,##0.000', date, '3,290.128', { locale: 'zh-CH' }); - t.format('h AM/PM', date, '3 上午', { locale: 'zh-CH' }); - - t.format('d dd ddd dddd ddddd', date, '2 02 сб суббота суббота', { locale: 0x0419 }); - t.format('m mm mmm mmmm mmmmm', date, '1 01 янв. января я', { locale: 0x0419 }); - t.format('#,##0.000', date, '3\u00a0290,128', { locale: 0x0419 }); - t.format('h AM/PM', date, '3 AM', { locale: 0x0419 }); - - // Currency - t.format('[$$-409]#,##0', 1234, '$1,234'); - t.format('#,##0\\ [$kr-438]', 1234, '1,234 kr'); - t.format('[$ISK] #,##0', 1234, 'ISK 1,234'); - t.format('[$ISK-] #,##0', 1234, 'ISK 1,234'); - t.format('[$NZ$-481]#,##0', 1234, 'NZ$1,234'); - t.format('[$whatever is here just gets through] #,##0', 1234, 'whatever is here just gets through 1,234'); - - // Hijri month names are emitted - t.format('[$-060409]mmmm', 42999, 'Muharram'); - t.format('[$-060409]mmmm', 43029, 'Safar'); - t.format('[$-060409]mmmm', 43058, 'Rabiʻ I'); - t.format('[$-060409]mmmm', 43088, 'Rabiʻ II'); - t.format('[$-060409]mmmm', 43118, 'Jumada I'); - t.format('[$-060409]mmmm', 43148, 'Jumada II'); - t.format('[$-060409]mmmm', 43177, 'Rajab'); - t.format('[$-060409]mmmm', 43207, 'Shaʻban'); - t.format('[$-060409]mmmm', 43237, 'Ramadan'); - t.format('[$-060409]mmmm', 43266, 'Shawwal'); - t.format('[$-060409]mmmm', 43295, 'Dhuʻl-Qiʻdah'); - t.format('[$-060409]mmmm', 43324, 'Dhuʻl-Hijjah'); - - t.format('[$Fr.-807] #,##0.00', 12345.67, 'Fr. 12\'345.67'); - - // TODO: names for hijri months - // Next test is known to be incorrect, Excel emits "1439 محرم 1" - t.format('B2yyyy mmmm d', 42999, '1439 Muharram 1', 'B2yyyy mmmm d'); - - t.format('[$-060409]yyyy mmmm d', 42999, '1439 Muharram 1', '[$-060409]yyyy mmmm d'); - t.format('[$-060C01]yyyy mmmm d', 42999, '1439 رمضان 1', '[$-060C01]yyyy mmmm d'); - t.format('[$-010C01]yyyy mmmm d', 42999, '2017 سبتمبر 21', '[$-010C01]yyyy mmmm d'); - - t.format('[$-0409]B2yyyy mmmm d', 42999, '2017 September 21', '[$-0409]yyyy mmmm d'); - - t.format('General', true, 'TRUE', { locale: 'en' }); - t.format('General', false, 'FALSE', { locale: 'en' }); - t.format('General', true, 'VRAI', { locale: 'fr' }); - t.format('General', false, 'FAUX', { locale: 'fr' }); - t.format('General', true, 'TRUE', { locale: 'is' }); - t.format('General', false, 'FALSE', { locale: 'is' }); - t.format('General', true, 'WAAR', { locale: 'nl' }); - t.format('General', false, 'ONWAAR', { locale: 'nl' }); - - t.end(); -}); - diff --git a/test/locale.spec.ts b/test/locale.spec.ts new file mode 100644 index 0000000..9efa3c9 --- /dev/null +++ b/test/locale.spec.ts @@ -0,0 +1,114 @@ +import { expect, test } from 'vitest'; +import { addLocale, format } from '../lib/index.js'; + +const date = 3290.1278435; // 1909-01-02 03:04:05.678 + +test('locale options', () => { + // default locale + expect(format('dddd, dd. mmmm yyy', date)).toBe('Saturday, 02. January 1909'); + + // General is localized + addLocale({ + decimal: '·', + positive: 'ᐩ', + negative: '÷', + percent: '٪', + exponent: 'X' + }, 'xx'); + expect(format('General', 123456700000000, { locale: 'xx' })).toBe('1·23457Xᐩ14'); + expect(format('General', 10000000000, { locale: 'xx' })).toBe('10000000000'); + expect(format('General', 0.000000001, { locale: 'xx' })).toBe('0·000000001'); + expect(format('General', 1234.56, { locale: 'xx' })).toBe('1234·56'); + expect(format('General', 0.1, { locale: 'xx' })).toBe('0·1'); + + // general should respect locale in all cases + expect(format('General', 0.0001, { locale: 'de' })).toBe('0,0001'); + expect(format('General', 10000000000, { locale: 'de' })).toBe('10000000000'); + expect(format('General', 1.1, { locale: 'de' })).toBe('1,1'); + expect(format('General', 1.1, { locale: 'de' })).toBe('1,1'); + expect(format('General', 1000000000.1, { locale: 'de' })).toBe('1000000000'); + expect(format('General', 1.1111111111, { locale: 'de' })).toBe('1,111111111'); + expect(format('General', 1.1e-9, { locale: 'de' })).toBe('1,1E-09'); + expect(format('General', 1.1e-10, { locale: 'de' })).toBe('1,1E-10'); + expect(format('General', 1.1e-10, { locale: 'de' })).toBe('1,1E-10'); + + // #59 + expect(format('General', 111.1111111, { locale: 'de' })).toBe('111,1111111'); + expect(format('General', 111.11111111, { locale: 'de' })).toBe('111,1111111'); + expect(format('General', 111.111111111, { locale: 'de' })).toBe('111,1111111'); + + // different locale address modes (both is-IS and is_IS are supported) + expect(format('[$-is]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-is_IS]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-is_IS]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-is_IS]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-is-IS]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-040F]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-01040F]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-00040F]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-0000040F]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('[$-0101040F]dddd, dd. mmmm yyy', date)).toBe('laugardagur, 02. janúar 1909'); + expect(format('dddd, dd. mmmm yyy', date, { locale: 'is' })).toBe('laugardagur, 02. janúar 1909'); + // setting a locale does not overwrite the format locale + expect(format('[$-040F]dddd, dd. mmmm yyy', date, { locale: 'fr' })).toBe('laugardagur, 02. janúar 1909'); + + // all types are present + expect(format('d dd ddd dddd ddddd', date, { locale: 'is' })).toBe('2 02 lau. laugardagur laugardagur'); + expect(format('m mm mmm mmmm mmmmm', date, { locale: 'is' })).toBe('1 01 jan. janúar j'); + expect(format('#,##0.000', date, { locale: 'is' })).toBe('3.290,128'); + expect(format('h AM/PM', date, { locale: 'is' })).toBe('3 f.h.'); + + expect(format('d dd ddd dddd ddddd', date, { locale: 'zh-CH' })).toBe('2 02 周六 星期六 星期六'); + expect(format('m mm mmm mmmm mmmmm', date, { locale: 'zh-CH' })).toBe('1 01 1月 一月 一'); + expect(format('#,##0.000', date, { locale: 'zh-CH' })).toBe('3,290.128'); + expect(format('h AM/PM', date, { locale: 'zh-CH' })).toBe('3 上午'); + + expect(format('d dd ddd dddd ddddd', date, { locale: 0x0419 })).toBe('2 02 сб суббота суббота'); + expect(format('m mm mmm mmmm mmmmm', date, { locale: 0x0419 })).toBe('1 01 янв. января я'); + expect(format('#,##0.000', date, { locale: 0x0419 })).toBe('3\u00a0290,128'); + expect(format('h AM/PM', date, { locale: 0x0419 })).toBe('3 AM'); + + // Currency + expect(format('[$$-409]#,##0', 1234)).toBe('$1,234'); + expect(format('#,##0\\ [$kr-438]', 1234)).toBe('1,234 kr'); + expect(format('[$ISK] #,##0', 1234)).toBe('ISK 1,234'); + expect(format('[$ISK-] #,##0', 1234)).toBe('ISK 1,234'); + expect(format('[$NZ$-481]#,##0', 1234)).toBe('NZ$1,234'); + expect(format('[$whatever is here just gets through] #,##0', 1234)).toBe('whatever is here just gets through 1,234'); + + // Hijri month names are emitted + expect(format('[$-060409]mmmm', 42999)).toBe('Muharram'); + expect(format('[$-060409]mmmm', 43029)).toBe('Safar'); + expect(format('[$-060409]mmmm', 43058)).toBe('Rabiʻ I'); + expect(format('[$-060409]mmmm', 43088)).toBe('Rabiʻ II'); + expect(format('[$-060409]mmmm', 43118)).toBe('Jumada I'); + expect(format('[$-060409]mmmm', 43148)).toBe('Jumada II'); + expect(format('[$-060409]mmmm', 43177)).toBe('Rajab'); + expect(format('[$-060409]mmmm', 43207)).toBe('Shaʻban'); + expect(format('[$-060409]mmmm', 43237)).toBe('Ramadan'); + expect(format('[$-060409]mmmm', 43266)).toBe('Shawwal'); + expect(format('[$-060409]mmmm', 43295)).toBe('Dhuʻl-Qiʻdah'); + expect(format('[$-060409]mmmm', 43324)).toBe('Dhuʻl-Hijjah'); + + expect(format('[$Fr.-807] #,##0.00', 12345.67)).toBe('Fr. 12\'345.67'); + + // TODO: names for hijri months + // Next test is known to be incorrect, Excel emits "1439 محرم 1" + expect(format('B2yyyy mmmm d', 42999), 'B2yyyy mmmm d').toBe('1439 Muharram 1'); + + expect(format('[$-060409]yyyy mmmm d', 42999), '[$-060409]yyyy mmmm d').toBe('1439 Muharram 1'); + expect(format('[$-060C01]yyyy mmmm d', 42999), '[$-060C01]yyyy mmmm d').toBe('1439 رمضان 1'); + expect(format('[$-010C01]yyyy mmmm d', 42999), '[$-010C01]yyyy mmmm d').toBe('2017 سبتمبر 21'); + + expect(format('[$-0409]B2yyyy mmmm d', 42999), '[$-0409]yyyy mmmm d').toBe('2017 September 21'); + + expect(format('General', true, { locale: 'en' })).toBe('TRUE'); + expect(format('General', false, { locale: 'en' })).toBe('FALSE'); + expect(format('General', true, { locale: 'fr' })).toBe('VRAI'); + expect(format('General', false, { locale: 'fr' })).toBe('FAUX'); + expect(format('General', true, { locale: 'is' })).toBe('TRUE'); + expect(format('General', false, { locale: 'is' })).toBe('FALSE'); + expect(format('General', true, { locale: 'nl' })).toBe('WAAR'); + expect(format('General', false, { locale: 'nl' })).toBe('ONWAAR'); +}); + diff --git a/test/numdec-test.js b/test/numdec-test.js deleted file mode 100644 index 8c0fdeb..0000000 --- a/test/numdec-test.js +++ /dev/null @@ -1,556 +0,0 @@ -/* eslint-disable no-loss-of-precision */ -// tests converted from SSF -import test from 'tape'; -import numdec from '../lib/numdec.js'; - -function _f (v) { - return numdec(v).total; -} - -test('numdec', t => { - t.equal(_f(1.234567E-14), 22, '1.234567E-14'); - t.equal(_f(1.234567E-13), 21, '1.234567E-13'); - t.equal(_f(0.000000000001234567), 20, '0.000000000001234567'); - t.equal(_f(0.00000000001234567), 19, '0.00000000001234567'); - t.equal(_f(0.0000000001234567), 18, '0.0000000001234567'); - t.equal(_f(0.000000001234567), 17, '0.000000001234567'); - t.equal(_f(0.00000001234567), 16, '0.00000001234567'); - t.equal(_f(0.0000001234567), 15, '0.0000001234567'); - t.equal(_f(0.000001234567), 14, '0.000001234567'); - t.equal(_f(0.00001234567), 13, '0.00001234567'); - t.equal(_f(0.0001234567), 12, '0.0001234567'); - t.equal(_f(0.001234567), 11, '0.001234567'); - t.equal(_f(0.01234567), 10, '0.01234567'); - t.equal(_f(0.1234567), 9, '0.1234567'); - t.equal(_f(1.234567), 8, '1.234567'); - t.equal(_f(12.34567), 8, '12.34567'); - t.equal(_f(123.4567), 8, '123.4567'); - t.equal(_f(1234.567), 8, '1234.567'); - t.equal(_f(12345.67), 8, '12345.67'); - t.equal(_f(123456.7), 8, '123456.7'); - t.equal(_f(1234567), 7, '1234567'); - t.equal(_f(12345670), 8, '12345670'); - t.equal(_f(123456700), 9, '123456700'); - t.equal(_f(1234567000), 10, '1234567000'); - t.equal(_f(12345670000), 11, '12345670000'); - t.equal(_f(123456700000), 12, '123456700000'); - t.equal(_f(1234567000000), 13, '1234567000000'); - t.equal(_f(12345670000000), 14, '12345670000000'); - t.equal(_f(123456700000000), 15, '123456700000000'); - t.equal(_f(0.00000000000001), 16, '0.00000000000001'); - t.equal(_f(0.0000000000001), 15, '0.0000000000001'); - t.equal(_f(0.000000000001), 14, '0.000000000001'); - t.equal(_f(0.00000000001), 13, '0.00000000001'); - t.equal(_f(0.0000000001), 12, '0.0000000001'); - t.equal(_f(0.000000001), 11, '0.000000001'); - t.equal(_f(0.00000001), 10, '0.00000001'); - t.equal(_f(0.0000001), 9, '0.0000001'); - t.equal(_f(0.000001), 8, '0.000001'); - t.equal(_f(0.00001), 7, '0.00001'); - t.equal(_f(0.0001), 6, '0.0001'); - t.equal(_f(0.001), 5, '0.001'); - t.equal(_f(0.01), 4, '0.01'); - t.equal(_f(0.1), 3, '0.1'); - t.equal(_f(1), 1, '1'); - t.equal(_f(10), 2, '10'); - t.equal(_f(100), 3, '100'); - t.equal(_f(1000), 4, '1000'); - t.equal(_f(10000), 5, '10000'); - t.equal(_f(100000), 6, '100000'); - t.equal(_f(1000000), 7, '1000000'); - t.equal(_f(10000000), 8, '10000000'); - t.equal(_f(100000000), 9, '100000000'); - t.equal(_f(1000000000), 10, '1000000000'); - t.equal(_f(10000000000), 11, '10000000000'); - t.equal(_f(100000000000), 12, '100000000000'); - t.equal(_f(1000000000000), 13, '1000000000000'); - t.equal(_f(10000000000000), 14, '10000000000000'); - t.equal(_f(100000000000000), 15, '100000000000000'); - t.equal(_f(0.000000000000012), 17, '0.000000000000012'); - t.equal(_f(0.00000000000012), 16, '0.00000000000012'); - t.equal(_f(0.0000000000012), 15, '0.0000000000012'); - t.equal(_f(0.000000000012), 14, '0.000000000012'); - t.equal(_f(0.00000000012), 13, '0.00000000012'); - t.equal(_f(0.0000000012), 12, '0.0000000012'); - t.equal(_f(0.000000012), 11, '0.000000012'); - t.equal(_f(0.00000012), 10, '0.00000012'); - t.equal(_f(0.0000012), 9, '0.0000012'); - t.equal(_f(0.000012), 8, '0.000012'); - t.equal(_f(0.00012), 7, '0.00012'); - t.equal(_f(0.0012), 6, '0.0012'); - t.equal(_f(0.012), 5, '0.012'); - t.equal(_f(0.12), 4, '0.12'); - t.equal(_f(1.2), 3, '1.2'); - t.equal(_f(12), 2, '12'); - t.equal(_f(120), 3, '120'); - t.equal(_f(1200), 4, '1200'); - t.equal(_f(12000), 5, '12000'); - t.equal(_f(120000), 6, '120000'); - t.equal(_f(1200000), 7, '1200000'); - t.equal(_f(12000000), 8, '12000000'); - t.equal(_f(120000000), 9, '120000000'); - t.equal(_f(1200000000), 10, '1200000000'); - t.equal(_f(12000000000), 11, '12000000000'); - t.equal(_f(120000000000), 12, '120000000000'); - t.equal(_f(1200000000000), 13, '1200000000000'); - t.equal(_f(12000000000000), 14, '12000000000000'); - t.equal(_f(120000000000000), 15, '120000000000000'); - t.equal(_f(0.0000000000000123), 18, '0.0000000000000123'); - t.equal(_f(0.000000000000123), 17, '0.000000000000123'); - t.equal(_f(0.00000000000123), 16, '0.00000000000123'); - t.equal(_f(0.0000000000123), 15, '0.0000000000123'); - t.equal(_f(0.000000000123), 14, '0.000000000123'); - t.equal(_f(0.00000000123), 13, '0.00000000123'); - t.equal(_f(0.0000000123), 12, '0.0000000123'); - t.equal(_f(0.000000123), 11, '0.000000123'); - t.equal(_f(0.00000123), 10, '0.00000123'); - t.equal(_f(0.0000123), 9, '0.0000123'); - t.equal(_f(0.000123), 8, '0.000123'); - t.equal(_f(0.00123), 7, '0.00123'); - t.equal(_f(0.0123), 6, '0.0123'); - t.equal(_f(0.123), 5, '0.123'); - t.equal(_f(1.23), 4, '1.23'); - t.equal(_f(12.3), 4, '12.3'); - t.equal(_f(123), 3, '123'); - t.equal(_f(1230), 4, '1230'); - t.equal(_f(12300), 5, '12300'); - t.equal(_f(123000), 6, '123000'); - t.equal(_f(1230000), 7, '1230000'); - t.equal(_f(12300000), 8, '12300000'); - t.equal(_f(123000000), 9, '123000000'); - t.equal(_f(1230000000), 10, '1230000000'); - t.equal(_f(12300000000), 11, '12300000000'); - t.equal(_f(123000000000), 12, '123000000000'); - t.equal(_f(1230000000000), 13, '1230000000000'); - t.equal(_f(12300000000000), 14, '12300000000000'); - t.equal(_f(123000000000000), 15, '123000000000000'); - t.equal(_f(0.00000000000001234), 19, '0.00000000000001234'); - t.equal(_f(0.0000000000001234), 18, '0.0000000000001234'); - t.equal(_f(0.000000000001234), 17, '0.000000000001234'); - t.equal(_f(0.00000000001234), 16, '0.00000000001234'); - t.equal(_f(0.0000000001234), 15, '0.0000000001234'); - t.equal(_f(0.000000001234), 14, '0.000000001234'); - t.equal(_f(0.00000001234), 13, '0.00000001234'); - t.equal(_f(0.0000001234), 12, '0.0000001234'); - t.equal(_f(0.000001234), 11, '0.000001234'); - t.equal(_f(0.00001234), 10, '0.00001234'); - t.equal(_f(0.0001234), 9, '0.0001234'); - t.equal(_f(0.001234), 8, '0.001234'); - t.equal(_f(0.01234), 7, '0.01234'); - t.equal(_f(0.1234), 6, '0.1234'); - t.equal(_f(1.234), 5, '1.234'); - t.equal(_f(12.34), 5, '12.34'); - t.equal(_f(123.4), 5, '123.4'); - t.equal(_f(1234), 4, '1234'); - t.equal(_f(12340), 5, '12340'); - t.equal(_f(123400), 6, '123400'); - t.equal(_f(1234000), 7, '1234000'); - t.equal(_f(12340000), 8, '12340000'); - t.equal(_f(123400000), 9, '123400000'); - t.equal(_f(1234000000), 10, '1234000000'); - t.equal(_f(12340000000), 11, '12340000000'); - t.equal(_f(123400000000), 12, '123400000000'); - t.equal(_f(1234000000000), 13, '1234000000000'); - t.equal(_f(12340000000000), 14, '12340000000000'); - t.equal(_f(123400000000000), 15, '123400000000000'); - t.equal(_f(0.000000000000012345), 20, '0.000000000000012345'); - t.equal(_f(0.00000000000012345), 19, '0.00000000000012345'); - t.equal(_f(0.0000000000012345), 18, '0.0000000000012345'); - t.equal(_f(0.000000000012345), 17, '0.000000000012345'); - t.equal(_f(0.00000000012345), 16, '0.00000000012345'); - t.equal(_f(0.0000000012345), 15, '0.0000000012345'); - t.equal(_f(0.000000012345), 14, '0.000000012345'); - t.equal(_f(0.00000012345), 13, '0.00000012345'); - t.equal(_f(0.0000012345), 12, '0.0000012345'); - t.equal(_f(0.000012345), 11, '0.000012345'); - t.equal(_f(0.00012345), 10, '0.00012345'); - t.equal(_f(0.0012345), 9, '0.0012345'); - t.equal(_f(0.012345), 8, '0.012345'); - t.equal(_f(0.12345), 7, '0.12345'); - t.equal(_f(1.2345), 6, '1.2345'); - t.equal(_f(12.345), 6, '12.345'); - t.equal(_f(123.45), 6, '123.45'); - t.equal(_f(1234.5), 6, '1234.5'); - t.equal(_f(12345), 5, '12345'); - t.equal(_f(123450), 6, '123450'); - t.equal(_f(1234500), 7, '1234500'); - t.equal(_f(12345000), 8, '12345000'); - t.equal(_f(123450000), 9, '123450000'); - t.equal(_f(1234500000), 10, '1234500000'); - t.equal(_f(12345000000), 11, '12345000000'); - t.equal(_f(123450000000), 12, '123450000000'); - t.equal(_f(1234500000000), 13, '1234500000000'); - t.equal(_f(12345000000000), 14, '12345000000000'); - t.equal(_f(123450000000000), 15, '123450000000000'); - t.equal(_f(1.23456E-14), 21, '1.23456E-14'); - t.equal(_f(0.000000000000123456), 20, '0.000000000000123456'); - t.equal(_f(0.00000000000123456), 19, '0.00000000000123456'); - t.equal(_f(0.0000000000123456), 18, '0.0000000000123456'); - t.equal(_f(0.000000000123456), 17, '0.000000000123456'); - t.equal(_f(0.00000000123456), 16, '0.00000000123456'); - t.equal(_f(0.0000000123456), 15, '0.0000000123456'); - t.equal(_f(0.000000123456), 14, '0.000000123456'); - t.equal(_f(0.00000123456), 13, '0.00000123456'); - t.equal(_f(0.0000123456), 12, '0.0000123456'); - t.equal(_f(0.000123456), 11, '0.000123456'); - t.equal(_f(0.00123456), 10, '0.00123456'); - t.equal(_f(0.0123456), 9, '0.0123456'); - t.equal(_f(0.123456), 8, '0.123456'); - t.equal(_f(1.23456), 7, '1.23456'); - t.equal(_f(12.3456), 7, '12.3456'); - t.equal(_f(123.456), 7, '123.456'); - t.equal(_f(1234.56), 7, '1234.56'); - t.equal(_f(12345.6), 7, '12345.6'); - t.equal(_f(123456), 6, '123456'); - t.equal(_f(1234560), 7, '1234560'); - t.equal(_f(12345600), 8, '12345600'); - t.equal(_f(123456000), 9, '123456000'); - t.equal(_f(1234560000), 10, '1234560000'); - t.equal(_f(12345600000), 11, '12345600000'); - t.equal(_f(123456000000), 12, '123456000000'); - t.equal(_f(1234560000000), 13, '1234560000000'); - t.equal(_f(12345600000000), 14, '12345600000000'); - t.equal(_f(123456000000000), 15, '123456000000000'); - t.equal(_f(1.234567E-14), 22, '1.234567E-14'); - t.equal(_f(1.234567E-13), 21, '1.234567E-13'); - t.equal(_f(0.000000000001234567), 20, '0.000000000001234567'); - t.equal(_f(0.00000000001234567), 19, '0.00000000001234567'); - t.equal(_f(0.0000000001234567), 18, '0.0000000001234567'); - t.equal(_f(0.000000001234567), 17, '0.000000001234567'); - t.equal(_f(0.00000001234567), 16, '0.00000001234567'); - t.equal(_f(0.0000001234567), 15, '0.0000001234567'); - t.equal(_f(0.000001234567), 14, '0.000001234567'); - t.equal(_f(0.00001234567), 13, '0.00001234567'); - t.equal(_f(0.0001234567), 12, '0.0001234567'); - t.equal(_f(0.001234567), 11, '0.001234567'); - t.equal(_f(0.01234567), 10, '0.01234567'); - t.equal(_f(0.1234567), 9, '0.1234567'); - t.equal(_f(1.234567), 8, '1.234567'); - t.equal(_f(12.34567), 8, '12.34567'); - t.equal(_f(123.4567), 8, '123.4567'); - t.equal(_f(1234.567), 8, '1234.567'); - t.equal(_f(12345.67), 8, '12345.67'); - t.equal(_f(123456.7), 8, '123456.7'); - t.equal(_f(1234567), 7, '1234567'); - t.equal(_f(12345670), 8, '12345670'); - t.equal(_f(123456700), 9, '123456700'); - t.equal(_f(1234567000), 10, '1234567000'); - t.equal(_f(12345670000), 11, '12345670000'); - t.equal(_f(123456700000), 12, '123456700000'); - t.equal(_f(1234567000000), 13, '1234567000000'); - t.equal(_f(12345670000000), 14, '12345670000000'); - t.equal(_f(123456700000000), 15, '123456700000000'); - t.equal(_f(1.2345678E-14), 23, '1.2345678E-14'); - t.equal(_f(1.2345678E-13), 22, '1.2345678E-13'); - t.equal(_f(1.2345678E-12), 21, '1.2345678E-12'); - t.equal(_f(0.000000000012345678), 20, '0.000000000012345678'); - t.equal(_f(0.00000000012345678), 19, '0.00000000012345678'); - t.equal(_f(0.0000000012345678), 18, '0.0000000012345678'); - t.equal(_f(0.000000012345678), 17, '0.000000012345678'); - t.equal(_f(0.00000012345678), 16, '0.00000012345678'); - t.equal(_f(0.0000012345678), 15, '0.0000012345678'); - t.equal(_f(0.000012345678), 14, '0.000012345678'); - t.equal(_f(0.00012345678), 13, '0.00012345678'); - t.equal(_f(0.0012345678), 12, '0.0012345678'); - t.equal(_f(0.012345678), 11, '0.012345678'); - t.equal(_f(0.12345678), 10, '0.12345678'); - t.equal(_f(1.2345678), 9, '1.2345678'); - t.equal(_f(12.345678), 9, '12.345678'); - t.equal(_f(123.45678), 9, '123.45678'); - t.equal(_f(1234.5678), 9, '1234.5678'); - t.equal(_f(12345.678), 9, '12345.678'); - t.equal(_f(123456.78), 9, '123456.78'); - t.equal(_f(1234567.8), 9, '1234567.8'); - t.equal(_f(12345678), 8, '12345678'); - t.equal(_f(123456780), 9, '123456780'); - t.equal(_f(1234567800), 10, '1234567800'); - t.equal(_f(12345678000), 11, '12345678000'); - t.equal(_f(123456780000), 12, '123456780000'); - t.equal(_f(1234567800000), 13, '1234567800000'); - t.equal(_f(12345678000000), 14, '12345678000000'); - t.equal(_f(123456780000000), 15, '123456780000000'); - t.equal(_f(1.23456789E-14), 24, '1.23456789E-14'); - t.equal(_f(1.23456789E-13), 23, '1.23456789E-13'); - t.equal(_f(1.23456789E-12), 22, '1.23456789E-12'); - t.equal(_f(1.23456789E-11), 21, '1.23456789E-11'); - t.equal(_f(0.000000000123456789), 20, '0.000000000123456789'); - t.equal(_f(0.00000000123456789), 19, '0.00000000123456789'); - t.equal(_f(0.0000000123456789), 18, '0.0000000123456789'); - t.equal(_f(0.000000123456789), 17, '0.000000123456789'); - t.equal(_f(0.00000123456789), 16, '0.00000123456789'); - t.equal(_f(0.0000123456789), 15, '0.0000123456789'); - t.equal(_f(0.000123456789), 14, '0.000123456789'); - t.equal(_f(0.00123456789), 13, '0.00123456789'); - t.equal(_f(0.0123456789), 12, '0.0123456789'); - t.equal(_f(0.123456789), 11, '0.123456789'); - t.equal(_f(1.23456789), 10, '1.23456789'); - t.equal(_f(12.3456789), 10, '12.3456789'); - t.equal(_f(123.456789), 10, '123.456789'); - t.equal(_f(1234.56789), 10, '1234.56789'); - t.equal(_f(12345.6789), 10, '12345.6789'); - t.equal(_f(123456.789), 10, '123456.789'); - t.equal(_f(1234567.89), 10, '1234567.89'); - t.equal(_f(12345678.9), 10, '12345678.9'); - t.equal(_f(123456789), 9, '123456789'); - t.equal(_f(1234567890), 10, '1234567890'); - t.equal(_f(12345678900), 11, '12345678900'); - t.equal(_f(123456789000), 12, '123456789000'); - t.equal(_f(1234567890000), 13, '1234567890000'); - t.equal(_f(12345678900000), 14, '12345678900000'); - t.equal(_f(123456789000000), 15, '123456789000000'); - t.equal(_f(1.234567891E-14), 25, '1.234567891E-14'); - t.equal(_f(1.234567891E-13), 24, '1.234567891E-13'); - t.equal(_f(1.234567891E-12), 23, '1.234567891E-12'); - t.equal(_f(1.234567891E-11), 22, '1.234567891E-11'); - t.equal(_f(1.234567891E-10), 21, '1.234567891E-10'); - t.equal(_f(0.000000001234567891), 20, '0.000000001234567891'); - t.equal(_f(0.00000001234567891), 19, '0.00000001234567891'); - t.equal(_f(0.0000001234567891), 18, '0.0000001234567891'); - t.equal(_f(0.000001234567891), 17, '0.000001234567891'); - t.equal(_f(0.00001234567891), 16, '0.00001234567891'); - t.equal(_f(0.0001234567891), 15, '0.0001234567891'); - t.equal(_f(0.001234567891), 14, '0.001234567891'); - t.equal(_f(0.01234567891), 13, '0.01234567891'); - t.equal(_f(0.1234567891), 12, '0.1234567891'); - t.equal(_f(1.234567891), 11, '1.234567891'); - t.equal(_f(12.34567891), 11, '12.34567891'); - t.equal(_f(123.4567891), 11, '123.4567891'); - t.equal(_f(1234.567891), 11, '1234.567891'); - t.equal(_f(12345.67891), 11, '12345.67891'); - t.equal(_f(123456.7891), 11, '123456.7891'); - t.equal(_f(1234567.891), 11, '1234567.891'); - t.equal(_f(12345678.91), 11, '12345678.91'); - t.equal(_f(123456789.1), 11, '123456789.1'); - t.equal(_f(1234567891), 10, '1234567891'); - t.equal(_f(12345678910), 11, '12345678910'); - t.equal(_f(123456789100), 12, '123456789100'); - t.equal(_f(1234567891000), 13, '1234567891000'); - t.equal(_f(12345678910000), 14, '12345678910000'); - t.equal(_f(123456789100000), 15, '123456789100000'); - t.equal(_f(1.2345678912E-14), 26, '1.2345678912E-14'); // 0.000000000000012345678912 - t.equal(_f(1.2345678912E-13), 25, '1.2345678912E-13'); - t.equal(_f(1.2345678912E-12), 24, '1.2345678912E-12'); - t.equal(_f(1.2345678912E-11), 23, '1.2345678912E-11'); - t.equal(_f(1.2345678912E-10), 22, '1.2345678912E-10'); - t.equal(_f(1.2345678912E-09), 21, '1.2345678912E-09'); - t.equal(_f(0.000000012345678912), 20, '0.000000012345678912'); - t.equal(_f(0.00000012345678912), 19, '0.00000012345678912'); - t.equal(_f(0.0000012345678912), 18, '0.0000012345678912'); - t.equal(_f(0.000012345678912), 17, '0.000012345678912'); - t.equal(_f(0.00012345678912), 16, '0.00012345678912'); - t.equal(_f(0.0012345678912), 15, '0.0012345678912'); - t.equal(_f(0.012345678912), 14, '0.012345678912'); - t.equal(_f(0.12345678912), 13, '0.12345678912'); - t.equal(_f(1.2345678912), 12, '1.2345678912'); - t.equal(_f(12.345678912), 12, '12.345678912'); - t.equal(_f(123.45678912), 12, '123.45678912'); - t.equal(_f(1234.5678912), 12, '1234.5678912'); - t.equal(_f(12345.678912), 12, '12345.678912'); - t.equal(_f(123456.78912), 12, '123456.78912'); - t.equal(_f(1234567.8912), 12, '1234567.8912'); - t.equal(_f(12345678.912), 12, '12345678.912'); - t.equal(_f(123456789.12), 12, '123456789.12'); - t.equal(_f(1234567891.2), 12, '1234567891.2'); - t.equal(_f(12345678912), 11, '12345678912'); - t.equal(_f(123456789120), 12, '123456789120'); - t.equal(_f(1234567891200), 13, '1234567891200'); - t.equal(_f(12345678912000), 14, '12345678912000'); - t.equal(_f(123456789120000), 15, '123456789120000'); - t.equal(_f(1.23456789123E-14), 27, '1.23456789123E-14'); - t.equal(_f(1.23456789123E-13), 26, '1.23456789123E-13'); - t.equal(_f(1.23456789123E-12), 25, '1.23456789123E-12'); - t.equal(_f(1.23456789123E-11), 24, '1.23456789123E-11'); - t.equal(_f(1.23456789123E-10), 23, '1.23456789123E-10'); - t.equal(_f(1.23456789123E-09), 22, '1.23456789123E-09'); - t.equal(_f(1.23456789123E-08), 21, '1.23456789123E-08'); - t.equal(_f(0.000000123456789123), 20, '0.000000123456789123'); - t.equal(_f(0.00000123456789123), 19, '0.00000123456789123'); - t.equal(_f(0.0000123456789123), 18, '0.0000123456789123'); - t.equal(_f(0.000123456789123), 17, '0.000123456789123'); - t.equal(_f(0.00123456789123), 16, '0.00123456789123'); - t.equal(_f(0.0123456789123), 15, '0.0123456789123'); - t.equal(_f(0.123456789123), 14, '0.123456789123'); - t.equal(_f(1.23456789123), 13, '1.23456789123'); - t.equal(_f(12.3456789123), 13, '12.3456789123'); - t.equal(_f(123.456789123), 13, '123.456789123'); - t.equal(_f(1234.56789123), 13, '1234.56789123'); - t.equal(_f(12345.6789123), 13, '12345.6789123'); - t.equal(_f(123456.789123), 13, '123456.789123'); - t.equal(_f(1234567.89123), 13, '1234567.89123'); - t.equal(_f(12345678.9123), 13, '12345678.9123'); - t.equal(_f(123456789.123), 13, '123456789.123'); - t.equal(_f(1234567891.23), 13, '1234567891.23'); - t.equal(_f(12345678912.3), 13, '12345678912.3'); - t.equal(_f(123456789123), 12, '123456789123'); - t.equal(_f(1234567891230), 13, '1234567891230'); - t.equal(_f(12345678912300), 14, '12345678912300'); - t.equal(_f(123456789123000), 15, '123456789123000'); - t.equal(_f(1.234567891234E-14), 28, '1.234567891234E-14'); - t.equal(_f(1.234567891234E-13), 27, '1.234567891234E-13'); - t.equal(_f(1.234567891234E-12), 26, '1.234567891234E-12'); - t.equal(_f(1.234567891234E-11), 25, '1.234567891234E-11'); - t.equal(_f(1.234567891234E-10), 24, '1.234567891234E-10'); - t.equal(_f(1.234567891234E-09), 23, '1.234567891234E-09'); - t.equal(_f(1.234567891234E-08), 22, '1.234567891234E-08'); - t.equal(_f(1.234567891234E-07), 21, '1.234567891234E-07'); - t.equal(_f(0.000001234567891234), 20, '0.000001234567891234'); - t.equal(_f(0.00001234567891234), 19, '0.00001234567891234'); - t.equal(_f(0.0001234567891234), 18, '0.0001234567891234'); - t.equal(_f(0.001234567891234), 17, '0.001234567891234'); - t.equal(_f(0.01234567891234), 16, '0.01234567891234'); - t.equal(_f(0.1234567891234), 15, '0.1234567891234'); - t.equal(_f(1.234567891234), 14, '1.234567891234'); - t.equal(_f(12.34567891234), 14, '12.34567891234'); - t.equal(_f(123.4567891234), 14, '123.4567891234'); - t.equal(_f(1234.567891234), 14, '1234.567891234'); - t.equal(_f(12345.67891234), 14, '12345.67891234'); - t.equal(_f(123456.7891234), 14, '123456.7891234'); - t.equal(_f(1234567.891234), 14, '1234567.891234'); - t.equal(_f(12345678.91234), 14, '12345678.91234'); - t.equal(_f(123456789.1234), 14, '123456789.1234'); - t.equal(_f(1234567891.234), 14, '1234567891.234'); - t.equal(_f(12345678912.34), 14, '12345678912.34'); - t.equal(_f(123456789123.4), 14, '123456789123.4'); - t.equal(_f(1234567891234), 13, '1234567891234'); - t.equal(_f(12345678912340), 14, '12345678912340'); - t.equal(_f(123456789123400), 15, '123456789123400'); - t.equal(_f(1.2345678912345E-14), 29, '1.2345678912345E-14'); - t.equal(_f(1.2345678912345E-13), 28, '1.2345678912345E-13'); - t.equal(_f(1.2345678912345E-12), 27, '1.2345678912345E-12'); - t.equal(_f(1.2345678912345E-11), 26, '1.2345678912345E-11'); - t.equal(_f(1.2345678912345E-10), 25, '1.2345678912345E-10'); - t.equal(_f(1.2345678912345E-09), 24, '1.2345678912345E-09'); - t.equal(_f(1.2345678912345E-08), 23, '1.2345678912345E-08'); - t.equal(_f(1.2345678912345E-07), 22, '1.2345678912345E-07'); - t.equal(_f(1.2345678912345E-06), 21, '1.2345678912345E-06'); - t.equal(_f(0.000012345678912345), 20, '0.000012345678912345'); - t.equal(_f(0.00012345678912345), 19, '0.00012345678912345'); - t.equal(_f(0.0012345678912345), 18, '0.0012345678912345'); - t.equal(_f(0.012345678912345), 17, '0.012345678912345'); - t.equal(_f(0.12345678912345), 16, '0.12345678912345'); - t.equal(_f(1.2345678912345), 15, '1.2345678912345'); - t.equal(_f(12.345678912345), 15, '12.345678912345'); - t.equal(_f(123.45678912345), 15, '123.45678912345'); - t.equal(_f(1234.5678912345), 15, '1234.5678912345'); - t.equal(_f(12345.678912345), 15, '12345.678912345'); - t.equal(_f(123456.78912345), 15, '123456.78912345'); - t.equal(_f(1234567.8912345), 15, '1234567.8912345'); - t.equal(_f(12345678.912345), 15, '12345678.912345'); - t.equal(_f(123456789.12345), 15, '123456789.12345'); - t.equal(_f(1234567891.2345), 15, '1234567891.2345'); - t.equal(_f(12345678912.345), 15, '12345678912.345'); - t.equal(_f(123456789123.45), 15, '123456789123.45'); - t.equal(_f(1234567891234.5), 15, '1234567891234.5'); - t.equal(_f(12345678912345), 14, '12345678912345'); - t.equal(_f(123456789123450), 15, '123456789123450'); - t.equal(_f(1.23456789123456E-14), 30, '1.23456789123456E-14'); - t.equal(_f(1.23456789123456E-13), 29, '1.23456789123456E-13'); - t.equal(_f(1.23456789123456E-12), 28, '1.23456789123456E-12'); - t.equal(_f(1.23456789123456E-11), 27, '1.23456789123456E-11'); - t.equal(_f(1.23456789123456E-10), 26, '1.23456789123456E-10'); - t.equal(_f(1.23456789123456E-09), 25, '1.23456789123456E-09'); - t.equal(_f(1.23456789123456E-08), 24, '1.23456789123456E-08'); - t.equal(_f(1.23456789123456E-07), 23, '1.23456789123456E-07'); - t.equal(_f(1.23456789123456E-06), 22, '1.23456789123456E-06'); - t.equal(_f(1.23456789123456E-05), 21, '1.23456789123456E-05'); - t.equal(_f(0.000123456789123456), 20, '0.000123456789123456'); - t.equal(_f(0.00123456789123456), 19, '0.00123456789123456'); - t.equal(_f(0.0123456789123456), 18, '0.0123456789123456'); - t.equal(_f(0.123456789123456), 17, '0.123456789123456'); - t.equal(_f(1.23456789123456), 16, '1.23456789123456'); - t.equal(_f(12.3456789123456), 16, '12.3456789123456'); - t.equal(_f(123.456789123456), 16, '123.456789123456'); - t.equal(_f(1234.56789123456), 16, '1234.56789123456'); - t.equal(_f(12345.6789123456), 16, '12345.6789123456'); - t.equal(_f(123456.789123456), 16, '123456.789123456'); - t.equal(_f(1234567.89123456), 16, '1234567.89123456'); - t.equal(_f(12345678.9123456), 16, '12345678.9123456'); - t.equal(_f(123456789.123456), 16, '123456789.123456'); - t.equal(_f(1234567891.23456), 16, '1234567891.23456'); - t.equal(_f(12345678912.3456), 16, '12345678912.3456'); - t.equal(_f(123456789123.456), 16, '123456789123.456'); - t.equal(_f(1234567891234.56), 16, '1234567891234.56'); - t.equal(_f(12345678912345.6), 16, '12345678912345.6'); - t.equal(_f(123456789123456), 15, '123456789123456'); - t.equal(_f(-1.234567E-14), 23, '-1.234567E-14'); - t.equal(_f(-1.234567E-13), 22, '-1.234567E-13'); - t.equal(_f(-0.000000000001234567), 21, '-0.000000000001234567'); - t.equal(_f(-0.00000000001234567), 20, '-0.00000000001234567'); - t.equal(_f(-0.0000000001234567), 19, '-0.0000000001234567'); - t.equal(_f(-0.000000001234567), 18, '-0.000000001234567'); - t.equal(_f(-0.00000001234567), 17, '-0.00000001234567'); - t.equal(_f(-0.0000001234567), 16, '-0.0000001234567'); - t.equal(_f(-0.000001234567), 15, '-0.000001234567'); - t.equal(_f(-0.00001234567), 14, '-0.00001234567'); - t.equal(_f(-0.0001234567), 13, '-0.0001234567'); - t.equal(_f(-0.001234567), 12, '-0.001234567'); - t.equal(_f(-0.01234567), 11, '-0.01234567'); - t.equal(_f(-0.1234567), 10, '-0.1234567'); - t.equal(_f(-1.234567), 9, '-1.234567'); - t.equal(_f(-12.34567), 9, '-12.34567'); - t.equal(_f(-123.4567), 9, '-123.4567'); - t.equal(_f(-1234.567), 9, '-1234.567'); - t.equal(_f(-12345.67), 9, '-12345.67'); - t.equal(_f(-123456.7), 9, '-123456.7'); - t.equal(_f(-1234567), 8, '-1234567'); - t.equal(_f(-12345670), 9, '-12345670'); - t.equal(_f(-123456700), 10, '-123456700'); - t.equal(_f(-1234567000), 11, '-1234567000'); - t.equal(_f(-12345670000), 12, '-12345670000'); - t.equal(_f(-123456700000), 13, '-123456700000'); - t.equal(_f(-1234567000000), 14, '-1234567000000'); - t.equal(_f(-12345670000000), 15, '-12345670000000'); - t.equal(_f(-123456700000000), 16, '-123456700000000'); - - // supposed corner cases, found on teh internets - // https://stackoverflow.com/questions/9539513/ - t.equal(_f(0.0028), 6, '0.0028'); - t.equal(_f(0.0029), 6, '0.0029'); - t.equal(_f(0.0408), 6, '0.0408'); - t.equal(_f(0.1584), 6, '0.1584'); - t.equal(_f(4.3573), 6, '4.3573'); - t.equal(_f(11.6894), 7, '11.6894'); - t.equal(_f(0), 1, '0'); - t.equal(_f(1), 1, '1.0'); - t.equal(_f(0.123), 5, '0.123'); - t.equal(_f(1e-3), 5, '1e-3'); - t.equal(_f(-1e2), 4, '-1e2'); - t.equal(_f(-1e-2), 5, '-1e-2'); - t.equal(_f(-0.1), 4, '-0.1'); - t.equal(_f(1 / 3), 17, '1/3'); - t.equal(_f(3.14), 4, '3.14'); - t.equal(_f(2e-3), 5, '2e-3'); - t.equal(_f(2e-14), 16, '2e-14'); - t.equal(_f(Math.PI), 16, 'Math.PI'); - t.equal(_f(1e-9), 11, '1e-9'); - t.equal(_f(1e-10), 12, '1e-10'); - t.equal(_f(-3.14e-13), 18, '-3.14e-13'); - t.equal(_f(3e-13), 15, '3e-13'); - t.equal(_f(3e-14), 16, '3e-14'); - t.equal(_f(123.12345678901234567890), 16, '123.12345678901235...'); // overflows - t.equal(_f(5555), 4, '5555'); - t.equal(_f(555.5), 5, '555.5'); - t.equal(_f(55.55), 5, '55.55'); - t.equal(_f(0.0000005), 9, '0.0000005'); - t.equal(_f(5e-7), 9, '5e-7'); - t.equal(_f(0.00000055), 10, '0.00000055'); - t.equal(_f(5e-8), 10, '5e-8'); - t.equal(_f(0.000006), 8, '0.000006'); - t.equal(_f(0.0000007), 9, '0.0000007'); - t.equal(_f(0.123), 5, '0.123'); - t.equal(_f(0.121), 5, '0.121'); - t.equal(_f(0.1215), 6, '0.1215'); - - // truncation test 4+11 = 15 (plus period) - t.equal(_f(1000.00000000001), 16, '1000.00000000001'); - t.equal(_f(-1000.00000000001), 17, '-1000.00000000001'); - // truncation test 4+12 = 16 - t.equal(_f(1000.000000000001), 4, '1000.000000000001'); - // truncation test 4+13 = 17 - t.equal(_f(1000.0000000000001), 4, '1000.0000000000001'); - // truncation test 5+13 = 18 - t.equal(_f(10000.0000000000001), 5, '10000.0000000000001'); - - t.end(); -}); - diff --git a/test/numdec.spec.ts b/test/numdec.spec.ts new file mode 100644 index 0000000..ccb8b54 --- /dev/null +++ b/test/numdec.spec.ts @@ -0,0 +1,553 @@ +/* eslint-disable no-loss-of-precision */ +// tests converted from SSF +import { expect, test } from 'vitest'; +import numdec from '../lib/numdec.js'; + +function _f (v: number) { + return numdec(v).total; +} + +test('numdec', () => { + expect(_f(1.234567E-14), '1.234567E-14').toBe(22); + expect(_f(1.234567E-13), '1.234567E-13').toBe(21); + expect(_f(0.000000000001234567), '0.000000000001234567').toBe(20); + expect(_f(0.00000000001234567), '0.00000000001234567').toBe(19); + expect(_f(0.0000000001234567), '0.0000000001234567').toBe(18); + expect(_f(0.000000001234567), '0.000000001234567').toBe(17); + expect(_f(0.00000001234567), '0.00000001234567').toBe(16); + expect(_f(0.0000001234567), '0.0000001234567').toBe(15); + expect(_f(0.000001234567), '0.000001234567').toBe(14); + expect(_f(0.00001234567), '0.00001234567').toBe(13); + expect(_f(0.0001234567), '0.0001234567').toBe(12); + expect(_f(0.001234567), '0.001234567').toBe(11); + expect(_f(0.01234567), '0.01234567').toBe(10); + expect(_f(0.1234567), '0.1234567').toBe(9); + expect(_f(1.234567), '1.234567').toBe(8); + expect(_f(12.34567), '12.34567').toBe(8); + expect(_f(123.4567), '123.4567').toBe(8); + expect(_f(1234.567), '1234.567').toBe(8); + expect(_f(12345.67), '12345.67').toBe(8); + expect(_f(123456.7), '123456.7').toBe(8); + expect(_f(1234567), '1234567').toBe(7); + expect(_f(12345670), '12345670').toBe(8); + expect(_f(123456700), '123456700').toBe(9); + expect(_f(1234567000), '1234567000').toBe(10); + expect(_f(12345670000), '12345670000').toBe(11); + expect(_f(123456700000), '123456700000').toBe(12); + expect(_f(1234567000000), '1234567000000').toBe(13); + expect(_f(12345670000000), '12345670000000').toBe(14); + expect(_f(123456700000000), '123456700000000').toBe(15); + expect(_f(0.00000000000001), '0.00000000000001').toBe(16); + expect(_f(0.0000000000001), '0.0000000000001').toBe(15); + expect(_f(0.000000000001), '0.000000000001').toBe(14); + expect(_f(0.00000000001), '0.00000000001').toBe(13); + expect(_f(0.0000000001), '0.0000000001').toBe(12); + expect(_f(0.000000001), '0.000000001').toBe(11); + expect(_f(0.00000001), '0.00000001').toBe(10); + expect(_f(0.0000001), '0.0000001').toBe(9); + expect(_f(0.000001), '0.000001').toBe(8); + expect(_f(0.00001), '0.00001').toBe(7); + expect(_f(0.0001), '0.0001').toBe(6); + expect(_f(0.001), '0.001').toBe(5); + expect(_f(0.01), '0.01').toBe(4); + expect(_f(0.1), '0.1').toBe(3); + expect(_f(1), '1').toBe(1); + expect(_f(10), '10').toBe(2); + expect(_f(100), '100').toBe(3); + expect(_f(1000), '1000').toBe(4); + expect(_f(10000), '10000').toBe(5); + expect(_f(100000), '100000').toBe(6); + expect(_f(1000000), '1000000').toBe(7); + expect(_f(10000000), '10000000').toBe(8); + expect(_f(100000000), '100000000').toBe(9); + expect(_f(1000000000), '1000000000').toBe(10); + expect(_f(10000000000), '10000000000').toBe(11); + expect(_f(100000000000), '100000000000').toBe(12); + expect(_f(1000000000000), '1000000000000').toBe(13); + expect(_f(10000000000000), '10000000000000').toBe(14); + expect(_f(100000000000000), '100000000000000').toBe(15); + expect(_f(0.000000000000012), '0.000000000000012').toBe(17); + expect(_f(0.00000000000012), '0.00000000000012').toBe(16); + expect(_f(0.0000000000012), '0.0000000000012').toBe(15); + expect(_f(0.000000000012), '0.000000000012').toBe(14); + expect(_f(0.00000000012), '0.00000000012').toBe(13); + expect(_f(0.0000000012), '0.0000000012').toBe(12); + expect(_f(0.000000012), '0.000000012').toBe(11); + expect(_f(0.00000012), '0.00000012').toBe(10); + expect(_f(0.0000012), '0.0000012').toBe(9); + expect(_f(0.000012), '0.000012').toBe(8); + expect(_f(0.00012), '0.00012').toBe(7); + expect(_f(0.0012), '0.0012').toBe(6); + expect(_f(0.012), '0.012').toBe(5); + expect(_f(0.12), '0.12').toBe(4); + expect(_f(1.2), '1.2').toBe(3); + expect(_f(12), '12').toBe(2); + expect(_f(120), '120').toBe(3); + expect(_f(1200), '1200').toBe(4); + expect(_f(12000), '12000').toBe(5); + expect(_f(120000), '120000').toBe(6); + expect(_f(1200000), '1200000').toBe(7); + expect(_f(12000000), '12000000').toBe(8); + expect(_f(120000000), '120000000').toBe(9); + expect(_f(1200000000), '1200000000').toBe(10); + expect(_f(12000000000), '12000000000').toBe(11); + expect(_f(120000000000), '120000000000').toBe(12); + expect(_f(1200000000000), '1200000000000').toBe(13); + expect(_f(12000000000000), '12000000000000').toBe(14); + expect(_f(120000000000000), '120000000000000').toBe(15); + expect(_f(0.0000000000000123), '0.0000000000000123').toBe(18); + expect(_f(0.000000000000123), '0.000000000000123').toBe(17); + expect(_f(0.00000000000123), '0.00000000000123').toBe(16); + expect(_f(0.0000000000123), '0.0000000000123').toBe(15); + expect(_f(0.000000000123), '0.000000000123').toBe(14); + expect(_f(0.00000000123), '0.00000000123').toBe(13); + expect(_f(0.0000000123), '0.0000000123').toBe(12); + expect(_f(0.000000123), '0.000000123').toBe(11); + expect(_f(0.00000123), '0.00000123').toBe(10); + expect(_f(0.0000123), '0.0000123').toBe(9); + expect(_f(0.000123), '0.000123').toBe(8); + expect(_f(0.00123), '0.00123').toBe(7); + expect(_f(0.0123), '0.0123').toBe(6); + expect(_f(0.123), '0.123').toBe(5); + expect(_f(1.23), '1.23').toBe(4); + expect(_f(12.3), '12.3').toBe(4); + expect(_f(123), '123').toBe(3); + expect(_f(1230), '1230').toBe(4); + expect(_f(12300), '12300').toBe(5); + expect(_f(123000), '123000').toBe(6); + expect(_f(1230000), '1230000').toBe(7); + expect(_f(12300000), '12300000').toBe(8); + expect(_f(123000000), '123000000').toBe(9); + expect(_f(1230000000), '1230000000').toBe(10); + expect(_f(12300000000), '12300000000').toBe(11); + expect(_f(123000000000), '123000000000').toBe(12); + expect(_f(1230000000000), '1230000000000').toBe(13); + expect(_f(12300000000000), '12300000000000').toBe(14); + expect(_f(123000000000000), '123000000000000').toBe(15); + expect(_f(0.00000000000001234), '0.00000000000001234').toBe(19); + expect(_f(0.0000000000001234), '0.0000000000001234').toBe(18); + expect(_f(0.000000000001234), '0.000000000001234').toBe(17); + expect(_f(0.00000000001234), '0.00000000001234').toBe(16); + expect(_f(0.0000000001234), '0.0000000001234').toBe(15); + expect(_f(0.000000001234), '0.000000001234').toBe(14); + expect(_f(0.00000001234), '0.00000001234').toBe(13); + expect(_f(0.0000001234), '0.0000001234').toBe(12); + expect(_f(0.000001234), '0.000001234').toBe(11); + expect(_f(0.00001234), '0.00001234').toBe(10); + expect(_f(0.0001234), '0.0001234').toBe(9); + expect(_f(0.001234), '0.001234').toBe(8); + expect(_f(0.01234), '0.01234').toBe(7); + expect(_f(0.1234), '0.1234').toBe(6); + expect(_f(1.234), '1.234').toBe(5); + expect(_f(12.34), '12.34').toBe(5); + expect(_f(123.4), '123.4').toBe(5); + expect(_f(1234), '1234').toBe(4); + expect(_f(12340), '12340').toBe(5); + expect(_f(123400), '123400').toBe(6); + expect(_f(1234000), '1234000').toBe(7); + expect(_f(12340000), '12340000').toBe(8); + expect(_f(123400000), '123400000').toBe(9); + expect(_f(1234000000), '1234000000').toBe(10); + expect(_f(12340000000), '12340000000').toBe(11); + expect(_f(123400000000), '123400000000').toBe(12); + expect(_f(1234000000000), '1234000000000').toBe(13); + expect(_f(12340000000000), '12340000000000').toBe(14); + expect(_f(123400000000000), '123400000000000').toBe(15); + expect(_f(0.000000000000012345), '0.000000000000012345').toBe(20); + expect(_f(0.00000000000012345), '0.00000000000012345').toBe(19); + expect(_f(0.0000000000012345), '0.0000000000012345').toBe(18); + expect(_f(0.000000000012345), '0.000000000012345').toBe(17); + expect(_f(0.00000000012345), '0.00000000012345').toBe(16); + expect(_f(0.0000000012345), '0.0000000012345').toBe(15); + expect(_f(0.000000012345), '0.000000012345').toBe(14); + expect(_f(0.00000012345), '0.00000012345').toBe(13); + expect(_f(0.0000012345), '0.0000012345').toBe(12); + expect(_f(0.000012345), '0.000012345').toBe(11); + expect(_f(0.00012345), '0.00012345').toBe(10); + expect(_f(0.0012345), '0.0012345').toBe(9); + expect(_f(0.012345), '0.012345').toBe(8); + expect(_f(0.12345), '0.12345').toBe(7); + expect(_f(1.2345), '1.2345').toBe(6); + expect(_f(12.345), '12.345').toBe(6); + expect(_f(123.45), '123.45').toBe(6); + expect(_f(1234.5), '1234.5').toBe(6); + expect(_f(12345), '12345').toBe(5); + expect(_f(123450), '123450').toBe(6); + expect(_f(1234500), '1234500').toBe(7); + expect(_f(12345000), '12345000').toBe(8); + expect(_f(123450000), '123450000').toBe(9); + expect(_f(1234500000), '1234500000').toBe(10); + expect(_f(12345000000), '12345000000').toBe(11); + expect(_f(123450000000), '123450000000').toBe(12); + expect(_f(1234500000000), '1234500000000').toBe(13); + expect(_f(12345000000000), '12345000000000').toBe(14); + expect(_f(123450000000000), '123450000000000').toBe(15); + expect(_f(1.23456E-14), '1.23456E-14').toBe(21); + expect(_f(0.000000000000123456), '0.000000000000123456').toBe(20); + expect(_f(0.00000000000123456), '0.00000000000123456').toBe(19); + expect(_f(0.0000000000123456), '0.0000000000123456').toBe(18); + expect(_f(0.000000000123456), '0.000000000123456').toBe(17); + expect(_f(0.00000000123456), '0.00000000123456').toBe(16); + expect(_f(0.0000000123456), '0.0000000123456').toBe(15); + expect(_f(0.000000123456), '0.000000123456').toBe(14); + expect(_f(0.00000123456), '0.00000123456').toBe(13); + expect(_f(0.0000123456), '0.0000123456').toBe(12); + expect(_f(0.000123456), '0.000123456').toBe(11); + expect(_f(0.00123456), '0.00123456').toBe(10); + expect(_f(0.0123456), '0.0123456').toBe(9); + expect(_f(0.123456), '0.123456').toBe(8); + expect(_f(1.23456), '1.23456').toBe(7); + expect(_f(12.3456), '12.3456').toBe(7); + expect(_f(123.456), '123.456').toBe(7); + expect(_f(1234.56), '1234.56').toBe(7); + expect(_f(12345.6), '12345.6').toBe(7); + expect(_f(123456), '123456').toBe(6); + expect(_f(1234560), '1234560').toBe(7); + expect(_f(12345600), '12345600').toBe(8); + expect(_f(123456000), '123456000').toBe(9); + expect(_f(1234560000), '1234560000').toBe(10); + expect(_f(12345600000), '12345600000').toBe(11); + expect(_f(123456000000), '123456000000').toBe(12); + expect(_f(1234560000000), '1234560000000').toBe(13); + expect(_f(12345600000000), '12345600000000').toBe(14); + expect(_f(123456000000000), '123456000000000').toBe(15); + expect(_f(1.234567E-14), '1.234567E-14').toBe(22); + expect(_f(1.234567E-13), '1.234567E-13').toBe(21); + expect(_f(0.000000000001234567), '0.000000000001234567').toBe(20); + expect(_f(0.00000000001234567), '0.00000000001234567').toBe(19); + expect(_f(0.0000000001234567), '0.0000000001234567').toBe(18); + expect(_f(0.000000001234567), '0.000000001234567').toBe(17); + expect(_f(0.00000001234567), '0.00000001234567').toBe(16); + expect(_f(0.0000001234567), '0.0000001234567').toBe(15); + expect(_f(0.000001234567), '0.000001234567').toBe(14); + expect(_f(0.00001234567), '0.00001234567').toBe(13); + expect(_f(0.0001234567), '0.0001234567').toBe(12); + expect(_f(0.001234567), '0.001234567').toBe(11); + expect(_f(0.01234567), '0.01234567').toBe(10); + expect(_f(0.1234567), '0.1234567').toBe(9); + expect(_f(1.234567), '1.234567').toBe(8); + expect(_f(12.34567), '12.34567').toBe(8); + expect(_f(123.4567), '123.4567').toBe(8); + expect(_f(1234.567), '1234.567').toBe(8); + expect(_f(12345.67), '12345.67').toBe(8); + expect(_f(123456.7), '123456.7').toBe(8); + expect(_f(1234567), '1234567').toBe(7); + expect(_f(12345670), '12345670').toBe(8); + expect(_f(123456700), '123456700').toBe(9); + expect(_f(1234567000), '1234567000').toBe(10); + expect(_f(12345670000), '12345670000').toBe(11); + expect(_f(123456700000), '123456700000').toBe(12); + expect(_f(1234567000000), '1234567000000').toBe(13); + expect(_f(12345670000000), '12345670000000').toBe(14); + expect(_f(123456700000000), '123456700000000').toBe(15); + expect(_f(1.2345678E-14), '1.2345678E-14').toBe(23); + expect(_f(1.2345678E-13), '1.2345678E-13').toBe(22); + expect(_f(1.2345678E-12), '1.2345678E-12').toBe(21); + expect(_f(0.000000000012345678), '0.000000000012345678').toBe(20); + expect(_f(0.00000000012345678), '0.00000000012345678').toBe(19); + expect(_f(0.0000000012345678), '0.0000000012345678').toBe(18); + expect(_f(0.000000012345678), '0.000000012345678').toBe(17); + expect(_f(0.00000012345678), '0.00000012345678').toBe(16); + expect(_f(0.0000012345678), '0.0000012345678').toBe(15); + expect(_f(0.000012345678), '0.000012345678').toBe(14); + expect(_f(0.00012345678), '0.00012345678').toBe(13); + expect(_f(0.0012345678), '0.0012345678').toBe(12); + expect(_f(0.012345678), '0.012345678').toBe(11); + expect(_f(0.12345678), '0.12345678').toBe(10); + expect(_f(1.2345678), '1.2345678').toBe(9); + expect(_f(12.345678), '12.345678').toBe(9); + expect(_f(123.45678), '123.45678').toBe(9); + expect(_f(1234.5678), '1234.5678').toBe(9); + expect(_f(12345.678), '12345.678').toBe(9); + expect(_f(123456.78), '123456.78').toBe(9); + expect(_f(1234567.8), '1234567.8').toBe(9); + expect(_f(12345678), '12345678').toBe(8); + expect(_f(123456780), '123456780').toBe(9); + expect(_f(1234567800), '1234567800').toBe(10); + expect(_f(12345678000), '12345678000').toBe(11); + expect(_f(123456780000), '123456780000').toBe(12); + expect(_f(1234567800000), '1234567800000').toBe(13); + expect(_f(12345678000000), '12345678000000').toBe(14); + expect(_f(123456780000000), '123456780000000').toBe(15); + expect(_f(1.23456789E-14), '1.23456789E-14').toBe(24); + expect(_f(1.23456789E-13), '1.23456789E-13').toBe(23); + expect(_f(1.23456789E-12), '1.23456789E-12').toBe(22); + expect(_f(1.23456789E-11), '1.23456789E-11').toBe(21); + expect(_f(0.000000000123456789), '0.000000000123456789').toBe(20); + expect(_f(0.00000000123456789), '0.00000000123456789').toBe(19); + expect(_f(0.0000000123456789), '0.0000000123456789').toBe(18); + expect(_f(0.000000123456789), '0.000000123456789').toBe(17); + expect(_f(0.00000123456789), '0.00000123456789').toBe(16); + expect(_f(0.0000123456789), '0.0000123456789').toBe(15); + expect(_f(0.000123456789), '0.000123456789').toBe(14); + expect(_f(0.00123456789), '0.00123456789').toBe(13); + expect(_f(0.0123456789), '0.0123456789').toBe(12); + expect(_f(0.123456789), '0.123456789').toBe(11); + expect(_f(1.23456789), '1.23456789').toBe(10); + expect(_f(12.3456789), '12.3456789').toBe(10); + expect(_f(123.456789), '123.456789').toBe(10); + expect(_f(1234.56789), '1234.56789').toBe(10); + expect(_f(12345.6789), '12345.6789').toBe(10); + expect(_f(123456.789), '123456.789').toBe(10); + expect(_f(1234567.89), '1234567.89').toBe(10); + expect(_f(12345678.9), '12345678.9').toBe(10); + expect(_f(123456789), '123456789').toBe(9); + expect(_f(1234567890), '1234567890').toBe(10); + expect(_f(12345678900), '12345678900').toBe(11); + expect(_f(123456789000), '123456789000').toBe(12); + expect(_f(1234567890000), '1234567890000').toBe(13); + expect(_f(12345678900000), '12345678900000').toBe(14); + expect(_f(123456789000000), '123456789000000').toBe(15); + expect(_f(1.234567891E-14), '1.234567891E-14').toBe(25); + expect(_f(1.234567891E-13), '1.234567891E-13').toBe(24); + expect(_f(1.234567891E-12), '1.234567891E-12').toBe(23); + expect(_f(1.234567891E-11), '1.234567891E-11').toBe(22); + expect(_f(1.234567891E-10), '1.234567891E-10').toBe(21); + expect(_f(0.000000001234567891), '0.000000001234567891').toBe(20); + expect(_f(0.00000001234567891), '0.00000001234567891').toBe(19); + expect(_f(0.0000001234567891), '0.0000001234567891').toBe(18); + expect(_f(0.000001234567891), '0.000001234567891').toBe(17); + expect(_f(0.00001234567891), '0.00001234567891').toBe(16); + expect(_f(0.0001234567891), '0.0001234567891').toBe(15); + expect(_f(0.001234567891), '0.001234567891').toBe(14); + expect(_f(0.01234567891), '0.01234567891').toBe(13); + expect(_f(0.1234567891), '0.1234567891').toBe(12); + expect(_f(1.234567891), '1.234567891').toBe(11); + expect(_f(12.34567891), '12.34567891').toBe(11); + expect(_f(123.4567891), '123.4567891').toBe(11); + expect(_f(1234.567891), '1234.567891').toBe(11); + expect(_f(12345.67891), '12345.67891').toBe(11); + expect(_f(123456.7891), '123456.7891').toBe(11); + expect(_f(1234567.891), '1234567.891').toBe(11); + expect(_f(12345678.91), '12345678.91').toBe(11); + expect(_f(123456789.1), '123456789.1').toBe(11); + expect(_f(1234567891), '1234567891').toBe(10); + expect(_f(12345678910), '12345678910').toBe(11); + expect(_f(123456789100), '123456789100').toBe(12); + expect(_f(1234567891000), '1234567891000').toBe(13); + expect(_f(12345678910000), '12345678910000').toBe(14); + expect(_f(123456789100000), '123456789100000').toBe(15); + expect(_f(1.2345678912E-14), '1.2345678912E-14').toBe(26); // 0.000000000000012345678912 + expect(_f(1.2345678912E-13), '1.2345678912E-13').toBe(25); + expect(_f(1.2345678912E-12), '1.2345678912E-12').toBe(24); + expect(_f(1.2345678912E-11), '1.2345678912E-11').toBe(23); + expect(_f(1.2345678912E-10), '1.2345678912E-10').toBe(22); + expect(_f(1.2345678912E-09), '1.2345678912E-09').toBe(21); + expect(_f(0.000000012345678912), '0.000000012345678912').toBe(20); + expect(_f(0.00000012345678912), '0.00000012345678912').toBe(19); + expect(_f(0.0000012345678912), '0.0000012345678912').toBe(18); + expect(_f(0.000012345678912), '0.000012345678912').toBe(17); + expect(_f(0.00012345678912), '0.00012345678912').toBe(16); + expect(_f(0.0012345678912), '0.0012345678912').toBe(15); + expect(_f(0.012345678912), '0.012345678912').toBe(14); + expect(_f(0.12345678912), '0.12345678912').toBe(13); + expect(_f(1.2345678912), '1.2345678912').toBe(12); + expect(_f(12.345678912), '12.345678912').toBe(12); + expect(_f(123.45678912), '123.45678912').toBe(12); + expect(_f(1234.5678912), '1234.5678912').toBe(12); + expect(_f(12345.678912), '12345.678912').toBe(12); + expect(_f(123456.78912), '123456.78912').toBe(12); + expect(_f(1234567.8912), '1234567.8912').toBe(12); + expect(_f(12345678.912), '12345678.912').toBe(12); + expect(_f(123456789.12), '123456789.12').toBe(12); + expect(_f(1234567891.2), '1234567891.2').toBe(12); + expect(_f(12345678912), '12345678912').toBe(11); + expect(_f(123456789120), '123456789120').toBe(12); + expect(_f(1234567891200), '1234567891200').toBe(13); + expect(_f(12345678912000), '12345678912000').toBe(14); + expect(_f(123456789120000), '123456789120000').toBe(15); + expect(_f(1.23456789123E-14), '1.23456789123E-14').toBe(27); + expect(_f(1.23456789123E-13), '1.23456789123E-13').toBe(26); + expect(_f(1.23456789123E-12), '1.23456789123E-12').toBe(25); + expect(_f(1.23456789123E-11), '1.23456789123E-11').toBe(24); + expect(_f(1.23456789123E-10), '1.23456789123E-10').toBe(23); + expect(_f(1.23456789123E-09), '1.23456789123E-09').toBe(22); + expect(_f(1.23456789123E-08), '1.23456789123E-08').toBe(21); + expect(_f(0.000000123456789123), '0.000000123456789123').toBe(20); + expect(_f(0.00000123456789123), '0.00000123456789123').toBe(19); + expect(_f(0.0000123456789123), '0.0000123456789123').toBe(18); + expect(_f(0.000123456789123), '0.000123456789123').toBe(17); + expect(_f(0.00123456789123), '0.00123456789123').toBe(16); + expect(_f(0.0123456789123), '0.0123456789123').toBe(15); + expect(_f(0.123456789123), '0.123456789123').toBe(14); + expect(_f(1.23456789123), '1.23456789123').toBe(13); + expect(_f(12.3456789123), '12.3456789123').toBe(13); + expect(_f(123.456789123), '123.456789123').toBe(13); + expect(_f(1234.56789123), '1234.56789123').toBe(13); + expect(_f(12345.6789123), '12345.6789123').toBe(13); + expect(_f(123456.789123), '123456.789123').toBe(13); + expect(_f(1234567.89123), '1234567.89123').toBe(13); + expect(_f(12345678.9123), '12345678.9123').toBe(13); + expect(_f(123456789.123), '123456789.123').toBe(13); + expect(_f(1234567891.23), '1234567891.23').toBe(13); + expect(_f(12345678912.3), '12345678912.3').toBe(13); + expect(_f(123456789123), '123456789123').toBe(12); + expect(_f(1234567891230), '1234567891230').toBe(13); + expect(_f(12345678912300), '12345678912300').toBe(14); + expect(_f(123456789123000), '123456789123000').toBe(15); + expect(_f(1.234567891234E-14), '1.234567891234E-14').toBe(28); + expect(_f(1.234567891234E-13), '1.234567891234E-13').toBe(27); + expect(_f(1.234567891234E-12), '1.234567891234E-12').toBe(26); + expect(_f(1.234567891234E-11), '1.234567891234E-11').toBe(25); + expect(_f(1.234567891234E-10), '1.234567891234E-10').toBe(24); + expect(_f(1.234567891234E-09), '1.234567891234E-09').toBe(23); + expect(_f(1.234567891234E-08), '1.234567891234E-08').toBe(22); + expect(_f(1.234567891234E-07), '1.234567891234E-07').toBe(21); + expect(_f(0.000001234567891234), '0.000001234567891234').toBe(20); + expect(_f(0.00001234567891234), '0.00001234567891234').toBe(19); + expect(_f(0.0001234567891234), '0.0001234567891234').toBe(18); + expect(_f(0.001234567891234), '0.001234567891234').toBe(17); + expect(_f(0.01234567891234), '0.01234567891234').toBe(16); + expect(_f(0.1234567891234), '0.1234567891234').toBe(15); + expect(_f(1.234567891234), '1.234567891234').toBe(14); + expect(_f(12.34567891234), '12.34567891234').toBe(14); + expect(_f(123.4567891234), '123.4567891234').toBe(14); + expect(_f(1234.567891234), '1234.567891234').toBe(14); + expect(_f(12345.67891234), '12345.67891234').toBe(14); + expect(_f(123456.7891234), '123456.7891234').toBe(14); + expect(_f(1234567.891234), '1234567.891234').toBe(14); + expect(_f(12345678.91234), '12345678.91234').toBe(14); + expect(_f(123456789.1234), '123456789.1234').toBe(14); + expect(_f(1234567891.234), '1234567891.234').toBe(14); + expect(_f(12345678912.34), '12345678912.34').toBe(14); + expect(_f(123456789123.4), '123456789123.4').toBe(14); + expect(_f(1234567891234), '1234567891234').toBe(13); + expect(_f(12345678912340), '12345678912340').toBe(14); + expect(_f(123456789123400), '123456789123400').toBe(15); + expect(_f(1.2345678912345E-14), '1.2345678912345E-14').toBe(29); + expect(_f(1.2345678912345E-13), '1.2345678912345E-13').toBe(28); + expect(_f(1.2345678912345E-12), '1.2345678912345E-12').toBe(27); + expect(_f(1.2345678912345E-11), '1.2345678912345E-11').toBe(26); + expect(_f(1.2345678912345E-10), '1.2345678912345E-10').toBe(25); + expect(_f(1.2345678912345E-09), '1.2345678912345E-09').toBe(24); + expect(_f(1.2345678912345E-08), '1.2345678912345E-08').toBe(23); + expect(_f(1.2345678912345E-07), '1.2345678912345E-07').toBe(22); + expect(_f(1.2345678912345E-06), '1.2345678912345E-06').toBe(21); + expect(_f(0.000012345678912345), '0.000012345678912345').toBe(20); + expect(_f(0.00012345678912345), '0.00012345678912345').toBe(19); + expect(_f(0.0012345678912345), '0.0012345678912345').toBe(18); + expect(_f(0.012345678912345), '0.012345678912345').toBe(17); + expect(_f(0.12345678912345), '0.12345678912345').toBe(16); + expect(_f(1.2345678912345), '1.2345678912345').toBe(15); + expect(_f(12.345678912345), '12.345678912345').toBe(15); + expect(_f(123.45678912345), '123.45678912345').toBe(15); + expect(_f(1234.5678912345), '1234.5678912345').toBe(15); + expect(_f(12345.678912345), '12345.678912345').toBe(15); + expect(_f(123456.78912345), '123456.78912345').toBe(15); + expect(_f(1234567.8912345), '1234567.8912345').toBe(15); + expect(_f(12345678.912345), '12345678.912345').toBe(15); + expect(_f(123456789.12345), '123456789.12345').toBe(15); + expect(_f(1234567891.2345), '1234567891.2345').toBe(15); + expect(_f(12345678912.345), '12345678912.345').toBe(15); + expect(_f(123456789123.45), '123456789123.45').toBe(15); + expect(_f(1234567891234.5), '1234567891234.5').toBe(15); + expect(_f(12345678912345), '12345678912345').toBe(14); + expect(_f(123456789123450), '123456789123450').toBe(15); + expect(_f(1.23456789123456E-14), '1.23456789123456E-14').toBe(30); + expect(_f(1.23456789123456E-13), '1.23456789123456E-13').toBe(29); + expect(_f(1.23456789123456E-12), '1.23456789123456E-12').toBe(28); + expect(_f(1.23456789123456E-11), '1.23456789123456E-11').toBe(27); + expect(_f(1.23456789123456E-10), '1.23456789123456E-10').toBe(26); + expect(_f(1.23456789123456E-09), '1.23456789123456E-09').toBe(25); + expect(_f(1.23456789123456E-08), '1.23456789123456E-08').toBe(24); + expect(_f(1.23456789123456E-07), '1.23456789123456E-07').toBe(23); + expect(_f(1.23456789123456E-06), '1.23456789123456E-06').toBe(22); + expect(_f(1.23456789123456E-05), '1.23456789123456E-05').toBe(21); + expect(_f(0.000123456789123456), '0.000123456789123456').toBe(20); + expect(_f(0.00123456789123456), '0.00123456789123456').toBe(19); + expect(_f(0.0123456789123456), '0.0123456789123456').toBe(18); + expect(_f(0.123456789123456), '0.123456789123456').toBe(17); + expect(_f(1.23456789123456), '1.23456789123456').toBe(16); + expect(_f(12.3456789123456), '12.3456789123456').toBe(16); + expect(_f(123.456789123456), '123.456789123456').toBe(16); + expect(_f(1234.56789123456), '1234.56789123456').toBe(16); + expect(_f(12345.6789123456), '12345.6789123456').toBe(16); + expect(_f(123456.789123456), '123456.789123456').toBe(16); + expect(_f(1234567.89123456), '1234567.89123456').toBe(16); + expect(_f(12345678.9123456), '12345678.9123456').toBe(16); + expect(_f(123456789.123456), '123456789.123456').toBe(16); + expect(_f(1234567891.23456), '1234567891.23456').toBe(16); + expect(_f(12345678912.3456), '12345678912.3456').toBe(16); + expect(_f(123456789123.456), '123456789123.456').toBe(16); + expect(_f(1234567891234.56), '1234567891234.56').toBe(16); + expect(_f(12345678912345.6), '12345678912345.6').toBe(16); + expect(_f(123456789123456), '123456789123456').toBe(15); + expect(_f(-1.234567E-14), '-1.234567E-14').toBe(23); + expect(_f(-1.234567E-13), '-1.234567E-13').toBe(22); + expect(_f(-0.000000000001234567), '-0.000000000001234567').toBe(21); + expect(_f(-0.00000000001234567), '-0.00000000001234567').toBe(20); + expect(_f(-0.0000000001234567), '-0.0000000001234567').toBe(19); + expect(_f(-0.000000001234567), '-0.000000001234567').toBe(18); + expect(_f(-0.00000001234567), '-0.00000001234567').toBe(17); + expect(_f(-0.0000001234567), '-0.0000001234567').toBe(16); + expect(_f(-0.000001234567), '-0.000001234567').toBe(15); + expect(_f(-0.00001234567), '-0.00001234567').toBe(14); + expect(_f(-0.0001234567), '-0.0001234567').toBe(13); + expect(_f(-0.001234567), '-0.001234567').toBe(12); + expect(_f(-0.01234567), '-0.01234567').toBe(11); + expect(_f(-0.1234567), '-0.1234567').toBe(10); + expect(_f(-1.234567), '-1.234567').toBe(9); + expect(_f(-12.34567), '-12.34567').toBe(9); + expect(_f(-123.4567), '-123.4567').toBe(9); + expect(_f(-1234.567), '-1234.567').toBe(9); + expect(_f(-12345.67), '-12345.67').toBe(9); + expect(_f(-123456.7), '-123456.7').toBe(9); + expect(_f(-1234567), '-1234567').toBe(8); + expect(_f(-12345670), '-12345670').toBe(9); + expect(_f(-123456700), '-123456700').toBe(10); + expect(_f(-1234567000), '-1234567000').toBe(11); + expect(_f(-12345670000), '-12345670000').toBe(12); + expect(_f(-123456700000), '-123456700000').toBe(13); + expect(_f(-1234567000000), '-1234567000000').toBe(14); + expect(_f(-12345670000000), '-12345670000000').toBe(15); + expect(_f(-123456700000000), '-123456700000000').toBe(16); + + // supposed corner cases, found on teh internets + // https://stackoverflow.com/questions/9539513/ + expect(_f(0.0028), '0.0028').toBe(6); + expect(_f(0.0029), '0.0029').toBe(6); + expect(_f(0.0408), '0.0408').toBe(6); + expect(_f(0.1584), '0.1584').toBe(6); + expect(_f(4.3573), '4.3573').toBe(6); + expect(_f(11.6894), '11.6894').toBe(7); + expect(_f(0), '0').toBe(1); + expect(_f(1), '1.0').toBe(1); + expect(_f(0.123), '0.123').toBe(5); + expect(_f(1e-3), '1e-3').toBe(5); + expect(_f(-1e2), '-1e2').toBe(4); + expect(_f(-1e-2), '-1e-2').toBe(5); + expect(_f(-0.1), '-0.1').toBe(4); + expect(_f(1 / 3), '1/3').toBe(17); + expect(_f(3.14), '3.14').toBe(4); + expect(_f(2e-3), '2e-3').toBe(5); + expect(_f(2e-14), '2e-14').toBe(16); + expect(_f(Math.PI), 'Math.PI').toBe(16); + expect(_f(1e-9), '1e-9').toBe(11); + expect(_f(1e-10), '1e-10').toBe(12); + expect(_f(-3.14e-13), '-3.14e-13').toBe(18); + expect(_f(3e-13), '3e-13').toBe(15); + expect(_f(3e-14), '3e-14').toBe(16); + expect(_f(123.12345678901234567890), '123.12345678901235...').toBe(16); // overflows + expect(_f(5555), '5555').toBe(4); + expect(_f(555.5), '555.5').toBe(5); + expect(_f(55.55), '55.55').toBe(5); + expect(_f(0.0000005), '0.0000005').toBe(9); + expect(_f(5e-7), '5e-7').toBe(9); + expect(_f(0.00000055), '0.00000055').toBe(10); + expect(_f(5e-8), '5e-8').toBe(10); + expect(_f(0.000006), '0.000006').toBe(8); + expect(_f(0.0000007), '0.0000007').toBe(9); + expect(_f(0.123), '0.123').toBe(5); + expect(_f(0.121), '0.121').toBe(5); + expect(_f(0.1215), '0.1215').toBe(6); + + // truncation test 4+11 = 15 (plus period) + expect(_f(1000.00000000001), '1000.00000000001').toBe(16); + expect(_f(-1000.00000000001), '-1000.00000000001').toBe(17); + // truncation test 4+12 = 16 + expect(_f(1000.000000000001), '1000.000000000001').toBe(4); + // truncation test 4+13 = 17 + expect(_f(1000.0000000000001), '1000.0000000000001').toBe(4); + // truncation test 5+13 = 18 + expect(_f(10000.0000000000001), '10000.0000000000001').toBe(5); +}); diff --git a/test/numfmt-test.js b/test/numfmt-test.js deleted file mode 100644 index e401a8a..0000000 --- a/test/numfmt-test.js +++ /dev/null @@ -1,299 +0,0 @@ -/* globals process */ -/* eslint-disable no-loss-of-precision */ -import test, { getTimeZoneName, getTimeZoneOffset } from './utils.js'; -import { format as numfmt, isDateFormat, isPercentFormat, isTextFormat } from '../lib/index.js'; - -test('near zero negatives:', t => { - t.format('-0', -1, '--1'); - t.format('-general', -1, '--1'); - t.throws(() => numfmt('0.0 general'), '0.0 general'); - t.format('0.0', -1, '-1.0'); - t.format('0.0', -0.1, '-0.1'); - t.format('-0.0', -0.01, '-0.0'); - t.format('0.0', -0.01, '0.0'); - t.format(' - 0.0', -0.01, ' - 0.0'); - t.format(' - 0.0', -1, '- - 1.0'); - t.format('0.0;-0.0', -0.01, '-0.0'); - t.format('# ?/?', -0.01, '-0 '); - t.format('\\p\\o\\s 0.0;\\n\\e\\g 0.0;', -0.01, 'neg 0.0'); - t.end(); -}); - -test('scaling should not mess number up:', t => { - t.format('0.0%', 0.0295, '3.0%'); - t.format('0.0,', 2950, '3.0'); - t.format('0%', 0, '0%'); - t.end(); -}); - -test('Misc input:', t => { - t.format('0', undefined, ''); - t.format('0', null, ''); - t.format('0', NaN, 'NaN'); - t.format('0', Infinity, '∞'); - t.format('0', -Infinity, '-∞'); - t.format('0', true, 'TRUE'); - t.format('0', false, 'FALSE'); - t.end(); -}); - -test('isDate:', t => { - t.equal(isDateFormat('y'), true, 'isDate(y)'); - t.equal(isDateFormat('#;y'), true, 'isDate(#;y)'); - t.equal(isDateFormat('"y"'), false, 'isDate("y")'); - t.equal(isDateFormat('#;"y"'), false, 'isDate(#;"y")'); - t.equal(isDateFormat('\\y'), false, 'isDate(\\y)'); - t.equal(isDateFormat('#;\\y'), false, 'isDate(#;\\y)'); - t.equal(isDateFormat('#'), false, 'isDate(#)'); - t.equal(isDateFormat('@'), false, 'isDate(@)'); - t.equal(isDateFormat(''), false, 'isDate()'); - t.end(); -}); - -test('isPercent:', t => { - t.equal(isPercentFormat('0%'), true, 'isPercent(0%)'); - t.equal(isPercentFormat('#%'), true, 'isPercent(#%)'); - t.equal(isPercentFormat('#;#%'), true, 'isPercent(#;#%)'); - t.equal(isPercentFormat('%'), true, 'isPercent(%)'); - t.equal(isPercentFormat('#"%"'), false, 'isPercent(#"%")'); - t.equal(isPercentFormat('#\\%'), false, 'isPercent(#\\%)'); - t.equal(isPercentFormat('@'), false, 'isPercent(@)'); - t.equal(isPercentFormat(''), false, 'isPercent()'); - t.end(); -}); - -test('isText:', t => { - t.equal(isTextFormat('0%'), false, 'isText(0%)'); - t.equal(isTextFormat('#%'), false, 'isText(#%)'); - t.equal(isTextFormat('#;#%'), false, 'isText(#;#%)'); - t.equal(isTextFormat('%'), false, 'isText(%)'); - t.equal(isTextFormat('#"%"'), false, 'isText(#"%")'); - t.equal(isTextFormat('#\\%'), false, 'isText(#\\%)'); - t.equal(isTextFormat(''), false, 'isText()'); - t.equal(isTextFormat('@'), true, 'isText(@)'); - t.equal(isTextFormat('[blue]@'), true, 'isText([blue]@)'); - t.equal(isTextFormat('#;@'), false, 'isText(#;@)'); - t.equal(isTextFormat('#;#;@'), false, 'isText(#;#;@)'); - t.equal(isTextFormat('#;#;#;@'), false, 'isText(#;#;#;@)'); - t.end(); -}); - -test('Date object as a value:', t => { - process.env.TZ = 'Etc/UTC'; - t.equal(getTimeZoneName(), 'Coordinated Universal Time'); - - t.format('0.######', new Date(1900, 1 - 1, 0), '0.'); - t.format('0.######', new Date(1900, 1 - 1, 1), '1.'); - t.format('0.######', new Date(1900, 1 - 1, 2), '2.'); - t.format('0.######', new Date(1900, 1 - 1, 3), '3.'); - t.format('0.######', new Date(1900, 1 - 1, 4), '4.'); - t.format('0.######', new Date(1900, 1 - 1, 5), '5.'); - t.format('0.######', new Date(1900, 1 - 1, 20), '20.'); - t.format('0.######', new Date(1900, 2 - 1, 1), '32.'); - t.equal(numfmt('0.######', new Date(1900, 2 - 1, 28)), '59.', 'new Date(1900, 2 - 1, 28, 0, 0, 0)'); - // 1900-02-29 (serial number 60) is a date that only exists in Excel - t.equal(numfmt('0.######', new Date(1900, 3 - 1, 1)), '61.', 'new Date(1900, 3 - 1, 1, 0, 0, 0)'); - t.equal(numfmt('0.######', new Date(1900, 3 - 1, 2)), '62.', 'new Date(1900, 3 - 1, 2, 0, 0, 0)'); - t.equal(numfmt('0.######', new Date(1900, 3 - 1, 3)), '63.', 'new Date(1900, 3 - 1, 3, 0, 0, 0)'); - t.format('0.######', new Date(2000, 10 - 1, 10), '36809.'); - t.format('0.######', new Date(2100, 10 - 1, 30), '73353.'); - t.format('0.######', new Date(2004, 2 - 1, 29), '38046.'); - t.format('0.######', new Date(2020, 2 - 1, 29), '43890.'); - t.format('0.######', new Date(2000, 5 - 1, 9, 1, 0, 0), '36655.041667'); - t.format('0.######', new Date(1900, 1 - 1, 0, 1, 0, 0), '0.041667'); - t.format('0.######', new Date(1900, 1 - 1, 0, 0, 1, 0), '0.000694'); - t.format('0.######', new Date(1900, 1 - 1, 0, 0, 0, 1), '0.000012'); - t.format('0.######', new Date(1900, 1 - 1, 0, 23, 0, 0), '0.958333'); - t.format('0.######', new Date(1900, 1 - 1, 0, 0, 59, 0), '0.040972'); - t.format('0.######', new Date(1900, 1 - 1, 0, 0, 0, 59), '0.000683'); - t.format('0.######', new Date(1900, 1 - 1, 0, 23, 59, 59), '0.999988'); - t.format('0.######', new Date(1909, 1 - 1, 2, 3, 4, 5), '3290.127836'); - t.format('0.######', new Date(1909, 1 - 1, 2, 3, 4, 5), '3290.127836'); - // these were yielding "Sep 0, 2020" - t.format('MMM D, YYYY', new Date(2020, 8 - 1, 31, 13, 3, 0), 'Aug 31, 2020'); - t.format('MMM D, YYYY', new Date(Date.parse('2020-08-31T02:42:00.1')), 'Aug 31, 2020'); - - // test ignoreTimezone - const testYMD = (y, m, d) => { - const dt = new Date(y, m, d); - const tzSkew = getTimeZoneOffset(dt) / (60 * 24); - const output = numfmt('General', dt, { ignoreTimezone: true }); - const diff = (output.replace(/^\d*(\.\d*)?$/, '0$1')) - tzSkew; - return Math.abs(diff); - }; - - t.ok(testYMD(1900, 0, 0) < 0.00001, '1900 [ignoreTimezone]'); - t.ok(testYMD(1950, 0, 0) < 0.00001, '1950 [ignoreTimezone]'); - t.ok(testYMD(2000, 0, 0) < 0.00001, '2000 [ignoreTimezone]'); - - t.end(); -}); - -test('Significant digits truncation:', t => { - t.format('General', 3300.0000000000005, '3300'); - t.format('General', -33000.000000000001, '-33000'); - t.end(); -}); - -test('Order of operators in fractions doesn\'t matter:', t => { - // 0 after # - t.format('#.##0', -10.29, '-10.290'); - t.format('#.###0', -10.29, '-10.290'); - t.format('#.####0', -10.29, '-10.290'); - t.format('#.###000', -10.29, '-10.29000'); - t.format('#.#0#0#0', -10.29, '-10.2900'); - t.format('#.#00', 1, '1.00'); - t.format('#.####0', 1, '1.0'); - t.format('#.###000', 1, '1.000'); - t.format('#.#0#0#0', 1, '1.000'); - t.format('#.##0', 0.01, '.010'); - t.format('#.###0', 0.01, '.010'); - t.format('#.#00', 0.01, '.010'); - t.format('#.####0', 0.0001, '.00010'); - t.format('#.#00', 0.0001, '.00'); - t.format('#.#0', 0.1, '.10'); - t.format('#.##0', 0.1, '.10'); - t.format('#.###0', 0.1, '.10'); - // 0 after ? - t.format('#.?00', 1, '1. 00'); - t.format('#.?0', 0.0001, '. 0'); - t.format('#.????0', -10.29, '-10.29 0'); - t.format('#.????0', 0.01, '.01 0'); - // split pattern - t.format('#.#x#0', 1, '1.x0'); - t.format('#.#x#0', 0.1, '.1x0'); - t.format('#.??x?0', 0.01, '.01x 0'); - t.end(); -}); - -test('Order of operators in integers doesn\'t matter:', t => { - t.format('0#', 0, '0'); - t.format('0?', 0, '0 '); - t.format('0#0#', 0, '00'); - t.format('0?0?', 0, '0 0 '); - t.end(); -}); - -test('Automatic minus injection for the third condition:', t => { // issue #27 - t.format('[>=100]#,##0;[<=-100]-#,##0;#,##0.00', -3.96, '-3.96'); - t.format('[>=100]#,##0;[<=-100]-#,##0;-#,##0.00', -3.96, '--3.96'); - t.format('[>=100]0;[<=-100]-0;"xx"0', -10, '-xx10'); - t.format('[<=-100]-0;"xx"0', -10, 'xx10'); - t.end(); -}); - -test('Excel ignores extra , in fractions:', t => { // issue #22 - t.format('#.##0,00', 0, '.000'); - t.format('#.##0,0,0', 0, '.000'); - t.end(); -}); - -test.skip('Order of operators in exponential notation does not matter:', t => { - t.format('0?.?0E+1', 0, '00. 0E+1'); - t.format('0?.?0E+0', 0, '00. 0E+0'); - t.end(); -}); - -test.skip('Digits following denominator are padding', t => { - t.format('00 00/0z0', 12345.67, '12345 02/3z0'); - t.format('00 00/0 0', 12345.67, '12345 02/3 0'); - t.format('00 00/? ?', 12345.67, '12345 02/3 '); - t.format('00 00/# #', 12345.67, '12345 02/3 0'); - t.end(); -}); - -test('Integer gets injected if not present:', t => { - t.format('.0', 1234, '1234.0'); - t.format(' .0', 1234, ' 1234.0'); - t.format('x.0', 1234, 'x1234.0'); - t.format(' . 0', 1234, ' 1234. 0'); - t.format('0 0/0', 1234, '1234 0/1'); - t.format('0/0', 1234, '1234/1'); - t.end(); -}); - -test('Padding:', t => { - t.format('0', 1, '1'); - t.format('0?', 1, '01'); - t.format('0??', 1, '0 1'); - t.format('0???', 1, '0 1'); - t.format('0????', 1, '0 1'); - t.format('0', 0, '0'); - t.format('0?', 0, '0 '); - t.format('0??', 0, '0 '); - t.format('0???', 0, '0 '); - t.format('0????', 0, '0 '); - t.format('0', 1, '1'); - t.format('0#', 1, '01'); - t.format('0##', 1, '01'); - t.format('0###', 1, '01'); - t.format('0####', 1, '01'); - t.format('0', 0, '0'); - t.format('0#', 0, '0'); - t.format('0##', 0, '0'); - t.format('0###', 0, '0'); - t.format('0####', 0, '0'); - - t.format('0,', 1, '0'); - t.format('0,?', 1, '01'); - t.format('0,??', 1, '0 1'); - t.format('0,???', 1, '0, 1'); - t.format('0,????', 1, '0 1'); - t.format('0,', 0, '0'); - t.format('0,?', 0, '0 '); - t.format('0,??', 0, '0 '); - t.format('0,???', 0, '0, '); - t.format('0,????', 0, '0 '); - - t.format('.0', 1, '1.0'); - t.format('.?0', 1, '1. 0'); - t.format('.??0', 1, '1. 0'); - t.format('.???0', 1, '1. 0'); - t.format('.????0', 1, '1. 0'); - t.format('.0', 0, '.0'); - t.format('.?0', 0, '. 0'); - t.format('.??0', 0, '. 0'); - t.format('.???0', 0, '. 0'); - t.format('.????0', 0, '. 0'); - t.format('.0', 1, '1.0'); - t.format('.#0', 1, '1.0'); - t.format('.##0', 1, '1.0'); - t.format('.###0', 1, '1.0'); - t.format('.####0', 1, '1.0'); - t.format('.0', 0, '.0'); - t.format('.#0', 0, '.0'); - t.format('.##0', 0, '.0'); - t.format('.###0', 0, '.0'); - t.format('.####0', 0, '.0'); - t.end(); -}); - -test('Tokenizer is not case sensitive:', t => { - t.format('mmmm', 1234, 'May'); - t.format('MMMM', 1234, 'May'); - t.format('Mmmm', 1234, 'May'); - t.format('MmMm', 1234, 'May'); - t.format('dddd', 1234, 'Monday'); - t.format('DDDD', 1234, 'Monday'); - t.format('Dddd', 1234, 'Monday'); - t.format('dDdD', 1234, 'Monday'); - t.end(); -}); - -test('Comma resolution test:', t => { - t.format('#,,"M"', 6000000, '6M'); - t.format('#,,"M";', 6000000, '6M'); - t.format('#,,"M";#,,"M";0', 6000000, '6M'); - t.end(); -}); - -test('Issue #64 (very small number):', t => { - t.format('0.000E+000', 2.33e-32, '2.330E-032'); - t.format('0.000E+000', 2.33e-321, '2.330E-321'); - t.format('0.000E+000', 2.33e+307, '2.330E+307'); - t.format('0.000E+000', 2.33e+309, '∞'); - - t.format('General', 2.33e-321, '2.33E-321'); - t.format('0.0', 2.33e-321, '0.0'); - t.end(); -}); diff --git a/test/numfmt.spec.ts b/test/numfmt.spec.ts new file mode 100644 index 0000000..b7bcce2 --- /dev/null +++ b/test/numfmt.spec.ts @@ -0,0 +1,280 @@ +/* globals process */ +/* eslint-disable no-loss-of-precision */ +import { expect, test } from 'vitest'; +import { getTimeZoneName, getTimeZoneOffset } from './utils.ts'; +import { format as numfmt, isDateFormat, isPercentFormat, isTextFormat } from '../lib/index.js'; + +test('near zero negatives:', () => { + expect(numfmt('-0', -1)).toBe('--1'); + expect(numfmt('-general', -1)).toBe('--1'); + expect(() => numfmt('0.0 general'), '0.0 general').toThrow(); + expect(numfmt('0.0', -1)).toBe('-1.0'); + expect(numfmt('0.0', -0.1)).toBe('-0.1'); + expect(numfmt('-0.0', -0.01)).toBe('-0.0'); + expect(numfmt('0.0', -0.01)).toBe('0.0'); + expect(numfmt(' - 0.0', -0.01)).toBe(' - 0.0'); + expect(numfmt(' - 0.0', -1)).toBe('- - 1.0'); + expect(numfmt('0.0;-0.0', -0.01)).toBe('-0.0'); + expect(numfmt('# ?/?', -0.01)).toBe('-0 '); + expect(numfmt('\\p\\o\\s 0.0;\\n\\e\\g 0.0;', -0.01)).toBe('neg 0.0'); +}); + +test('scaling should not mess number up:', () => { + expect(numfmt('0.0%', 0.0295)).toBe('3.0%'); + expect(numfmt('0.0,', 2950)).toBe('3.0'); + expect(numfmt('0%', 0)).toBe('0%'); +}); + +test('Misc input:', () => { + expect(numfmt('0', undefined)).toBe(''); + expect(numfmt('0', null)).toBe(''); + expect(numfmt('0', NaN)).toBe('NaN'); + expect(numfmt('0', Infinity)).toBe('∞'); + expect(numfmt('0', -Infinity)).toBe('-∞'); + expect(numfmt('0', true)).toBe('TRUE'); + expect(numfmt('0', false)).toBe('FALSE'); +}); + +test('isDate:', () => { + expect(isDateFormat('y'), 'isDate(y)').toBe(true); + expect(isDateFormat('#;y'), 'isDate(#;y)').toBe(true); + expect(isDateFormat('"y"'), 'isDate("y")').toBe(false); + expect(isDateFormat('#;"y"'), 'isDate(#;"y")').toBe(false); + expect(isDateFormat('\\y'), 'isDate(\\y)').toBe(false); + expect(isDateFormat('#;\\y'), 'isDate(#;\\y)').toBe(false); + expect(isDateFormat('#'), 'isDate(#)').toBe(false); + expect(isDateFormat('@'), 'isDate(@)').toBe(false); + expect(isDateFormat(''), 'isDate()').toBe(false); +}); + +test('isPercent:', () => { + expect(isPercentFormat('0%'), 'isPercent(0%)').toBe(true); + expect(isPercentFormat('#%'), 'isPercent(#%)').toBe(true); + expect(isPercentFormat('#;#%'), 'isPercent(#;#%)').toBe(true); + expect(isPercentFormat('%'), 'isPercent(%)').toBe(true); + expect(isPercentFormat('#"%"'), 'isPercent(#"%")').toBe(false); + expect(isPercentFormat('#\\%'), 'isPercent(#\\%)').toBe(false); + expect(isPercentFormat('@'), 'isPercent(@)').toBe(false); + expect(isPercentFormat(''), 'isPercent()').toBe(false); +}); + +test('isText:', () => { + expect(isTextFormat('0%'), 'isText(0%)').toBe(false); + expect(isTextFormat('#%'), 'isText(#%)').toBe(false); + expect(isTextFormat('#;#%'), 'isText(#;#%)').toBe(false); + expect(isTextFormat('%'), 'isText(%)').toBe(false); + expect(isTextFormat('#"%"'), 'isText(#"%")').toBe(false); + expect(isTextFormat('#\\%'), 'isText(#\\%)').toBe(false); + expect(isTextFormat(''), 'isText()').toBe(false); + expect(isTextFormat('@'), 'isText(@)').toBe(true); + expect(isTextFormat('[blue]@'), 'isText([blue]@)').toBe(true); + expect(isTextFormat('#;@'), 'isText(#;@)').toBe(false); + expect(isTextFormat('#;#;@'), 'isText(#;#;@)').toBe(false); + expect(isTextFormat('#;#;#;@'), 'isText(#;#;#;@)').toBe(false); +}); + +test('Date object as a value:', () => { + process.env.TZ = 'Etc/UTC'; + expect(getTimeZoneName()).toBe('Coordinated Universal Time'); + + expect(numfmt('0.######', new Date(1900, 1 - 1, 0))).toBe('0.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 1))).toBe('1.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 2))).toBe('2.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 3))).toBe('3.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 4))).toBe('4.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 5))).toBe('5.'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 20))).toBe('20.'); + expect(numfmt('0.######', new Date(1900, 2 - 1, 1))).toBe('32.'); + expect(numfmt('0.######', new Date(1900, 2 - 1, 28)), 'new Date(1900, 2 - 1, 28, 0, 0, 0)').toBe('59.'); + // 1900-02-29 (serial number 60) is a date that only exists in Excel + expect(numfmt('0.######', new Date(1900, 3 - 1, 1)), 'new Date(1900, 3 - 1, 1, 0, 0, 0)').toBe('61.'); + expect(numfmt('0.######', new Date(1900, 3 - 1, 2)), 'new Date(1900, 3 - 1, 2, 0, 0, 0)').toBe('62.'); + expect(numfmt('0.######', new Date(1900, 3 - 1, 3)), 'new Date(1900, 3 - 1, 3, 0, 0, 0)').toBe('63.'); + expect(numfmt('0.######', new Date(2000, 10 - 1, 10))).toBe('36809.'); + expect(numfmt('0.######', new Date(2100, 10 - 1, 30))).toBe('73353.'); + expect(numfmt('0.######', new Date(2004, 2 - 1, 29))).toBe('38046.'); + expect(numfmt('0.######', new Date(2020, 2 - 1, 29))).toBe('43890.'); + expect(numfmt('0.######', new Date(2000, 5 - 1, 9, 1, 0, 0))).toBe('36655.041667'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 1, 0, 0))).toBe('0.041667'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 0, 1, 0))).toBe('0.000694'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 0, 0, 1))).toBe('0.000012'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 23, 0, 0))).toBe('0.958333'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 0, 59, 0))).toBe('0.040972'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 0, 0, 59))).toBe('0.000683'); + expect(numfmt('0.######', new Date(1900, 1 - 1, 0, 23, 59, 59))).toBe('0.999988'); + expect(numfmt('0.######', new Date(1909, 1 - 1, 2, 3, 4, 5))).toBe('3290.127836'); + expect(numfmt('0.######', new Date(1909, 1 - 1, 2, 3, 4, 5))).toBe('3290.127836'); + // these were yielding "Sep 0, 2020" + expect(numfmt('MMM D, YYYY', new Date(2020, 8 - 1, 31, 13, 3, 0))).toBe('Aug 31, 2020'); + expect(numfmt('MMM D, YYYY', new Date(Date.parse('2020-08-31T02:42:00.1')))).toBe('Aug 31, 2020'); + + // test ignoreTimezone + const testYMD = (y: number, m: number, d: number) => { + const dt = new Date(y, m, d); + const tzSkew = getTimeZoneOffset(dt) / (60 * 24); + const output = numfmt('General', dt, { ignoreTimezone: true }); + const diff = Number(output.replace(/^\d*(\.\d*)?$/, '0$1')) - tzSkew; + return Math.abs(diff); + }; + + expect(testYMD(1900, 0, 0) < 0.00001, '1900 [ignoreTimezone]').toBeTruthy(); + expect(testYMD(1950, 0, 0) < 0.00001, '1950 [ignoreTimezone]').toBeTruthy(); + expect(testYMD(2000, 0, 0) < 0.00001, '2000 [ignoreTimezone]').toBeTruthy(); +}); + +test('Significant digits truncation:', () => { + expect(numfmt('General', 3300.0000000000005)).toBe('3300'); + expect(numfmt('General', -33000.000000000001)).toBe('-33000'); +}); + +test('Order of operators in fractions doesn\'t matter:', () => { + // 0 after # + expect(numfmt('#.##0', -10.29)).toBe('-10.290'); + expect(numfmt('#.###0', -10.29)).toBe('-10.290'); + expect(numfmt('#.####0', -10.29)).toBe('-10.290'); + expect(numfmt('#.###000', -10.29)).toBe('-10.29000'); + expect(numfmt('#.#0#0#0', -10.29)).toBe('-10.2900'); + expect(numfmt('#.#00', 1)).toBe('1.00'); + expect(numfmt('#.####0', 1)).toBe('1.0'); + expect(numfmt('#.###000', 1)).toBe('1.000'); + expect(numfmt('#.#0#0#0', 1)).toBe('1.000'); + expect(numfmt('#.##0', 0.01)).toBe('.010'); + expect(numfmt('#.###0', 0.01)).toBe('.010'); + expect(numfmt('#.#00', 0.01)).toBe('.010'); + expect(numfmt('#.####0', 0.0001)).toBe('.00010'); + expect(numfmt('#.#00', 0.0001)).toBe('.00'); + expect(numfmt('#.#0', 0.1)).toBe('.10'); + expect(numfmt('#.##0', 0.1)).toBe('.10'); + expect(numfmt('#.###0', 0.1)).toBe('.10'); + // 0 after ? + expect(numfmt('#.?00', 1)).toBe('1. 00'); + expect(numfmt('#.?0', 0.0001)).toBe('. 0'); + expect(numfmt('#.????0', -10.29)).toBe('-10.29 0'); + expect(numfmt('#.????0', 0.01)).toBe('.01 0'); + // split pattern + expect(numfmt('#.#x#0', 1)).toBe('1.x0'); + expect(numfmt('#.#x#0', 0.1)).toBe('.1x0'); + expect(numfmt('#.??x?0', 0.01)).toBe('.01x 0'); +}); + +test('Order of operators in integers doesn\'t matter:', () => { + expect(numfmt('0#', 0)).toBe('0'); + expect(numfmt('0?', 0)).toBe('0 '); + expect(numfmt('0#0#', 0)).toBe('00'); + expect(numfmt('0?0?', 0)).toBe('0 0 '); +}); + +test('Automatic minus injection for the third condition:', () => { // issue #27 + expect(numfmt('[>=100]#,##0;[<=-100]-#,##0;#,##0.00', -3.96)).toBe('-3.96'); + expect(numfmt('[>=100]#,##0;[<=-100]-#,##0;-#,##0.00', -3.96)).toBe('--3.96'); + expect(numfmt('[>=100]0;[<=-100]-0;"xx"0', -10)).toBe('-xx10'); + expect(numfmt('[<=-100]-0;"xx"0', -10)).toBe('xx10'); +}); + +test('Excel ignores extra , in fractions:', () => { // issue #22 + expect(numfmt('#.##0,00', 0)).toBe('.000'); + expect(numfmt('#.##0,0,0', 0)).toBe('.000'); +}); + +test.skip('Order of operators in exponential notation does not matter:', () => { + expect(numfmt('0?.?0E+1', 0)).toBe('00. 0E+1'); + expect(numfmt('0?.?0E+0', 0)).toBe('00. 0E+0'); +}); + +test.skip('Digits following denominator are padding', () => { + expect(numfmt('00 00/0z0', 12345.67)).toBe('12345 02/3z0'); + expect(numfmt('00 00/0 0', 12345.67)).toBe('12345 02/3 0'); + expect(numfmt('00 00/? ?', 12345.67)).toBe('12345 02/3 '); + expect(numfmt('00 00/# #', 12345.67)).toBe('12345 02/3 0'); +}); + +test('Integer gets injected if not present:', () => { + expect(numfmt('.0', 1234)).toBe('1234.0'); + expect(numfmt(' .0', 1234)).toBe(' 1234.0'); + expect(numfmt('x.0', 1234)).toBe('x1234.0'); + expect(numfmt(' . 0', 1234)).toBe(' 1234. 0'); + expect(numfmt('0 0/0', 1234)).toBe('1234 0/1'); + expect(numfmt('0/0', 1234)).toBe('1234/1'); +}); + +test('Padding:', () => { + expect(numfmt('0', 1)).toBe('1'); + expect(numfmt('0?', 1)).toBe('01'); + expect(numfmt('0??', 1)).toBe('0 1'); + expect(numfmt('0???', 1)).toBe('0 1'); + expect(numfmt('0????', 1)).toBe('0 1'); + expect(numfmt('0', 0)).toBe('0'); + expect(numfmt('0?', 0)).toBe('0 '); + expect(numfmt('0??', 0)).toBe('0 '); + expect(numfmt('0???', 0)).toBe('0 '); + expect(numfmt('0????', 0)).toBe('0 '); + expect(numfmt('0', 1)).toBe('1'); + expect(numfmt('0#', 1)).toBe('01'); + expect(numfmt('0##', 1)).toBe('01'); + expect(numfmt('0###', 1)).toBe('01'); + expect(numfmt('0####', 1)).toBe('01'); + expect(numfmt('0', 0)).toBe('0'); + expect(numfmt('0#', 0)).toBe('0'); + expect(numfmt('0##', 0)).toBe('0'); + expect(numfmt('0###', 0)).toBe('0'); + expect(numfmt('0####', 0)).toBe('0'); + + expect(numfmt('0,', 1)).toBe('0'); + expect(numfmt('0,?', 1)).toBe('01'); + expect(numfmt('0,??', 1)).toBe('0 1'); + expect(numfmt('0,???', 1)).toBe('0, 1'); + expect(numfmt('0,????', 1)).toBe('0 1'); + expect(numfmt('0,', 0)).toBe('0'); + expect(numfmt('0,?', 0)).toBe('0 '); + expect(numfmt('0,??', 0)).toBe('0 '); + expect(numfmt('0,???', 0)).toBe('0, '); + expect(numfmt('0,????', 0)).toBe('0 '); + + expect(numfmt('.0', 1)).toBe('1.0'); + expect(numfmt('.?0', 1)).toBe('1. 0'); + expect(numfmt('.??0', 1)).toBe('1. 0'); + expect(numfmt('.???0', 1)).toBe('1. 0'); + expect(numfmt('.????0', 1)).toBe('1. 0'); + expect(numfmt('.0', 0)).toBe('.0'); + expect(numfmt('.?0', 0)).toBe('. 0'); + expect(numfmt('.??0', 0)).toBe('. 0'); + expect(numfmt('.???0', 0)).toBe('. 0'); + expect(numfmt('.????0', 0)).toBe('. 0'); + expect(numfmt('.0', 1)).toBe('1.0'); + expect(numfmt('.#0', 1)).toBe('1.0'); + expect(numfmt('.##0', 1)).toBe('1.0'); + expect(numfmt('.###0', 1)).toBe('1.0'); + expect(numfmt('.####0', 1)).toBe('1.0'); + expect(numfmt('.0', 0)).toBe('.0'); + expect(numfmt('.#0', 0)).toBe('.0'); + expect(numfmt('.##0', 0)).toBe('.0'); + expect(numfmt('.###0', 0)).toBe('.0'); + expect(numfmt('.####0', 0)).toBe('.0'); +}); + +test('Tokenizer is not case sensitive:', () => { + expect(numfmt('mmmm', 1234)).toBe('May'); + expect(numfmt('MMMM', 1234)).toBe('May'); + expect(numfmt('Mmmm', 1234)).toBe('May'); + expect(numfmt('MmMm', 1234)).toBe('May'); + expect(numfmt('dddd', 1234)).toBe('Monday'); + expect(numfmt('DDDD', 1234)).toBe('Monday'); + expect(numfmt('Dddd', 1234)).toBe('Monday'); + expect(numfmt('dDdD', 1234)).toBe('Monday'); +}); + +test('Comma resolution test:', () => { + expect(numfmt('#,,"M"', 6000000)).toBe('6M'); + expect(numfmt('#,,"M";', 6000000)).toBe('6M'); + expect(numfmt('#,,"M";#,,"M";0', 6000000)).toBe('6M'); +}); + +test('Issue #64 (very small number):', () => { + expect(numfmt('0.000E+000', 2.33e-32)).toBe('2.330E-032'); + expect(numfmt('0.000E+000', 2.33e-321)).toBe('2.330E-321'); + expect(numfmt('0.000E+000', 2.33e+307)).toBe('2.330E+307'); + expect(numfmt('0.000E+000', 2.33e+309)).toBe('∞'); + + expect(numfmt('General', 2.33e-321)).toBe('2.33E-321'); + expect(numfmt('0.0', 2.33e-321)).toBe('0.0'); +}); diff --git a/test/options-test.js b/test/options-test.js deleted file mode 100644 index e48e9b0..0000000 --- a/test/options-test.js +++ /dev/null @@ -1,103 +0,0 @@ -/* global process */ -import test, { getTimeZoneName } from './utils.js'; -import { format } from '../lib/index.js'; - -const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; - -test('option: overflow', t => { - t.format('yyyy', -1, '######', { ...excelOpts }); - t.format('yyyy', -1, '🦆', { ...excelOpts, overflow: '🦆' }); - t.format('yyyy', -1, '👻', { ...excelOpts, overflow: '👻' }); - t.end(); -}); - -test('option: locale', t => { - t.format('mmmm', 2000, 'June'); - t.format('mmmm', 2000, '六月', { locale: 'zh_CN' }); - t.format('mmmm', 2000, 'kesäkuuta', { locale: 'fi' }); - t.end(); -}); - -test('option: throws', t => { - t.throws(() => format('h #', 0), '{}'); - t.equal(format('h #', 0, { throws: false }), '######', '{ throws: false }'); - t.throws(() => format('h #', 0, { throws: true }), '{ throws: true }'); - t.end(); -}); - -test('option: invalid', t => { - t.format('h #', 0, '######', { throws: false }); - t.format('h #', 0, '🦂', { invalid: '🦂', throws: false }); - t.format('h #', 0, '#VALUE!', { invalid: '#VALUE!', throws: false }); - t.format('h #', 0, 'true', { invalid: true, throws: false }); - t.end(); -}); - -test('option: leap1900', t => { - t.format('yyyy-mm-dd', 60, '1900-02-29', {}); - t.format('yyyy-mm-dd', 60, '1900-02-29', { leap1900: true }); - t.format('yyyy-mm-dd', 60, '1900-02-28', { leap1900: false }); - t.end(); -}); - -test('option: dateErrorThrows', t => { - t.format('yyyy', -694325, '-694325', {}); - t.format('yyyy', -1, '-1', { dateSpanLarge: false }); - t.formatThrows('yyyy', -1, '-1', { dateSpanLarge: false, dateErrorThrows: true }); - t.formatThrows('yyyy', -694325, '-694325', { dateErrorThrows: true }); - t.end(); -}); - -test('option: dateErrorNumber', t => { - t.format('yyyy', -1, '-1', { dateSpanLarge: false }); - t.format('yyyy', -1, '-1', { dateSpanLarge: false, dateErrorNumber: true }); - t.format('yyyy', -1, '######', { dateSpanLarge: false, dateErrorNumber: false }); - t.end(); -}); - -test('option: nbsp', t => { - const spaceFmt = '???0" ". 0??'; - t.format(spaceFmt, 1, ' 1 . 0 '); - t.format(spaceFmt, 1, '   1 . 0  ', { nbsp: true }); - t.format(spaceFmt, 1, ' 1 . 0 ', { nbsp: false }); - t.format('0 "foo bar" .0', 1.1, '1 foo bar .1'); - t.format('0 "foo bar" .0', 1.1, '1 foo bar .1', { nbsp: false }); - t.format('0 "foo bar" .0', 1.1, '1 foo bar .1', { nbsp: true }); - t.end(); -}); - -test('option: grouping', t => { - t.format('0', 1234567890, '1234567890', { grouping: [ 2, 2 ] }); - t.format('#,##0', 1234567890, '1,234,567,890', { grouping: [ 3, 3 ] }); - t.format('#,##0', 1234567890, '1,234,567,890', { grouping: [ 3 ] }); - t.format('#,##0', 1234567890, '1,23,45,67,890', { grouping: [ 3, 2 ] }); - t.format('#,##0', 1234567890, '12,34,56,78,90', { grouping: [ 2, 2 ] }); - t.format('#,##0', 1234567890, '12,34,56,78,90', { grouping: [ 2 ] }); - t.format('#,##0', 1234567890, '12,345,678,90', { grouping: [ 2, 3 ] }); - t.end(); -}); - -test('option: grouping', t => { - t.format('_($* #,##0.00_)', 12345.67, ' $12,345.67 '); - t.format('_($* #,##0.00_)', 12345.67, '\x03($12,345.67\x03)', { skipChar: '\x03' }); - t.format('_($* #,##0.00_)', 12345.67, 'ÆÐ($12,345.67ÆÐ)', { skipChar: 'ÆÐ' }); - t.format('_($* #,##0.00_)', 12345.67, ' $\x04 12,345.67 ', { fillChar: '\x04' }); - t.format('_($* #,##0.00_)', 12345.67, ' $ÞÖ 12,345.67 ', { fillChar: 'ÞÖ' }); - t.format('_($* #,##0.00_)', 12345.67, '\x03($\x04 12,345.67\x03)', { skipChar: '\x03', fillChar: '\x04' }); - t.end(); -}); - -// this test is flaky at best in node versions < 14 so only run it in 14+ -if (parseInt(process.version.replace(/^v/, ''), 10) >= 14) { - test('option: ignoreTimezone', t => { - process.env.TZ = 'Asia/Calcutta'; - t.equal(getTimeZoneName(), 'India Standard Time', 'Timezone is IST'); - const baseDate = new Date(2000, 0, 1); - t.equal(baseDate.toUTCString(), 'Fri, 31 Dec 1999 18:30:00 GMT', 'Date has a timezone'); - const gmtStr = 'ddd, dd mmm yyyy hh:mm:ss "GMT"'; - t.format(gmtStr, baseDate, 'Sat, 01 Jan 2000 00:00:00 GMT', { nbsp: 0 }); - t.format(gmtStr, baseDate, 'Fri, 31 Dec 1999 18:30:00 GMT', { nbsp: 0, ignoreTimezone: true }); - t.format(gmtStr, baseDate, 'Sat, 01 Jan 2000 00:00:00 GMT', { nbsp: 0, ignoreTimezone: false }); - t.end(); - }); -} diff --git a/test/options.spec.ts b/test/options.spec.ts new file mode 100644 index 0000000..fa66eef --- /dev/null +++ b/test/options.spec.ts @@ -0,0 +1,94 @@ +/* global process */ +import { expect, test } from 'vitest'; +import { getTimeZoneName } from './utils.ts'; +import { format } from '../lib/index.js'; + +const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; + +test('option: overflow', () => { + expect(format('yyyy', -1, { ...excelOpts })).toBe('######'); + expect(format('yyyy', -1, { ...excelOpts, overflow: '🦆' })).toBe('🦆'); + expect(format('yyyy', -1, { ...excelOpts, overflow: '👻' })).toBe('👻'); +}); + +test('option: locale', () => { + expect(format('mmmm', 2000)).toBe('June'); + expect(format('mmmm', 2000, { locale: 'zh_CN' })).toBe('六月'); + expect(format('mmmm', 2000, { locale: 'fi' })).toBe('kesäkuuta'); +}); + +test('option: throws', () => { + expect(() => format('h #', 0), '{}').toThrow(); + expect(format('h #', 0, { throws: false }), '{ throws: false }').toBe('######'); + expect(() => format('h #', 0, { throws: true }), '{ throws: true }').toThrow(); +}); + +test('option: invalid', () => { + expect(format('h #', 0, { throws: false })).toBe('######'); + expect(format('h #', 0, { invalid: '🦂', throws: false })).toBe('🦂'); + expect(format('h #', 0, { invalid: '#VALUE!', throws: false })).toBe('#VALUE!'); + expect(format('h #', 0, { invalid: true, throws: false })).toBe('true'); +}); + +test('option: leap1900', () => { + expect(format('yyyy-mm-dd', 60, {})).toBe('1900-02-29'); + expect(format('yyyy-mm-dd', 60, { leap1900: true })).toBe('1900-02-29'); + expect(format('yyyy-mm-dd', 60, { leap1900: false })).toBe('1900-02-28'); +}); + +test('option: dateErrorThrows', () => { + expect(format('yyyy', -694325, {})).toBe('-694325'); + expect(format('yyyy', -1, { dateSpanLarge: false })).toBe('-1'); + expect(() => format('yyyy', -1, { dateSpanLarge: false, dateErrorThrows: true })).toThrow(); + expect(() => format('yyyy', -694325, { dateErrorThrows: true })).toThrow(); +}); + +test('option: dateErrorNumber', () => { + expect(format('yyyy', -1, { dateSpanLarge: false })).toBe('-1'); + expect(format('yyyy', -1, { dateSpanLarge: false, dateErrorNumber: true })).toBe('-1'); + expect(format('yyyy', -1, { dateSpanLarge: false, dateErrorNumber: false })).toBe('######'); +}); + +test('option: nbsp', () => { + const spaceFmt = '???0" ". 0??'; + expect(format(spaceFmt, 1)).toBe(' 1 . 0 '); + expect(format(spaceFmt, 1, { nbsp: true })).toBe('   1 . 0  '); + expect(format(spaceFmt, 1, { nbsp: false })).toBe(' 1 . 0 '); + expect(format('0 "foo bar" .0', 1.1)).toBe('1 foo bar .1'); + expect(format('0 "foo bar" .0', 1.1, { nbsp: false })).toBe('1 foo bar .1'); + expect(format('0 "foo bar" .0', 1.1, { nbsp: true })).toBe('1 foo bar .1'); +}); + +test('option: grouping', () => { + expect(format('0', 1234567890, { grouping: [ 2, 2 ] })).toBe('1234567890'); + expect(format('#,##0', 1234567890, { grouping: [ 3, 3 ] })).toBe('1,234,567,890'); + expect(format('#,##0', 1234567890, { grouping: [ 3 ] })).toBe('1,234,567,890'); + expect(format('#,##0', 1234567890, { grouping: [ 3, 2 ] })).toBe('1,23,45,67,890'); + expect(format('#,##0', 1234567890, { grouping: [ 2, 2 ] })).toBe('12,34,56,78,90'); + expect(format('#,##0', 1234567890, { grouping: [ 2 ] })).toBe('12,34,56,78,90'); + expect(format('#,##0', 1234567890, { grouping: [ 2, 3 ] })).toBe('12,345,678,90'); +}); + +test('option: grouping', () => { + expect(format('_($* #,##0.00_)', 12345.67)).toBe(' $12,345.67 '); + expect(format('_($* #,##0.00_)', 12345.67, { skipChar: '\x03' })).toBe('\x03($12,345.67\x03)'); + expect(format('_($* #,##0.00_)', 12345.67, { skipChar: 'ÆÐ' })).toBe('ÆÐ($12,345.67ÆÐ)'); + expect(format('_($* #,##0.00_)', 12345.67, { fillChar: '\x04' })).toBe(' $\x04 12,345.67 '); + expect(format('_($* #,##0.00_)', 12345.67, { fillChar: 'ÞÖ' })).toBe(' $ÞÖ 12,345.67 '); + expect(format('_($* #,##0.00_)', 12345.67, { skipChar: '\x03', fillChar: '\x04' })) + .toBe('\x03($\x04 12,345.67\x03)'); +}); + +// this test is flaky at best in node versions < 14 so only run it in 14+ +if (parseInt(process.version.replace(/^v/, ''), 10) >= 14) { + test('option: ignoreTimezone', () => { + process.env.TZ = 'Asia/Calcutta'; + expect(getTimeZoneName(), 'Timezone is IST').toBe('India Standard Time'); + const baseDate = new Date(2000, 0, 1); + expect(baseDate.toUTCString(), 'Date has a timezone').toBe('Fri, 31 Dec 1999 18:30:00 GMT'); + const gmtStr = 'ddd, dd mmm yyyy hh:mm:ss "GMT"'; + expect(format(gmtStr, baseDate, { nbsp: 0 })).toBe('Sat, 01 Jan 2000 00:00:00 GMT'); + expect(format(gmtStr, baseDate, { nbsp: 0, ignoreTimezone: true })).toBe('Fri, 31 Dec 1999 18:30:00 GMT'); + expect(format(gmtStr, baseDate, { nbsp: 0, ignoreTimezone: false })).toBe('Sat, 01 Jan 2000 00:00:00 GMT'); + }); +} diff --git a/test/parseValue-test.js b/test/parseValue.spec.ts similarity index 80% rename from test/parseValue-test.js rename to test/parseValue.spec.ts index 9b7bb85..09b8ea7 100644 --- a/test/parseValue-test.js +++ b/test/parseValue.spec.ts @@ -1,16 +1,12 @@ -/* globals process */ -import tape, { getTimeZoneName, isLeapYear } from './utils.js'; +import { expect, test } from 'vitest'; +import { getTimeZoneName, isLeapYear } from './utils.ts'; import { addLocale, dateToSerial, format, parseBool, parseDate, parseNumber, parseTime, parseValue } from '../lib/index.js'; import { getLocale, listLocales } from '../lib/locale.js'; const currentYear = dateToSerial([ new Date().getUTCFullYear(), 1, 1 ]) || 0; const leapDay = isLeapYear(new Date().getUTCFullYear()) ? 1 : 0; -/** - * @type {[ string, number | boolean | null, string | null ][]} - * @ignore - */ -const tests = [ +const tests: [ string, number | boolean | null, string | null ][] = [ // general [ '1234', 1234, null ], [ '12.34', 12.34, null ], @@ -546,85 +542,73 @@ const tests = [ [ ' FALSE ', false, null ] ]; -tape('parseNumber', t => { +test('parseNumber', () => { process.env.TZ = 'Asia/Calcutta'; - t.equal(getTimeZoneName(), 'India Standard Time', 'Timezone is IST'); + expect(getTimeZoneName(), 'Timezone is IST').toBe('India Standard Time'); - t.deepLooseEqual( + expect( parseNumber('-123'), - { v: -123 }, 'parseNumber parses numbers' - ); - t.deepLooseEqual( + ).toEqual({ v: -123 }); + expect( parseNumber('1999.10.01'), - null, 'parseNumber does not parse invalid numbers' - ); - t.deepLooseEqual( + ).toEqual(null); + expect( parseNumber('1999-10-01'), - null, 'parseNumber does not parse non-numbers' - ); + ).toEqual(null); - t.deepLooseEqual( + expect( parseDate('1999-10-01 12:00:00'), - { v: 36434.5, z: 'yyyy-mm-dd hh:mm:ss' }, 'parseDate parses dates' - ); - t.deepLooseEqual( + ).toEqual({ v: 36434.5, z: 'yyyy-mm-dd hh:mm:ss' }); + expect( parseDate('-123'), - null, 'parseDate does not parse non-dates' - ); + ).toEqual(null); - t.deepLooseEqual( + expect( parseTime('09:18 PM'), - { v: 0.8875, z: 'hh:mm AM/PM' }, 'parseTime parses time' - ); - t.deepLooseEqual( + ).toEqual({ v: 0.8875, z: 'hh:mm AM/PM' }); + expect( parseTime('-123'), - null, 'parseTime does not parse non-time' - ); + ).toEqual(null); - t.deepLooseEqual( + expect( parseBool('False'), - { v: false }, 'parseBool parses booleans' - ); - t.deepLooseEqual( + ).toEqual({ v: false }); + expect( parseBool('-123'), - null, 'parseBool does not parse non-booleans' - ); + ).toEqual(null); - t.deepLooseEqual( + expect( parseBool('False'), - { v: false }, 'parseBool parses booleans' - ); - t.deepLooseEqual( + ).toEqual({ v: false }); + expect( parseBool('-123'), - null, 'parseBool does not parse non-booleans' - ); + ).toEqual(null); - t.deepLooseEqual( + expect( parseDate('5.2022'), - null, 'parseDate does not parse "decimals"' - ); + ).toEqual(null); // test value parsing tests.forEach(ts => { const [ input, value ] = ts; const p = parseValue(input); if (p == null) { - t.equal(null, value, input); + expect(null, input).toBe(value); } else { - t.equal(p.v, value, `valueOf("${input}")`); + expect(p.v, `valueOf("${input}")`).toBe(value); } }); @@ -633,26 +617,24 @@ tape('parseNumber', t => { const [ input, , expectedZ ] = ts; const p = parseValue(input); if (p == null) { - t.equal(null, expectedZ, input); + expect(null, input).toBe(expectedZ); } else { - t.equal(p.z ?? null, expectedZ, `formatOf("${input}")`); + expect(p.z ?? null, `formatOf("${input}")`).toBe(expectedZ); } }); - - t.end(); }); -tape('parseNumber locale support', t => { +test('parseNumber locale support', () => { // can parse numbers in any language - t.deepEqual(parseNumber('1,234,567.89', { locale: 'en' }), { v: 1234567.89, z: '#,##0.00' }); - t.deepEqual(parseNumber('1.234.567,89', { locale: 'en' }), null); + expect(parseNumber('1,234,567.89', { locale: 'en' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); + expect(parseNumber('1.234.567,89', { locale: 'en' })).toEqual(null); - t.deepEqual(parseNumber('1,234,567.89', { locale: 'de' }), null); - t.deepEqual(parseNumber('1.234.567,89', { locale: 'de' }), { v: 1234567.89, z: '#,##0.00' }); + expect(parseNumber('1,234,567.89', { locale: 'de' })).toEqual(null); + expect(parseNumber('1.234.567,89', { locale: 'de' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); - t.deepEqual(parseNumber('1,234,567.89', { locale: 'de' }), null); - t.deepEqual(parseNumber('1.234.567,89', { locale: 'de' }), { v: 1234567.89, z: '#,##0.00' }); + expect(parseNumber('1,234,567.89', { locale: 'de' })).toEqual(null); + expect(parseNumber('1.234.567,89', { locale: 'de' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); addLocale({ decimal: '·', @@ -662,28 +644,26 @@ tape('parseNumber locale support', t => { percent: '٪', exponent: 'X' }, 'xy'); - // t.format('#,##0.00', 1234567.89, '1~234~567·89', { locale: 'xy' }); - t.deepEqual(parseNumber('1~234~567·89', { locale: 'xy' }), { v: 1234567.89, z: '#,##0.00' }); - t.deepEqual(parseNumber('1\u202f234\u202f567,89', { locale: 'fr' }), { v: 1234567.89, z: '#,##0.00' }); - t.deepEqual(parseNumber('1٬234٬567٫89', { locale: 'ar' }), { v: 1234567.89, z: '#,##0.00' }); - - t.end(); + // expect(format('#,##0.00', 1234567.89, { locale: 'xy' })).toBe('1~234~567·89'); + expect(parseNumber('1~234~567·89', { locale: 'xy' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); + expect(parseNumber('1\u202f234\u202f567,89', { locale: 'fr' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); + expect(parseNumber('1٬234٬567٫89', { locale: 'ar' })).toEqual({ v: 1234567.89, z: '#,##0.00' }); }); -tape('parseDate locale support', t => { +test('parseDate locale support', () => { // can parse dates in any language - t.deepEqual(parseDate('Wednesday, 13. march 1989', { locale: 'en' }), { v: 32580, z: 'dddd, d. mmmm yyyy' }); - t.deepEqual(parseDate('sreda, 13. marec 1989', { locale: 'sl' }), { v: 32580, z: 'dddd, d. mmmm yyyy' }); - t.deepEqual(parseDate('miðvikudagur, 13. mars 1989', { locale: 'is' }), { v: 32580, z: 'dddd, d. mmmm yyyy' }); + expect(parseDate('Wednesday, 13. march 1989', { locale: 'en' })).toEqual({ v: 32580, z: 'dddd, d. mmmm yyyy' }); + expect(parseDate('sreda, 13. marec 1989', { locale: 'sl' })).toEqual({ v: 32580, z: 'dddd, d. mmmm yyyy' }); + expect(parseDate('miðvikudagur, 13. mars 1989', { locale: 'is' })).toEqual({ v: 32580, z: 'dddd, d. mmmm yyyy' }); - t.deepEqual(parseDate('Fri, 23 Dec 1988', { locale: 'en' }), { v: 32500, z: 'ddd, d mmm yyyy' }); - t.deepEqual(parseDate('Fös, 23 DES 1988', { locale: 'is' }), { v: 32500, z: 'ddd, d mmm yyyy' }); - t.deepEqual(parseDate('vin, 23 dec 1988', { locale: 'ro' }), { v: 32500, z: 'ddd, d mmm yyyy' }); + expect(parseDate('Fri, 23 Dec 1988', { locale: 'en' })).toEqual({ v: 32500, z: 'ddd, d mmm yyyy' }); + expect(parseDate('Fös, 23 DES 1988', { locale: 'is' })).toEqual({ v: 32500, z: 'ddd, d mmm yyyy' }); + expect(parseDate('vin, 23 dec 1988', { locale: 'ro' })).toEqual({ v: 32500, z: 'ddd, d mmm yyyy' }); - t.deepEqual(parseDate('31/febrero/27', { locale: 'es_UY' }), { v: 11381, z: 'yy/mmmm/d' }); + expect(parseDate('31/febrero/27', { locale: 'es_UY' })).toEqual({ v: 11381, z: 'yy/mmmm/d' }); - t.deepEqual(parseDate('kedd 29 február 1916', { locale: 'hu' }), { v: 5904, z: 'dddd d mmmm yyyy' }); - t.deepEqual(parseDate('01 oct 1975', { locale: 'eb' }), { v: 27668, z: 'dd mmm yyyy' }); + expect(parseDate('kedd 29 február 1916', { locale: 'hu' })).toEqual({ v: 5904, z: 'dddd d mmmm yyyy' }); + expect(parseDate('01 oct 1975', { locale: 'eb' })).toEqual({ v: 27668, z: 'dd mmm yyyy' }); const fm = [ 'dddd d mmmm yyyy', @@ -705,46 +685,43 @@ tape('parseDate locale support', t => { for (const f of fm) { const o = format(f, 3290.1278435, opt); const parsed = parseDate(o, opt); - t.ok(!!parsed, `Locale: "${f}" in ${l} (${o})`); + expect(!!parsed, `Locale: "${f}" in ${l} (${o})`).toBeTruthy(); } // locales with preferMDY should allow dates that fit, else only allow DMY const MDY = getLocale(l)?.preferMDY; if (MDY) { - t.deepEqual(parseDate('07/05/82', opt), { v: 30137, z: 'mm/dd/yy' }, `${l} prefers MDY (07/05/82)`); - t.deepEqual(parseDate('31/05/82', opt), null, `${l} prefers MDY (31/05/82)`); - t.deepEqual(parseDate('05/31/82', opt), { v: 30102, z: 'mm/dd/yy' }, `${l} prefers MDY (05/31/82)`); + expect(parseDate('07/05/82', opt), `${l} prefers MDY (07/05/82)`).toEqual({ v: 30137, z: 'mm/dd/yy' }); + expect(parseDate('31/05/82', opt), `${l} prefers MDY (31/05/82)`).toEqual(null); + expect(parseDate('05/31/82', opt), `${l} prefers MDY (05/31/82)`).toEqual({ v: 30102, z: 'mm/dd/yy' }); } else { - t.deepEqual(parseDate('07/05/82', opt), { v: 30078, z: 'dd/mm/yy' }, `${l} prefers DMY (07/05/82)`); - t.deepEqual(parseDate('07/31/82', opt), null, `${l} prefers DMY (07/31/82)`); - t.deepEqual(parseDate('31/05/82', opt), { v: 30102, z: 'dd/mm/yy' }, `${l} prefers MDY (31/05/82)`); + expect(parseDate('07/05/82', opt), `${l} prefers DMY (07/05/82)`).toEqual({ v: 30078, z: 'dd/mm/yy' }); + expect(parseDate('07/31/82', opt), `${l} prefers DMY (07/31/82)`).toEqual(null); + expect(parseDate('31/05/82', opt), `${l} prefers MDY (31/05/82)`).toEqual({ v: 30102, z: 'dd/mm/yy' }); } } - t.end(); }); -tape('parseTime locale support', t => { - t.deepEqual(parseTime('01:31 a', { locale: 'fi' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'fi: 01:31 a'); - t.deepEqual(parseTime('01:31 am', { locale: 'fi' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'fi: 01:31 am'); - t.deepEqual(parseTime('01:31 ap.', { locale: 'fi' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'fi: 01:31 ap.'); - t.deepEqual(parseTime('01:31 ap', { locale: 'fi' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'fi: 01:31 ap'); - t.deepEqual(parseTime('01:31 a', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 a'); - t.deepEqual(parseTime('01:31 am', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 am'); - t.deepEqual(parseTime('01:31 fh', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 fh'); - t.deepEqual(parseTime('01:31 fh.', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 fh.'); - t.deepEqual(parseTime('01:31 f.h.', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 f.h.'); - t.deepEqual(parseTime('01:31 f. h.', { locale: 'is' }), { v: 0.06319444444444444, z: 'hh:mm AM/PM' }, 'is: 01:31 f. h.'); - t.end(); +test('parseTime locale support', () => { + expect(parseTime('01:31 a', { locale: 'fi' }), 'fi: 01:31 a').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 am', { locale: 'fi' }), 'fi: 01:31 am').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 ap.', { locale: 'fi' }), 'fi: 01:31 ap.').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 ap', { locale: 'fi' }), 'fi: 01:31 ap').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 a', { locale: 'is' }), 'is: 01:31 a').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 am', { locale: 'is' }), 'is: 01:31 am').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 fh', { locale: 'is' }), 'is: 01:31 fh').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 fh.', { locale: 'is' }), 'is: 01:31 fh.').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 f.h.', { locale: 'is' }), 'is: 01:31 f.h.').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); + expect(parseTime('01:31 f. h.', { locale: 'is' }), 'is: 01:31 f. h.').toEqual({ v: 0.06319444444444444, z: 'hh:mm AM/PM' }); }); -tape('parseBool locale support', t => { - t.deepEqual(parseBool('TRUE', { locale: 'en' }), { v: true }, 'en: TRUE'); - t.deepEqual(parseBool('FALSE', { locale: 'en' }), { v: false }, 'en: FALSE'); - t.deepEqual(parseBool('TRUE', { locale: 'jn' }), { v: true }, 'jn: TRUE'); - t.deepEqual(parseBool('FALSE', { locale: 'jn' }), { v: false }, 'jn: FALSE'); - t.deepEqual(parseBool('TRUE', { locale: 'hu' }), { v: true }, 'hu: TRUE'); - t.deepEqual(parseBool('FALSE', { locale: 'hu' }), { v: false }, 'hu: FALSE'); - t.deepEqual(parseBool('IGAZ', { locale: 'hu' }), { v: true }, 'hu: IGAZ'); - t.deepEqual(parseBool('HAMIS', { locale: 'hu' }), { v: false }, 'hu: HAMIS'); - t.end(); +test('parseBool locale support', () => { + expect(parseBool('TRUE', { locale: 'en' }), 'en: TRUE').toEqual({ v: true }); + expect(parseBool('FALSE', { locale: 'en' }), 'en: FALSE').toEqual({ v: false }); + expect(parseBool('TRUE', { locale: 'jn' }), 'jn: TRUE').toEqual({ v: true }); + expect(parseBool('FALSE', { locale: 'jn' }), 'jn: FALSE').toEqual({ v: false }); + expect(parseBool('TRUE', { locale: 'hu' }), 'hu: TRUE').toEqual({ v: true }); + expect(parseBool('FALSE', { locale: 'hu' }), 'hu: FALSE').toEqual({ v: false }); + expect(parseBool('IGAZ', { locale: 'hu' }), 'hu: IGAZ').toEqual({ v: true }); + expect(parseBool('HAMIS', { locale: 'hu' }), 'hu: HAMIS').toEqual({ v: false }); }); diff --git a/test/robust-mode-test.js b/test/robust-mode-test.js deleted file mode 100644 index 034d7a0..0000000 --- a/test/robust-mode-test.js +++ /dev/null @@ -1,24 +0,0 @@ -import test from './utils.js'; -import { format, formatColor, isDateFormat } from '../lib/index.js'; - -const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; - -test('Robust mode', t => { - t.equal(format('dddd, dd. mmmm yyy', -1, excelOpts), '######'); - - // these things should throw - t.throws(() => format('a;b;c;d;', 0, excelOpts), 'a;b;c;d;'); - t.throws(() => format('y 0', 0, excelOpts), 'y 0'); - - // ...but not in robust mode - const opts = { locale: 'en', throws: false, ...excelOpts }; - t.equal(format('a;b;c;d;', 0, opts), '######', 'format does not throw with "a;b;c;d;"'); - t.equal(format('y 0', 1, opts), '######', 'format does not throw with "y 0"'); - t.equal(format('dddd, dd. mmmm yyy', -1, opts), '######', 'format does not throw with "dddd, dd. mmmm yyy"'); - t.equal(format('y 0', 1, opts), '######', 'format does not throw with "dddd, dd. mmmm yyy"'); - - t.equal(formatColor('a;b;c;d;', 0, opts), null, 'formatColor does not throw'); - t.equal(isDateFormat('a;b;c;d;', opts), false, 'isDateFormat does not throw'); - - t.end(); -}); diff --git a/test/robust-mode.spec.ts b/test/robust-mode.spec.ts new file mode 100644 index 0000000..6a8d55c --- /dev/null +++ b/test/robust-mode.spec.ts @@ -0,0 +1,22 @@ +import { expect, test } from 'vitest'; +import { format, formatColor, isDateFormat } from '../lib/index.js'; + +const excelOpts = { dateSpanLarge: false, dateErrorNumber: false }; + +test('Robust mode', () => { + expect(format('dddd, dd. mmmm yyy', -1, excelOpts)).toBe('######'); + + // these things should throw + expect(() => format('a;b;c;d;', 0, excelOpts), 'a;b;c;d;').toThrow(); + expect(() => format('y 0', 0, excelOpts), 'y 0').toThrow(); + + // ...but not in robust mode + const opts = { locale: 'en', throws: false, ...excelOpts }; + expect(format('a;b;c;d;', 0, opts), 'format does not throw with "a;b;c;d;"').toBe('######'); + expect(format('y 0', 1, opts), 'format does not throw with "y 0"').toBe('######'); + expect(format('dddd, dd. mmmm yyy', -1, opts), 'format does not throw with "dddd, dd. mmmm yyy"').toBe('######'); + expect(format('y 0', 1, opts), 'format does not throw with "dddd, dd. mmmm yyy"').toBe('######'); + + expect(formatColor('a;b;c;d;', 0, opts), 'formatColor does not throw').toBe(null); + expect(isDateFormat('a;b;c;d;', opts), 'isDateFormat does not throw').toBe(false); +}); diff --git a/test/serialDate-test.js b/test/serialDate-test.js deleted file mode 100644 index 82505f5..0000000 --- a/test/serialDate-test.js +++ /dev/null @@ -1,91 +0,0 @@ -/* globals process */ - -import test, { getTimeZoneName } from './utils.js'; -import { dateToSerial, dateFromSerial } from '../lib/index.js'; - -function round (n) { - return Math.round(n * 1e10) / 1e10; -} - -test('dateToSerial (Date):', t => { - process.env.TZ = 'Asia/Calcutta'; - t.equal(getTimeZoneName(), 'India Standard Time', 'Timezone is IST'); - - const testYMD = (y, m, d, hh, mm, ss, tz = false) => { - const dt = new Date(y, m - 1, d, hh, mm, ss); - return round(dateToSerial(dt, { ignoreTimezone: tz })); - }; - - t.equal(testYMD(1978, 5, 17, 10, 25, 30, true), 28627.2052083333, '[1978, 5, 17, 10, 25, 30] ignoreTimezone'); - t.equal(testYMD(1978, 5, 17, 10, 25, 30), 28627.434375, '[1978, 5, 17, 10, 25, 30]'); - - t.equal(testYMD(2022, 3, 1, 13, 53, 11), 44621.578599537, '[2022, 3, 1, 13, 53, 11]'); - t.equal(testYMD(2022, 3, 1, 13, 53, 11, true), 44621.3494328704, '[2022, 3, 1, 13, 53, 11] ignoreTimezone'); - - t.equal(testYMD(1900, 1, 1, 0, 0, 0), 1, '[1900, 1, 1, 0, 0, 0]'); - t.equal(testYMD(1900, 1, 1, 0, 0, 0, true), 0.7769675926, '[1900, 1, 1, 0, 0, 0] ignoreTimezone'); - - t.equal(testYMD(1950, 1, 1, 0, 0, 0), 18264, '[1950, 1, 1, 0, 0, 0]'); - t.equal(testYMD(1950, 1, 1, 0, 0, 0, true), 18263.7708333333, '[1950, 1, 1, 0, 0, 0] ignoreTimezone'); - - t.equal(testYMD(2000, 1, 1, 0, 0, 0), 36526, '[2000, 1, 1, 0, 0, 0]'); - t.equal(testYMD(2000, 1, 1, 0, 0, 0, true), 36525.7708333333, '[2000, 1, 1, 0, 0, 0] ignoreTimezone'); - - t.end(); -}); - -test('dateToSerial (Array):', t => { - const testYMD = (y, m, d, hh, mm, ss, tz = false) => { - return round(dateToSerial( - [ y, m, d, hh, mm, ss ], - { ignoreTimezone: tz } - )); - }; - t.equal(testYMD(1978, 5, 17, 10, 25, 30, false), 28627.434375, '[1978, 5, 17, 10, 25, 30]'); - t.equal(testYMD(1978, 5, 17, 10, 25, 30, true), 28627.434375, '[1978, 5, 17, 10, 25, 30]'); - t.equal(testYMD(2022, 3, 1, 13, 53, 11, false), 44621.578599537, '[2022, 3, 1, 13, 53, 11]'); - t.equal(testYMD(2022, 3, 1, 13, 53, 11, true), 44621.578599537, '[2022, 3, 1, 13, 53, 11]'); - t.equal(testYMD(1900, 1, 1, 0, 0, 0, false), 1, '[1900, 1, 1, 0, 0, 0]'); - t.equal(testYMD(1900, 1, 1, 0, 0, 0, true), 1, '[1900, 1, 1, 0, 0, 0]'); - t.equal(testYMD(1950, 1, 1, 0, 0, 0, false), 18264, '[1950, 1, 1, 0, 0, 0]'); - t.equal(testYMD(1950, 1, 1, 0, 0, 0, true), 18264, '[1950, 1, 1, 0, 0, 0]'); - t.equal(testYMD(2000, 1, 1, 0, 0, 0, false), 36526, '[2000, 1, 1, 0, 0, 0]'); - t.equal(testYMD(2000, 1, 1, 0, 0, 0, true), 36526, '[2000, 1, 1, 0, 0, 0]'); - t.end(); -}); - -test('dateFromSerial:', t => { - process.env.TZ = 'Europe/Amsterdam'; - t.ok( - /^Central European (Standard|Summer) Time$/.test(getTimeZoneName()), - 'Timezone is what we think it is' - ); - - t.deepLooseEqual( - dateFromSerial(1234), - [ 1903, 5, 18, 0, 0, 0 ], - 'dateFromSerial(1234)' - ); - t.deepLooseEqual( - dateFromSerial(1234.567), - [ 1903, 5, 18, 13, 36, 28 ], - 'dateFromSerial(1234)' - ); - t.deepLooseEqual( - dateFromSerial(12), - [ 1900, 1, 12, 0, 0, 0 ], - 'dateFromSerial(12)' - ); - t.deepLooseEqual( - dateFromSerial(24052.8361), - [ 1965, 11, 6, 20, 3, 59 ], - 'dateFromSerial(24052.8361)' - ); - t.deepLooseEqual( - dateFromSerial(42341), - [ 2015, 12, 3, 0, 0, 0 ], - 'dateFromSerial(42341)' - ); - - t.end(); -}); diff --git a/test/serialDate.spec.ts b/test/serialDate.spec.ts new file mode 100644 index 0000000..a618cf8 --- /dev/null +++ b/test/serialDate.spec.ts @@ -0,0 +1,82 @@ +/* globals process */ + +import { expect, test } from 'vitest'; +import { getTimeZoneName } from './utils.ts'; +import { dateToSerial, dateFromSerial } from '../lib/index.js'; + +function round (n: number): number { + return Math.round(n * 1e10) / 1e10; +} + +test('dateToSerial (Date):', () => { + process.env.TZ = 'Asia/Calcutta'; + expect(getTimeZoneName(), 'Timezone is IST').toBe('India Standard Time'); + + const testYMD = (y: number, m: number, d: number, hh: number, mm: number, ss: number, tz = false) => { + const dt = new Date(y, m - 1, d, hh, mm, ss); + return round(dateToSerial(dt, { ignoreTimezone: tz })); + }; + + expect(testYMD(1978, 5, 17, 10, 25, 30, true), '[1978, 5, 17, 10, 25, 30] ignoreTimezone').toBe(28627.2052083333); + expect(testYMD(1978, 5, 17, 10, 25, 30), '[1978, 5, 17, 10, 25, 30]').toBe(28627.434375); + + expect(testYMD(2022, 3, 1, 13, 53, 11), '[2022, 3, 1, 13, 53, 11]').toBe(44621.578599537); + expect(testYMD(2022, 3, 1, 13, 53, 11, true), '[2022, 3, 1, 13, 53, 11] ignoreTimezone').toBe(44621.3494328704); + + expect(testYMD(1900, 1, 1, 0, 0, 0), '[1900, 1, 1, 0, 0, 0]').toBe(1); + expect(testYMD(1900, 1, 1, 0, 0, 0, true), '[1900, 1, 1, 0, 0, 0] ignoreTimezone').toBe(0.7769675926); + + expect(testYMD(1950, 1, 1, 0, 0, 0), '[1950, 1, 1, 0, 0, 0]').toBe(18264); + expect(testYMD(1950, 1, 1, 0, 0, 0, true), '[1950, 1, 1, 0, 0, 0] ignoreTimezone').toBe(18263.7708333333); + + expect(testYMD(2000, 1, 1, 0, 0, 0), '[2000, 1, 1, 0, 0, 0]').toBe(36526); + expect(testYMD(2000, 1, 1, 0, 0, 0, true), '[2000, 1, 1, 0, 0, 0] ignoreTimezone').toBe(36525.7708333333); +}); + +test('dateToSerial (Array):', () => { + const testYMD = (y: number, m: number, d: number, hh: number, mm: number, ss: number, tz = false) => { + return round(dateToSerial( + [ y, m, d, hh, mm, ss ], + { ignoreTimezone: tz } + )); + }; + expect(testYMD(1978, 5, 17, 10, 25, 30, false), '[1978, 5, 17, 10, 25, 30]').toBe(28627.434375); + expect(testYMD(1978, 5, 17, 10, 25, 30, true), '[1978, 5, 17, 10, 25, 30]').toBe(28627.434375); + expect(testYMD(2022, 3, 1, 13, 53, 11, false), '[2022, 3, 1, 13, 53, 11]').toBe(44621.578599537); + expect(testYMD(2022, 3, 1, 13, 53, 11, true), '[2022, 3, 1, 13, 53, 11]').toBe(44621.578599537); + expect(testYMD(1900, 1, 1, 0, 0, 0, false), '[1900, 1, 1, 0, 0, 0]').toBe(1); + expect(testYMD(1900, 1, 1, 0, 0, 0, true), '[1900, 1, 1, 0, 0, 0]').toBe(1); + expect(testYMD(1950, 1, 1, 0, 0, 0, false), '[1950, 1, 1, 0, 0, 0]').toBe(18264); + expect(testYMD(1950, 1, 1, 0, 0, 0, true), '[1950, 1, 1, 0, 0, 0]').toBe(18264); + expect(testYMD(2000, 1, 1, 0, 0, 0, false), '[2000, 1, 1, 0, 0, 0]').toBe(36526); + expect(testYMD(2000, 1, 1, 0, 0, 0, true), '[2000, 1, 1, 0, 0, 0]').toBe(36526); +}); + +test('dateFromSerial:', () => { + process.env.TZ = 'Europe/Amsterdam'; + expect( + /^Central European (Standard|Summer) Time$/.test(getTimeZoneName()), + 'Timezone is what we think it is' + ).toBeTruthy(); + + expect( + dateFromSerial(1234), + 'dateFromSerial(1234)' + ).toEqual([ 1903, 5, 18, 0, 0, 0 ]); + expect( + dateFromSerial(1234.567), + 'dateFromSerial(1234)' + ).toEqual([ 1903, 5, 18, 13, 36, 28 ]); + expect( + dateFromSerial(12), + 'dateFromSerial(12)' + ).toEqual([ 1900, 1, 12, 0, 0, 0 ]); + expect( + dateFromSerial(24052.8361), + 'dateFromSerial(24052.8361)' + ).toEqual([ 1965, 11, 6, 20, 3, 59 ]); + expect( + dateFromSerial(42341), + 'dateFromSerial(42341)' + ).toEqual([ 2015, 12, 3, 0, 0, 0 ]); +}); diff --git a/test/ssf-cal-test.js b/test/ssf-cal-test.js deleted file mode 100644 index 7035d03..0000000 --- a/test/ssf-cal-test.js +++ /dev/null @@ -1,6 +0,0 @@ -import test from './utils.js'; - -test('SSF table: tables/cal-updated.tsv', t => { - t.runTable('tables/cal-updated.tsv'); - t.end(); -}); diff --git a/test/ssf-cal.spec.ts b/test/ssf-cal.spec.ts new file mode 100644 index 0000000..2a1f203 --- /dev/null +++ b/test/ssf-cal.spec.ts @@ -0,0 +1,6 @@ +import { describe } from 'vitest'; +import { runTable } from './utils.ts'; + +describe('SSF table: tables/cal-updated.tsv', () => { + runTable('tables/cal-updated.tsv'); +}); diff --git a/test/ssf-comma-test.js b/test/ssf-comma-test.js deleted file mode 100644 index ae0eff8..0000000 --- a/test/ssf-comma-test.js +++ /dev/null @@ -1,135 +0,0 @@ -// tests converted from SSF -import test from './utils.js'; - -test('Exponential: #.0000,,,', t => { - t.format('#.0000,,,', 0.99, '.0000'); - t.format('#.0000,,,', 1.2345, '.0000'); - t.format('#.0000,,,', 12.345, '.0000'); - t.format('#.0000,,,', 123.456, '.0000'); - t.format('#.0000,,,', 1234, '.0000'); - t.format('#.0000,,,', 12345, '.0000'); - t.format('#.0000,,,', 123456, '.0001'); - t.format('#.0000,,,', 1234567, '.0012'); - t.format('#.0000,,,', 12345678, '.0123'); - t.format('#.0000,,,', 123456789, '.1235'); - t.format('#.0000,,,', 1234567890, '1.2346'); - t.format('#.0000,,,', 12345678901, '12.3457'); - t.format('#.0000,,,', 123456789012, '123.4568'); - t.format('#.0000,,,', 4321, '.0000'); - t.format('#.0000,,,', 4321234, '.0043'); - t.end(); -}); - -test('Exponential: #.0000,,', t => { - t.format('#.0000,,', 0.99, '.0000'); - t.format('#.0000,,', 1.2345, '.0000'); - t.format('#.0000,,', 12.345, '.0000'); - t.format('#.0000,,', 123.456, '.0001'); - t.format('#.0000,,', 1234, '.0012'); - t.format('#.0000,,', 12345, '.0123'); - t.format('#.0000,,', 123456, '.1235'); - t.format('#.0000,,', 1234567, '1.2346'); - t.format('#.0000,,', 12345678, '12.3457'); - t.format('#.0000,,', 123456789, '123.4568'); - t.format('#.0000,,', 1234567890, '1234.5679'); - t.format('#.0000,,', 12345678901, '12345.6789'); - t.format('#.0000,,', 123456789012, '123456.7890'); - t.format('#.0000,,', 4321, '.0043'); - t.format('#.0000,,', 4321234, '4.3212'); - t.end(); -}); - -test('Exponential: #.0000,', t => { - t.format('#.0000,', 0.99, '.0010'); - t.format('#.0000,', 1.2345, '.0012'); - t.format('#.0000,', 12.345, '.0123'); - t.format('#.0000,', 123.456, '.1235'); - t.format('#.0000,', 1234, '1.2340'); - t.format('#.0000,', 12345, '12.3450'); - t.format('#.0000,', 123456, '123.4560'); - t.format('#.0000,', 1234567, '1234.5670'); - t.format('#.0000,', 12345678, '12345.6780'); - t.format('#.0000,', 123456789, '123456.7890'); - t.format('#.0000,', 1234567890, '1234567.8900'); - t.format('#.0000,', 12345678901, '12345678.9010'); - t.format('#.0000,', 123456789012, '123456789.0120'); - t.format('#.0000,', 4321, '4.3210'); - t.format('#.0000,', 4321234, '4321.2340'); - t.end(); -}); - -test('Exponential: #,##0.0', t => { - t.format('#,##0.0', 0.99, '1.0'); - t.format('#,##0.0', 1.2345, '1.2'); - t.format('#,##0.0', 12.345, '12.3'); - t.format('#,##0.0', 123.456, '123.5'); - t.format('#,##0.0', 1234, '1,234.0'); - t.format('#,##0.0', 12345, '12,345.0'); - t.format('#,##0.0', 123456, '123,456.0'); - t.format('#,##0.0', 1234567, '1,234,567.0'); - t.format('#,##0.0', 12345678, '12,345,678.0'); - t.format('#,##0.0', 123456789, '123,456,789.0'); - t.format('#,##0.0', 1234567890, '1,234,567,890.0'); - t.format('#,##0.0', 12345678901, '12,345,678,901.0'); - t.format('#,##0.0', 123456789012, '123,456,789,012.0'); - t.format('#,##0.0', 4321, '4,321.0'); - t.format('#,##0.0', 4321234, '4,321,234.0'); - t.end(); -}); - -test('Exponential: ###,##0', t => { - t.format('###,##0', 0.99, '1'); - t.format('###,##0', 1.2345, '1'); - t.format('###,##0', 12.345, '12'); - t.format('###,##0', 123.456, '123'); - t.format('###,##0', 1234, '1,234'); - t.format('###,##0', 12345, '12,345'); - t.format('###,##0', 123456, '123,456'); - t.format('###,##0', 1234567, '1,234,567'); - t.format('###,##0', 12345678, '12,345,678'); - t.format('###,##0', 123456789, '123,456,789'); - t.format('###,##0', 1234567890, '1,234,567,890'); - t.format('###,##0', 12345678901, '12,345,678,901'); - t.format('###,##0', 123456789012, '123,456,789,012'); - t.format('###,##0', 4321, '4,321'); - t.format('###,##0', 4321234, '4,321,234'); - t.end(); -}); - -test('Exponential: ###,###', t => { - t.format('###,###', 0.99, '1'); - t.format('###,###', 1.2345, '1'); - t.format('###,###', 12.345, '12'); - t.format('###,###', 123.456, '123'); - t.format('###,###', 1234, '1,234'); - t.format('###,###', 12345, '12,345'); - t.format('###,###', 123456, '123,456'); - t.format('###,###', 1234567, '1,234,567'); - t.format('###,###', 12345678, '12,345,678'); - t.format('###,###', 123456789, '123,456,789'); - t.format('###,###', 1234567890, '1,234,567,890'); - t.format('###,###', 12345678901, '12,345,678,901'); - t.format('###,###', 123456789012, '123,456,789,012'); - t.format('###,###', 4321, '4,321'); - t.format('###,###', 4321234, '4,321,234'); - t.end(); -}); - -test('Exponential: #,###.00', t => { - t.format('#,###.00', 0.99, '.99'); - t.format('#,###.00', 1.2345, '1.23'); - t.format('#,###.00', 12.345, '12.35'); - t.format('#,###.00', 123.456, '123.46'); - t.format('#,###.00', 1234, '1,234.00'); - t.format('#,###.00', 12345, '12,345.00'); - t.format('#,###.00', 123456, '123,456.00'); - t.format('#,###.00', 1234567, '1,234,567.00'); - t.format('#,###.00', 12345678, '12,345,678.00'); - t.format('#,###.00', 123456789, '123,456,789.00'); - t.format('#,###.00', 1234567890, '1,234,567,890.00'); - t.format('#,###.00', 12345678901, '12,345,678,901.00'); - t.format('#,###.00', 123456789012, '123,456,789,012.00'); - t.format('#,###.00', 4321, '4,321.00'); - t.format('#,###.00', 4321234, '4,321,234.00'); - t.end(); -}); diff --git a/test/ssf-comma.spec.ts b/test/ssf-comma.spec.ts new file mode 100644 index 0000000..608eafd --- /dev/null +++ b/test/ssf-comma.spec.ts @@ -0,0 +1,129 @@ +// tests converted from SSF +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Exponential: #.0000,,,', () => { + expect(format('#.0000,,,', 0.99)).toBe('.0000'); + expect(format('#.0000,,,', 1.2345)).toBe('.0000'); + expect(format('#.0000,,,', 12.345)).toBe('.0000'); + expect(format('#.0000,,,', 123.456)).toBe('.0000'); + expect(format('#.0000,,,', 1234)).toBe('.0000'); + expect(format('#.0000,,,', 12345)).toBe('.0000'); + expect(format('#.0000,,,', 123456)).toBe('.0001'); + expect(format('#.0000,,,', 1234567)).toBe('.0012'); + expect(format('#.0000,,,', 12345678)).toBe('.0123'); + expect(format('#.0000,,,', 123456789)).toBe('.1235'); + expect(format('#.0000,,,', 1234567890)).toBe('1.2346'); + expect(format('#.0000,,,', 12345678901)).toBe('12.3457'); + expect(format('#.0000,,,', 123456789012)).toBe('123.4568'); + expect(format('#.0000,,,', 4321)).toBe('.0000'); + expect(format('#.0000,,,', 4321234)).toBe('.0043'); +}); + +test('Exponential: #.0000,,', () => { + expect(format('#.0000,,', 0.99)).toBe('.0000'); + expect(format('#.0000,,', 1.2345)).toBe('.0000'); + expect(format('#.0000,,', 12.345)).toBe('.0000'); + expect(format('#.0000,,', 123.456)).toBe('.0001'); + expect(format('#.0000,,', 1234)).toBe('.0012'); + expect(format('#.0000,,', 12345)).toBe('.0123'); + expect(format('#.0000,,', 123456)).toBe('.1235'); + expect(format('#.0000,,', 1234567)).toBe('1.2346'); + expect(format('#.0000,,', 12345678)).toBe('12.3457'); + expect(format('#.0000,,', 123456789)).toBe('123.4568'); + expect(format('#.0000,,', 1234567890)).toBe('1234.5679'); + expect(format('#.0000,,', 12345678901)).toBe('12345.6789'); + expect(format('#.0000,,', 123456789012)).toBe('123456.7890'); + expect(format('#.0000,,', 4321)).toBe('.0043'); + expect(format('#.0000,,', 4321234)).toBe('4.3212'); +}); + +test('Exponential: #.0000,', () => { + expect(format('#.0000,', 0.99)).toBe('.0010'); + expect(format('#.0000,', 1.2345)).toBe('.0012'); + expect(format('#.0000,', 12.345)).toBe('.0123'); + expect(format('#.0000,', 123.456)).toBe('.1235'); + expect(format('#.0000,', 1234)).toBe('1.2340'); + expect(format('#.0000,', 12345)).toBe('12.3450'); + expect(format('#.0000,', 123456)).toBe('123.4560'); + expect(format('#.0000,', 1234567)).toBe('1234.5670'); + expect(format('#.0000,', 12345678)).toBe('12345.6780'); + expect(format('#.0000,', 123456789)).toBe('123456.7890'); + expect(format('#.0000,', 1234567890)).toBe('1234567.8900'); + expect(format('#.0000,', 12345678901)).toBe('12345678.9010'); + expect(format('#.0000,', 123456789012)).toBe('123456789.0120'); + expect(format('#.0000,', 4321)).toBe('4.3210'); + expect(format('#.0000,', 4321234)).toBe('4321.2340'); +}); + +test('Exponential: #,##0.0', () => { + expect(format('#,##0.0', 0.99)).toBe('1.0'); + expect(format('#,##0.0', 1.2345)).toBe('1.2'); + expect(format('#,##0.0', 12.345)).toBe('12.3'); + expect(format('#,##0.0', 123.456)).toBe('123.5'); + expect(format('#,##0.0', 1234)).toBe('1,234.0'); + expect(format('#,##0.0', 12345)).toBe('12,345.0'); + expect(format('#,##0.0', 123456)).toBe('123,456.0'); + expect(format('#,##0.0', 1234567)).toBe('1,234,567.0'); + expect(format('#,##0.0', 12345678)).toBe('12,345,678.0'); + expect(format('#,##0.0', 123456789)).toBe('123,456,789.0'); + expect(format('#,##0.0', 1234567890)).toBe('1,234,567,890.0'); + expect(format('#,##0.0', 12345678901)).toBe('12,345,678,901.0'); + expect(format('#,##0.0', 123456789012)).toBe('123,456,789,012.0'); + expect(format('#,##0.0', 4321)).toBe('4,321.0'); + expect(format('#,##0.0', 4321234)).toBe('4,321,234.0'); +}); + +test('Exponential: ###,##0', () => { + expect(format('###,##0', 0.99)).toBe('1'); + expect(format('###,##0', 1.2345)).toBe('1'); + expect(format('###,##0', 12.345)).toBe('12'); + expect(format('###,##0', 123.456)).toBe('123'); + expect(format('###,##0', 1234)).toBe('1,234'); + expect(format('###,##0', 12345)).toBe('12,345'); + expect(format('###,##0', 123456)).toBe('123,456'); + expect(format('###,##0', 1234567)).toBe('1,234,567'); + expect(format('###,##0', 12345678)).toBe('12,345,678'); + expect(format('###,##0', 123456789)).toBe('123,456,789'); + expect(format('###,##0', 1234567890)).toBe('1,234,567,890'); + expect(format('###,##0', 12345678901)).toBe('12,345,678,901'); + expect(format('###,##0', 123456789012)).toBe('123,456,789,012'); + expect(format('###,##0', 4321)).toBe('4,321'); + expect(format('###,##0', 4321234)).toBe('4,321,234'); +}); + +test('Exponential: ###,###', () => { + expect(format('###,###', 0.99)).toBe('1'); + expect(format('###,###', 1.2345)).toBe('1'); + expect(format('###,###', 12.345)).toBe('12'); + expect(format('###,###', 123.456)).toBe('123'); + expect(format('###,###', 1234)).toBe('1,234'); + expect(format('###,###', 12345)).toBe('12,345'); + expect(format('###,###', 123456)).toBe('123,456'); + expect(format('###,###', 1234567)).toBe('1,234,567'); + expect(format('###,###', 12345678)).toBe('12,345,678'); + expect(format('###,###', 123456789)).toBe('123,456,789'); + expect(format('###,###', 1234567890)).toBe('1,234,567,890'); + expect(format('###,###', 12345678901)).toBe('12,345,678,901'); + expect(format('###,###', 123456789012)).toBe('123,456,789,012'); + expect(format('###,###', 4321)).toBe('4,321'); + expect(format('###,###', 4321234)).toBe('4,321,234'); +}); + +test('Exponential: #,###.00', () => { + expect(format('#,###.00', 0.99)).toBe('.99'); + expect(format('#,###.00', 1.2345)).toBe('1.23'); + expect(format('#,###.00', 12.345)).toBe('12.35'); + expect(format('#,###.00', 123.456)).toBe('123.46'); + expect(format('#,###.00', 1234)).toBe('1,234.00'); + expect(format('#,###.00', 12345)).toBe('12,345.00'); + expect(format('#,###.00', 123456)).toBe('123,456.00'); + expect(format('#,###.00', 1234567)).toBe('1,234,567.00'); + expect(format('#,###.00', 12345678)).toBe('12,345,678.00'); + expect(format('#,###.00', 123456789)).toBe('123,456,789.00'); + expect(format('#,###.00', 1234567890)).toBe('1,234,567,890.00'); + expect(format('#,###.00', 12345678901)).toBe('12,345,678,901.00'); + expect(format('#,###.00', 123456789012)).toBe('123,456,789,012.00'); + expect(format('#,###.00', 4321)).toBe('4,321.00'); + expect(format('#,###.00', 4321234)).toBe('4,321,234.00'); +}); diff --git a/test/ssf-dates-test.js b/test/ssf-dates-test.js deleted file mode 100644 index fcf9767..0000000 --- a/test/ssf-dates-test.js +++ /dev/null @@ -1,6 +0,0 @@ -import test from './utils.js'; - -test('SSF table: tables/ssf-dates.tsv', t => { - t.runTable('tables/ssf-dates.tsv'); - t.end(); -}); diff --git a/test/ssf-dates.spec.ts b/test/ssf-dates.spec.ts new file mode 100644 index 0000000..8cddf79 --- /dev/null +++ b/test/ssf-dates.spec.ts @@ -0,0 +1,6 @@ +import { describe } from 'vitest'; +import { runTable } from './utils.ts'; + +describe('SSF table: tables/ssf-dates.tsv', () => { + runTable('tables/ssf-dates.tsv'); +}); diff --git a/test/ssf-exp-test.js b/test/ssf-exp-test.js deleted file mode 100644 index a6694c9..0000000 --- a/test/ssf-exp-test.js +++ /dev/null @@ -1,198 +0,0 @@ -// tests converted from SSF -import test from './utils.js'; - -test('Exponential: #0.0E+0', t => { - t.format('#0.0E+0', 1.23457E-13, '12.3E-14'); - t.format('#0.0E+0', 1.23457E-12, '1.2E-12'); - t.format('#0.0E+0', 1.23457E-11, '12.3E-12'); - t.format('#0.0E+0', 1.23457E-10, '1.2E-10'); - t.format('#0.0E+0', 1.23457E-09, '12.3E-10'); - t.format('#0.0E+0', 1.23457E-08, '1.2E-8'); - t.format('#0.0E+0', 0.000000123457, '12.3E-8'); - t.format('#0.0E+0', 0.00000123457, '1.2E-6'); - t.format('#0.0E+0', 0.0000123457, '12.3E-6'); - t.format('#0.0E+0', 0.000123457, '1.2E-4'); - t.format('#0.0E+0', 0.001234568, '12.3E-4'); - t.format('#0.0E+0', 0.012345679, '1.2E-2'); - t.format('#0.0E+0', 0.123456789, '12.3E-2'); - t.format('#0.0E+0', 1.23456789, '1.2E+0'); - t.format('#0.0E+0', 12.3456789, '12.3E+0'); - t.format('#0.0E+0', 123.456789, '1.2E+2'); - t.format('#0.0E+0', 1234.56789, '12.3E+2'); - t.format('#0.0E+0', 12345.6789, '1.2E+4'); - t.format('#0.0E+0', 123456.789, '12.3E+4'); - t.format('#0.0E+0', 1234567.89, '1.2E+6'); - t.format('#0.0E+0', 12345678.9, '12.3E+6'); - t.format('#0.0E+0', 123456789, '1.2E+8'); - t.format('#0.0E+0', 1234567890, '12.3E+8'); - t.format('#0.0E+0', 12345678900, '1.2E+10'); - t.format('#0.0E+0', 123456789000, '12.3E+10'); - t.format('#0.0E+0', 1234567890000, '1.2E+12'); - t.format('#0.0E+0', 12345678900000, '12.3E+12'); - t.format('#0.0E+0', 123456789000000, '1.2E+14'); - t.format('#0.0E+0', 1234567890000000, '12.3E+14'); - t.format('#0.0E+0', 12345678900000000, '1.2E+16'); - t.format('#0.0E+0', 123456789000000000, '12.3E+16'); - t.format('#0.0E+0', 1234567890000000000, '1.2E+18'); - t.format('#0.0E+0', 12345678900000000000, '12.3E+18'); - t.format('#0.0E+0', 123456789000000000000, '1.2E+20'); - t.format('#0.0E+0', 1234567890000000000000, '12.3E+20'); - t.format('#0.0E+0', 12345678900000000000000, '1.2E+22'); - t.format('#0.0E+0', 123456789000000000000000, '12.3E+22'); - t.format('#0.0E+0', 1234567890000000000000000, '1.2E+24'); - t.format('#0.0E+0', 12345678900000000000000000, '12.3E+24'); - t.format('#0.0E+0', 123456789000000000000000000, '1.2E+26'); - t.format('#0.0E+0', 1234567890000000000000000000, '12.3E+26'); - t.format('#0.0E+0', 12345678900000000000000000000, '1.2E+28'); - t.format('#0.0E+0', 123456789000000000000000000000, '12.3E+28'); - t.format('#0.0E+0', 1234567890000000000000000000000, '1.2E+30'); - t.format('#0.0E+0', 12345678900000000000000000000000, '12.3E+30'); - t.end(); -}); - -test('Exponential: ##0.0E+0', t => { - t.format('##0.0E+0', 1.23457E-13, '123.5E-15'); - t.format('##0.0E+0', 1.23457E-12, '1.2E-12'); - t.format('##0.0E+0', 1.23457E-11, '12.3E-12'); - t.format('##0.0E+0', 1.23457E-10, '123.5E-12'); - t.format('##0.0E+0', 1.23457E-09, '1.2E-9'); - t.format('##0.0E+0', 1.23457E-08, '12.3E-9'); - t.format('##0.0E+0', 0.000000123457, '123.5E-9'); - t.format('##0.0E+0', 0.00000123457, '1.2E-6'); - t.format('##0.0E+0', 0.0000123457, '12.3E-6'); - t.format('##0.0E+0', 0.000123457, '123.5E-6'); - t.format('##0.0E+0', 0.001234568, '1.2E-3'); - t.format('##0.0E+0', 0.012345679, '12.3E-3'); - t.format('##0.0E+0', 0.123456789, '123.5E-3'); - t.format('##0.0E+0', 1.23456789, '1.2E+0'); - t.format('##0.0E+0', 12.3456789, '12.3E+0'); - t.format('##0.0E+0', 123.456789, '123.5E+0'); - t.format('##0.0E+0', 1234.56789, '1.2E+3'); - t.format('##0.0E+0', 12345.6789, '12.3E+3'); - t.format('##0.0E+0', 123456.789, '123.5E+3'); - t.format('##0.0E+0', 1234567.89, '1.2E+6'); - t.format('##0.0E+0', 12345678.9, '12.3E+6'); - t.format('##0.0E+0', 123456789, '123.5E+6'); - t.format('##0.0E+0', 1234567890, '1.2E+9'); - t.format('##0.0E+0', 12345678900, '12.3E+9'); - t.format('##0.0E+0', 123456789000, '123.5E+9'); - t.format('##0.0E+0', 1234567890000, '1.2E+12'); - t.format('##0.0E+0', 12345678900000, '12.3E+12'); - t.format('##0.0E+0', 123456789000000, '123.5E+12'); - t.format('##0.0E+0', 1234567890000000, '1.2E+15'); - t.format('##0.0E+0', 12345678900000000, '12.3E+15'); - t.format('##0.0E+0', 123456789000000000, '123.5E+15'); - t.format('##0.0E+0', 1234567890000000000, '1.2E+18'); - t.format('##0.0E+0', 12345678900000000000, '12.3E+18'); - t.format('##0.0E+0', 123456789000000000000, '123.5E+18'); - t.format('##0.0E+0', 1234567890000000000000, '1.2E+21'); - t.format('##0.0E+0', 12345678900000000000000, '12.3E+21'); - t.format('##0.0E+0', 123456789000000000000000, '123.5E+21'); - t.format('##0.0E+0', 1234567890000000000000000, '1.2E+24'); - t.format('##0.0E+0', 12345678900000000000000000, '12.3E+24'); - t.format('##0.0E+0', 123456789000000000000000000, '123.5E+24'); - t.format('##0.0E+0', 1234567890000000000000000000, '1.2E+27'); - t.format('##0.0E+0', 12345678900000000000000000000, '12.3E+27'); - t.format('##0.0E+0', 123456789000000000000000000000, '123.5E+27'); - t.format('##0.0E+0', 1234567890000000000000000000000, '1.2E+30'); - t.format('##0.0E+0', 12345678900000000000000000000000, '12.3E+30'); - t.end(); -}); - -test('Exponential: ###0.0E+0', t => { - t.format('###0.0E+0', 1.23457E-13, '1234.6E-16'); - t.format('###0.0E+0', 1.23457E-12, '1.2E-12'); - t.format('###0.0E+0', 1.23457E-11, '12.3E-12'); - t.format('###0.0E+0', 1.23457E-10, '123.5E-12'); - t.format('###0.0E+0', 1.23457E-09, '1234.6E-12'); - t.format('###0.0E+0', 1.23457E-08, '1.2E-8'); - t.format('###0.0E+0', 0.000000123457, '12.3E-8'); - t.format('###0.0E+0', 0.00000123457, '123.5E-8'); - t.format('###0.0E+0', 0.0000123457, '1234.6E-8'); - t.format('###0.0E+0', 0.000123457, '1.2E-4'); - t.format('###0.0E+0', 0.001234568, '12.3E-4'); - t.format('###0.0E+0', 0.012345679, '123.5E-4'); - t.format('###0.0E+0', 0.123456789, '1234.6E-4'); - t.format('###0.0E+0', 1.23456789, '1.2E+0'); - t.format('###0.0E+0', 12.3456789, '12.3E+0'); - t.format('###0.0E+0', 123.456789, '123.5E+0'); - t.format('###0.0E+0', 1234.56789, '1234.6E+0'); - t.format('###0.0E+0', 12345.6789, '1.2E+4'); - t.format('###0.0E+0', 123456.789, '12.3E+4'); - t.format('###0.0E+0', 1234567.89, '123.5E+4'); - t.format('###0.0E+0', 12345678.9, '1234.6E+4'); - t.format('###0.0E+0', 123456789, '1.2E+8'); - t.format('###0.0E+0', 1234567890, '12.3E+8'); - t.format('###0.0E+0', 12345678900, '123.5E+8'); - t.format('###0.0E+0', 123456789000, '1234.6E+8'); - t.format('###0.0E+0', 1234567890000, '1.2E+12'); - t.format('###0.0E+0', 12345678900000, '12.3E+12'); - t.format('###0.0E+0', 123456789000000, '123.5E+12'); - t.format('###0.0E+0', 1234567890000000, '1234.6E+12'); - t.format('###0.0E+0', 12345678900000000, '1.2E+16'); - t.format('###0.0E+0', 123456789000000000, '12.3E+16'); - t.format('###0.0E+0', 1234567890000000000, '123.5E+16'); - t.format('###0.0E+0', 12345678900000000000, '1234.6E+16'); - t.format('###0.0E+0', 123456789000000000000, '1.2E+20'); - t.format('###0.0E+0', 1234567890000000000000, '12.3E+20'); - t.format('###0.0E+0', 12345678900000000000000, '123.5E+20'); - t.format('###0.0E+0', 123456789000000000000000, '1234.6E+20'); - t.format('###0.0E+0', 1234567890000000000000000, '1.2E+24'); - t.format('###0.0E+0', 12345678900000000000000000, '12.3E+24'); - t.format('###0.0E+0', 123456789000000000000000000, '123.5E+24'); - t.format('###0.0E+0', 1234567890000000000000000000, '1234.6E+24'); - t.format('###0.0E+0', 12345678900000000000000000000, '1.2E+28'); - t.format('###0.0E+0', 123456789000000000000000000000, '12.3E+28'); - t.format('###0.0E+0', 1234567890000000000000000000000, '123.5E+28'); - t.format('###0.0E+0', 12345678900000000000000000000000, '1234.6E+28'); - t.end(); -}); - -test('Exponential: ####0.0E+0', t => { - t.format('####0.0E+0', 1.23457E-13, '123.5E-15'); - t.format('####0.0E+0', 1.23457E-12, '1234.6E-15'); - t.format('####0.0E+0', 1.23457E-11, '12345.7E-15'); - t.format('####0.0E+0', 1.23457E-10, '1.2E-10'); - t.format('####0.0E+0', 1.23457E-09, '12.3E-10'); - t.format('####0.0E+0', 1.23457E-08, '123.5E-10'); - t.format('####0.0E+0', 0.000000123457, '1234.6E-10'); - t.format('####0.0E+0', 0.00000123457, '12345.7E-10'); - t.format('####0.0E+0', 0.0000123457, '1.2E-5'); - t.format('####0.0E+0', 0.000123457, '12.3E-5'); - t.format('####0.0E+0', 0.001234568, '123.5E-5'); - t.format('####0.0E+0', 0.012345679, '1234.6E-5'); - t.format('####0.0E+0', 0.123456789, '12345.7E-5'); - t.format('####0.0E+0', 1.23456789, '1.2E+0'); - t.format('####0.0E+0', 12.3456789, '12.3E+0'); - t.format('####0.0E+0', 123.456789, '123.5E+0'); - t.format('####0.0E+0', 1234.56789, '1234.6E+0'); - t.format('####0.0E+0', 12345.6789, '12345.7E+0'); - t.format('####0.0E+0', 123456.789, '1.2E+5'); - t.format('####0.0E+0', 1234567.89, '12.3E+5'); - t.format('####0.0E+0', 12345678.9, '123.5E+5'); - t.format('####0.0E+0', 123456789, '1234.6E+5'); - t.format('####0.0E+0', 1234567890, '12345.7E+5'); - t.format('####0.0E+0', 12345678900, '1.2E+10'); - t.format('####0.0E+0', 123456789000, '12.3E+10'); - t.format('####0.0E+0', 1234567890000, '123.5E+10'); - t.format('####0.0E+0', 12345678900000, '1234.6E+10'); - t.format('####0.0E+0', 123456789000000, '12345.7E+10'); - t.format('####0.0E+0', 1234567890000000, '1.2E+15'); - t.format('####0.0E+0', 12345678900000000, '12.3E+15'); - t.format('####0.0E+0', 123456789000000000, '123.5E+15'); - t.format('####0.0E+0', 1234567890000000000, '1234.6E+15'); - t.format('####0.0E+0', 12345678900000000000, '12345.7E+15'); - t.format('####0.0E+0', 123456789000000000000, '1.2E+20'); - t.format('####0.0E+0', 1234567890000000000000, '12.3E+20'); - t.format('####0.0E+0', 12345678900000000000000, '123.5E+20'); - t.format('####0.0E+0', 123456789000000000000000, '1234.6E+20'); - t.format('####0.0E+0', 1234567890000000000000000, '12345.7E+20'); - t.format('####0.0E+0', 12345678900000000000000000, '1.2E+25'); - t.format('####0.0E+0', 123456789000000000000000000, '12.3E+25'); - t.format('####0.0E+0', 1234567890000000000000000000, '123.5E+25'); - t.format('####0.0E+0', 12345678900000000000000000000, '1234.6E+25'); - t.format('####0.0E+0', 123456789000000000000000000000, '12345.7E+25'); - t.format('####0.0E+0', 1234567890000000000000000000000, '1.2E+30'); - t.format('####0.0E+0', 12345678900000000000000000000000, '12.3E+30'); - t.end(); -}); diff --git a/test/ssf-exp.spec.ts b/test/ssf-exp.spec.ts new file mode 100644 index 0000000..37fc6de --- /dev/null +++ b/test/ssf-exp.spec.ts @@ -0,0 +1,195 @@ +// tests converted from SSF +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Exponential: #0.0E+0', () => { + expect(format('#0.0E+0', 1.23457E-13)).toBe('12.3E-14'); + expect(format('#0.0E+0', 1.23457E-12)).toBe('1.2E-12'); + expect(format('#0.0E+0', 1.23457E-11)).toBe('12.3E-12'); + expect(format('#0.0E+0', 1.23457E-10)).toBe('1.2E-10'); + expect(format('#0.0E+0', 1.23457E-09)).toBe('12.3E-10'); + expect(format('#0.0E+0', 1.23457E-08)).toBe('1.2E-8'); + expect(format('#0.0E+0', 0.000000123457)).toBe('12.3E-8'); + expect(format('#0.0E+0', 0.00000123457)).toBe('1.2E-6'); + expect(format('#0.0E+0', 0.0000123457)).toBe('12.3E-6'); + expect(format('#0.0E+0', 0.000123457)).toBe('1.2E-4'); + expect(format('#0.0E+0', 0.001234568)).toBe('12.3E-4'); + expect(format('#0.0E+0', 0.012345679)).toBe('1.2E-2'); + expect(format('#0.0E+0', 0.123456789)).toBe('12.3E-2'); + expect(format('#0.0E+0', 1.23456789)).toBe('1.2E+0'); + expect(format('#0.0E+0', 12.3456789)).toBe('12.3E+0'); + expect(format('#0.0E+0', 123.456789)).toBe('1.2E+2'); + expect(format('#0.0E+0', 1234.56789)).toBe('12.3E+2'); + expect(format('#0.0E+0', 12345.6789)).toBe('1.2E+4'); + expect(format('#0.0E+0', 123456.789)).toBe('12.3E+4'); + expect(format('#0.0E+0', 1234567.89)).toBe('1.2E+6'); + expect(format('#0.0E+0', 12345678.9)).toBe('12.3E+6'); + expect(format('#0.0E+0', 123456789)).toBe('1.2E+8'); + expect(format('#0.0E+0', 1234567890)).toBe('12.3E+8'); + expect(format('#0.0E+0', 12345678900)).toBe('1.2E+10'); + expect(format('#0.0E+0', 123456789000)).toBe('12.3E+10'); + expect(format('#0.0E+0', 1234567890000)).toBe('1.2E+12'); + expect(format('#0.0E+0', 12345678900000)).toBe('12.3E+12'); + expect(format('#0.0E+0', 123456789000000)).toBe('1.2E+14'); + expect(format('#0.0E+0', 1234567890000000)).toBe('12.3E+14'); + expect(format('#0.0E+0', 12345678900000000)).toBe('1.2E+16'); + expect(format('#0.0E+0', 123456789000000000)).toBe('12.3E+16'); + expect(format('#0.0E+0', 1234567890000000000)).toBe('1.2E+18'); + expect(format('#0.0E+0', 12345678900000000000)).toBe('12.3E+18'); + expect(format('#0.0E+0', 123456789000000000000)).toBe('1.2E+20'); + expect(format('#0.0E+0', 1234567890000000000000)).toBe('12.3E+20'); + expect(format('#0.0E+0', 12345678900000000000000)).toBe('1.2E+22'); + expect(format('#0.0E+0', 123456789000000000000000)).toBe('12.3E+22'); + expect(format('#0.0E+0', 1234567890000000000000000)).toBe('1.2E+24'); + expect(format('#0.0E+0', 12345678900000000000000000)).toBe('12.3E+24'); + expect(format('#0.0E+0', 123456789000000000000000000)).toBe('1.2E+26'); + expect(format('#0.0E+0', 1234567890000000000000000000)).toBe('12.3E+26'); + expect(format('#0.0E+0', 12345678900000000000000000000)).toBe('1.2E+28'); + expect(format('#0.0E+0', 123456789000000000000000000000)).toBe('12.3E+28'); + expect(format('#0.0E+0', 1234567890000000000000000000000)).toBe('1.2E+30'); + expect(format('#0.0E+0', 12345678900000000000000000000000)).toBe('12.3E+30'); +}); + +test('Exponential: ##0.0E+0', () => { + expect(format('##0.0E+0', 1.23457E-13)).toBe('123.5E-15'); + expect(format('##0.0E+0', 1.23457E-12)).toBe('1.2E-12'); + expect(format('##0.0E+0', 1.23457E-11)).toBe('12.3E-12'); + expect(format('##0.0E+0', 1.23457E-10)).toBe('123.5E-12'); + expect(format('##0.0E+0', 1.23457E-09)).toBe('1.2E-9'); + expect(format('##0.0E+0', 1.23457E-08)).toBe('12.3E-9'); + expect(format('##0.0E+0', 0.000000123457)).toBe('123.5E-9'); + expect(format('##0.0E+0', 0.00000123457)).toBe('1.2E-6'); + expect(format('##0.0E+0', 0.0000123457)).toBe('12.3E-6'); + expect(format('##0.0E+0', 0.000123457)).toBe('123.5E-6'); + expect(format('##0.0E+0', 0.001234568)).toBe('1.2E-3'); + expect(format('##0.0E+0', 0.012345679)).toBe('12.3E-3'); + expect(format('##0.0E+0', 0.123456789)).toBe('123.5E-3'); + expect(format('##0.0E+0', 1.23456789)).toBe('1.2E+0'); + expect(format('##0.0E+0', 12.3456789)).toBe('12.3E+0'); + expect(format('##0.0E+0', 123.456789)).toBe('123.5E+0'); + expect(format('##0.0E+0', 1234.56789)).toBe('1.2E+3'); + expect(format('##0.0E+0', 12345.6789)).toBe('12.3E+3'); + expect(format('##0.0E+0', 123456.789)).toBe('123.5E+3'); + expect(format('##0.0E+0', 1234567.89)).toBe('1.2E+6'); + expect(format('##0.0E+0', 12345678.9)).toBe('12.3E+6'); + expect(format('##0.0E+0', 123456789)).toBe('123.5E+6'); + expect(format('##0.0E+0', 1234567890)).toBe('1.2E+9'); + expect(format('##0.0E+0', 12345678900)).toBe('12.3E+9'); + expect(format('##0.0E+0', 123456789000)).toBe('123.5E+9'); + expect(format('##0.0E+0', 1234567890000)).toBe('1.2E+12'); + expect(format('##0.0E+0', 12345678900000)).toBe('12.3E+12'); + expect(format('##0.0E+0', 123456789000000)).toBe('123.5E+12'); + expect(format('##0.0E+0', 1234567890000000)).toBe('1.2E+15'); + expect(format('##0.0E+0', 12345678900000000)).toBe('12.3E+15'); + expect(format('##0.0E+0', 123456789000000000)).toBe('123.5E+15'); + expect(format('##0.0E+0', 1234567890000000000)).toBe('1.2E+18'); + expect(format('##0.0E+0', 12345678900000000000)).toBe('12.3E+18'); + expect(format('##0.0E+0', 123456789000000000000)).toBe('123.5E+18'); + expect(format('##0.0E+0', 1234567890000000000000)).toBe('1.2E+21'); + expect(format('##0.0E+0', 12345678900000000000000)).toBe('12.3E+21'); + expect(format('##0.0E+0', 123456789000000000000000)).toBe('123.5E+21'); + expect(format('##0.0E+0', 1234567890000000000000000)).toBe('1.2E+24'); + expect(format('##0.0E+0', 12345678900000000000000000)).toBe('12.3E+24'); + expect(format('##0.0E+0', 123456789000000000000000000)).toBe('123.5E+24'); + expect(format('##0.0E+0', 1234567890000000000000000000)).toBe('1.2E+27'); + expect(format('##0.0E+0', 12345678900000000000000000000)).toBe('12.3E+27'); + expect(format('##0.0E+0', 123456789000000000000000000000)).toBe('123.5E+27'); + expect(format('##0.0E+0', 1234567890000000000000000000000)).toBe('1.2E+30'); + expect(format('##0.0E+0', 12345678900000000000000000000000)).toBe('12.3E+30'); +}); + +test('Exponential: ###0.0E+0', () => { + expect(format('###0.0E+0', 1.23457E-13)).toBe('1234.6E-16'); + expect(format('###0.0E+0', 1.23457E-12)).toBe('1.2E-12'); + expect(format('###0.0E+0', 1.23457E-11)).toBe('12.3E-12'); + expect(format('###0.0E+0', 1.23457E-10)).toBe('123.5E-12'); + expect(format('###0.0E+0', 1.23457E-09)).toBe('1234.6E-12'); + expect(format('###0.0E+0', 1.23457E-08)).toBe('1.2E-8'); + expect(format('###0.0E+0', 0.000000123457)).toBe('12.3E-8'); + expect(format('###0.0E+0', 0.00000123457)).toBe('123.5E-8'); + expect(format('###0.0E+0', 0.0000123457)).toBe('1234.6E-8'); + expect(format('###0.0E+0', 0.000123457)).toBe('1.2E-4'); + expect(format('###0.0E+0', 0.001234568)).toBe('12.3E-4'); + expect(format('###0.0E+0', 0.012345679)).toBe('123.5E-4'); + expect(format('###0.0E+0', 0.123456789)).toBe('1234.6E-4'); + expect(format('###0.0E+0', 1.23456789)).toBe('1.2E+0'); + expect(format('###0.0E+0', 12.3456789)).toBe('12.3E+0'); + expect(format('###0.0E+0', 123.456789)).toBe('123.5E+0'); + expect(format('###0.0E+0', 1234.56789)).toBe('1234.6E+0'); + expect(format('###0.0E+0', 12345.6789)).toBe('1.2E+4'); + expect(format('###0.0E+0', 123456.789)).toBe('12.3E+4'); + expect(format('###0.0E+0', 1234567.89)).toBe('123.5E+4'); + expect(format('###0.0E+0', 12345678.9)).toBe('1234.6E+4'); + expect(format('###0.0E+0', 123456789)).toBe('1.2E+8'); + expect(format('###0.0E+0', 1234567890)).toBe('12.3E+8'); + expect(format('###0.0E+0', 12345678900)).toBe('123.5E+8'); + expect(format('###0.0E+0', 123456789000)).toBe('1234.6E+8'); + expect(format('###0.0E+0', 1234567890000)).toBe('1.2E+12'); + expect(format('###0.0E+0', 12345678900000)).toBe('12.3E+12'); + expect(format('###0.0E+0', 123456789000000)).toBe('123.5E+12'); + expect(format('###0.0E+0', 1234567890000000)).toBe('1234.6E+12'); + expect(format('###0.0E+0', 12345678900000000)).toBe('1.2E+16'); + expect(format('###0.0E+0', 123456789000000000)).toBe('12.3E+16'); + expect(format('###0.0E+0', 1234567890000000000)).toBe('123.5E+16'); + expect(format('###0.0E+0', 12345678900000000000)).toBe('1234.6E+16'); + expect(format('###0.0E+0', 123456789000000000000)).toBe('1.2E+20'); + expect(format('###0.0E+0', 1234567890000000000000)).toBe('12.3E+20'); + expect(format('###0.0E+0', 12345678900000000000000)).toBe('123.5E+20'); + expect(format('###0.0E+0', 123456789000000000000000)).toBe('1234.6E+20'); + expect(format('###0.0E+0', 1234567890000000000000000)).toBe('1.2E+24'); + expect(format('###0.0E+0', 12345678900000000000000000)).toBe('12.3E+24'); + expect(format('###0.0E+0', 123456789000000000000000000)).toBe('123.5E+24'); + expect(format('###0.0E+0', 1234567890000000000000000000)).toBe('1234.6E+24'); + expect(format('###0.0E+0', 12345678900000000000000000000)).toBe('1.2E+28'); + expect(format('###0.0E+0', 123456789000000000000000000000)).toBe('12.3E+28'); + expect(format('###0.0E+0', 1234567890000000000000000000000)).toBe('123.5E+28'); + expect(format('###0.0E+0', 12345678900000000000000000000000)).toBe('1234.6E+28'); +}); + +test('Exponential: ####0.0E+0', () => { + expect(format('####0.0E+0', 1.23457E-13)).toBe('123.5E-15'); + expect(format('####0.0E+0', 1.23457E-12)).toBe('1234.6E-15'); + expect(format('####0.0E+0', 1.23457E-11)).toBe('12345.7E-15'); + expect(format('####0.0E+0', 1.23457E-10)).toBe('1.2E-10'); + expect(format('####0.0E+0', 1.23457E-09)).toBe('12.3E-10'); + expect(format('####0.0E+0', 1.23457E-08)).toBe('123.5E-10'); + expect(format('####0.0E+0', 0.000000123457)).toBe('1234.6E-10'); + expect(format('####0.0E+0', 0.00000123457)).toBe('12345.7E-10'); + expect(format('####0.0E+0', 0.0000123457)).toBe('1.2E-5'); + expect(format('####0.0E+0', 0.000123457)).toBe('12.3E-5'); + expect(format('####0.0E+0', 0.001234568)).toBe('123.5E-5'); + expect(format('####0.0E+0', 0.012345679)).toBe('1234.6E-5'); + expect(format('####0.0E+0', 0.123456789)).toBe('12345.7E-5'); + expect(format('####0.0E+0', 1.23456789)).toBe('1.2E+0'); + expect(format('####0.0E+0', 12.3456789)).toBe('12.3E+0'); + expect(format('####0.0E+0', 123.456789)).toBe('123.5E+0'); + expect(format('####0.0E+0', 1234.56789)).toBe('1234.6E+0'); + expect(format('####0.0E+0', 12345.6789)).toBe('12345.7E+0'); + expect(format('####0.0E+0', 123456.789)).toBe('1.2E+5'); + expect(format('####0.0E+0', 1234567.89)).toBe('12.3E+5'); + expect(format('####0.0E+0', 12345678.9)).toBe('123.5E+5'); + expect(format('####0.0E+0', 123456789)).toBe('1234.6E+5'); + expect(format('####0.0E+0', 1234567890)).toBe('12345.7E+5'); + expect(format('####0.0E+0', 12345678900)).toBe('1.2E+10'); + expect(format('####0.0E+0', 123456789000)).toBe('12.3E+10'); + expect(format('####0.0E+0', 1234567890000)).toBe('123.5E+10'); + expect(format('####0.0E+0', 12345678900000)).toBe('1234.6E+10'); + expect(format('####0.0E+0', 123456789000000)).toBe('12345.7E+10'); + expect(format('####0.0E+0', 1234567890000000)).toBe('1.2E+15'); + expect(format('####0.0E+0', 12345678900000000)).toBe('12.3E+15'); + expect(format('####0.0E+0', 123456789000000000)).toBe('123.5E+15'); + expect(format('####0.0E+0', 1234567890000000000)).toBe('1234.6E+15'); + expect(format('####0.0E+0', 12345678900000000000)).toBe('12345.7E+15'); + expect(format('####0.0E+0', 123456789000000000000)).toBe('1.2E+20'); + expect(format('####0.0E+0', 1234567890000000000000)).toBe('12.3E+20'); + expect(format('####0.0E+0', 12345678900000000000000)).toBe('123.5E+20'); + expect(format('####0.0E+0', 123456789000000000000000)).toBe('1234.6E+20'); + expect(format('####0.0E+0', 1234567890000000000000000)).toBe('12345.7E+20'); + expect(format('####0.0E+0', 12345678900000000000000000)).toBe('1.2E+25'); + expect(format('####0.0E+0', 123456789000000000000000000)).toBe('12.3E+25'); + expect(format('####0.0E+0', 1234567890000000000000000000)).toBe('123.5E+25'); + expect(format('####0.0E+0', 12345678900000000000000000000)).toBe('1234.6E+25'); + expect(format('####0.0E+0', 123456789000000000000000000000)).toBe('12345.7E+25'); + expect(format('####0.0E+0', 1234567890000000000000000000000)).toBe('1.2E+30'); + expect(format('####0.0E+0', 12345678900000000000000000000000)).toBe('12.3E+30'); +}); diff --git a/test/ssf-fraction-test.js b/test/ssf-fraction-test.js deleted file mode 100644 index ad51d68..0000000 --- a/test/ssf-fraction-test.js +++ /dev/null @@ -1,147 +0,0 @@ -import test from './utils.js'; - -test('SSF-fractions tests', t => { - t.format('# ?/?', 1, '1 ', '# ?/?'); - t.format('# ?/?', -1.2, '-1 1/5', '# ?/?'); - t.format('# ?/?', 12.3, '12 1/3', '# ?/?'); - t.format('# ?/?', -12.34, '-12 1/3', '# ?/?'); - t.format('# ?/?', 123.45, '123 4/9', '# ?/?'); - t.format('# ?/?', -123.456, '-123 1/2', '# ?/?'); - t.format('# ?/?', 1234.567, '1234 4/7', '# ?/?'); - t.format('# ?/?', -1234.5678, '-1234 4/7', '# ?/?'); - t.format('# ?/?', 12345.6789, '12345 2/3', '# ?/?'); - t.format('# ?/?', -12345.67891, '-12345 2/3', '# ?/?'); - t.format('# ??/??', 1, '1 ', '# ??/??'); - t.format('# ??/??', -1.2, '-1 1/5 ', '# ??/??'); - t.format('# ??/??', 12.3, '12 3/10', '# ??/??'); - t.format('# ??/??', -12.34, '-12 17/50', '# ??/??'); - t.format('# ??/??', 123.45, '123 9/20', '# ??/??'); - t.format('# ??/??', -123.456, '-123 26/57', '# ??/??'); - t.format('# ??/??', 1234.567, '1234 55/97', '# ??/??'); - t.format('# ??/??', -1234.5678, '-1234 46/81', '# ??/??'); - t.format('# ??/??', 12345.6789, '12345 55/81', '# ??/??'); - t.format('# ??/??', -12345.67891, '-12345 55/81', '# ??/??'); - t.format('# ???/???', 1, '1 ', '# ???/???'); - t.format('# ???/???', -1.2, '-1 1/5 ', '# ???/???'); - t.format('# ???/???', 12.3, '12 3/10 ', '# ???/???'); - t.format('# ???/???', -12.34, '-12 17/50 ', '# ???/???'); - t.format('# ???/???', 123.45, '123 9/20 ', '# ???/???'); - t.format('# ???/???', -123.456, '-123 57/125', '# ???/???'); - t.format('# ???/???', 1234.567, '1234 55/97 ', '# ???/???'); - t.format('# ???/???', -1234.5678, '-1234 67/118', '# ???/???'); - t.format('# ???/???', 12345.6789, '12345 74/109', '# ???/???'); - t.format('# ???/???', -12345.67891, '-12345 573/844', '# ???/???'); - t.format('# ?/2', 1, '1 ', '# ?/2'); - t.format('# ?/2', -1.2, '-1 ', '# ?/2'); - t.format('# ?/2', 12.3, '12 1/2', '# ?/2'); - t.format('# ?/2', -12.34, '-12 1/2', '# ?/2'); - t.format('# ?/2', 123.45, '123 1/2', '# ?/2'); - t.format('# ?/2', -123.456, '-123 1/2', '# ?/2'); - t.format('# ?/2', 1234.567, '1234 1/2', '# ?/2'); - t.format('# ?/2', -1234.5678, '-1234 1/2', '# ?/2'); - t.format('# ?/2', 12345.6789, '12345 1/2', '# ?/2'); - t.format('# ?/2', -12345.67891, '-12345 1/2', '# ?/2'); - t.format('# ?/4', 1, '1 ', '# ?/4'); - t.format('# ?/4', -1.2, '-1 1/4', '# ?/4'); - t.format('# ?/4', 12.3, '12 1/4', '# ?/4'); - t.format('# ?/4', -12.34, '-12 1/4', '# ?/4'); - t.format('# ?/4', 123.45, '123 2/4', '# ?/4'); - t.format('# ?/4', -123.456, '-123 2/4', '# ?/4'); - t.format('# ?/4', 1234.567, '1234 2/4', '# ?/4'); - t.format('# ?/4', -1234.5678, '-1234 2/4', '# ?/4'); - t.format('# ?/4', 12345.6789, '12345 3/4', '# ?/4'); - t.format('# ?/4', -12345.67891, '-12345 3/4', '# ?/4'); - t.format('# ?/8', 1, '1 ', '# ?/8'); - t.format('# ?/8', -1.2, '-1 2/8', '# ?/8'); - t.format('# ?/8', 12.3, '12 2/8', '# ?/8'); - t.format('# ?/8', -12.34, '-12 3/8', '# ?/8'); - t.format('# ?/8', 123.45, '123 4/8', '# ?/8'); - t.format('# ?/8', -123.456, '-123 4/8', '# ?/8'); - t.format('# ?/8', 1234.567, '1234 5/8', '# ?/8'); - t.format('# ?/8', -1234.5678, '-1234 5/8', '# ?/8'); - t.format('# ?/8', 12345.6789, '12345 5/8', '# ?/8'); - t.format('# ?/8', -12345.67891, '-12345 5/8', '# ?/8'); - t.format('# ??/16', 1, '1 ', '# ??/16'); - t.format('# ??/16', -1.2, '-1 3/16', '# ??/16'); - t.format('# ??/16', 12.3, '12 5/16', '# ??/16'); - t.format('# ??/16', -12.34, '-12 5/16', '# ??/16'); - t.format('# ??/16', 123.45, '123 7/16', '# ??/16'); - t.format('# ??/16', -123.456, '-123 7/16', '# ??/16'); - t.format('# ??/16', 1234.567, '1234 9/16', '# ??/16'); - t.format('# ??/16', -1234.5678, '-1234 9/16', '# ??/16'); - t.format('# ??/16', 12345.6789, '12345 11/16', '# ??/16'); - t.format('# ??/16', -12345.67891, '-12345 11/16', '# ??/16'); - t.format('# ?/10', 1, '1 ', '# ?/10'); - t.format('# ?/10', -1.2, '-1 2/10', '# ?/10'); - t.format('# ?/10', 12.3, '12 3/10', '# ?/10'); - t.format('# ?/10', -12.34, '-12 3/10', '# ?/10'); - t.format('# ?/10', 123.45, '123 5/10', '# ?/10'); - t.format('# ?/10', -123.456, '-123 5/10', '# ?/10'); - t.format('# ?/10', 1234.567, '1234 6/10', '# ?/10'); - t.format('# ?/10', -1234.5678, '-1234 6/10', '# ?/10'); - t.format('# ?/10', 12345.6789, '12345 7/10', '# ?/10'); - t.format('# ?/10', -12345.67891, '-12345 7/10', '# ?/10'); - t.format('# ??/100', 1, '1 ', '# ??/100'); - t.format('# ??/100', -1.2, '-1 20/100', '# ??/100'); - t.format('# ??/100', 12.3, '12 30/100', '# ??/100'); - t.format('# ??/100', -12.34, '-12 34/100', '# ??/100'); - t.format('# ??/100', 123.45, '123 45/100', '# ??/100'); - t.format('# ??/100', -123.456, '-123 46/100', '# ??/100'); - t.format('# ??/100', 1234.567, '1234 57/100', '# ??/100'); - t.format('# ??/100', -1234.5678, '-1234 57/100', '# ??/100'); - t.format('# ??/100', 12345.6789, '12345 68/100', '# ??/100'); - t.format('# ??/100', -12345.67891, '-12345 68/100', '# ??/100'); - t.format('??/??', 1, ' 1/1 ', '??/??'); - t.format('??/??', -1.2, '- 6/5 ', '??/??'); - t.format('??/??', 12.3, '123/10', '??/??'); - t.format('??/??', -12.34, '-617/50', '??/??'); - t.format('??/??', 123.45, '2469/20', '??/??'); - t.format('??/??', -123.456, '-7037/57', '??/??'); - t.format('??/??', 1234.567, '119753/97', '??/??'); - t.format('??/??', -1234.5678, '-100000/81', '??/??'); - t.format('??/??', 12345.6789, '1000000/81', '??/??'); - t.format('??/??', -12345.67891, '-1000000/81', '??/??'); - t.format('# ?/?', 0.3, ' 2/7', '# ?/?'); - t.format('# ?/?', 1.3, '1 1/3', '# ?/?'); - t.format('# ?/?', 2.3, '2 2/7', '# ?/?'); - t.format('# ??/?????????', 0.123251512342345, ' 480894/3901729 ', '# ??/?????????'); - t.format('# ?? / ?????????', 0.123251512342345, ' 480894 / 3901729 ', '# ?? / ?????????'); - t.format('0', 0, '0', '0'); - - t.end(); -}); - -test('More fraction cases', t => { - t.formatInvalid('0/'); - t.formatInvalid('/0'); - t.formatInvalid('/'); - - t.format('0/0', 0, '0/1'); - t.format('0/0', 1, '1/1'); - t.format('0/0', 123, '123/1'); - t.format('0/0', 12.345, '37/3'); - t.format('0 0/0', 0, '0 0/1'); - t.format('0 0/0', 1, '1 0/1'); - t.format('0 0/0', 123, '123 0/1'); - t.format('0 0/0', 12.345, '12 1/3'); - - t.format('?/?', 0, '0/1'); - t.format('?/?', 1, '1/1'); - t.format('?/?', 123, '123/1'); - t.format('?/?', 12.345, '37/3'); - t.format('? ?/?', 0, '0 '); - t.format('? ?/?', 1, '1 '); - t.format('? ?/?', 123, '123 '); - t.format('? ?/?', 12.345, '12 1/3'); - - t.format('#/#', 0, '0/1'); - t.format('#/#', 1, '1/1'); - t.format('#/#', 123, '123/1'); - t.format('#/#', 12.345, '37/3'); - t.format('# #/#', 0, '0'); - t.format('# #/#', 1, '1'); - t.format('# #/#', 123, '123'); - t.format('# #/#', 12.345, '12 1/3'); - - t.end(); -}); diff --git a/test/ssf-fraction.spec.ts b/test/ssf-fraction.spec.ts new file mode 100644 index 0000000..3bace79 --- /dev/null +++ b/test/ssf-fraction.spec.ts @@ -0,0 +1,144 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('SSF-fractions tests', () => { + expect(format('# ?/?', 1, '# ?/?')).toBe('1 '); + expect(format('# ?/?', -1.2, '# ?/?')).toBe('-1 1/5'); + expect(format('# ?/?', 12.3, '# ?/?')).toBe('12 1/3'); + expect(format('# ?/?', -12.34, '# ?/?')).toBe('-12 1/3'); + expect(format('# ?/?', 123.45, '# ?/?')).toBe('123 4/9'); + expect(format('# ?/?', -123.456, '# ?/?')).toBe('-123 1/2'); + expect(format('# ?/?', 1234.567, '# ?/?')).toBe('1234 4/7'); + expect(format('# ?/?', -1234.5678, '# ?/?')).toBe('-1234 4/7'); + expect(format('# ?/?', 12345.6789, '# ?/?')).toBe('12345 2/3'); + expect(format('# ?/?', -12345.67891, '# ?/?')).toBe('-12345 2/3'); + expect(format('# ??/??', 1, '# ??/??')).toBe('1 '); + expect(format('# ??/??', -1.2, '# ??/??')).toBe('-1 1/5 '); + expect(format('# ??/??', 12.3, '# ??/??')).toBe('12 3/10'); + expect(format('# ??/??', -12.34, '# ??/??')).toBe('-12 17/50'); + expect(format('# ??/??', 123.45, '# ??/??')).toBe('123 9/20'); + expect(format('# ??/??', -123.456, '# ??/??')).toBe('-123 26/57'); + expect(format('# ??/??', 1234.567, '# ??/??')).toBe('1234 55/97'); + expect(format('# ??/??', -1234.5678, '# ??/??')).toBe('-1234 46/81'); + expect(format('# ??/??', 12345.6789, '# ??/??')).toBe('12345 55/81'); + expect(format('# ??/??', -12345.67891, '# ??/??')).toBe('-12345 55/81'); + expect(format('# ???/???', 1, '# ???/???')).toBe('1 '); + expect(format('# ???/???', -1.2, '# ???/???')).toBe('-1 1/5 '); + expect(format('# ???/???', 12.3, '# ???/???')).toBe('12 3/10 '); + expect(format('# ???/???', -12.34, '# ???/???')).toBe('-12 17/50 '); + expect(format('# ???/???', 123.45, '# ???/???')).toBe('123 9/20 '); + expect(format('# ???/???', -123.456, '# ???/???')).toBe('-123 57/125'); + expect(format('# ???/???', 1234.567, '# ???/???')).toBe('1234 55/97 '); + expect(format('# ???/???', -1234.5678, '# ???/???')).toBe('-1234 67/118'); + expect(format('# ???/???', 12345.6789, '# ???/???')).toBe('12345 74/109'); + expect(format('# ???/???', -12345.67891, '# ???/???')).toBe('-12345 573/844'); + expect(format('# ?/2', 1, '# ?/2')).toBe('1 '); + expect(format('# ?/2', -1.2, '# ?/2')).toBe('-1 '); + expect(format('# ?/2', 12.3, '# ?/2')).toBe('12 1/2'); + expect(format('# ?/2', -12.34, '# ?/2')).toBe('-12 1/2'); + expect(format('# ?/2', 123.45, '# ?/2')).toBe('123 1/2'); + expect(format('# ?/2', -123.456, '# ?/2')).toBe('-123 1/2'); + expect(format('# ?/2', 1234.567, '# ?/2')).toBe('1234 1/2'); + expect(format('# ?/2', -1234.5678, '# ?/2')).toBe('-1234 1/2'); + expect(format('# ?/2', 12345.6789, '# ?/2')).toBe('12345 1/2'); + expect(format('# ?/2', -12345.67891, '# ?/2')).toBe('-12345 1/2'); + expect(format('# ?/4', 1, '# ?/4')).toBe('1 '); + expect(format('# ?/4', -1.2, '# ?/4')).toBe('-1 1/4'); + expect(format('# ?/4', 12.3, '# ?/4')).toBe('12 1/4'); + expect(format('# ?/4', -12.34, '# ?/4')).toBe('-12 1/4'); + expect(format('# ?/4', 123.45, '# ?/4')).toBe('123 2/4'); + expect(format('# ?/4', -123.456, '# ?/4')).toBe('-123 2/4'); + expect(format('# ?/4', 1234.567, '# ?/4')).toBe('1234 2/4'); + expect(format('# ?/4', -1234.5678, '# ?/4')).toBe('-1234 2/4'); + expect(format('# ?/4', 12345.6789, '# ?/4')).toBe('12345 3/4'); + expect(format('# ?/4', -12345.67891, '# ?/4')).toBe('-12345 3/4'); + expect(format('# ?/8', 1, '# ?/8')).toBe('1 '); + expect(format('# ?/8', -1.2, '# ?/8')).toBe('-1 2/8'); + expect(format('# ?/8', 12.3, '# ?/8')).toBe('12 2/8'); + expect(format('# ?/8', -12.34, '# ?/8')).toBe('-12 3/8'); + expect(format('# ?/8', 123.45, '# ?/8')).toBe('123 4/8'); + expect(format('# ?/8', -123.456, '# ?/8')).toBe('-123 4/8'); + expect(format('# ?/8', 1234.567, '# ?/8')).toBe('1234 5/8'); + expect(format('# ?/8', -1234.5678, '# ?/8')).toBe('-1234 5/8'); + expect(format('# ?/8', 12345.6789, '# ?/8')).toBe('12345 5/8'); + expect(format('# ?/8', -12345.67891, '# ?/8')).toBe('-12345 5/8'); + expect(format('# ??/16', 1, '# ??/16')).toBe('1 '); + expect(format('# ??/16', -1.2, '# ??/16')).toBe('-1 3/16'); + expect(format('# ??/16', 12.3, '# ??/16')).toBe('12 5/16'); + expect(format('# ??/16', -12.34, '# ??/16')).toBe('-12 5/16'); + expect(format('# ??/16', 123.45, '# ??/16')).toBe('123 7/16'); + expect(format('# ??/16', -123.456, '# ??/16')).toBe('-123 7/16'); + expect(format('# ??/16', 1234.567, '# ??/16')).toBe('1234 9/16'); + expect(format('# ??/16', -1234.5678, '# ??/16')).toBe('-1234 9/16'); + expect(format('# ??/16', 12345.6789, '# ??/16')).toBe('12345 11/16'); + expect(format('# ??/16', -12345.67891, '# ??/16')).toBe('-12345 11/16'); + expect(format('# ?/10', 1, '# ?/10')).toBe('1 '); + expect(format('# ?/10', -1.2, '# ?/10')).toBe('-1 2/10'); + expect(format('# ?/10', 12.3, '# ?/10')).toBe('12 3/10'); + expect(format('# ?/10', -12.34, '# ?/10')).toBe('-12 3/10'); + expect(format('# ?/10', 123.45, '# ?/10')).toBe('123 5/10'); + expect(format('# ?/10', -123.456, '# ?/10')).toBe('-123 5/10'); + expect(format('# ?/10', 1234.567, '# ?/10')).toBe('1234 6/10'); + expect(format('# ?/10', -1234.5678, '# ?/10')).toBe('-1234 6/10'); + expect(format('# ?/10', 12345.6789, '# ?/10')).toBe('12345 7/10'); + expect(format('# ?/10', -12345.67891, '# ?/10')).toBe('-12345 7/10'); + expect(format('# ??/100', 1, '# ??/100')).toBe('1 '); + expect(format('# ??/100', -1.2, '# ??/100')).toBe('-1 20/100'); + expect(format('# ??/100', 12.3, '# ??/100')).toBe('12 30/100'); + expect(format('# ??/100', -12.34, '# ??/100')).toBe('-12 34/100'); + expect(format('# ??/100', 123.45, '# ??/100')).toBe('123 45/100'); + expect(format('# ??/100', -123.456, '# ??/100')).toBe('-123 46/100'); + expect(format('# ??/100', 1234.567, '# ??/100')).toBe('1234 57/100'); + expect(format('# ??/100', -1234.5678, '# ??/100')).toBe('-1234 57/100'); + expect(format('# ??/100', 12345.6789, '# ??/100')).toBe('12345 68/100'); + expect(format('# ??/100', -12345.67891, '# ??/100')).toBe('-12345 68/100'); + expect(format('??/??', 1, '??/??')).toBe(' 1/1 '); + expect(format('??/??', -1.2, '??/??')).toBe('- 6/5 '); + expect(format('??/??', 12.3, '??/??')).toBe('123/10'); + expect(format('??/??', -12.34, '??/??')).toBe('-617/50'); + expect(format('??/??', 123.45, '??/??')).toBe('2469/20'); + expect(format('??/??', -123.456, '??/??')).toBe('-7037/57'); + expect(format('??/??', 1234.567, '??/??')).toBe('119753/97'); + expect(format('??/??', -1234.5678, '??/??')).toBe('-100000/81'); + expect(format('??/??', 12345.6789, '??/??')).toBe('1000000/81'); + expect(format('??/??', -12345.67891, '??/??')).toBe('-1000000/81'); + expect(format('# ?/?', 0.3, '# ?/?')).toBe(' 2/7'); + expect(format('# ?/?', 1.3, '# ?/?')).toBe('1 1/3'); + expect(format('# ?/?', 2.3, '# ?/?')).toBe('2 2/7'); + expect(format('# ??/?????????', 0.123251512342345, '# ??/?????????')).toBe(' 480894/3901729 '); + expect(format('# ?? / ?????????', 0.123251512342345, '# ?? / ?????????')).toBe(' 480894 / 3901729 '); + expect(format('0', 0, '0')).toBe('0'); +}); + +test('More fraction cases', () => { + expect(() => format('0/', '')).toThrow(); + expect(() => format('/0', '')).toThrow(); + expect(() => format('/', '')).toThrow(); + + expect(format('0/0', 0)).toBe('0/1'); + expect(format('0/0', 1)).toBe('1/1'); + expect(format('0/0', 123)).toBe('123/1'); + expect(format('0/0', 12.345)).toBe('37/3'); + expect(format('0 0/0', 0)).toBe('0 0/1'); + expect(format('0 0/0', 1)).toBe('1 0/1'); + expect(format('0 0/0', 123)).toBe('123 0/1'); + expect(format('0 0/0', 12.345)).toBe('12 1/3'); + + expect(format('?/?', 0)).toBe('0/1'); + expect(format('?/?', 1)).toBe('1/1'); + expect(format('?/?', 123)).toBe('123/1'); + expect(format('?/?', 12.345)).toBe('37/3'); + expect(format('? ?/?', 0)).toBe('0 '); + expect(format('? ?/?', 1)).toBe('1 '); + expect(format('? ?/?', 123)).toBe('123 '); + expect(format('? ?/?', 12.345)).toBe('12 1/3'); + + expect(format('#/#', 0)).toBe('0/1'); + expect(format('#/#', 1)).toBe('1/1'); + expect(format('#/#', 123)).toBe('123/1'); + expect(format('#/#', 12.345)).toBe('37/3'); + expect(format('# #/#', 0)).toBe('0'); + expect(format('# #/#', 1)).toBe('1'); + expect(format('# #/#', 123)).toBe('123'); + expect(format('# #/#', 12.345)).toBe('12 1/3'); +}); diff --git a/test/ssf-general-test.js b/test/ssf-general-test.js deleted file mode 100644 index afb720d..0000000 --- a/test/ssf-general-test.js +++ /dev/null @@ -1,520 +0,0 @@ -// tests converted from SSF -import test from './utils.js'; - -test('General format', t => { - t.format('General', 1.234567e-14, '1.23457E-14'); - t.format('General', 1.234567e-13, '1.23457E-13'); - t.format('General', 1.234567e-12, '1.23457E-12'); - t.format('General', 1.234567e-11, '1.23457E-11'); - t.format('General', 1.234567e-10, '1.23457E-10'); - t.format('General', 1.234567e-9, '1.23457E-09'); - t.format('General', 1.234567e-8, '1.23457E-08'); - t.format('General', 1.234567e-7, '1.23457E-07'); - t.format('General', 0.000001234567, '1.23457E-06'); - t.format('General', 0.00001234567, '1.23457E-05'); - t.format('General', 0.0001234567, '0.000123457'); - t.format('General', 0.001234567, '0.001234567'); - t.format('General', 0.01234567, '0.01234567'); - t.format('General', 0.1234567, '0.1234567'); - t.format('General', 1.234567, '1.234567'); - t.format('General', 12.34567, '12.34567'); - t.format('General', 123.4567, '123.4567'); - t.format('General', 1234.567, '1234.567'); - t.format('General', 12345.67, '12345.67'); - t.format('General', 123456.7, '123456.7'); - t.format('General', 1234567, '1234567'); - t.format('General', 12345670, '12345670'); - t.format('General', 123456700, '123456700'); - t.format('General', 1234567000, '1234567000'); - t.format('General', 12345670000, '12345670000'); - t.format('General', 123456700000, '1.23457E+11'); - t.format('General', 1234567000000, '1.23457E+12'); - t.format('General', 12345670000000, '1.23457E+13'); - t.format('General', 123456700000000, '1.23457E+14'); - t.format('General', 1e-14, '1E-14'); - t.format('General', 1e-13, '1E-13'); - t.format('General', 1e-12, '1E-12'); - t.format('General', 1e-11, '1E-11'); - t.format('General', 1e-10, '1E-10'); - t.format('General', 1e-9, '0.000000001'); - t.format('General', 1e-8, '0.00000001'); - t.format('General', 1e-7, '0.0000001'); - t.format('General', 0.000001, '0.000001'); - t.format('General', 0.00001, '0.00001'); - t.format('General', 0.0001, '0.0001'); - t.format('General', 0.001, '0.001'); - t.format('General', 0.01, '0.01'); - t.format('General', 0.1, '0.1'); - t.format('General', 1, '1'); - t.format('General', 10, '10'); - t.format('General', 100, '100'); - t.format('General', 1000, '1000'); - t.format('General', 10000, '10000'); - t.format('General', 100000, '100000'); - t.format('General', 1000000, '1000000'); - t.format('General', 10000000, '10000000'); - t.format('General', 100000000, '100000000'); - t.format('General', 1000000000, '1000000000'); - t.format('General', 10000000000, '10000000000'); - t.format('General', 100000000000, '1E+11'); - t.format('General', 1000000000000, '1E+12'); - t.format('General', 10000000000000, '1E+13'); - t.format('General', 100000000000000, '1E+14'); - t.format('General', 1.2e-14, '1.2E-14'); - t.format('General', 1.2e-13, '1.2E-13'); - t.format('General', 1.2e-12, '1.2E-12'); - t.format('General', 1.2e-11, '1.2E-11'); - t.format('General', 1.2e-10, '1.2E-10'); - t.format('General', 1.2e-9, '1.2E-09'); - t.format('General', 1.2e-8, '0.000000012'); - t.format('General', 1.2e-7, '0.00000012'); - t.format('General', 0.0000012, '0.0000012'); - t.format('General', 0.000012, '0.000012'); - t.format('General', 0.00012, '0.00012'); - t.format('General', 0.0012, '0.0012'); - t.format('General', 0.012, '0.012'); - t.format('General', 0.12, '0.12'); - t.format('General', 1.2, '1.2'); - t.format('General', 12, '12'); - t.format('General', 120, '120'); - t.format('General', 1200, '1200'); - t.format('General', 12000, '12000'); - t.format('General', 120000, '120000'); - t.format('General', 1200000, '1200000'); - t.format('General', 12000000, '12000000'); - t.format('General', 120000000, '120000000'); - t.format('General', 1200000000, '1200000000'); - t.format('General', 12000000000, '12000000000'); - t.format('General', 120000000000, '1.2E+11'); - t.format('General', 1200000000000, '1.2E+12'); - t.format('General', 12000000000000, '1.2E+13'); - t.format('General', 120000000000000, '1.2E+14'); - t.format('General', 1.23e-14, '1.23E-14'); - t.format('General', 1.23e-13, '1.23E-13'); - t.format('General', 1.23e-12, '1.23E-12'); - t.format('General', 1.23e-11, '1.23E-11'); - t.format('General', 1.23e-10, '1.23E-10'); - t.format('General', 1.23e-9, '1.23E-09'); - t.format('General', 1.23e-8, '1.23E-08'); - t.format('General', 1.23e-7, '0.000000123'); - t.format('General', 0.00000123, '0.00000123'); - t.format('General', 0.0000123, '0.0000123'); - t.format('General', 0.000123, '0.000123'); - t.format('General', 0.00123, '0.00123'); - t.format('General', 0.0123, '0.0123'); - t.format('General', 0.123, '0.123'); - t.format('General', 1.23, '1.23'); - t.format('General', 12.3, '12.3'); - t.format('General', 123, '123'); - t.format('General', 1230, '1230'); - t.format('General', 12300, '12300'); - t.format('General', 123000, '123000'); - t.format('General', 1230000, '1230000'); - t.format('General', 12300000, '12300000'); - t.format('General', 123000000, '123000000'); - t.format('General', 1230000000, '1230000000'); - t.format('General', 12300000000, '12300000000'); - t.format('General', 123000000000, '1.23E+11'); - t.format('General', 1230000000000, '1.23E+12'); - t.format('General', 12300000000000, '1.23E+13'); - t.format('General', 123000000000000, '1.23E+14'); - t.format('General', 1.234e-14, '1.234E-14'); - t.format('General', 1.234e-13, '1.234E-13'); - t.format('General', 1.234e-12, '1.234E-12'); - t.format('General', 1.234e-11, '1.234E-11'); - t.format('General', 1.234e-10, '1.234E-10'); - t.format('General', 1.234e-9, '1.234E-09'); - t.format('General', 1.234e-8, '1.234E-08'); - t.format('General', 1.234e-7, '1.234E-07'); - t.format('General', 0.000001234, '0.000001234'); - t.format('General', 0.00001234, '0.00001234'); - t.format('General', 0.0001234, '0.0001234'); - t.format('General', 0.001234, '0.001234'); - t.format('General', 0.01234, '0.01234'); - t.format('General', 0.1234, '0.1234'); - t.format('General', 1.234, '1.234'); - t.format('General', 12.34, '12.34'); - t.format('General', 123.4, '123.4'); - t.format('General', 1234, '1234'); - t.format('General', 12340, '12340'); - t.format('General', 123400, '123400'); - t.format('General', 1234000, '1234000'); - t.format('General', 12340000, '12340000'); - t.format('General', 123400000, '123400000'); - t.format('General', 1234000000, '1234000000'); - t.format('General', 12340000000, '12340000000'); - t.format('General', 123400000000, '1.234E+11'); - t.format('General', 1234000000000, '1.234E+12'); - t.format('General', 12340000000000, '1.234E+13'); - t.format('General', 123400000000000, '1.234E+14'); - t.format('General', 1.2345e-14, '1.2345E-14'); - t.format('General', 1.2345e-13, '1.2345E-13'); - t.format('General', 1.2345e-12, '1.2345E-12'); - t.format('General', 1.2345e-11, '1.2345E-11'); - t.format('General', 1.2345e-10, '1.2345E-10'); - t.format('General', 1.2345e-9, '1.2345E-09'); - t.format('General', 1.2345e-8, '1.2345E-08'); - t.format('General', 1.2345e-7, '1.2345E-07'); - t.format('General', 0.0000012345, '1.2345E-06'); - t.format('General', 0.000012345, '0.000012345'); - t.format('General', 0.00012345, '0.00012345'); - t.format('General', 0.0012345, '0.0012345'); - t.format('General', 0.012345, '0.012345'); - t.format('General', 0.12345, '0.12345'); - t.format('General', 1.2345, '1.2345'); - t.format('General', 12.345, '12.345'); - t.format('General', 123.45, '123.45'); - t.format('General', 1234.5, '1234.5'); - t.format('General', 12345, '12345'); - t.format('General', 123450, '123450'); - t.format('General', 1234500, '1234500'); - t.format('General', 12345000, '12345000'); - t.format('General', 123450000, '123450000'); - t.format('General', 1234500000, '1234500000'); - t.format('General', 12345000000, '12345000000'); - t.format('General', 123450000000, '1.2345E+11'); - t.format('General', 1234500000000, '1.2345E+12'); - t.format('General', 12345000000000, '1.2345E+13'); - t.format('General', 123450000000000, '1.2345E+14'); - t.format('General', 1.23456e-14, '1.23456E-14'); - t.format('General', 1.23456e-13, '1.23456E-13'); - t.format('General', 1.23456e-12, '1.23456E-12'); - t.format('General', 1.23456e-11, '1.23456E-11'); - t.format('General', 1.23456e-10, '1.23456E-10'); - t.format('General', 1.23456e-9, '1.23456E-09'); - t.format('General', 1.23456e-8, '1.23456E-08'); - t.format('General', 1.23456e-7, '1.23456E-07'); - t.format('General', 0.00000123456, '1.23456E-06'); - t.format('General', 0.0000123456, '1.23456E-05'); - t.format('General', 0.000123456, '0.000123456'); - t.format('General', 0.00123456, '0.00123456'); - t.format('General', 0.0123456, '0.0123456'); - t.format('General', 0.123456, '0.123456'); - t.format('General', 1.23456, '1.23456'); - t.format('General', 12.3456, '12.3456'); - t.format('General', 123.456, '123.456'); - t.format('General', 1234.56, '1234.56'); - t.format('General', 12345.6, '12345.6'); - t.format('General', 123456, '123456'); - t.format('General', 1234560, '1234560'); - t.format('General', 12345600, '12345600'); - t.format('General', 123456000, '123456000'); - t.format('General', 1234560000, '1234560000'); - t.format('General', 12345600000, '12345600000'); - t.format('General', 123456000000, '1.23456E+11'); - t.format('General', 1234560000000, '1.23456E+12'); - t.format('General', 12345600000000, '1.23456E+13'); - t.format('General', 123456000000000, '1.23456E+14'); - t.format('General', 1.234567e-14, '1.23457E-14'); - t.format('General', 1.234567e-13, '1.23457E-13'); - t.format('General', 1.234567e-12, '1.23457E-12'); - t.format('General', 1.234567e-11, '1.23457E-11'); - t.format('General', 1.234567e-10, '1.23457E-10'); - t.format('General', 1.234567e-9, '1.23457E-09'); - t.format('General', 1.234567e-8, '1.23457E-08'); - t.format('General', 1.234567e-7, '1.23457E-07'); - t.format('General', 0.000001234567, '1.23457E-06'); - t.format('General', 0.00001234567, '1.23457E-05'); - t.format('General', 0.0001234567, '0.000123457'); - t.format('General', 0.001234567, '0.001234567'); - t.format('General', 0.01234567, '0.01234567'); - t.format('General', 0.1234567, '0.1234567'); - t.format('General', 1.234567, '1.234567'); - t.format('General', 12.34567, '12.34567'); - t.format('General', 123.4567, '123.4567'); - t.format('General', 1234.567, '1234.567'); - t.format('General', 12345.67, '12345.67'); - t.format('General', 123456.7, '123456.7'); - t.format('General', 1234567, '1234567'); - t.format('General', 12345670, '12345670'); - t.format('General', 123456700, '123456700'); - t.format('General', 1234567000, '1234567000'); - t.format('General', 12345670000, '12345670000'); - t.format('General', 123456700000, '1.23457E+11'); - t.format('General', 1234567000000, '1.23457E+12'); - t.format('General', 12345670000000, '1.23457E+13'); - t.format('General', 123456700000000, '1.23457E+14'); - t.format('General', 1.2345678e-14, '1.23457E-14'); - t.format('General', 1.2345678e-13, '1.23457E-13'); - t.format('General', 1.2345678e-12, '1.23457E-12'); - t.format('General', 1.2345678e-11, '1.23457E-11'); - t.format('General', 1.2345678e-10, '1.23457E-10'); - t.format('General', 1.2345678e-9, '1.23457E-09'); - t.format('General', 1.2345678e-8, '1.23457E-08'); - t.format('General', 1.2345678e-7, '1.23457E-07'); - t.format('General', 0.0000012345678, '1.23457E-06'); - t.format('General', 0.000012345678, '1.23457E-05'); - t.format('General', 0.00012345678, '0.000123457'); - t.format('General', 0.0012345678, '0.001234568'); - t.format('General', 0.012345678, '0.012345678'); - t.format('General', 0.12345678, '0.12345678'); - t.format('General', 1.2345678, '1.2345678'); - t.format('General', 12.345678, '12.345678'); - t.format('General', 123.45678, '123.45678'); - t.format('General', 1234.5678, '1234.5678'); - t.format('General', 12345.678, '12345.678'); - t.format('General', 123456.78, '123456.78'); - t.format('General', 1234567.8, '1234567.8'); - t.format('General', 12345678, '12345678'); - t.format('General', 123456780, '123456780'); - t.format('General', 1234567800, '1234567800'); - t.format('General', 12345678000, '12345678000'); - t.format('General', 123456780000, '1.23457E+11'); - t.format('General', 1234567800000, '1.23457E+12'); - t.format('General', 12345678000000, '1.23457E+13'); - t.format('General', 123456780000000, '1.23457E+14'); - t.format('General', 1.23456789e-14, '1.23457E-14'); - t.format('General', 1.23456789e-13, '1.23457E-13'); - t.format('General', 1.23456789e-12, '1.23457E-12'); - t.format('General', 1.23456789e-11, '1.23457E-11'); - t.format('General', 1.23456789e-10, '1.23457E-10'); - t.format('General', 1.23456789e-9, '1.23457E-09'); - t.format('General', 1.23456789e-8, '1.23457E-08'); - t.format('General', 1.23456789e-7, '1.23457E-07'); - t.format('General', 0.00000123456789, '1.23457E-06'); - t.format('General', 0.0000123456789, '1.23457E-05'); - t.format('General', 0.000123456789, '0.000123457'); - t.format('General', 0.00123456789, '0.001234568'); - t.format('General', 0.0123456789, '0.012345679'); - t.format('General', 0.123456789, '0.123456789'); - t.format('General', 1.23456789, '1.23456789'); - t.format('General', 12.3456789, '12.3456789'); - t.format('General', 123.456789, '123.456789'); - t.format('General', 1234.56789, '1234.56789'); - t.format('General', 12345.6789, '12345.6789'); - t.format('General', 123456.789, '123456.789'); - t.format('General', 1234567.89, '1234567.89'); - t.format('General', 12345678.9, '12345678.9'); - t.format('General', 123456789, '123456789'); - t.format('General', 1234567890, '1234567890'); - t.format('General', 12345678900, '12345678900'); - t.format('General', 123456789000, '1.23457E+11'); - t.format('General', 1234567890000, '1.23457E+12'); - t.format('General', 12345678900000, '1.23457E+13'); - t.format('General', 123456789000000, '1.23457E+14'); - t.format('General', 1.234567891e-14, '1.23457E-14'); - t.format('General', 1.234567891e-13, '1.23457E-13'); - t.format('General', 1.234567891e-12, '1.23457E-12'); - t.format('General', 1.234567891e-11, '1.23457E-11'); - t.format('General', 1.234567891e-10, '1.23457E-10'); - t.format('General', 1.234567891e-9, '1.23457E-09'); - t.format('General', 1.234567891e-8, '1.23457E-08'); - t.format('General', 1.234567891e-7, '1.23457E-07'); - t.format('General', 0.000001234567891, '1.23457E-06'); - t.format('General', 0.00001234567891, '1.23457E-05'); - t.format('General', 0.0001234567891, '0.000123457'); - t.format('General', 0.001234567891, '0.001234568'); - t.format('General', 0.01234567891, '0.012345679'); - t.format('General', 0.1234567891, '0.123456789'); - t.format('General', 1.234567891, '1.234567891'); - t.format('General', 12.34567891, '12.34567891'); - t.format('General', 123.4567891, '123.4567891'); - t.format('General', 1234.567891, '1234.567891'); - t.format('General', 12345.67891, '12345.67891'); - t.format('General', 123456.7891, '123456.7891'); - t.format('General', 1234567.891, '1234567.891'); - t.format('General', 12345678.91, '12345678.91'); - t.format('General', 123456789.1, '123456789.1'); - t.format('General', 1234567891, '1234567891'); - t.format('General', 12345678910, '12345678910'); - t.format('General', 123456789100, '1.23457E+11'); - t.format('General', 1234567891000, '1.23457E+12'); - t.format('General', 12345678910000, '1.23457E+13'); - t.format('General', 123456789100000, '1.23457E+14'); - t.format('General', 1.2345678912e-14, '1.23457E-14'); - t.format('General', 1.2345678912e-13, '1.23457E-13'); - t.format('General', 1.2345678912e-12, '1.23457E-12'); - t.format('General', 1.2345678912e-11, '1.23457E-11'); - t.format('General', 1.2345678912e-10, '1.23457E-10'); - t.format('General', 1.2345678912e-9, '1.23457E-09'); - t.format('General', 1.2345678912e-8, '1.23457E-08'); - t.format('General', 1.2345678912e-7, '1.23457E-07'); - t.format('General', 0.0000012345678912, '1.23457E-06'); - t.format('General', 0.000012345678912, '1.23457E-05'); - t.format('General', 0.00012345678912, '0.000123457'); - t.format('General', 0.0012345678912, '0.001234568'); - t.format('General', 0.012345678912, '0.012345679'); - t.format('General', 0.12345678912, '0.123456789'); - t.format('General', 1.2345678912, '1.234567891'); - t.format('General', 12.345678912, '12.34567891'); - t.format('General', 123.45678912, '123.4567891'); - t.format('General', 1234.5678912, '1234.567891'); - t.format('General', 12345.678912, '12345.67891'); - t.format('General', 123456.78912, '123456.7891'); - t.format('General', 1234567.8912, '1234567.891'); - t.format('General', 12345678.912, '12345678.91'); - t.format('General', 123456789.12, '123456789.1'); - t.format('General', 1234567891.2, '1234567891'); - t.format('General', 12345678912, '12345678912'); - t.format('General', 123456789120, '1.23457E+11'); - t.format('General', 1234567891200, '1.23457E+12'); - t.format('General', 12345678912000, '1.23457E+13'); - t.format('General', 123456789120000, '1.23457E+14'); - t.format('General', 1.23456789123e-14, '1.23457E-14'); - t.format('General', 1.23456789123e-13, '1.23457E-13'); - t.format('General', 1.23456789123e-12, '1.23457E-12'); - t.format('General', 1.23456789123e-11, '1.23457E-11'); - t.format('General', 1.23456789123e-10, '1.23457E-10'); - t.format('General', 1.23456789123e-9, '1.23457E-09'); - t.format('General', 1.23456789123e-8, '1.23457E-08'); - t.format('General', 1.23456789123e-7, '1.23457E-07'); - t.format('General', 0.00000123456789123, '1.23457E-06'); - t.format('General', 0.0000123456789123, '1.23457E-05'); - t.format('General', 0.000123456789123, '0.000123457'); - t.format('General', 0.00123456789123, '0.001234568'); - t.format('General', 0.0123456789123, '0.012345679'); - t.format('General', 0.123456789123, '0.123456789'); - t.format('General', 1.23456789123, '1.234567891'); - t.format('General', 12.3456789123, '12.34567891'); - t.format('General', 123.456789123, '123.4567891'); - t.format('General', 1234.56789123, '1234.567891'); - t.format('General', 12345.6789123, '12345.67891'); - t.format('General', 123456.789123, '123456.7891'); - t.format('General', 1234567.89123, '1234567.891'); - t.format('General', 12345678.9123, '12345678.91'); - t.format('General', 123456789.123, '123456789.1'); - t.format('General', 1234567891.23, '1234567891'); - t.format('General', 12345678912.3, '12345678912'); - t.format('General', 123456789123, '1.23457E+11'); - t.format('General', 1234567891230, '1.23457E+12'); - t.format('General', 12345678912300, '1.23457E+13'); - t.format('General', 123456789123000, '1.23457E+14'); - t.format('General', 1.234567891234e-14, '1.23457E-14'); - t.format('General', 1.234567891234e-13, '1.23457E-13'); - t.format('General', 1.234567891234e-12, '1.23457E-12'); - t.format('General', 1.234567891234e-11, '1.23457E-11'); - t.format('General', 1.234567891234e-10, '1.23457E-10'); - t.format('General', 1.234567891234e-9, '1.23457E-09'); - t.format('General', 1.234567891234e-8, '1.23457E-08'); - t.format('General', 1.234567891234e-7, '1.23457E-07'); - t.format('General', 0.000001234567891234, '1.23457E-06'); - t.format('General', 0.00001234567891234, '1.23457E-05'); - t.format('General', 0.0001234567891234, '0.000123457'); - t.format('General', 0.001234567891234, '0.001234568'); - t.format('General', 0.01234567891234, '0.012345679'); - t.format('General', 0.1234567891234, '0.123456789'); - t.format('General', 1.234567891234, '1.234567891'); - t.format('General', 12.34567891234, '12.34567891'); - t.format('General', 123.4567891234, '123.4567891'); - t.format('General', 1234.567891234, '1234.567891'); - t.format('General', 12345.67891234, '12345.67891'); - t.format('General', 123456.7891234, '123456.7891'); - t.format('General', 1234567.891234, '1234567.891'); - t.format('General', 12345678.91234, '12345678.91'); - t.format('General', 123456789.1234, '123456789.1'); - t.format('General', 1234567891.234, '1234567891'); - t.format('General', 12345678912.34, '12345678912'); - t.format('General', 123456789123.4, '1.23457E+11'); - t.format('General', 1234567891234, '1.23457E+12'); - t.format('General', 12345678912340, '1.23457E+13'); - t.format('General', 123456789123400, '1.23457E+14'); - t.format('General', 1.2345678912345e-14, '1.23457E-14'); - t.format('General', 1.2345678912345e-13, '1.23457E-13'); - t.format('General', 1.2345678912345e-12, '1.23457E-12'); - t.format('General', 1.2345678912345e-11, '1.23457E-11'); - t.format('General', 1.2345678912345e-10, '1.23457E-10'); - t.format('General', 1.2345678912345e-9, '1.23457E-09'); - t.format('General', 1.2345678912345e-8, '1.23457E-08'); - t.format('General', 1.2345678912345e-7, '1.23457E-07'); - t.format('General', 0.0000012345678912345, '1.23457E-06'); - t.format('General', 0.000012345678912345, '1.23457E-05'); - t.format('General', 0.00012345678912345, '0.000123457'); - t.format('General', 0.0012345678912345, '0.001234568'); - t.format('General', 0.012345678912345, '0.012345679'); - t.format('General', 0.12345678912345, '0.123456789'); - t.format('General', 1.2345678912345, '1.234567891'); - t.format('General', 12.345678912345, '12.34567891'); - t.format('General', 123.45678912345, '123.4567891'); - t.format('General', 1234.5678912345, '1234.567891'); - t.format('General', 12345.678912345, '12345.67891'); - t.format('General', 123456.78912345, '123456.7891'); - t.format('General', 1234567.8912345, '1234567.891'); - t.format('General', 12345678.912345, '12345678.91'); - t.format('General', 123456789.12345, '123456789.1'); - t.format('General', 1234567891.2345, '1234567891'); - t.format('General', 12345678912.345, '12345678912'); - t.format('General', 123456789123.45, '1.23457E+11'); - t.format('General', 1234567891234.5, '1.23457E+12'); - t.format('General', 12345678912345, '1.23457E+13'); - t.format('General', 123456789123450, '1.23457E+14'); - t.format('General', 1.23456789123456e-14, '1.23457E-14'); - t.format('General', 1.23456789123456e-13, '1.23457E-13'); - t.format('General', 1.23456789123456e-12, '1.23457E-12'); - t.format('General', 1.23456789123456e-11, '1.23457E-11'); - t.format('General', 1.23456789123456e-10, '1.23457E-10'); - t.format('General', 1.23456789123456e-9, '1.23457E-09'); - t.format('General', 1.23456789123456e-8, '1.23457E-08'); - t.format('General', 1.23456789123456e-7, '1.23457E-07'); - t.format('General', 0.00000123456789123456, '1.23457E-06'); - t.format('General', 0.0000123456789123456, '1.23457E-05'); - t.format('General', 0.000123456789123456, '0.000123457'); - t.format('General', 0.00123456789123456, '0.001234568'); - t.format('General', 0.0123456789123456, '0.012345679'); - t.format('General', 0.123456789123456, '0.123456789'); - t.format('General', 1.23456789123456, '1.234567891'); - t.format('General', 12.3456789123456, '12.34567891'); - t.format('General', 123.456789123456, '123.4567891'); - t.format('General', 1234.56789123456, '1234.567891'); - t.format('General', 12345.6789123456, '12345.67891'); - t.format('General', 123456.789123456, '123456.7891'); - t.format('General', 1234567.89123456, '1234567.891'); - t.format('General', 12345678.9123456, '12345678.91'); - t.format('General', 123456789.123456, '123456789.1'); - t.format('General', 1234567891.23456, '1234567891'); - t.format('General', 12345678912.3456, '12345678912'); - t.format('General', 123456789123.456, '1.23457E+11'); - t.format('General', 1234567891234.56, '1.23457E+12'); - t.format('General', 12345678912345.6, '1.23457E+13'); - t.format('General', 123456789123456, '1.23457E+14'); - t.format('General', -1.234567e-14, '-1.23457E-14'); - t.format('General', -1.234567e-13, '-1.23457E-13'); - t.format('General', -1.234567e-12, '-1.23457E-12'); - t.format('General', -1.234567e-11, '-1.23457E-11'); - t.format('General', -1.234567e-10, '-1.23457E-10'); - t.format('General', -1.234567e-9, '-1.23457E-09'); - t.format('General', -1.234567e-8, '-1.23457E-08'); - t.format('General', -1.234567e-7, '-1.23457E-07'); - t.format('General', -0.000001234567, '-1.23457E-06'); - t.format('General', -0.00001234567, '-1.23457E-05'); - t.format('General', -0.0001234567, '-0.000123457'); - t.format('General', -0.001234567, '-0.001234567'); - t.format('General', -0.01234567, '-0.01234567'); - t.format('General', -0.1234567, '-0.1234567'); - t.format('General', -1.234567, '-1.234567'); - t.format('General', -12.34567, '-12.34567'); - t.format('General', -123.4567, '-123.4567'); - t.format('General', -1234.567, '-1234.567'); - t.format('General', -12345.67, '-12345.67'); - t.format('General', -123456.7, '-123456.7'); - t.format('General', -1234567, '-1234567'); - t.format('General', -12345670, '-12345670'); - t.format('General', -123456700, '-123456700'); - t.format('General', -1234567000, '-1234567000'); - t.format('General', -12345670000, '-12345670000'); - t.format('General', -123456700000, '-1.23457E+11'); - t.format('General', -1234567000000, '-1.23457E+12'); - t.format('General', -12345670000000, '-1.23457E+13'); - t.format('General', -123456700000000, '-1.23457E+14'); - t.format('General', true, 'TRUE'); - t.format('General', false, 'FALSE'); - t.format('General', 'sheetjs', 'sheetjs'); - - t.format('General', undefined, ''); - t.format('General', null, ''); - t.end(); -}); - -test('No decimal point', t => { - t.format('General', 0.9999999999999999, '1'); - t.format('General', 0.999999999999999, '1'); - t.format('General', 0.99999999999999, '1'); - t.format('General', 0.9999999999999, '1'); - t.format('General', 0.999999999999, '1'); - t.format('General', 0.99999999999, '1'); - t.format('General', 0.9999999999, '1'); // Sheets emits "0.9999999999" here which is not by spec - t.format('General', 0.999999999, '0.999999999'); // Excel yeilds a "1" here, but this is not by spec - t.format('General', 0.99999999, '0.99999999'); - t.format('General', 0.9999999, '0.9999999'); - t.format('General', 0.999999, '0.999999'); - t.end(); -}); diff --git a/test/ssf-general.spec.ts b/test/ssf-general.spec.ts new file mode 100644 index 0000000..9d75bae --- /dev/null +++ b/test/ssf-general.spec.ts @@ -0,0 +1,519 @@ +// tests converted from SSF +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('General format', () => { + expect(format('General', 1.234567e-14)).toBe('1.23457E-14'); + expect(format('General', 1.234567e-13)).toBe('1.23457E-13'); + expect(format('General', 1.234567e-12)).toBe('1.23457E-12'); + expect(format('General', 1.234567e-11)).toBe('1.23457E-11'); + expect(format('General', 1.234567e-10)).toBe('1.23457E-10'); + expect(format('General', 1.234567e-9)).toBe('1.23457E-09'); + expect(format('General', 1.234567e-8)).toBe('1.23457E-08'); + expect(format('General', 1.234567e-7)).toBe('1.23457E-07'); + expect(format('General', 0.000001234567)).toBe('1.23457E-06'); + expect(format('General', 0.00001234567)).toBe('1.23457E-05'); + expect(format('General', 0.0001234567)).toBe('0.000123457'); + expect(format('General', 0.001234567)).toBe('0.001234567'); + expect(format('General', 0.01234567)).toBe('0.01234567'); + expect(format('General', 0.1234567)).toBe('0.1234567'); + expect(format('General', 1.234567)).toBe('1.234567'); + expect(format('General', 12.34567)).toBe('12.34567'); + expect(format('General', 123.4567)).toBe('123.4567'); + expect(format('General', 1234.567)).toBe('1234.567'); + expect(format('General', 12345.67)).toBe('12345.67'); + expect(format('General', 123456.7)).toBe('123456.7'); + expect(format('General', 1234567)).toBe('1234567'); + expect(format('General', 12345670)).toBe('12345670'); + expect(format('General', 123456700)).toBe('123456700'); + expect(format('General', 1234567000)).toBe('1234567000'); + expect(format('General', 12345670000)).toBe('12345670000'); + expect(format('General', 123456700000)).toBe('1.23457E+11'); + expect(format('General', 1234567000000)).toBe('1.23457E+12'); + expect(format('General', 12345670000000)).toBe('1.23457E+13'); + expect(format('General', 123456700000000)).toBe('1.23457E+14'); + expect(format('General', 1e-14)).toBe('1E-14'); + expect(format('General', 1e-13)).toBe('1E-13'); + expect(format('General', 1e-12)).toBe('1E-12'); + expect(format('General', 1e-11)).toBe('1E-11'); + expect(format('General', 1e-10)).toBe('1E-10'); + expect(format('General', 1e-9)).toBe('0.000000001'); + expect(format('General', 1e-8)).toBe('0.00000001'); + expect(format('General', 1e-7)).toBe('0.0000001'); + expect(format('General', 0.000001)).toBe('0.000001'); + expect(format('General', 0.00001)).toBe('0.00001'); + expect(format('General', 0.0001)).toBe('0.0001'); + expect(format('General', 0.001)).toBe('0.001'); + expect(format('General', 0.01)).toBe('0.01'); + expect(format('General', 0.1)).toBe('0.1'); + expect(format('General', 1)).toBe('1'); + expect(format('General', 10)).toBe('10'); + expect(format('General', 100)).toBe('100'); + expect(format('General', 1000)).toBe('1000'); + expect(format('General', 10000)).toBe('10000'); + expect(format('General', 100000)).toBe('100000'); + expect(format('General', 1000000)).toBe('1000000'); + expect(format('General', 10000000)).toBe('10000000'); + expect(format('General', 100000000)).toBe('100000000'); + expect(format('General', 1000000000)).toBe('1000000000'); + expect(format('General', 10000000000)).toBe('10000000000'); + expect(format('General', 100000000000)).toBe('1E+11'); + expect(format('General', 1000000000000)).toBe('1E+12'); + expect(format('General', 10000000000000)).toBe('1E+13'); + expect(format('General', 100000000000000)).toBe('1E+14'); + expect(format('General', 1.2e-14)).toBe('1.2E-14'); + expect(format('General', 1.2e-13)).toBe('1.2E-13'); + expect(format('General', 1.2e-12)).toBe('1.2E-12'); + expect(format('General', 1.2e-11)).toBe('1.2E-11'); + expect(format('General', 1.2e-10)).toBe('1.2E-10'); + expect(format('General', 1.2e-9)).toBe('1.2E-09'); + expect(format('General', 1.2e-8)).toBe('0.000000012'); + expect(format('General', 1.2e-7)).toBe('0.00000012'); + expect(format('General', 0.0000012)).toBe('0.0000012'); + expect(format('General', 0.000012)).toBe('0.000012'); + expect(format('General', 0.00012)).toBe('0.00012'); + expect(format('General', 0.0012)).toBe('0.0012'); + expect(format('General', 0.012)).toBe('0.012'); + expect(format('General', 0.12)).toBe('0.12'); + expect(format('General', 1.2)).toBe('1.2'); + expect(format('General', 12)).toBe('12'); + expect(format('General', 120)).toBe('120'); + expect(format('General', 1200)).toBe('1200'); + expect(format('General', 12000)).toBe('12000'); + expect(format('General', 120000)).toBe('120000'); + expect(format('General', 1200000)).toBe('1200000'); + expect(format('General', 12000000)).toBe('12000000'); + expect(format('General', 120000000)).toBe('120000000'); + expect(format('General', 1200000000)).toBe('1200000000'); + expect(format('General', 12000000000)).toBe('12000000000'); + expect(format('General', 120000000000)).toBe('1.2E+11'); + expect(format('General', 1200000000000)).toBe('1.2E+12'); + expect(format('General', 12000000000000)).toBe('1.2E+13'); + expect(format('General', 120000000000000)).toBe('1.2E+14'); + expect(format('General', 1.23e-14)).toBe('1.23E-14'); + expect(format('General', 1.23e-13)).toBe('1.23E-13'); + expect(format('General', 1.23e-12)).toBe('1.23E-12'); + expect(format('General', 1.23e-11)).toBe('1.23E-11'); + expect(format('General', 1.23e-10)).toBe('1.23E-10'); + expect(format('General', 1.23e-9)).toBe('1.23E-09'); + expect(format('General', 1.23e-8)).toBe('1.23E-08'); + expect(format('General', 1.23e-7)).toBe('0.000000123'); + expect(format('General', 0.00000123)).toBe('0.00000123'); + expect(format('General', 0.0000123)).toBe('0.0000123'); + expect(format('General', 0.000123)).toBe('0.000123'); + expect(format('General', 0.00123)).toBe('0.00123'); + expect(format('General', 0.0123)).toBe('0.0123'); + expect(format('General', 0.123)).toBe('0.123'); + expect(format('General', 1.23)).toBe('1.23'); + expect(format('General', 12.3)).toBe('12.3'); + expect(format('General', 123)).toBe('123'); + expect(format('General', 1230)).toBe('1230'); + expect(format('General', 12300)).toBe('12300'); + expect(format('General', 123000)).toBe('123000'); + expect(format('General', 1230000)).toBe('1230000'); + expect(format('General', 12300000)).toBe('12300000'); + expect(format('General', 123000000)).toBe('123000000'); + expect(format('General', 1230000000)).toBe('1230000000'); + expect(format('General', 12300000000)).toBe('12300000000'); + expect(format('General', 123000000000)).toBe('1.23E+11'); + expect(format('General', 1230000000000)).toBe('1.23E+12'); + expect(format('General', 12300000000000)).toBe('1.23E+13'); + expect(format('General', 123000000000000)).toBe('1.23E+14'); + expect(format('General', 1.234e-14)).toBe('1.234E-14'); + expect(format('General', 1.234e-13)).toBe('1.234E-13'); + expect(format('General', 1.234e-12)).toBe('1.234E-12'); + expect(format('General', 1.234e-11)).toBe('1.234E-11'); + expect(format('General', 1.234e-10)).toBe('1.234E-10'); + expect(format('General', 1.234e-9)).toBe('1.234E-09'); + expect(format('General', 1.234e-8)).toBe('1.234E-08'); + expect(format('General', 1.234e-7)).toBe('1.234E-07'); + expect(format('General', 0.000001234)).toBe('0.000001234'); + expect(format('General', 0.00001234)).toBe('0.00001234'); + expect(format('General', 0.0001234)).toBe('0.0001234'); + expect(format('General', 0.001234)).toBe('0.001234'); + expect(format('General', 0.01234)).toBe('0.01234'); + expect(format('General', 0.1234)).toBe('0.1234'); + expect(format('General', 1.234)).toBe('1.234'); + expect(format('General', 12.34)).toBe('12.34'); + expect(format('General', 123.4)).toBe('123.4'); + expect(format('General', 1234)).toBe('1234'); + expect(format('General', 12340)).toBe('12340'); + expect(format('General', 123400)).toBe('123400'); + expect(format('General', 1234000)).toBe('1234000'); + expect(format('General', 12340000)).toBe('12340000'); + expect(format('General', 123400000)).toBe('123400000'); + expect(format('General', 1234000000)).toBe('1234000000'); + expect(format('General', 12340000000)).toBe('12340000000'); + expect(format('General', 123400000000)).toBe('1.234E+11'); + expect(format('General', 1234000000000)).toBe('1.234E+12'); + expect(format('General', 12340000000000)).toBe('1.234E+13'); + expect(format('General', 123400000000000)).toBe('1.234E+14'); + expect(format('General', 1.2345e-14)).toBe('1.2345E-14'); + expect(format('General', 1.2345e-13)).toBe('1.2345E-13'); + expect(format('General', 1.2345e-12)).toBe('1.2345E-12'); + expect(format('General', 1.2345e-11)).toBe('1.2345E-11'); + expect(format('General', 1.2345e-10)).toBe('1.2345E-10'); + expect(format('General', 1.2345e-9)).toBe('1.2345E-09'); + expect(format('General', 1.2345e-8)).toBe('1.2345E-08'); + expect(format('General', 1.2345e-7)).toBe('1.2345E-07'); + expect(format('General', 0.0000012345)).toBe('1.2345E-06'); + expect(format('General', 0.000012345)).toBe('0.000012345'); + expect(format('General', 0.00012345)).toBe('0.00012345'); + expect(format('General', 0.0012345)).toBe('0.0012345'); + expect(format('General', 0.012345)).toBe('0.012345'); + expect(format('General', 0.12345)).toBe('0.12345'); + expect(format('General', 1.2345)).toBe('1.2345'); + expect(format('General', 12.345)).toBe('12.345'); + expect(format('General', 123.45)).toBe('123.45'); + expect(format('General', 1234.5)).toBe('1234.5'); + expect(format('General', 12345)).toBe('12345'); + expect(format('General', 123450)).toBe('123450'); + expect(format('General', 1234500)).toBe('1234500'); + expect(format('General', 12345000)).toBe('12345000'); + expect(format('General', 123450000)).toBe('123450000'); + expect(format('General', 1234500000)).toBe('1234500000'); + expect(format('General', 12345000000)).toBe('12345000000'); + expect(format('General', 123450000000)).toBe('1.2345E+11'); + expect(format('General', 1234500000000)).toBe('1.2345E+12'); + expect(format('General', 12345000000000)).toBe('1.2345E+13'); + expect(format('General', 123450000000000)).toBe('1.2345E+14'); + expect(format('General', 1.23456e-14)).toBe('1.23456E-14'); + expect(format('General', 1.23456e-13)).toBe('1.23456E-13'); + expect(format('General', 1.23456e-12)).toBe('1.23456E-12'); + expect(format('General', 1.23456e-11)).toBe('1.23456E-11'); + expect(format('General', 1.23456e-10)).toBe('1.23456E-10'); + expect(format('General', 1.23456e-9)).toBe('1.23456E-09'); + expect(format('General', 1.23456e-8)).toBe('1.23456E-08'); + expect(format('General', 1.23456e-7)).toBe('1.23456E-07'); + expect(format('General', 0.00000123456)).toBe('1.23456E-06'); + expect(format('General', 0.0000123456)).toBe('1.23456E-05'); + expect(format('General', 0.000123456)).toBe('0.000123456'); + expect(format('General', 0.00123456)).toBe('0.00123456'); + expect(format('General', 0.0123456)).toBe('0.0123456'); + expect(format('General', 0.123456)).toBe('0.123456'); + expect(format('General', 1.23456)).toBe('1.23456'); + expect(format('General', 12.3456)).toBe('12.3456'); + expect(format('General', 123.456)).toBe('123.456'); + expect(format('General', 1234.56)).toBe('1234.56'); + expect(format('General', 12345.6)).toBe('12345.6'); + expect(format('General', 123456)).toBe('123456'); + expect(format('General', 1234560)).toBe('1234560'); + expect(format('General', 12345600)).toBe('12345600'); + expect(format('General', 123456000)).toBe('123456000'); + expect(format('General', 1234560000)).toBe('1234560000'); + expect(format('General', 12345600000)).toBe('12345600000'); + expect(format('General', 123456000000)).toBe('1.23456E+11'); + expect(format('General', 1234560000000)).toBe('1.23456E+12'); + expect(format('General', 12345600000000)).toBe('1.23456E+13'); + expect(format('General', 123456000000000)).toBe('1.23456E+14'); + expect(format('General', 1.234567e-14)).toBe('1.23457E-14'); + expect(format('General', 1.234567e-13)).toBe('1.23457E-13'); + expect(format('General', 1.234567e-12)).toBe('1.23457E-12'); + expect(format('General', 1.234567e-11)).toBe('1.23457E-11'); + expect(format('General', 1.234567e-10)).toBe('1.23457E-10'); + expect(format('General', 1.234567e-9)).toBe('1.23457E-09'); + expect(format('General', 1.234567e-8)).toBe('1.23457E-08'); + expect(format('General', 1.234567e-7)).toBe('1.23457E-07'); + expect(format('General', 0.000001234567)).toBe('1.23457E-06'); + expect(format('General', 0.00001234567)).toBe('1.23457E-05'); + expect(format('General', 0.0001234567)).toBe('0.000123457'); + expect(format('General', 0.001234567)).toBe('0.001234567'); + expect(format('General', 0.01234567)).toBe('0.01234567'); + expect(format('General', 0.1234567)).toBe('0.1234567'); + expect(format('General', 1.234567)).toBe('1.234567'); + expect(format('General', 12.34567)).toBe('12.34567'); + expect(format('General', 123.4567)).toBe('123.4567'); + expect(format('General', 1234.567)).toBe('1234.567'); + expect(format('General', 12345.67)).toBe('12345.67'); + expect(format('General', 123456.7)).toBe('123456.7'); + expect(format('General', 1234567)).toBe('1234567'); + expect(format('General', 12345670)).toBe('12345670'); + expect(format('General', 123456700)).toBe('123456700'); + expect(format('General', 1234567000)).toBe('1234567000'); + expect(format('General', 12345670000)).toBe('12345670000'); + expect(format('General', 123456700000)).toBe('1.23457E+11'); + expect(format('General', 1234567000000)).toBe('1.23457E+12'); + expect(format('General', 12345670000000)).toBe('1.23457E+13'); + expect(format('General', 123456700000000)).toBe('1.23457E+14'); + expect(format('General', 1.2345678e-14)).toBe('1.23457E-14'); + expect(format('General', 1.2345678e-13)).toBe('1.23457E-13'); + expect(format('General', 1.2345678e-12)).toBe('1.23457E-12'); + expect(format('General', 1.2345678e-11)).toBe('1.23457E-11'); + expect(format('General', 1.2345678e-10)).toBe('1.23457E-10'); + expect(format('General', 1.2345678e-9)).toBe('1.23457E-09'); + expect(format('General', 1.2345678e-8)).toBe('1.23457E-08'); + expect(format('General', 1.2345678e-7)).toBe('1.23457E-07'); + expect(format('General', 0.0000012345678)).toBe('1.23457E-06'); + expect(format('General', 0.000012345678)).toBe('1.23457E-05'); + expect(format('General', 0.00012345678)).toBe('0.000123457'); + expect(format('General', 0.0012345678)).toBe('0.001234568'); + expect(format('General', 0.012345678)).toBe('0.012345678'); + expect(format('General', 0.12345678)).toBe('0.12345678'); + expect(format('General', 1.2345678)).toBe('1.2345678'); + expect(format('General', 12.345678)).toBe('12.345678'); + expect(format('General', 123.45678)).toBe('123.45678'); + expect(format('General', 1234.5678)).toBe('1234.5678'); + expect(format('General', 12345.678)).toBe('12345.678'); + expect(format('General', 123456.78)).toBe('123456.78'); + expect(format('General', 1234567.8)).toBe('1234567.8'); + expect(format('General', 12345678)).toBe('12345678'); + expect(format('General', 123456780)).toBe('123456780'); + expect(format('General', 1234567800)).toBe('1234567800'); + expect(format('General', 12345678000)).toBe('12345678000'); + expect(format('General', 123456780000)).toBe('1.23457E+11'); + expect(format('General', 1234567800000)).toBe('1.23457E+12'); + expect(format('General', 12345678000000)).toBe('1.23457E+13'); + expect(format('General', 123456780000000)).toBe('1.23457E+14'); + expect(format('General', 1.23456789e-14)).toBe('1.23457E-14'); + expect(format('General', 1.23456789e-13)).toBe('1.23457E-13'); + expect(format('General', 1.23456789e-12)).toBe('1.23457E-12'); + expect(format('General', 1.23456789e-11)).toBe('1.23457E-11'); + expect(format('General', 1.23456789e-10)).toBe('1.23457E-10'); + expect(format('General', 1.23456789e-9)).toBe('1.23457E-09'); + expect(format('General', 1.23456789e-8)).toBe('1.23457E-08'); + expect(format('General', 1.23456789e-7)).toBe('1.23457E-07'); + expect(format('General', 0.00000123456789)).toBe('1.23457E-06'); + expect(format('General', 0.0000123456789)).toBe('1.23457E-05'); + expect(format('General', 0.000123456789)).toBe('0.000123457'); + expect(format('General', 0.00123456789)).toBe('0.001234568'); + expect(format('General', 0.0123456789)).toBe('0.012345679'); + expect(format('General', 0.123456789)).toBe('0.123456789'); + expect(format('General', 1.23456789)).toBe('1.23456789'); + expect(format('General', 12.3456789)).toBe('12.3456789'); + expect(format('General', 123.456789)).toBe('123.456789'); + expect(format('General', 1234.56789)).toBe('1234.56789'); + expect(format('General', 12345.6789)).toBe('12345.6789'); + expect(format('General', 123456.789)).toBe('123456.789'); + expect(format('General', 1234567.89)).toBe('1234567.89'); + expect(format('General', 12345678.9)).toBe('12345678.9'); + expect(format('General', 123456789)).toBe('123456789'); + expect(format('General', 1234567890)).toBe('1234567890'); + expect(format('General', 12345678900)).toBe('12345678900'); + expect(format('General', 123456789000)).toBe('1.23457E+11'); + expect(format('General', 1234567890000)).toBe('1.23457E+12'); + expect(format('General', 12345678900000)).toBe('1.23457E+13'); + expect(format('General', 123456789000000)).toBe('1.23457E+14'); + expect(format('General', 1.234567891e-14)).toBe('1.23457E-14'); + expect(format('General', 1.234567891e-13)).toBe('1.23457E-13'); + expect(format('General', 1.234567891e-12)).toBe('1.23457E-12'); + expect(format('General', 1.234567891e-11)).toBe('1.23457E-11'); + expect(format('General', 1.234567891e-10)).toBe('1.23457E-10'); + expect(format('General', 1.234567891e-9)).toBe('1.23457E-09'); + expect(format('General', 1.234567891e-8)).toBe('1.23457E-08'); + expect(format('General', 1.234567891e-7)).toBe('1.23457E-07'); + expect(format('General', 0.000001234567891)).toBe('1.23457E-06'); + expect(format('General', 0.00001234567891)).toBe('1.23457E-05'); + expect(format('General', 0.0001234567891)).toBe('0.000123457'); + expect(format('General', 0.001234567891)).toBe('0.001234568'); + expect(format('General', 0.01234567891)).toBe('0.012345679'); + expect(format('General', 0.1234567891)).toBe('0.123456789'); + expect(format('General', 1.234567891)).toBe('1.234567891'); + expect(format('General', 12.34567891)).toBe('12.34567891'); + expect(format('General', 123.4567891)).toBe('123.4567891'); + expect(format('General', 1234.567891)).toBe('1234.567891'); + expect(format('General', 12345.67891)).toBe('12345.67891'); + expect(format('General', 123456.7891)).toBe('123456.7891'); + expect(format('General', 1234567.891)).toBe('1234567.891'); + expect(format('General', 12345678.91)).toBe('12345678.91'); + expect(format('General', 123456789.1)).toBe('123456789.1'); + expect(format('General', 1234567891)).toBe('1234567891'); + expect(format('General', 12345678910)).toBe('12345678910'); + expect(format('General', 123456789100)).toBe('1.23457E+11'); + expect(format('General', 1234567891000)).toBe('1.23457E+12'); + expect(format('General', 12345678910000)).toBe('1.23457E+13'); + expect(format('General', 123456789100000)).toBe('1.23457E+14'); + expect(format('General', 1.2345678912e-14)).toBe('1.23457E-14'); + expect(format('General', 1.2345678912e-13)).toBe('1.23457E-13'); + expect(format('General', 1.2345678912e-12)).toBe('1.23457E-12'); + expect(format('General', 1.2345678912e-11)).toBe('1.23457E-11'); + expect(format('General', 1.2345678912e-10)).toBe('1.23457E-10'); + expect(format('General', 1.2345678912e-9)).toBe('1.23457E-09'); + expect(format('General', 1.2345678912e-8)).toBe('1.23457E-08'); + expect(format('General', 1.2345678912e-7)).toBe('1.23457E-07'); + expect(format('General', 0.0000012345678912)).toBe('1.23457E-06'); + expect(format('General', 0.000012345678912)).toBe('1.23457E-05'); + expect(format('General', 0.00012345678912)).toBe('0.000123457'); + expect(format('General', 0.0012345678912)).toBe('0.001234568'); + expect(format('General', 0.012345678912)).toBe('0.012345679'); + expect(format('General', 0.12345678912)).toBe('0.123456789'); + expect(format('General', 1.2345678912)).toBe('1.234567891'); + expect(format('General', 12.345678912)).toBe('12.34567891'); + expect(format('General', 123.45678912)).toBe('123.4567891'); + expect(format('General', 1234.5678912)).toBe('1234.567891'); + expect(format('General', 12345.678912)).toBe('12345.67891'); + expect(format('General', 123456.78912)).toBe('123456.7891'); + expect(format('General', 1234567.8912)).toBe('1234567.891'); + expect(format('General', 12345678.912)).toBe('12345678.91'); + expect(format('General', 123456789.12)).toBe('123456789.1'); + expect(format('General', 1234567891.2)).toBe('1234567891'); + expect(format('General', 12345678912)).toBe('12345678912'); + expect(format('General', 123456789120)).toBe('1.23457E+11'); + expect(format('General', 1234567891200)).toBe('1.23457E+12'); + expect(format('General', 12345678912000)).toBe('1.23457E+13'); + expect(format('General', 123456789120000)).toBe('1.23457E+14'); + expect(format('General', 1.23456789123e-14)).toBe('1.23457E-14'); + expect(format('General', 1.23456789123e-13)).toBe('1.23457E-13'); + expect(format('General', 1.23456789123e-12)).toBe('1.23457E-12'); + expect(format('General', 1.23456789123e-11)).toBe('1.23457E-11'); + expect(format('General', 1.23456789123e-10)).toBe('1.23457E-10'); + expect(format('General', 1.23456789123e-9)).toBe('1.23457E-09'); + expect(format('General', 1.23456789123e-8)).toBe('1.23457E-08'); + expect(format('General', 1.23456789123e-7)).toBe('1.23457E-07'); + expect(format('General', 0.00000123456789123)).toBe('1.23457E-06'); + expect(format('General', 0.0000123456789123)).toBe('1.23457E-05'); + expect(format('General', 0.000123456789123)).toBe('0.000123457'); + expect(format('General', 0.00123456789123)).toBe('0.001234568'); + expect(format('General', 0.0123456789123)).toBe('0.012345679'); + expect(format('General', 0.123456789123)).toBe('0.123456789'); + expect(format('General', 1.23456789123)).toBe('1.234567891'); + expect(format('General', 12.3456789123)).toBe('12.34567891'); + expect(format('General', 123.456789123)).toBe('123.4567891'); + expect(format('General', 1234.56789123)).toBe('1234.567891'); + expect(format('General', 12345.6789123)).toBe('12345.67891'); + expect(format('General', 123456.789123)).toBe('123456.7891'); + expect(format('General', 1234567.89123)).toBe('1234567.891'); + expect(format('General', 12345678.9123)).toBe('12345678.91'); + expect(format('General', 123456789.123)).toBe('123456789.1'); + expect(format('General', 1234567891.23)).toBe('1234567891'); + expect(format('General', 12345678912.3)).toBe('12345678912'); + expect(format('General', 123456789123)).toBe('1.23457E+11'); + expect(format('General', 1234567891230)).toBe('1.23457E+12'); + expect(format('General', 12345678912300)).toBe('1.23457E+13'); + expect(format('General', 123456789123000)).toBe('1.23457E+14'); + expect(format('General', 1.234567891234e-14)).toBe('1.23457E-14'); + expect(format('General', 1.234567891234e-13)).toBe('1.23457E-13'); + expect(format('General', 1.234567891234e-12)).toBe('1.23457E-12'); + expect(format('General', 1.234567891234e-11)).toBe('1.23457E-11'); + expect(format('General', 1.234567891234e-10)).toBe('1.23457E-10'); + expect(format('General', 1.234567891234e-9)).toBe('1.23457E-09'); + expect(format('General', 1.234567891234e-8)).toBe('1.23457E-08'); + expect(format('General', 1.234567891234e-7)).toBe('1.23457E-07'); + expect(format('General', 0.000001234567891234)).toBe('1.23457E-06'); + expect(format('General', 0.00001234567891234)).toBe('1.23457E-05'); + expect(format('General', 0.0001234567891234)).toBe('0.000123457'); + expect(format('General', 0.001234567891234)).toBe('0.001234568'); + expect(format('General', 0.01234567891234)).toBe('0.012345679'); + expect(format('General', 0.1234567891234)).toBe('0.123456789'); + expect(format('General', 1.234567891234)).toBe('1.234567891'); + expect(format('General', 12.34567891234)).toBe('12.34567891'); + expect(format('General', 123.4567891234)).toBe('123.4567891'); + expect(format('General', 1234.567891234)).toBe('1234.567891'); + expect(format('General', 12345.67891234)).toBe('12345.67891'); + expect(format('General', 123456.7891234)).toBe('123456.7891'); + expect(format('General', 1234567.891234)).toBe('1234567.891'); + expect(format('General', 12345678.91234)).toBe('12345678.91'); + expect(format('General', 123456789.1234)).toBe('123456789.1'); + expect(format('General', 1234567891.234)).toBe('1234567891'); + expect(format('General', 12345678912.34)).toBe('12345678912'); + expect(format('General', 123456789123.4)).toBe('1.23457E+11'); + expect(format('General', 1234567891234)).toBe('1.23457E+12'); + expect(format('General', 12345678912340)).toBe('1.23457E+13'); + expect(format('General', 123456789123400)).toBe('1.23457E+14'); + expect(format('General', 1.2345678912345e-14)).toBe('1.23457E-14'); + expect(format('General', 1.2345678912345e-13)).toBe('1.23457E-13'); + expect(format('General', 1.2345678912345e-12)).toBe('1.23457E-12'); + expect(format('General', 1.2345678912345e-11)).toBe('1.23457E-11'); + expect(format('General', 1.2345678912345e-10)).toBe('1.23457E-10'); + expect(format('General', 1.2345678912345e-9)).toBe('1.23457E-09'); + expect(format('General', 1.2345678912345e-8)).toBe('1.23457E-08'); + expect(format('General', 1.2345678912345e-7)).toBe('1.23457E-07'); + expect(format('General', 0.0000012345678912345)).toBe('1.23457E-06'); + expect(format('General', 0.000012345678912345)).toBe('1.23457E-05'); + expect(format('General', 0.00012345678912345)).toBe('0.000123457'); + expect(format('General', 0.0012345678912345)).toBe('0.001234568'); + expect(format('General', 0.012345678912345)).toBe('0.012345679'); + expect(format('General', 0.12345678912345)).toBe('0.123456789'); + expect(format('General', 1.2345678912345)).toBe('1.234567891'); + expect(format('General', 12.345678912345)).toBe('12.34567891'); + expect(format('General', 123.45678912345)).toBe('123.4567891'); + expect(format('General', 1234.5678912345)).toBe('1234.567891'); + expect(format('General', 12345.678912345)).toBe('12345.67891'); + expect(format('General', 123456.78912345)).toBe('123456.7891'); + expect(format('General', 1234567.8912345)).toBe('1234567.891'); + expect(format('General', 12345678.912345)).toBe('12345678.91'); + expect(format('General', 123456789.12345)).toBe('123456789.1'); + expect(format('General', 1234567891.2345)).toBe('1234567891'); + expect(format('General', 12345678912.345)).toBe('12345678912'); + expect(format('General', 123456789123.45)).toBe('1.23457E+11'); + expect(format('General', 1234567891234.5)).toBe('1.23457E+12'); + expect(format('General', 12345678912345)).toBe('1.23457E+13'); + expect(format('General', 123456789123450)).toBe('1.23457E+14'); + expect(format('General', 1.23456789123456e-14)).toBe('1.23457E-14'); + expect(format('General', 1.23456789123456e-13)).toBe('1.23457E-13'); + expect(format('General', 1.23456789123456e-12)).toBe('1.23457E-12'); + expect(format('General', 1.23456789123456e-11)).toBe('1.23457E-11'); + expect(format('General', 1.23456789123456e-10)).toBe('1.23457E-10'); + expect(format('General', 1.23456789123456e-9)).toBe('1.23457E-09'); + expect(format('General', 1.23456789123456e-8)).toBe('1.23457E-08'); + expect(format('General', 1.23456789123456e-7)).toBe('1.23457E-07'); + expect(format('General', 0.00000123456789123456)).toBe('1.23457E-06'); + expect(format('General', 0.0000123456789123456)).toBe('1.23457E-05'); + expect(format('General', 0.000123456789123456)).toBe('0.000123457'); + expect(format('General', 0.00123456789123456)).toBe('0.001234568'); + expect(format('General', 0.0123456789123456)).toBe('0.012345679'); + expect(format('General', 0.123456789123456)).toBe('0.123456789'); + expect(format('General', 1.23456789123456)).toBe('1.234567891'); + expect(format('General', 12.3456789123456)).toBe('12.34567891'); + expect(format('General', 123.456789123456)).toBe('123.4567891'); + expect(format('General', 1234.56789123456)).toBe('1234.567891'); + expect(format('General', 12345.6789123456)).toBe('12345.67891'); + expect(format('General', 123456.789123456)).toBe('123456.7891'); + expect(format('General', 1234567.89123456)).toBe('1234567.891'); + expect(format('General', 12345678.9123456)).toBe('12345678.91'); + expect(format('General', 123456789.123456)).toBe('123456789.1'); + expect(format('General', 1234567891.23456)).toBe('1234567891'); + expect(format('General', 12345678912.3456)).toBe('12345678912'); + expect(format('General', 123456789123.456)).toBe('1.23457E+11'); + expect(format('General', 1234567891234.56)).toBe('1.23457E+12'); + expect(format('General', 12345678912345.6)).toBe('1.23457E+13'); + expect(format('General', 123456789123456)).toBe('1.23457E+14'); + expect(format('General', -1.234567e-14)).toBe('-1.23457E-14'); + expect(format('General', -1.234567e-13)).toBe('-1.23457E-13'); + expect(format('General', -1.234567e-12)).toBe('-1.23457E-12'); + expect(format('General', -1.234567e-11)).toBe('-1.23457E-11'); + expect(format('General', -1.234567e-10)).toBe('-1.23457E-10'); + expect(format('General', -1.234567e-9)).toBe('-1.23457E-09'); + expect(format('General', -1.234567e-8)).toBe('-1.23457E-08'); + expect(format('General', -1.234567e-7)).toBe('-1.23457E-07'); + expect(format('General', -0.000001234567)).toBe('-1.23457E-06'); + expect(format('General', -0.00001234567)).toBe('-1.23457E-05'); + expect(format('General', -0.0001234567)).toBe('-0.000123457'); + expect(format('General', -0.001234567)).toBe('-0.001234567'); + expect(format('General', -0.01234567)).toBe('-0.01234567'); + expect(format('General', -0.1234567)).toBe('-0.1234567'); + expect(format('General', -1.234567)).toBe('-1.234567'); + expect(format('General', -12.34567)).toBe('-12.34567'); + expect(format('General', -123.4567)).toBe('-123.4567'); + expect(format('General', -1234.567)).toBe('-1234.567'); + expect(format('General', -12345.67)).toBe('-12345.67'); + expect(format('General', -123456.7)).toBe('-123456.7'); + expect(format('General', -1234567)).toBe('-1234567'); + expect(format('General', -12345670)).toBe('-12345670'); + expect(format('General', -123456700)).toBe('-123456700'); + expect(format('General', -1234567000)).toBe('-1234567000'); + expect(format('General', -12345670000)).toBe('-12345670000'); + expect(format('General', -123456700000)).toBe('-1.23457E+11'); + expect(format('General', -1234567000000)).toBe('-1.23457E+12'); + expect(format('General', -12345670000000)).toBe('-1.23457E+13'); + expect(format('General', -123456700000000)).toBe('-1.23457E+14'); + expect(format('General', true)).toBe('TRUE'); + expect(format('General', false)).toBe('FALSE'); + expect(format('General', 'sheetjs')).toBe('sheetjs'); + + expect(format('General', undefined)).toBe(''); + expect(format('General', null)).toBe(''); +}); + +test('No decimal point', () => { + expect(format('General', 0.9999999999999999)).toBe('1'); + expect(format('General', 0.999999999999999)).toBe('1'); + expect(format('General', 0.99999999999999)).toBe('1'); + expect(format('General', 0.9999999999999)).toBe('1'); + expect(format('General', 0.999999999999)).toBe('1'); + expect(format('General', 0.99999999999)).toBe('1'); + expect(format('General', 0.9999999999)).toBe('1'); // Sheets emits "0.9999999999" here which is not by spec + expect(format('General', 0.999999999)).toBe('0.999999999'); // Excel yeilds a "1" here, but this is not by spec + expect(format('General', 0.99999999)).toBe('0.99999999'); + expect(format('General', 0.9999999)).toBe('0.9999999'); + expect(format('General', 0.999999)).toBe('0.999999'); +}); diff --git a/test/ssf-oddities-test.js b/test/ssf-oddities-test.js deleted file mode 100644 index 3b61dae..0000000 --- a/test/ssf-oddities-test.js +++ /dev/null @@ -1,685 +0,0 @@ -// Tests originally converted from SSF but have been reviewed -// and corrected and conformed to Excel for Mac version 16.35 -import test from './utils.js'; -import { format } from '../lib/index.js'; - -test('Oddity: "foo";"bar";"baz";"qux"', t => { - t.format('"foo";"bar";"baz";"qux"', 1, 'foo'); - t.format('"foo";"bar";"baz";"qux"', -1, 'bar'); - t.format('"foo";"bar";"baz";"qux"', 0, 'baz'); - t.format('"foo";"bar";"baz";"qux"', 'text', 'qux'); - t.end(); -}); - -test('Oddity: "foo";"bar";"baz"', t => { - t.format('"foo";"bar";"baz"', 1, 'foo'); - t.format('"foo";"bar";"baz"', -1, 'bar'); - t.format('"foo";"bar";"baz"', 0, 'baz'); - t.format('"foo";"bar";"baz"', 'text', 'text'); - t.end(); -}); - -test('Oddity: "foo";"bar";@', t => { - t.format('"foo";"bar";@', 1, 'foo'); - t.format('"foo";"bar";@', -1, 'bar'); - t.format('"foo";"bar";@', 0, 'foo'); - t.format('"foo";"bar";@', 'text', 'text'); - t.end(); -}); - -test('Oddity: "foo";"bar"', t => { - t.format('"foo";"bar"', 1, 'foo'); - t.format('"foo";"bar"', -1, 'bar'); - t.format('"foo";"bar"', 0, 'foo'); - t.format('"foo";"bar"', 'text', 'text'); - t.end(); -}); - -test('Oddity: @@', t => { - t.format('@@', 1, '1'); - t.format('@@', -1, '-1'); - t.format('@@', 0, '0'); - t.format('@@', 'text', 'texttext'); - t.end(); -}); - -test('Oddity: [Blue]General', t => { - t.format('[Blue]General', 1, '1'); - t.format('[Blue]General', -1, '-1'); - t.format('[Blue]General', 0, '0'); - t.format('[Blue]General', 'text', 'text'); - t.end(); -}); - -test('Oddity: [Blue]G3neral', t => { - t.formatInvalid('[Blue]G3neral', 0); - t.end(); -}); - -test('Oddity: A"TODO"', t => { - t.format('A"TODO"', 1, 'ATODO'); - t.format('A"TODO"', -1, '-ATODO'); - t.format('A"TODO"', 0, 'ATODO'); - t.format('A"TODO"', 'text', 'text'); - t.end(); -}); - -test('Oddity: r', t => { - t.format('r', 1, 'r'); - t.format('r', -1, '-r'); - t.format('r', 0, 'r'); - t.format('r', 'text', 'text'); - t.end(); -}); - -test('Oddity: ((;@', t => { - t.format('((;@', 1, '(('); - t.format('((;@', 0, '(('); - t.format('((;@', 'text', 'text'); - t.end(); -}); - -test('Oddity: \\r', t => { - t.format('\\r', 1, 'r'); - t.format('\\r', -1, '-r'); - t.format('\\r', 0, 'r'); - t.format('\\r', 'text', 'text'); - t.end(); -}); - -test('Oddity: _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', t => { - t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (1), ' $1 '); - t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (-1), ' $(1)'); - t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (0), ' $- '); - t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', ('text'), ' text '); - // t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (null), ' $- '); - // t.format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (''), ''); - t.end(); -}); - -test('Oddity: #0.#', t => { - t.format('#0.#', 0, '0.'); - t.format('#0.#', 1, '1.'); - t.format('#0.#', 12, '12.'); - t.format('#0.#', 12.34, '12.3'); - t.format('#0.#', -1.23, '-1.2'); - t.end(); -}); - -test('Oddity: #,##0.0', t => { - t.format('#,##0.0', 1, '1.0'); - t.format('#,##0.0', -1, '-1.0'); - t.format('#,##0.0', 0, '0.0'); - t.format('#,##0.0', 'text', 'text'); - t.end(); -}); - -test('Oddity: #,##0.00', t => { - t.format('#,##0.00', 1, '1.00'); - t.format('#,##0.00', -1, '-1.00'); - t.format('#,##0.00', 0, '0.00'); - t.format('#,##0.00', 'text', 'text'); - t.end(); -}); - -test('Oddity: #,##0.000', t => { - t.format('#,##0.000', 1, '1.000'); - t.format('#,##0.000', -1, '-1.000'); - t.format('#,##0.000', 0, '0.000'); - t.format('#,##0.000', 'text', 'text'); - t.end(); -}); - -test('Oddity: #,##0.0000', t => { - t.format('#,##0.0000', 1, '1.0000'); - t.format('#,##0.0000', -1, '-1.0000'); - t.format('#,##0.0000', 0, '0.0000'); - t.format('#,##0.0000', 'text', 'text'); - t.end(); -}); - -test('Oddity: #,##0.00000', t => { - t.format('#,##0.00000', 1000000, '1,000,000.00000'); - t.end(); -}); - -test('Oddity: #,##0.000000', t => { - t.format('#,##0.000000', 1000000, '1,000,000.000000'); - t.end(); -}); - -test('Oddity: #,##0.0000000', t => { - t.format('#,##0.0000000', 1000000, '1,000,000.0000000'); - t.end(); -}); - -test('Oddity: #,##0.00000000', t => { - t.format('#,##0.00000000', 1000000, '1,000,000.00000000'); - t.end(); -}); - -test('Oddity: #,##0.000000000', t => { - t.format('#,##0.000000000', 1000000, '1,000,000.000000000'); - t.end(); -}); - -test('Oddity: #,###', t => { - t.format('#,###', 1, '1'); - t.format('#,###', -1, '-1'); - t.format('#,###', 0, ''); - t.format('#,###', 12345.6789, '12,346'); - t.format('#,###', 'TODO', 'TODO'); - t.end(); -}); - -test('Oddity: #.##', t => { - t.format('#.##', 1, '1.'); - t.format('#.##', -1, '-1.'); - t.format('#.##', 0, '.'); - t.format('#.##', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0;0', t => { - t.format('0;0', 1.1, '1'); - t.format('0;0', -1.1, '1'); - t.format('0;0', 0, '0'); - t.format('0;0', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0.0', t => { - t.format('0.0', 1, '1.0'); - t.format('0.0', -1, '-1.0'); - t.format('0.0', 0, '0.0'); - t.format('0.0', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0.00', t => { - t.format('0.00', 1.0001, '1.00'); - t.format('0.00', -1, '-1.00'); - t.format('0.00', 0, '0.00'); - t.format('0.00', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0.000', t => { - t.format('0.000', 1, '1.000'); - t.format('0.000', -1, '-1.000'); - t.format('0.000', 0, '0.000'); - t.format('0.000', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0.0000', t => { - t.format('0.0000', 1, '1.0000'); - t.format('0.0000', -1, '-1.0000'); - t.format('0.0000', 0, '0.0000'); - t.format('0.0000', 'text', 'text'); - t.end(); -}); - -test('Oddity: hh:mm AM/PM', t => { - t.format('hh:mm AM/PM', 0.7, '04:48 PM'); - t.end(); -}); - -test('Oddity: hhh:mm AM/PM', t => { - t.format('hhh:mm AM/PM', 0.7, '04:48 PM'); - t.end(); -}); - -test('Oddity: hhh:mmm:sss', t => { - t.format('hhh:mmm:sss', 0.7, '16:Jan:00'); - t.end(); -}); - -test('Oddity: hh:mmm:sss', t => { - t.format('hhh:mmm:sss', 0.7, '16:Jan:00'); - t.end(); -}); - -test('Oddity: hh:mm:sss', t => { - t.format('hh:mm:sss', 0.7, '16:48:00'); - t.end(); -}); - -test('Oddity: hh:mm:ss.000', t => { - t.format('hh:mm:ss.000', 0.7, '16:48:00.000'); - t.format('hh:mm:ss.000', 0.70707, '16:58:10.848'); - t.end(); -}); - -test('Oddity: hh.000', t => { - t.format('hh.000', 0.70707, '16.848'); - t.end(); -}); - -test('Oddity: hh .00', t => { - t.format('hh .00', 0.70707, '16 .85'); - t.end(); -}); - -test('Oddity: hh .0', t => { - t.format('hh .0', 0.70707, '16 .8'); - t.end(); -}); - -test('Oddity: hh .00 .000', t => { - t.format('hh .00 .000', 0.70707, '16 .84 .848'); - t.end(); -}); - -test('Oddity: [hhh]', t => { - t.format('[hhh]', 1, '024'); - t.format('[hhh]', -1, '-024'); - t.format('[hhh]', 0, '000'); - t.format('[hhh]', 'text', 'text'); - t.end(); -}); - -test('Oddity: [', t => { - t.throws(() => format('['), '['); - t.end(); -}); - -test('Oddity: A/P', t => { - t.format('A/P', 0.7, 'P'); - t.end(); -}); - -test('Oddity: e', t => { - t.format('e', 0.7, '1900'); - t.end(); -}); - -test('Oddity: 123', t => { - t.format('123', 0.7, '123'); - t.format('123', 0, '123'); - t.format('123', 'text', 'text'); - t.end(); -}); - -test('Oddity: 0.##', t => { - t.format('0.##', 1, '1.'); - t.format('0.##', -1, '-1.'); - t.format('0.##', 0, '0.'); - t.format('0.##', 1.1, '1.1'); - t.format('0.##', -1.2, '-1.2'); - t.format('0.##', 1000000000000.01, '1000000000000.01'); - t.format('0.##', -1000.01, '-1000.01'); - t.format('0.##', 0.1, '0.1'); - t.format('0.##', 1.007, '1.01'); - t.format('0.##', -1.008, '-1.01'); - t.end(); -}); - -test('Oddity: ** #,###,#00,000.00,**', t => { - t.format('** #,###,#00,000.00,**', 1.2345, ' 00,000.00'); - t.format('** #,###,#00,000.00,**', 12.345, ' 00,000.01'); - t.format('** #,###,#00,000.00,**', 123.45, ' 00,000.12'); - t.format('** #,###,#00,000.00,**', 1234.56, ' 00,001.23'); - t.format('** #,###,#00,000.00,**', 12345.67, ' 00,012.35'); - t.format('** #,###,#00,000.00,**', 123456.78, ' 00,123.46'); - t.format('** #,###,#00,000.00,**', 1234567.89, ' 01,234.57'); - t.format('** #,###,#00,000.00,**', 12345681.9, ' 12,345.68'); - t.format('** #,###,#00,000.00,**', 123456822, ' 123,456.82'); - t.format('** #,###,#00,000.00,**', 1234568223, ' 1,234,568.22'); - t.format('** #,###,#00,000.00,**', 12345682233, ' 12,345,682.23'); - t.format('** #,###,#00,000.00,**', 123456822333, ' 123,456,822.33'); - t.format('** #,###,#00,000.00,**', 1234568223333, ' 1,234,568,223.33'); - t.format('** #,###,#00,000.00,**', 12345682233333, ' 12,345,682,233.33'); - t.format('** #,###,#00,000.00,**', 123456822333333, ' 123,456,822,333.33'); - t.format('** #,###,#00,000.00,**', 1234568223333330, ' 1,234,568,223,333.33'); - t.format('** #,###,#00,000.00,**', 12345682233333300, ' 12,345,682,233,333.30'); - t.format('** #,###,#00,000.00,**', 123456822333333000, ' 123,456,822,333,333.00'); - t.format('** #,###,#00,000.00,**', 1234568223333330000, ' 1,234,568,223,333,330.00'); - t.format('** #,###,#00,000.00,**', 12345682233333300000, ' 12,345,682,233,333,300.00'); - t.format('** #,###,#00,000.00,**', 123456822333333000000, ' 123,456,822,333,333,000.00'); - t.format('** #,###,#00,000.00,**', 1.23456822333333e+21, ' 1,234,568,223,333,330,000.00'); - t.end(); -}); - -test('Oddity: 00,000.00,', t => { - t.format('00,000.00,', 12345, '00,012.35'); - t.end(); -}); - -test('Oddity: 00,000.00', t => { - t.format('00,000.00', 12345, '12,345.00'); - t.end(); -}); - -test('Oddity: ##0.0E+0', t => { - t.format('##0.0E+0', 1, '1.0E+0'); - t.format('##0.0E+0', 12, '12.0E+0'); - t.format('##0.0E+0', 123, '123.0E+0'); - t.format('##0.0E+0', 1234, '1.2E+3'); - t.format('##0.0E+0', 12345, '12.3E+3'); - t.format('##0.0E+0', 123456, '123.5E+3'); - t.format('##0.0E+0', 1234567, '1.2E+6'); - t.format('##0.0E+0', 12345678, '12.3E+6'); - t.format('##0.0E+0', 123456789, '123.5E+6'); - t.end(); -}); - -test.skip('Oddity: 000#0#0#0##00##00##0#########', t => { - // 000#0#0#0##00##00##0######### - // 000 0 0 0 00 00 0 12345 (12345) - // 000 0 0 0 00 00 0 1 (1) - t.format('000#0#0#0##00##00##0#########', 12345, '0000000000012345'); - t.end(); -}); - -test.skip('Oddity: 0#######0.##0##0######00######0', t => { - t.format('0#######0.##0##0######00######0', 12.3456789, '012.3456789000'); - t.format('0#######0.##0##0######00######0', 123456789, '123456789.00000'); - t.end(); -}); - -test('Oddity: ###\\###\\##0.00', t => { - t.format('###\\###\\##0.00', 0.00101, '##0.00'); - t.format('###\\###\\##0.00', 0.0101, '##0.01'); - t.format('###\\###\\##0.00', 0.101, '##0.10'); - t.format('###\\###\\##0.00', 1.01, '##1.01'); - t.format('###\\###\\##0.00', 10.1, '##10.10'); - t.format('###\\###\\##0.00', 101, '#1#01.00'); - t.format('###\\###\\##0.00', 1010, '#10#10.00'); - t.format('###\\###\\##0.00', 10100, '1#01#00.00'); - t.format('###\\###\\##0.00', 101000, '10#10#00.00'); - t.format('###\\###\\##0.00', 1010000, '101#00#00.00'); - t.format('###\\###\\##0.00', 10100000, '1010#00#00.00'); - t.format('###\\###\\##0.00', 101000000, '10100#00#00.00'); - t.format('###\\###\\##0.00', 123456789.01, '12345#67#89.01'); - t.end(); -}); - -test('Oddity: ###\\\\###\\\\##\\0.00', t => { - t.format('###\\\\###\\\\##\\0.00', 0.00101, '\\\\0.00'); - t.format('###\\\\###\\\\##\\0.00', 0.0101, '\\\\0.01'); - t.format('###\\\\###\\\\##\\0.00', 0.101, '\\\\0.10'); - t.format('###\\\\###\\\\##\\0.00', 1.01, '\\\\10.01'); - t.format('###\\\\###\\\\##\\0.00', 10.1, '\\\\100.10'); - t.format('###\\\\###\\\\##\\0.00', 101, '\\1\\010.00'); - t.format('###\\\\###\\\\##\\0.00', 1010, '\\10\\100.00'); - t.format('###\\\\###\\\\##\\0.00', 10100, '\\101\\000.00'); - t.format('###\\\\###\\\\##\\0.00', 101000, '1\\010\\000.00'); - t.format('###\\\\###\\\\##\\0.00', 1010000, '10\\100\\000.00'); - t.format('###\\\\###\\\\##\\0.00', 10100000, '101\\000\\000.00'); - t.format('###\\\\###\\\\##\\0.00', 101000000, '1010\\000\\000.00'); - t.format('###\\\\###\\\\##\\0.00', 123456789.01, '1234\\567\\890.01'); - t.end(); -}); - -test('Oddity: 0.0#', t => { - t.format('0.0#', 12345, '12345.0'); - t.format('0.0#', 1234.5, '1234.5'); - t.format('0.0#', 123.45, '123.45'); - t.format('0.0#', 12.345, '12.35'); - t.format('0.0#', 1.2345, '1.23'); - t.format('0.0#', 0.12345, '0.12'); - t.format('0.0#', 0.012345, '0.01'); - t.format('0.0#', 0.0012345, '0.0'); - t.format('0.0#', 0.00012345, '0.0'); - t.format('0.0#', 15.04, '15.04'); - t.format('0.0#', 15.06, '15.06'); - t.end(); -}); - -test('Oddity: ###\\\\###\\\\##\\0', t => { - t.format('###\\\\###\\\\##\\0', 12345.6789, '\\123\\460'); - t.end(); -}); - -test('Oddity: 00000-0000', t => { - t.format('00000-0000', 941051630, '94105-1630'); - t.format('00000-0000', 12345.6789, '00001-2346'); - t.end(); -}); - -test('Oddity: 000-00-0000', t => { - t.format('000-00-0000', 123456789, '123-45-6789'); - t.end(); -}); - -test('Oddity: 00000\\-0000', t => { - t.format('00000\\-0000', 941051630, '94105-1630'); - t.end(); -}); - -test('Oddity: 000\\-00\\-0000', t => { - t.format('000\\-00\\-0000', 123456789, '123-45-6789'); - t.end(); -}); - -test('Oddity: ??/??', t => { - t.format('??/??', 12.3456789, '1000/81'); - t.format('??/??', 0.00001, ' 0/1 '); - t.end(); -}); - -test('Oddity: # ??/??', t => { - t.format('# ??/??', 12.3456789, '12 28/81'); - t.end(); -}); - -test('Oddity: #??/??', t => { - t.format('#??/??', 12.3456789, '1000/81'); - t.end(); -}); - -test('Oddity: #0#00??/??', t => { - t.format('#0#00??/??', 12.3456789, '01000/81'); - t.end(); -}); - -test('Oddity: [<=9999999]###-####;(###) ###-####', t => { - t.format('[<=9999999]###-####;(###) ###-####', 8675309, '867-5309'); - t.format('[<=9999999]###-####;(###) ###-####', 2813308004, '(281) 330-8004'); - t.format('[<=9999999]###-####;(###) ###-####', 2018675309, '(201) 867-5309'); - t.end(); -}); - -test('Oddity: [<=9999999]###\\-####;(###) ###\\-####', t => { - t.format('[<=9999999]###\\-####;(###) ###\\-####', 8675309, '867-5309'); - t.format('[<=9999999]###\\-####;(###) ###\\-####', 2813308004, '(281) 330-8004'); - t.end(); -}); - -test('Oddity: [Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General', t => { - const z = '[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General'; - t.format(z, 50, '50'); - t.format(z, 26, '26'); - t.format(z, 25, '25'); - t.format(z, 1, '1'); - t.format(z, 0, '0'); - t.format(z, -1, '-1'); - t.format(z, -25, '-25'); - t.format(z, -26, '26'); - t.format(z, -50.1, '50.1'); - t.format(z, 'foo', 'foo'); - t.format(z, 'bar', 'bar'); - t.end(); -}); - -test('Oddity: [Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', t => { - const z = '[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General'; - t.format(z, 50, '50'); - t.format(z, 26, '26'); - t.format(z, 25, '25'); - t.format(z, 1, '1'); - t.format(z, 0, '0'); - t.format(z, -1, '-1'); - t.format(z, -25, '25'); - t.format(z, -26.1, '26.1'); - t.format(z, -50, '50'); - t.format(z, 'foo', 'foo'); - t.format(z, 'bar', 'bar'); - t.end(); -}); - -test("Oddity: [Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'", t => { - const z = "[Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'"; - t.format(z, 50, '50 '); - t.format(z, 0, '0p'); - t.format(z, -25, '25 '); - t.format(z, 'foo', 'foo\''); - t.end(); -}); - -test('Oddity: [Red][=50]General;[Blue]000', t => { - t.format('[Red][=50]General;[Blue]000', 50, '50'); - t.format('[Red][=50]General;[Blue]000', 51, '051'); - t.format('[Red][=50]General;[Blue]000', 49, '049'); - t.end(); -}); - -test('Oddity: [Red][<>50]General;[Blue]000', t => { - t.format('[Red][<>50]General;[Blue]000', 50, '050'); - t.format('[Red][<>50]General;[Blue]000', 51, '51'); - t.format('[Red][<>50]General;[Blue]000', 49, '49'); - t.end(); -}); - -test('Oddity: b', t => { - t.format('b', 1, '43'); - t.format('b', 1000, '45'); - t.format('b', 10000, '70'); - t.end(); -}); - -test('Oddity: B2yyyy-mm-dd', t => { - t.format('B2yyyy-mm-dd', 0, '1317-08-29'); - t.format('B2yyyy-mm-dd', 59, '1317-10-28'); - t.formatThrows('B2yyyy-mm-dd', 60); - t.format('B2yyyy-mm-dd', 61, '1317-10-29'); - t.format('B2yyyy-mm-dd', 1000, '1320-06-23'); - t.format('B2yyyy-mm-dd', 10000, '1345-11-17'); - t.end(); -}); - -test('Oddity: ☃', t => { - t.format('☃', 0, '☃'); - t.format('☃', 1, '☃'); - t.format('☃', -1, '-☃'); - t.format('☃', 'foo', 'foo'); - t.end(); -}); - -test.skip('Oddity: #0#######', t => { - t.format('#0#######', 12345, '012345'); - t.format('#0#######', 12345.4321, '012345'); - t.format('#0#######', 12345.6789, '012346'); - t.end(); -}); - -test.skip('Oddity: ##,##', t => { - t.format('##,##', 0, ''); - t.format('##,##', 1, '1'); - t.format('##,##', 1234, '1,234'); - t.format('##,##', 12345, '12,345'); - t.format('##,##', 1234567, '1,234,567'); - t.end(); -}); - -test('Oddity: 0', t => { - t.format('0', 12345, '12345'); - t.format('0', 4294967296.5, '4294967297'); - t.end(); -}); - -test('Oddity: "Rs."#,##0.00', t => { - t.format('"Rs."#,##0.00', -51968287, '-Rs.51,968,287.00'); - t.format('"Rs."#,##0.00', 2000000, 'Rs.2,000,000.00'); - t.end(); -}); - -test('Oddity: $#.00', t => { - t.format('$#.00', 3.14159, '$3.14'); - t.format('$#.00', -3.14159, '-$3.14'); - t.end(); -}); - -test.skip('Oddity: "This is a ".00"test"000', t => { - t.format('"This is a ".00"test"000', -3.14159, '-This is a 3.14test159'); - t.format('"This is a ".00"test"000', 3.14159, 'This is a 3.14test159'); - t.end(); -}); - -test('Oddity: [$INR]\\ #,##0.00', t => { - t.format('[$INR]\\ #,##0.00', 3.14159, 'INR 3.14'); - t.format('[$INR]\\ #,##0.00', -3.14159, '-INR 3.14'); - t.end(); -}); - -test('Oddity: [$₹-4009]\\ #,##0.00', t => { - t.format('[$₹-4009]\\ #,##0.00', 3.14159, '₹ 3.14'); - t.format('[$₹-4009]\\ #,##0.00', -3.14159, '-₹ 3.14'); - t.end(); -}); - -test('Oddity: [$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', t => { - t.format('[$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', 3.14159, '£3.1416'); - t.format('[$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', -3.14159, '-£3.1416'); - t.end(); -}); - -test('Oddity: "-"0.00', t => { - t.format('"-"0.00', 3.14159, '-3.14'); - t.format('"-"0.00', -3.14159, '--3.14'); - t.end(); -}); - -test('Oddity: [$-409]mmm\\-yy', t => { - t.format('[$-409]mmm\\-yy', 12345, 'Oct-33'); - t.end(); -}); - -test('Oddity: \\,##.??;\\(#,###.??\\);0', t => { - t.format('\\,##.??;\\(#,###.??\\);0', 15, ',15. '); - t.format('\\,##.??;\\(#,###.??\\);0', 14.3453453, ',14.35'); - t.format('\\,##.??;\\(#,###.??\\);0', 12.1, ',12.1 '); - t.format('\\,##.??;\\(#,###.??\\);0', 0, '0'); - t.format('\\,##.??;\\(#,###.??\\);0', -15, '(15. )'); - t.format('\\,##.??;\\(#,###.??\\);0', -14.3453453, '(14.35)'); - t.format('\\,##.??;\\(#,###.??\\);0', -12.1, '(12.1 )'); - t.format('\\,##.??;\\(#,###.??\\);0', 1, ',1. '); - t.end(); -}); - -test('Oddity: "£"#.####;-"£"#.####', t => { - t.format('"£"#.####;-"£"#.####', 3.141592654, '£3.1416'); - t.format('"£"#.####;-"£"#.####', -3.141592654, '-£3.1416'); - t.end(); -}); - -test('Oddity: [h]:mm:ss;@', t => { - t.format('[h]:mm:ss;@', 2.9999999999999996, '72:00:00'); - t.end(); -}); - -test('Oddity: hh:mm:ss AM/PM', t => { - t.format('hh:mm:ss AM/PM', 0.5, '12:00:00 PM'); - t.end(); -}); - -test('Oddity: hh:mm:ss am/pm', t => { - t.format('hh:mm:ss am/pm', 0.5, '12:00:00 PM'); - t.end(); -}); - -test('Oddity: hh:mm:ss AM/P', t => { - t.format('hh:mm:ss AM/P', 0.5, '12:00:00 A1/P'); - t.end(); -}); - -test('Oddity: hh:mm:ss am/p', t => { - t.format('hh:mm:ss am/p', 0.5, '12:00:00 a1/p'); - t.end(); -}); - -test('Oddity: "foo";"bar";"baz";"qux";"foobar"', t => { - t.throws(() => format('"foo";"bar";"baz";"qux";"foobar"'), '"foo";"bar";"baz";"qux";"foobar"'); - t.end(); -}); diff --git a/test/ssf-oddities.spec.ts b/test/ssf-oddities.spec.ts new file mode 100644 index 0000000..f7cd298 --- /dev/null +++ b/test/ssf-oddities.spec.ts @@ -0,0 +1,593 @@ +// Tests originally converted from SSF but have been reviewed +// and corrected and conformed to Excel for Mac version 16.35 +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Oddity: "foo";"bar";"baz";"qux"', () => { + expect(format('"foo";"bar";"baz";"qux"', 1)).toBe('foo'); + expect(format('"foo";"bar";"baz";"qux"', -1)).toBe('bar'); + expect(format('"foo";"bar";"baz";"qux"', 0)).toBe('baz'); + expect(format('"foo";"bar";"baz";"qux"', 'text')).toBe('qux'); +}); + +test('Oddity: "foo";"bar";"baz"', () => { + expect(format('"foo";"bar";"baz"', 1)).toBe('foo'); + expect(format('"foo";"bar";"baz"', -1)).toBe('bar'); + expect(format('"foo";"bar";"baz"', 0)).toBe('baz'); + expect(format('"foo";"bar";"baz"', 'text')).toBe('text'); +}); + +test('Oddity: "foo";"bar";@', () => { + expect(format('"foo";"bar";@', 1)).toBe('foo'); + expect(format('"foo";"bar";@', -1)).toBe('bar'); + expect(format('"foo";"bar";@', 0)).toBe('foo'); + expect(format('"foo";"bar";@', 'text')).toBe('text'); +}); + +test('Oddity: "foo";"bar"', () => { + expect(format('"foo";"bar"', 1)).toBe('foo'); + expect(format('"foo";"bar"', -1)).toBe('bar'); + expect(format('"foo";"bar"', 0)).toBe('foo'); + expect(format('"foo";"bar"', 'text')).toBe('text'); +}); + +test('Oddity: @@', () => { + expect(format('@@', 1)).toBe('1'); + expect(format('@@', -1)).toBe('-1'); + expect(format('@@', 0)).toBe('0'); + expect(format('@@', 'text')).toBe('texttext'); +}); + +test('Oddity: [Blue]General', () => { + expect(format('[Blue]General', 1)).toBe('1'); + expect(format('[Blue]General', -1)).toBe('-1'); + expect(format('[Blue]General', 0)).toBe('0'); + expect(format('[Blue]General', 'text')).toBe('text'); +}); + +test('Oddity: [Blue]G3neral', () => { + expect(() => format('[Blue]G3neral', '', 0)).toThrow(); +}); + +test('Oddity: A"TODO"', () => { + expect(format('A"TODO"', 1)).toBe('ATODO'); + expect(format('A"TODO"', -1)).toBe('-ATODO'); + expect(format('A"TODO"', 0)).toBe('ATODO'); + expect(format('A"TODO"', 'text')).toBe('text'); +}); + +test('Oddity: r', () => { + expect(format('r', 1)).toBe('r'); + expect(format('r', -1)).toBe('-r'); + expect(format('r', 0)).toBe('r'); + expect(format('r', 'text')).toBe('text'); +}); + +test('Oddity: ((;@', () => { + expect(format('((;@', 1)).toBe('(('); + expect(format('((;@', 0)).toBe('(('); + expect(format('((;@', 'text')).toBe('text'); +}); + +test('Oddity: \\r', () => { + expect(format('\\r', 1)).toBe('r'); + expect(format('\\r', -1)).toBe('-r'); + expect(format('\\r', 0)).toBe('r'); + expect(format('\\r', 'text')).toBe('text'); +}); + +test('Oddity: _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', () => { + expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (1))).toBe(' $1 '); + expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (-1))).toBe(' $(1)'); + expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (0))).toBe(' $- '); + expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', ('text'))).toBe(' text '); + // expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (null))).toBe(' $- '); + // expect(format('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)', (''))).toBe(''); +}); + +test('Oddity: #0.#', () => { + expect(format('#0.#', 0)).toBe('0.'); + expect(format('#0.#', 1)).toBe('1.'); + expect(format('#0.#', 12)).toBe('12.'); + expect(format('#0.#', 12.34)).toBe('12.3'); + expect(format('#0.#', -1.23)).toBe('-1.2'); +}); + +test('Oddity: #,##0.0', () => { + expect(format('#,##0.0', 1)).toBe('1.0'); + expect(format('#,##0.0', -1)).toBe('-1.0'); + expect(format('#,##0.0', 0)).toBe('0.0'); + expect(format('#,##0.0', 'text')).toBe('text'); +}); + +test('Oddity: #,##0.00', () => { + expect(format('#,##0.00', 1)).toBe('1.00'); + expect(format('#,##0.00', -1)).toBe('-1.00'); + expect(format('#,##0.00', 0)).toBe('0.00'); + expect(format('#,##0.00', 'text')).toBe('text'); +}); + +test('Oddity: #,##0.000', () => { + expect(format('#,##0.000', 1)).toBe('1.000'); + expect(format('#,##0.000', -1)).toBe('-1.000'); + expect(format('#,##0.000', 0)).toBe('0.000'); + expect(format('#,##0.000', 'text')).toBe('text'); +}); + +test('Oddity: #,##0.0000', () => { + expect(format('#,##0.0000', 1)).toBe('1.0000'); + expect(format('#,##0.0000', -1)).toBe('-1.0000'); + expect(format('#,##0.0000', 0)).toBe('0.0000'); + expect(format('#,##0.0000', 'text')).toBe('text'); +}); + +test('Oddity: #,##0.00000', () => { + expect(format('#,##0.00000', 1000000)).toBe('1,000,000.00000'); +}); + +test('Oddity: #,##0.000000', () => { + expect(format('#,##0.000000', 1000000)).toBe('1,000,000.000000'); +}); + +test('Oddity: #,##0.0000000', () => { + expect(format('#,##0.0000000', 1000000)).toBe('1,000,000.0000000'); +}); + +test('Oddity: #,##0.00000000', () => { + expect(format('#,##0.00000000', 1000000)).toBe('1,000,000.00000000'); +}); + +test('Oddity: #,##0.000000000', () => { + expect(format('#,##0.000000000', 1000000)).toBe('1,000,000.000000000'); +}); + +test('Oddity: #,###', () => { + expect(format('#,###', 1)).toBe('1'); + expect(format('#,###', -1)).toBe('-1'); + expect(format('#,###', 0)).toBe(''); + expect(format('#,###', 12345.6789)).toBe('12,346'); + expect(format('#,###', 'TODO')).toBe('TODO'); +}); + +test('Oddity: #.##', () => { + expect(format('#.##', 1)).toBe('1.'); + expect(format('#.##', -1)).toBe('-1.'); + expect(format('#.##', 0)).toBe('.'); + expect(format('#.##', 'text')).toBe('text'); +}); + +test('Oddity: 0;0', () => { + expect(format('0;0', 1.1)).toBe('1'); + expect(format('0;0', -1.1)).toBe('1'); + expect(format('0;0', 0)).toBe('0'); + expect(format('0;0', 'text')).toBe('text'); +}); + +test('Oddity: 0.0', () => { + expect(format('0.0', 1)).toBe('1.0'); + expect(format('0.0', -1)).toBe('-1.0'); + expect(format('0.0', 0)).toBe('0.0'); + expect(format('0.0', 'text')).toBe('text'); +}); + +test('Oddity: 0.00', () => { + expect(format('0.00', 1.0001)).toBe('1.00'); + expect(format('0.00', -1)).toBe('-1.00'); + expect(format('0.00', 0)).toBe('0.00'); + expect(format('0.00', 'text')).toBe('text'); +}); + +test('Oddity: 0.000', () => { + expect(format('0.000', 1)).toBe('1.000'); + expect(format('0.000', -1)).toBe('-1.000'); + expect(format('0.000', 0)).toBe('0.000'); + expect(format('0.000', 'text')).toBe('text'); +}); + +test('Oddity: 0.0000', () => { + expect(format('0.0000', 1)).toBe('1.0000'); + expect(format('0.0000', -1)).toBe('-1.0000'); + expect(format('0.0000', 0)).toBe('0.0000'); + expect(format('0.0000', 'text')).toBe('text'); +}); + +test('Oddity: hh:mm AM/PM', () => { + expect(format('hh:mm AM/PM', 0.7)).toBe('04:48 PM'); +}); + +test('Oddity: hhh:mm AM/PM', () => { + expect(format('hhh:mm AM/PM', 0.7)).toBe('04:48 PM'); +}); + +test('Oddity: hhh:mmm:sss', () => { + expect(format('hhh:mmm:sss', 0.7)).toBe('16:Jan:00'); +}); + +test('Oddity: hh:mmm:sss', () => { + expect(format('hhh:mmm:sss', 0.7)).toBe('16:Jan:00'); +}); + +test('Oddity: hh:mm:sss', () => { + expect(format('hh:mm:sss', 0.7)).toBe('16:48:00'); +}); + +test('Oddity: hh:mm:ss.000', () => { + expect(format('hh:mm:ss.000', 0.7)).toBe('16:48:00.000'); + expect(format('hh:mm:ss.000', 0.70707)).toBe('16:58:10.848'); +}); + +test('Oddity: hh.000', () => { + expect(format('hh.000', 0.70707)).toBe('16.848'); +}); + +test('Oddity: hh .00', () => { + expect(format('hh .00', 0.70707)).toBe('16 .85'); +}); + +test('Oddity: hh .0', () => { + expect(format('hh .0', 0.70707)).toBe('16 .8'); +}); + +test('Oddity: hh .00 .000', () => { + expect(format('hh .00 .000', 0.70707)).toBe('16 .84 .848'); +}); + +test('Oddity: [hhh]', () => { + expect(format('[hhh]', 1)).toBe('024'); + expect(format('[hhh]', -1)).toBe('-024'); + expect(format('[hhh]', 0)).toBe('000'); + expect(format('[hhh]', 'text')).toBe('text'); +}); + +test('Oddity: [', () => { + expect(() => format('['), '[').toThrow(); +}); + +test('Oddity: A/P', () => { + expect(format('A/P', 0.7)).toBe('P'); +}); + +test('Oddity: e', () => { + expect(format('e', 0.7)).toBe('1900'); +}); + +test('Oddity: 123', () => { + expect(format('123', 0.7)).toBe('123'); + expect(format('123', 0)).toBe('123'); + expect(format('123', 'text')).toBe('text'); +}); + +test('Oddity: 0.##', () => { + expect(format('0.##', 1)).toBe('1.'); + expect(format('0.##', -1)).toBe('-1.'); + expect(format('0.##', 0)).toBe('0.'); + expect(format('0.##', 1.1)).toBe('1.1'); + expect(format('0.##', -1.2)).toBe('-1.2'); + expect(format('0.##', 1000000000000.01)).toBe('1000000000000.01'); + expect(format('0.##', -1000.01)).toBe('-1000.01'); + expect(format('0.##', 0.1)).toBe('0.1'); + expect(format('0.##', 1.007)).toBe('1.01'); + expect(format('0.##', -1.008)).toBe('-1.01'); +}); + +test('Oddity: ** #,###,#00,000.00,**', () => { + expect(format('** #,###,#00,000.00,**', 1.2345)).toBe(' 00,000.00'); + expect(format('** #,###,#00,000.00,**', 12.345)).toBe(' 00,000.01'); + expect(format('** #,###,#00,000.00,**', 123.45)).toBe(' 00,000.12'); + expect(format('** #,###,#00,000.00,**', 1234.56)).toBe(' 00,001.23'); + expect(format('** #,###,#00,000.00,**', 12345.67)).toBe(' 00,012.35'); + expect(format('** #,###,#00,000.00,**', 123456.78)).toBe(' 00,123.46'); + expect(format('** #,###,#00,000.00,**', 1234567.89)).toBe(' 01,234.57'); + expect(format('** #,###,#00,000.00,**', 12345681.9)).toBe(' 12,345.68'); + expect(format('** #,###,#00,000.00,**', 123456822)).toBe(' 123,456.82'); + expect(format('** #,###,#00,000.00,**', 1234568223)).toBe(' 1,234,568.22'); + expect(format('** #,###,#00,000.00,**', 12345682233)).toBe(' 12,345,682.23'); + expect(format('** #,###,#00,000.00,**', 123456822333)).toBe(' 123,456,822.33'); + expect(format('** #,###,#00,000.00,**', 1234568223333)).toBe(' 1,234,568,223.33'); + expect(format('** #,###,#00,000.00,**', 12345682233333)).toBe(' 12,345,682,233.33'); + expect(format('** #,###,#00,000.00,**', 123456822333333)).toBe(' 123,456,822,333.33'); + expect(format('** #,###,#00,000.00,**', 1234568223333330)).toBe(' 1,234,568,223,333.33'); + expect(format('** #,###,#00,000.00,**', 12345682233333300)).toBe(' 12,345,682,233,333.30'); + expect(format('** #,###,#00,000.00,**', 123456822333333000)).toBe(' 123,456,822,333,333.00'); + expect(format('** #,###,#00,000.00,**', 1234568223333330000)).toBe(' 1,234,568,223,333,330.00'); + expect(format('** #,###,#00,000.00,**', 12345682233333300000)).toBe(' 12,345,682,233,333,300.00'); + expect(format('** #,###,#00,000.00,**', 123456822333333000000)).toBe(' 123,456,822,333,333,000.00'); + expect(format('** #,###,#00,000.00,**', 1.23456822333333e+21)).toBe(' 1,234,568,223,333,330,000.00'); +}); + +test('Oddity: 00,000.00,', () => { + expect(format('00,000.00,', 12345)).toBe('00,012.35'); +}); + +test('Oddity: 00,000.00', () => { + expect(format('00,000.00', 12345)).toBe('12,345.00'); +}); + +test('Oddity: ##0.0E+0', () => { + expect(format('##0.0E+0', 1)).toBe('1.0E+0'); + expect(format('##0.0E+0', 12)).toBe('12.0E+0'); + expect(format('##0.0E+0', 123)).toBe('123.0E+0'); + expect(format('##0.0E+0', 1234)).toBe('1.2E+3'); + expect(format('##0.0E+0', 12345)).toBe('12.3E+3'); + expect(format('##0.0E+0', 123456)).toBe('123.5E+3'); + expect(format('##0.0E+0', 1234567)).toBe('1.2E+6'); + expect(format('##0.0E+0', 12345678)).toBe('12.3E+6'); + expect(format('##0.0E+0', 123456789)).toBe('123.5E+6'); +}); + +test.skip('Oddity: 000#0#0#0##00##00##0#########', () => { + // 000#0#0#0##00##00##0######### + // 000 0 0 0 00 00 0 12345 (12345) + // 000 0 0 0 00 00 0 1 (1) + expect(format('000#0#0#0##00##00##0#########', 12345)).toBe('0000000000012345'); +}); + +test.skip('Oddity: 0#######0.##0##0######00######0', () => { + expect(format('0#######0.##0##0######00######0', 12.3456789)).toBe('012.3456789000'); + expect(format('0#######0.##0##0######00######0', 123456789)).toBe('123456789.00000'); +}); + +test('Oddity: ###\\###\\##0.00', () => { + expect(format('###\\###\\##0.00', 0.00101)).toBe('##0.00'); + expect(format('###\\###\\##0.00', 0.0101)).toBe('##0.01'); + expect(format('###\\###\\##0.00', 0.101)).toBe('##0.10'); + expect(format('###\\###\\##0.00', 1.01)).toBe('##1.01'); + expect(format('###\\###\\##0.00', 10.1)).toBe('##10.10'); + expect(format('###\\###\\##0.00', 101)).toBe('#1#01.00'); + expect(format('###\\###\\##0.00', 1010)).toBe('#10#10.00'); + expect(format('###\\###\\##0.00', 10100)).toBe('1#01#00.00'); + expect(format('###\\###\\##0.00', 101000)).toBe('10#10#00.00'); + expect(format('###\\###\\##0.00', 1010000)).toBe('101#00#00.00'); + expect(format('###\\###\\##0.00', 10100000)).toBe('1010#00#00.00'); + expect(format('###\\###\\##0.00', 101000000)).toBe('10100#00#00.00'); + expect(format('###\\###\\##0.00', 123456789.01)).toBe('12345#67#89.01'); +}); + +test('Oddity: ###\\\\###\\\\##\\0.00', () => { + expect(format('###\\\\###\\\\##\\0.00', 0.00101)).toBe('\\\\0.00'); + expect(format('###\\\\###\\\\##\\0.00', 0.0101)).toBe('\\\\0.01'); + expect(format('###\\\\###\\\\##\\0.00', 0.101)).toBe('\\\\0.10'); + expect(format('###\\\\###\\\\##\\0.00', 1.01)).toBe('\\\\10.01'); + expect(format('###\\\\###\\\\##\\0.00', 10.1)).toBe('\\\\100.10'); + expect(format('###\\\\###\\\\##\\0.00', 101)).toBe('\\1\\010.00'); + expect(format('###\\\\###\\\\##\\0.00', 1010)).toBe('\\10\\100.00'); + expect(format('###\\\\###\\\\##\\0.00', 10100)).toBe('\\101\\000.00'); + expect(format('###\\\\###\\\\##\\0.00', 101000)).toBe('1\\010\\000.00'); + expect(format('###\\\\###\\\\##\\0.00', 1010000)).toBe('10\\100\\000.00'); + expect(format('###\\\\###\\\\##\\0.00', 10100000)).toBe('101\\000\\000.00'); + expect(format('###\\\\###\\\\##\\0.00', 101000000)).toBe('1010\\000\\000.00'); + expect(format('###\\\\###\\\\##\\0.00', 123456789.01)).toBe('1234\\567\\890.01'); +}); + +test('Oddity: 0.0#', () => { + expect(format('0.0#', 12345)).toBe('12345.0'); + expect(format('0.0#', 1234.5)).toBe('1234.5'); + expect(format('0.0#', 123.45)).toBe('123.45'); + expect(format('0.0#', 12.345)).toBe('12.35'); + expect(format('0.0#', 1.2345)).toBe('1.23'); + expect(format('0.0#', 0.12345)).toBe('0.12'); + expect(format('0.0#', 0.012345)).toBe('0.01'); + expect(format('0.0#', 0.0012345)).toBe('0.0'); + expect(format('0.0#', 0.00012345)).toBe('0.0'); + expect(format('0.0#', 15.04)).toBe('15.04'); + expect(format('0.0#', 15.06)).toBe('15.06'); +}); + +test('Oddity: ###\\\\###\\\\##\\0', () => { + expect(format('###\\\\###\\\\##\\0', 12345.6789)).toBe('\\123\\460'); +}); + +test('Oddity: 00000-0000', () => { + expect(format('00000-0000', 941051630)).toBe('94105-1630'); + expect(format('00000-0000', 12345.6789)).toBe('00001-2346'); +}); + +test('Oddity: 000-00-0000', () => { + expect(format('000-00-0000', 123456789)).toBe('123-45-6789'); +}); + +test('Oddity: 00000\\-0000', () => { + expect(format('00000\\-0000', 941051630)).toBe('94105-1630'); +}); + +test('Oddity: 000\\-00\\-0000', () => { + expect(format('000\\-00\\-0000', 123456789)).toBe('123-45-6789'); +}); + +test('Oddity: ??/??', () => { + expect(format('??/??', 12.3456789)).toBe('1000/81'); + expect(format('??/??', 0.00001)).toBe(' 0/1 '); +}); + +test('Oddity: # ??/??', () => { + expect(format('# ??/??', 12.3456789)).toBe('12 28/81'); +}); + +test('Oddity: #??/??', () => { + expect(format('#??/??', 12.3456789)).toBe('1000/81'); +}); + +test('Oddity: #0#00??/??', () => { + expect(format('#0#00??/??', 12.3456789)).toBe('01000/81'); +}); + +test('Oddity: [<=9999999]###-####;(###) ###-####', () => { + expect(format('[<=9999999]###-####;(###) ###-####', 8675309)).toBe('867-5309'); + expect(format('[<=9999999]###-####;(###) ###-####', 2813308004)).toBe('(281) 330-8004'); + expect(format('[<=9999999]###-####;(###) ###-####', 2018675309)).toBe('(201) 867-5309'); +}); + +test('Oddity: [<=9999999]###\\-####;(###) ###\\-####', () => { + expect(format('[<=9999999]###\\-####;(###) ###\\-####', 8675309)).toBe('867-5309'); + expect(format('[<=9999999]###\\-####;(###) ###\\-####', 2813308004)).toBe('(281) 330-8004'); +}); + +test('Oddity: [Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General', () => { + const z = '[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General'; + expect(format(z, 50)).toBe('50'); + expect(format(z, 26)).toBe('26'); + expect(format(z, 25)).toBe('25'); + expect(format(z, 1)).toBe('1'); + expect(format(z, 0)).toBe('0'); + expect(format(z, -1)).toBe('-1'); + expect(format(z, -25)).toBe('-25'); + expect(format(z, -26)).toBe('26'); + expect(format(z, -50.1)).toBe('50.1'); + expect(format(z, 'foo')).toBe('foo'); + expect(format(z, 'bar')).toBe('bar'); +}); + +test('Oddity: [Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', () => { + const z = '[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General'; + expect(format(z, 50)).toBe('50'); + expect(format(z, 26)).toBe('26'); + expect(format(z, 25)).toBe('25'); + expect(format(z, 1)).toBe('1'); + expect(format(z, 0)).toBe('0'); + expect(format(z, -1)).toBe('-1'); + expect(format(z, -25)).toBe('25'); + expect(format(z, -26.1)).toBe('26.1'); + expect(format(z, -50)).toBe('50'); + expect(format(z, 'foo')).toBe('foo'); + expect(format(z, 'bar')).toBe('bar'); +}); + +test("Oddity: [Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'", () => { + const z = "[Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'"; + expect(format(z, 50)).toBe('50 '); + expect(format(z, 0)).toBe('0p'); + expect(format(z, -25)).toBe('25 '); + expect(format(z, 'foo')).toBe('foo\''); +}); + +test('Oddity: [Red][=50]General;[Blue]000', () => { + expect(format('[Red][=50]General;[Blue]000', 50)).toBe('50'); + expect(format('[Red][=50]General;[Blue]000', 51)).toBe('051'); + expect(format('[Red][=50]General;[Blue]000', 49)).toBe('049'); +}); + +test('Oddity: [Red][<>50]General;[Blue]000', () => { + expect(format('[Red][<>50]General;[Blue]000', 50)).toBe('050'); + expect(format('[Red][<>50]General;[Blue]000', 51)).toBe('51'); + expect(format('[Red][<>50]General;[Blue]000', 49)).toBe('49'); +}); + +test('Oddity: b', () => { + expect(format('b', 1)).toBe('43'); + expect(format('b', 1000)).toBe('45'); + expect(format('b', 10000)).toBe('70'); +}); + +test('Oddity: B2yyyy-mm-dd', () => { + expect(format('B2yyyy-mm-dd', 0)).toBe('1317-08-29'); + expect(format('B2yyyy-mm-dd', 59)).toBe('1317-10-28'); + expect(() => format('B2yyyy-mm-dd', 60)).toThrow(); + expect(format('B2yyyy-mm-dd', 61)).toBe('1317-10-29'); + expect(format('B2yyyy-mm-dd', 1000)).toBe('1320-06-23'); + expect(format('B2yyyy-mm-dd', 10000)).toBe('1345-11-17'); +}); + +test('Oddity: ☃', () => { + expect(format('☃', 0)).toBe('☃'); + expect(format('☃', 1)).toBe('☃'); + expect(format('☃', -1)).toBe('-☃'); + expect(format('☃', 'foo')).toBe('foo'); +}); + +test.skip('Oddity: #0#######', () => { + expect(format('#0#######', 12345)).toBe('012345'); + expect(format('#0#######', 12345.4321)).toBe('012345'); + expect(format('#0#######', 12345.6789)).toBe('012346'); +}); + +test.skip('Oddity: ##,##', () => { + expect(format('##,##', 0)).toBe(''); + expect(format('##,##', 1)).toBe('1'); + expect(format('##,##', 1234)).toBe('1,234'); + expect(format('##,##', 12345)).toBe('12,345'); + expect(format('##,##', 1234567)).toBe('1,234,567'); +}); + +test('Oddity: 0', () => { + expect(format('0', 12345)).toBe('12345'); + expect(format('0', 4294967296.5)).toBe('4294967297'); +}); + +test('Oddity: "Rs."#,##0.00', () => { + expect(format('"Rs."#,##0.00', -51968287)).toBe('-Rs.51,968,287.00'); + expect(format('"Rs."#,##0.00', 2000000)).toBe('Rs.2,000,000.00'); +}); + +test('Oddity: $#.00', () => { + expect(format('$#.00', 3.14159)).toBe('$3.14'); + expect(format('$#.00', -3.14159)).toBe('-$3.14'); +}); + +test.skip('Oddity: "This is a ".00"test"000', () => { + expect(format('"This is a ".00"test"000', -3.14159)).toBe('-This is a 3.14test159'); + expect(format('"This is a ".00"test"000', 3.14159)).toBe('This is a 3.14test159'); +}); + +test('Oddity: [$INR]\\ #,##0.00', () => { + expect(format('[$INR]\\ #,##0.00', 3.14159)).toBe('INR 3.14'); + expect(format('[$INR]\\ #,##0.00', -3.14159)).toBe('-INR 3.14'); +}); + +test('Oddity: [$₹-4009]\\ #,##0.00', () => { + expect(format('[$₹-4009]\\ #,##0.00', 3.14159)).toBe('₹ 3.14'); + expect(format('[$₹-4009]\\ #,##0.00', -3.14159)).toBe('-₹ 3.14'); +}); + +test('Oddity: [$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', () => { + expect(format('[$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', 3.14159)).toBe('£3.1416'); + expect(format('[$£-809]#,##0.0000;\\-[$£-809]#,##0.0000', -3.14159)).toBe('-£3.1416'); +}); + +test('Oddity: "-"0.00', () => { + expect(format('"-"0.00', 3.14159)).toBe('-3.14'); + expect(format('"-"0.00', -3.14159)).toBe('--3.14'); +}); + +test('Oddity: [$-409]mmm\\-yy', () => { + expect(format('[$-409]mmm\\-yy', 12345)).toBe('Oct-33'); +}); + +test('Oddity: \\,##.??;\\(#,###.??\\);0', () => { + expect(format('\\,##.??;\\(#,###.??\\);0', 15)).toBe(',15. '); + expect(format('\\,##.??;\\(#,###.??\\);0', 14.3453453)).toBe(',14.35'); + expect(format('\\,##.??;\\(#,###.??\\);0', 12.1)).toBe(',12.1 '); + expect(format('\\,##.??;\\(#,###.??\\);0', 0)).toBe('0'); + expect(format('\\,##.??;\\(#,###.??\\);0', -15)).toBe('(15. )'); + expect(format('\\,##.??;\\(#,###.??\\);0', -14.3453453)).toBe('(14.35)'); + expect(format('\\,##.??;\\(#,###.??\\);0', -12.1)).toBe('(12.1 )'); + expect(format('\\,##.??;\\(#,###.??\\);0', 1)).toBe(',1. '); +}); + +test('Oddity: "£"#.####;-"£"#.####', () => { + expect(format('"£"#.####;-"£"#.####', 3.141592654)).toBe('£3.1416'); + expect(format('"£"#.####;-"£"#.####', -3.141592654)).toBe('-£3.1416'); +}); + +test('Oddity: [h]:mm:ss;@', () => { + expect(format('[h]:mm:ss;@', 2.9999999999999996)).toBe('72:00:00'); +}); + +test('Oddity: hh:mm:ss AM/PM', () => { + expect(format('hh:mm:ss AM/PM', 0.5)).toBe('12:00:00 PM'); +}); + +test('Oddity: hh:mm:ss am/pm', () => { + expect(format('hh:mm:ss am/pm', 0.5)).toBe('12:00:00 PM'); +}); + +test('Oddity: hh:mm:ss AM/P', () => { + expect(format('hh:mm:ss AM/P', 0.5)).toBe('12:00:00 A1/P'); +}); + +test('Oddity: hh:mm:ss am/p', () => { + expect(format('hh:mm:ss am/p', 0.5)).toBe('12:00:00 a1/p'); +}); + +test('Oddity: "foo";"bar";"baz";"qux";"foobar"', () => { + expect(() => format('"foo";"bar";"baz";"qux";"foobar"'), '"foo";"bar";"baz";"qux";"foobar"').toThrow(); +}); diff --git a/test/ssf-times-test.js b/test/ssf-times.spec.ts similarity index 52% rename from test/ssf-times-test.js rename to test/ssf-times.spec.ts index af171bf..9ae8773 100644 --- a/test/ssf-times-test.js +++ b/test/ssf-times.spec.ts @@ -1,13 +1,13 @@ -import test from './utils.js'; +import { describe } from 'vitest'; +import { runTable } from './utils.ts'; // -- running the full table takes a while const FULL = false; -test('SSF table: tables/ssf-times.tsv', t => { - t.runTable( +describe('SSF table: tables/ssf-times.tsv', () => { + runTable( FULL ? 'tables/ssf-times-full.tsv' : 'tables/ssf-times.tsv' ); - t.end(); }); diff --git a/test/ssf-valid-test.js b/test/ssf-valid-test.js deleted file mode 100644 index 2eefa14..0000000 --- a/test/ssf-valid-test.js +++ /dev/null @@ -1,449 +0,0 @@ -import test from './utils.js'; - -test('Validity tests', t => { - t.validFormat('" Excellent"', '" Excellent"'); - t.validFormat('" Fair"', '" Fair"'); - t.validFormat('" Good"', '" Good"'); - t.validFormat('" Poor"', '" Poor"'); - t.validFormat('" Very Good"', '" Very Good"'); - t.validFormat('"$"#,##0', '"$"#,##0'); - t.validFormat('"$"#,##0.00', '"$"#,##0.00'); - t.validFormat('"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)'); - t.validFormat('"$"#,##0.00_);\\("$"#,##0.00\\)', '"$"#,##0.00_);\\("$"#,##0.00\\)'); - t.validFormat('"$"#,##0;[Red]\\-"$"#,##0', '"$"#,##0;[Red]\\-"$"#,##0'); - t.validFormat('"$"#,##0_);[Red]\\("$"#,##0\\)', '"$"#,##0_);[Red]\\("$"#,##0\\)'); - t.validFormat('"$"#,##0_);\\("$"#,##0\\)', '"$"#,##0_);\\("$"#,##0\\)'); - t.validFormat('"Haha!"\\ @\\ "Yeah!"', '"Haha!"\\ @\\ "Yeah!"'); - t.validFormat('"TRUE";"TRUE";"FALSE"', '"TRUE";"TRUE";"FALSE"'); - t.validFormat('"True";"True";"False";@', '"True";"True";"False";@'); - t.validFormat('"Years: "0', '"Years: "0'); - t.validFormat('"Yes";"Yes";"No";@', '"Yes";"Yes";"No";@'); - t.validFormat('"kl "hh:mm:ss;@', '"kl "hh:mm:ss;@'); - t.validFormat('"£"#,##0.00', '"£"#,##0.00'); - t.validFormat('"£"#,##0;[Red]\\-"£"#,##0', '"£"#,##0;[Red]\\-"£"#,##0'); - t.validFormat('"€"#,##0.00', '"€"#,##0.00'); - t.validFormat('"€"\\ #,##0.00_-', '"€"\\ #,##0.00_-'); - t.validFormat('"上午/下午 "hh"時"mm"分"ss"秒 "', '"上午/下午 "hh"時"mm"分"ss"秒 "'); - t.validFormat('"¥"#,##0.00;"¥"\\-#,##0.00', '"¥"#,##0.00;"¥"\\-#,##0.00'); - t.validFormat('#', '#'); - t.validFormat('# ?/?', '# ?/?'); - t.validFormat('# ??/??', '# ??/??'); - t.validFormat('#" "?/?', '#" "?/?'); - t.validFormat('#" "??/??', '#" "??/??'); - t.validFormat('#"abded"\\ ??/??', '#"abded"\\ ??/??'); - t.validFormat('###0.00;-###0.00', '###0.00;-###0.00'); - t.validFormat('###0;-###0', '###0;-###0'); - t.validFormat('##0.0E+0', '##0.0E+0'); - t.validFormat('#,##0', '#,##0'); - t.validFormat('#,##0 ;(#,##0)', '#,##0 ;(#,##0)'); - t.validFormat('#,##0 ;[Red](#,##0)', '#,##0 ;[Red](#,##0)'); - t.validFormat('#,##0"р.";[Red]\\-#,##0"р."', '#,##0"р.";[Red]\\-#,##0"р."'); - t.validFormat('#,##0.0', '#,##0.0'); - t.validFormat('#,##0.00', '#,##0.00'); - t.validFormat('#,##0.00 "�"', '#,##0.00 "�"'); - t.validFormat('#,##0.00 €;-#,##0.00 €', '#,##0.00 €;-#,##0.00 €'); - t.validFormat('#,##0.00"р.";[Red]\\-#,##0.00"р."', '#,##0.00"р.";[Red]\\-#,##0.00"р."'); - t.validFormat('#,##0.000', '#,##0.000'); - t.validFormat('#,##0.0000', '#,##0.0000'); - t.validFormat('#,##0.00000', '#,##0.00000'); - t.validFormat('#,##0.000000', '#,##0.000000'); - t.validFormat('#,##0.0000000', '#,##0.0000000'); - t.validFormat('#,##0.00000000', '#,##0.00000000'); - t.validFormat('#,##0.000000000', '#,##0.000000000'); - t.validFormat('#,##0.00000000;[Red]#,##0.00000000', '#,##0.00000000;[Red]#,##0.00000000'); - t.validFormat('#,##0.0000_ ', '#,##0.0000_ '); - t.validFormat('#,##0.000_ ', '#,##0.000_ '); - t.validFormat('#,##0.000_);\\(#,##0.000\\)', '#,##0.000_);\\(#,##0.000\\)'); - t.validFormat('#,##0.00;(#,##0.00)', '#,##0.00;(#,##0.00)'); - t.validFormat('#,##0.00;(#,##0.00);0.00', '#,##0.00;(#,##0.00);0.00'); - t.validFormat('#,##0.00;[Red](#,##0.00)', '#,##0.00;[Red](#,##0.00)'); - t.validFormat('#,##0.00;[Red]\\(#,##0.00\\)', '#,##0.00;[Red]\\(#,##0.00\\)'); - t.validFormat('#,##0.00;\\(#,##0.00\\)', '#,##0.00;\\(#,##0.00\\)'); - t.validFormat('#,##0.00[$₹-449]_);\\(#,##0.00[$₹-449]\\)', '#,##0.00[$₹-449]_);\\(#,##0.00[$₹-449]\\)'); - t.validFormat('#,##0.00\\ "р."', '#,##0.00\\ "р."'); - t.validFormat('#,##0.00\\ "р.";[Red]\\-#,##0.00\\ "р."', '#,##0.00\\ "р.";[Red]\\-#,##0.00\\ "р."'); - t.validFormat('#,##0.00\\ [$€-407]', '#,##0.00\\ [$€-407]'); - t.validFormat('#,##0.00\\ [$€-40C]', '#,##0.00\\ [$€-40C]'); - t.validFormat('#,##0.00_);\\(#,##0.00\\)', '#,##0.00_);\\(#,##0.00\\)'); - t.validFormat('#,##0.00_р_.;[Red]\\-#,##0.00_р_.', '#,##0.00_р_.;[Red]\\-#,##0.00_р_.'); - t.validFormat('#,##0.00_р_.;\\-#,##0.00_р_.', '#,##0.00_р_.;\\-#,##0.00_р_.'); - t.validFormat('#,##0.0;[Red]#,##0.0', '#,##0.0;[Red]#,##0.0'); - t.validFormat('#,##0.0_ ;\\-#,##0.0\\ ', '#,##0.0_ ;\\-#,##0.0\\ '); - t.validFormat('#,##0.0_);[Red]\\(#,##0.0\\)', '#,##0.0_);[Red]\\(#,##0.0\\)'); - t.validFormat('#,##0.0_);\\(#,##0.0\\)', '#,##0.0_);\\(#,##0.0\\)'); - t.validFormat('#,##0;\\-#,##0;0', '#,##0;\\-#,##0;0'); - t.validFormat('#,##0\\ "р.";[Red]\\-#,##0\\ "р."', '#,##0\\ "р.";[Red]\\-#,##0\\ "р."'); - t.validFormat('#,##0\\ "р.";\\-#,##0\\ "р."', '#,##0\\ "р.";\\-#,##0\\ "р."'); - t.validFormat('#,##0\\ ;[Red]\\(#,##0\\)', '#,##0\\ ;[Red]\\(#,##0\\)'); - t.validFormat('#,##0\\ ;\\(#,##0\\)', '#,##0\\ ;\\(#,##0\\)'); - t.validFormat('#,##0_ ', '#,##0_ '); - t.validFormat('#,##0_ ;[Red]\\-#,##0\\ ', '#,##0_ ;[Red]\\-#,##0\\ '); - t.validFormat('#,##0_);[Red]\\(#,##0\\)', '#,##0_);[Red]\\(#,##0\\)'); - t.validFormat('#,##0_р_.;[Red]\\-#,##0_р_.', '#,##0_р_.;[Red]\\-#,##0_р_.'); - t.validFormat('#,##0_р_.;\\-#,##0_р_.', '#,##0_р_.;\\-#,##0_р_.'); - t.validFormat('#.0000,,', '#.0000,,'); - t.validFormat('#0', '#0'); - t.validFormat('#0.00', '#0.00'); - t.validFormat('#0.0000', '#0.0000'); - t.validFormat('#\\ ?/10', '#\\ ?/10'); - t.validFormat('#\\ ?/2', '#\\ ?/2'); - t.validFormat('#\\ ?/4', '#\\ ?/4'); - t.validFormat('#\\ ?/8', '#\\ ?/8'); - t.validFormat('#\\ ?/?', '#\\ ?/?'); - t.validFormat('#\\ ??/100', '#\\ ??/100'); - t.validFormat('#\\ ??/100;[Red]\\(#\\ ??/16\\)', '#\\ ??/100;[Red]\\(#\\ ??/16\\)'); - t.validFormat('#\\ ??/16', '#\\ ??/16'); - t.validFormat('#\\ ??/??', '#\\ ??/??'); - t.validFormat('#\\ ??/?????????', '#\\ ??/?????????'); - t.validFormat('#\\ ???/???', '#\\ ???/???'); - t.validFormat('**\\ #,###,#00,000.00,**', '**\\ #,###,#00,000.00,**'); - t.validFormat('0', '0'); - t.validFormat('0"abde".0"??"000E+00', '0"abde".0"??"000E+00'); - t.validFormat('0%', '0%'); - t.validFormat('0.0', '0.0'); - t.validFormat('0.0%', '0.0%'); - t.validFormat('0.00', '0.00'); - t.validFormat('0.00"°"', '0.00"°"'); - t.validFormat('0.00%', '0.00%'); - t.validFormat('0.000', '0.000'); - t.validFormat('0.000%', '0.000%'); - t.validFormat('0.0000', '0.0000'); - t.validFormat('0.000000', '0.000000'); - t.validFormat('0.00000000', '0.00000000'); - t.validFormat('0.000000000', '0.000000000'); - t.validFormat('0.000000000%', '0.000000000%'); - t.validFormat('0.00000000000', '0.00000000000'); - t.validFormat('0.000000000000000', '0.000000000000000'); - t.validFormat('0.00000000E+00', '0.00000000E+00'); - t.validFormat('0.0000E+00', '0.0000E+00'); - t.validFormat('0.00;[Red]0.00', '0.00;[Red]0.00'); - t.validFormat('0.00E+00', '0.00E+00'); - t.validFormat('0.00_);[Red]\\(0.00\\)', '0.00_);[Red]\\(0.00\\)'); - t.validFormat('0.00_);\\(0.00\\)', '0.00_);\\(0.00\\)'); - t.validFormat('0.0_ ', '0.0_ '); - t.validFormat('00.00.00.000', '00.00.00.000'); - t.validFormat('00.000%', '00.000%'); - t.validFormat('0000', '0000'); - t.validFormat('00000', '00000'); - t.validFormat('00000000', '00000000'); - t.validFormat('000000000', '000000000'); - t.validFormat('00000\\-0000', '00000\\-0000'); - t.validFormat('00000\\-00000', '00000\\-00000'); - t.validFormat('000\\-00\\-0000', '000\\-00\\-0000'); - t.validFormat('0;[Red]0', '0;[Red]0'); - t.validFormat('0\\-00000\\-00000\\-0', '0\\-00000\\-00000\\-0'); - t.validFormat('0_);[Red]\\(0\\)', '0_);[Red]\\(0\\)'); - t.validFormat('0_);\\(0\\)', '0_);\\(0\\)'); - t.validFormat('@', '@'); - t.validFormat('A/P', 'A/P'); - t.validFormat('AM/PM', 'AM/PM'); - t.validFormat('AM/PMh"時"mm"分"ss"秒";@', 'AM/PMh"時"mm"分"ss"秒";@'); - t.validFormat('D', 'D'); - t.validFormat('DD', 'DD'); - t.validFormat('DD/MM/YY;@', 'DD/MM/YY;@'); - t.validFormat('DD/MM/YYYY', 'DD/MM/YYYY'); - t.validFormat('DD/MM/YYYY;@', 'DD/MM/YYYY;@'); - t.validFormat('DDD', 'DDD'); - t.validFormat('DDDD', 'DDDD'); - t.validFormat('DDDD", "MMMM\\ DD", "YYYY', 'DDDD", "MMMM\\ DD", "YYYY'); - t.validFormat('GENERAL', 'GENERAL'); - t.validFormat('General', 'General'); - t.validFormat('H', 'H'); - t.validFormat('H:MM:SS\\ AM/PM', 'H:MM:SS\\ AM/PM'); - t.validFormat('HH:MM', 'HH:MM'); - t.validFormat('HH:MM:SS\\ AM/PM', 'HH:MM:SS\\ AM/PM'); - t.validFormat('HHM', 'HHM'); - t.validFormat('HHMM', 'HHMM'); - t.validFormat('HH[MM]', 'HH[MM]'); - t.validFormat('HH[M]', 'HH[M]'); - t.validFormat('M/D/YYYY', 'M/D/YYYY'); - t.validFormat('M/D/YYYY\\ H:MM', 'M/D/YYYY\\ H:MM'); - t.validFormat('MM/DD/YY', 'MM/DD/YY'); - t.validFormat('S', 'S'); - t.validFormat('SS', 'SS'); - t.validFormat('YY', 'YY'); - t.validFormat('YYM', 'YYM'); - t.validFormat('YYMM', 'YYMM'); - t.validFormat('YYMMM', 'YYMMM'); - t.validFormat('YYMMMM', 'YYMMMM'); - t.validFormat('YYMMMMM', 'YYMMMMM'); - t.validFormat('YYYY', 'YYYY'); - t.validFormat('YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DD HH:MM:SS'); - t.validFormat('YYYY\\-MM\\-DD', 'YYYY\\-MM\\-DD'); - t.validFormat('[$$-409]#,##0', '[$$-409]#,##0'); - t.validFormat('[$$-409]#,##0.00', '[$$-409]#,##0.00'); - t.validFormat('[$$-409]#,##0.00_);[Red]\\([$$-409]#,##0.00\\)', '[$$-409]#,##0.00_);[Red]\\([$$-409]#,##0.00\\)'); - t.validFormat('[$$-C09]#,##0.00', '[$$-C09]#,##0.00'); - t.validFormat('[$-100042A]h:mm:ss\\ AM/PM;@', '[$-100042A]h:mm:ss\\ AM/PM;@'); - t.validFormat('[$-1010409]0.000%', '[$-1010409]0.000%'); - t.validFormat('[$-1010409]General', '[$-1010409]General'); - t.validFormat('[$-1010409]d/m/yyyy\\ h:mm\\ AM/PM;@', '[$-1010409]d/m/yyyy\\ h:mm\\ AM/PM;@'); - t.validFormat('[$-1010409]dddd, mmmm dd, yyyy', '[$-1010409]dddd, mmmm dd, yyyy'); - t.validFormat('[$-1010409]m/d/yyyy', '[$-1010409]m/d/yyyy'); - t.validFormat('[$-1409]h:mm:ss\\ AM/PM;@', '[$-1409]h:mm:ss\\ AM/PM;@'); - t.validFormat('[$-2000000]h:mm:ss;@', '[$-2000000]h:mm:ss;@'); - t.validFormat('[$-2010401]d/mm/yyyy\\ h:mm\\ AM/PM;@', '[$-2010401]d/mm/yyyy\\ h:mm\\ AM/PM;@'); - t.validFormat('[$-4000439]h:mm:ss\\ AM/PM;@', '[$-4000439]h:mm:ss\\ AM/PM;@'); - t.validFormat('[$-4010439]d/m/yyyy\\ h:mm\\ AM/PM;@', '[$-4010439]d/m/yyyy\\ h:mm\\ AM/PM;@'); - t.validFormat('[$-409]AM/PM\\ hh:mm:ss;@', '[$-409]AM/PM\\ hh:mm:ss;@'); - t.validFormat('[$-409]d/m/yyyy\\ hh:mm;@', '[$-409]d/m/yyyy\\ hh:mm;@'); - t.validFormat('[$-409]d\\-mmm;@', '[$-409]d\\-mmm;@'); - t.validFormat('[$-409]d\\-mmm\\-yy;@', '[$-409]d\\-mmm\\-yy;@'); - t.validFormat('[$-409]d\\-mmm\\-yyyy;@', '[$-409]d\\-mmm\\-yyyy;@'); - t.validFormat('[$-409]dd/mm/yyyy\\ hh:mm;@', '[$-409]dd/mm/yyyy\\ hh:mm;@'); - t.validFormat('[$-409]dd\\-mmm\\-yy;@', '[$-409]dd\\-mmm\\-yy;@'); - t.validFormat('[$-409]h:mm:ss\\ AM/PM;@', '[$-409]h:mm:ss\\ AM/PM;@'); - t.validFormat('[$-409]h:mm\\ AM/PM;@', '[$-409]h:mm\\ AM/PM;@'); - t.validFormat('[$-409]m/d/yy\\ h:mm\\ AM/PM;@', '[$-409]m/d/yy\\ h:mm\\ AM/PM;@'); - t.validFormat('[$-409]mmm\\-yy;@', '[$-409]mmm\\-yy;@'); - t.validFormat('[$-409]mmmm\\ d\\,\\ yyyy;@', '[$-409]mmmm\\ d\\,\\ yyyy;@'); - t.validFormat('[$-409]mmmm\\-yy;@', '[$-409]mmmm\\-yy;@'); - t.validFormat('[$-409]mmmmm;@', '[$-409]mmmmm;@'); - t.validFormat('[$-409]mmmmm\\-yy;@', '[$-409]mmmmm\\-yy;@'); - t.validFormat('[$-40E]h\\ "óra"\\ m\\ "perckor"\\ AM/PM;@', '[$-40E]h\\ "óra"\\ m\\ "perckor"\\ AM/PM;@'); - t.validFormat('[$-412]AM/PM\\ h"시"\\ mm"분"\\ ss"초";@', '[$-412]AM/PM\\ h"시"\\ mm"분"\\ ss"초";@'); - t.validFormat('[$-41C]h:mm:ss\\.AM/PM;@', '[$-41C]h:mm:ss\\.AM/PM;@'); - t.validFormat('[$-449]hh:mm:ss\\ AM/PM;@', '[$-449]hh:mm:ss\\ AM/PM;@'); - t.validFormat('[$-44E]hh:mm:ss\\ AM/PM;@', '[$-44E]hh:mm:ss\\ AM/PM;@'); - t.validFormat('[$-44F]hh:mm:ss\\ AM/PM;@', '[$-44F]hh:mm:ss\\ AM/PM;@'); - t.validFormat('[$-D000409]h:mm\\ AM/PM;@', '[$-D000409]h:mm\\ AM/PM;@'); - t.validFormat('[$-D010000]d/mm/yyyy\\ h:mm\\ "น.";@', '[$-D010000]d/mm/yyyy\\ h:mm\\ "น.";@'); - t.validFormat('[$-F400]h:mm:ss\\ AM/PM', '[$-F400]h:mm:ss\\ AM/PM'); - t.validFormat('[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy', '[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy'); - t.validFormat('[$AUD]\\ #,##0.00', '[$AUD]\\ #,##0.00'); - t.validFormat('[$RD$-1C0A]#,##0.00;[Red]\\-[$RD$-1C0A]#,##0.00', '[$RD$-1C0A]#,##0.00;[Red]\\-[$RD$-1C0A]#,##0.00'); - t.validFormat('[$SFr.-810]\\ #,##0.00_);[Red]\\([$SFr.-810]\\ #,##0.00\\)', '[$SFr.-810]\\ #,##0.00_);[Red]\\([$SFr.-810]\\ #,##0.00\\)'); - t.validFormat('[$£-809]#,##0.00;[Red][$£-809]#,##0.00', '[$£-809]#,##0.00;[Red][$£-809]#,##0.00'); - t.validFormat('[$¥-411]#,##0.00', '[$¥-411]#,##0.00'); - t.validFormat('[$¥-804]#,##0.00', '[$¥-804]#,##0.00'); - t.validFormat('[<0]"";0%', '[<0]"";0%'); - t.validFormat('[<=9999999]###\\-####;\\(###\\)\\ ###\\-####', '[<=9999999]###\\-####;\\(###\\)\\ ###\\-####'); - t.validFormat('[=0]?;#,##0.00', '[=0]?;#,##0.00'); - t.validFormat('[=0]?;0%', '[=0]?;0%'); - t.validFormat('[=0]?;[<4.16666666666667][hh]:mm:ss;[hh]:mm', '[=0]?;[<4.16666666666667][hh]:mm:ss;[hh]:mm'); - t.validFormat('[>999999]#,,"M";[>999]#,"K";#', '[>999999]#,,"M";[>999]#,"K";#'); - t.validFormat('[>999999]#.000,,"M";[>999]#.000,"K";#.000', '[>999999]#.000,,"M";[>999]#.000,"K";#.000'); - t.validFormat("[>=100000]0.000\\ \\\";[Red]0.000\\ \\<\\ \\>\\ \\\"\\ \\&\\ \\'\\ ", "[>=100000]0.000\\ \\\";[Red]0.000\\ \\<\\ \\>\\ \\\"\\ \\&\\ \\'\\ "); - t.validFormat('[>=100000]0.000\\ \\<;[Red]0.000\\ \\>', '[>=100000]0.000\\ \\<;[Red]0.000\\ \\>'); - t.validFormat('[BLACK]@', '[BLACK]@'); - t.validFormat('[BLUE]GENERAL', '[BLUE]GENERAL'); - t.validFormat('[Black]@', '[Black]@'); - t.validFormat('[Blue]General', '[Blue]General'); - t.validFormat('[CYAN]@', '[CYAN]@'); - t.validFormat('[Cyan]@', '[Cyan]@'); - t.validFormat('[DBNum1][$-804]AM/PMh"时"mm"分";@', '[DBNum1][$-804]AM/PMh"时"mm"分";@'); - t.validFormat('[DBNum1][$-804]General', '[DBNum1][$-804]General'); - t.validFormat('[DBNum1][$-804]h"时"mm"分";@', '[DBNum1][$-804]h"时"mm"分";@'); - t.validFormat('[$-1004]dddd\\,\\ d\\ mmmm\\,\\ yyyy;@', '[$-1004]dddd\\,\\ d\\ mmmm\\,\\ yyyy;@'); - t.validFormat('[$-101040D]d\\ mmmm\\ yyyy;@', '[$-101040D]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-101042A]d\\ mmmm\\ yyyy;@', '[$-101042A]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-140C]dddd\\ "YeahWoo!"\\ ddd\\ mmmm\\ yyyy;@', '[$-140C]dddd\\ "YeahWoo!"\\ ddd\\ mmmm\\ yyyy;@'); - t.validFormat('[$-2C0A]dddd\\ d" de "mmmm" de "yyyy;@', '[$-2C0A]dddd\\ d" de "mmmm" de "yyyy;@'); - t.validFormat('[$-402]dd\\ mmmm\\ yyyy\\ "г.";@', '[$-402]dd\\ mmmm\\ yyyy\\ "г.";@'); - t.validFormat('[$-403]dddd\\,\\ d" / "mmmm" / "yyyy;@', '[$-403]dddd\\,\\ d" / "mmmm" / "yyyy;@'); - t.validFormat('[$-405]d\\.\\ mmmm\\ yyyy;@', '[$-405]d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-408]d\\ mmmm\\ yyyy;@', '[$-408]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-409]d\\-mmm;@', '[$-409]d\\-mmm;@'); - t.validFormat('[$-409]d\\-mmm\\-yy;@', '[$-409]d\\-mmm\\-yy;@'); - t.validFormat('[$-409]d\\-mmm\\-yyyy;@', '[$-409]d\\-mmm\\-yyyy;@'); - t.validFormat('[$-409]dd\\-mmm\\-yy;@', '[$-409]dd\\-mmm\\-yy;@'); - t.validFormat('[$-409]mmm\\-yy;@', '[$-409]mmm\\-yy;@'); - t.validFormat('[$-409]mmmm\\ d\\,\\ yyyy;@', '[$-409]mmmm\\ d\\,\\ yyyy;@'); - t.validFormat('[$-409]mmmm\\-yy;@', '[$-409]mmmm\\-yy;@'); - t.validFormat('[$-40B]d\\.\\ mmmm\\t\\a\\ yyyy;@', '[$-40B]d\\.\\ mmmm\\t\\a\\ yyyy;@'); - t.validFormat('[$-40C]d/mmm/yyyy;@', '[$-40C]d/mmm/yyyy;@'); - t.validFormat('[$-40E]yyyy/\\ mmmm\\ d\\.;@', '[$-40E]yyyy/\\ mmmm\\ d\\.;@'); - t.validFormat('[$-40F]dd\\.\\ mmmm\\ yyyy;@', '[$-40F]dd\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-410]d\\ mmmm\\ yyyy;@', '[$-410]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-415]d\\ mmmm\\ yyyy;@', '[$-415]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-416]d\\ \\ mmmm\\,\\ yyyy;@', '[$-416]d\\ \\ mmmm\\,\\ yyyy;@'); - t.validFormat('[$-418]d\\ mmmm\\ yyyy;@', '[$-418]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-41A]d\\.\\ mmmm\\ yyyy\\.;@', '[$-41A]d\\.\\ mmmm\\ yyyy\\.;@'); - t.validFormat('[$-41B]d\\.\\ mmmm\\ yyyy;@', '[$-41B]d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-41D]"den "\\ d\\ mmmm\\ yyyy;@', '[$-41D]"den "\\ d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-420]dddd\\,\\ dd\\ mmmm\\,\\ yyyy;@', '[$-420]dddd\\,\\ dd\\ mmmm\\,\\ yyyy;@'); - t.validFormat('[$-421]dd\\ mmmm\\ yyyy;@', '[$-421]dd\\ mmmm\\ yyyy;@'); - t.validFormat('[$-424]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', '[$-424]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-425]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', '[$-425]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-426]dddd\\,\\ yyyy". gada "d\\.\\ mmmm;@', '[$-426]dddd\\,\\ yyyy". gada "d\\.\\ mmmm;@'); - t.validFormat('[$-427]yyyy\\ "m."\\ mmmm\\ d\\ "d.";@', '[$-427]yyyy\\ "m."\\ mmmm\\ d\\ "d.";@'); - t.validFormat('[$-42B]dddd\\,\\ d\\ mmmm\\ yyyy;@', '[$-42B]dddd\\,\\ d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-42C]d\\ mmmm\\ yyyy;@', '[$-42C]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-42D]yyyy"(e)ko"\\ mmmm"ren"\\ d"a";@', '[$-42D]yyyy"(e)ko"\\ mmmm"ren"\\ d"a";@'); - t.validFormat('[$-42F]dddd\\,\\ dd\\ mmmm\\ yyyy;@', '[$-42F]dddd\\,\\ dd\\ mmmm\\ yyyy;@'); - t.validFormat('[$-437]yyyy\\ \\წ\\ლ\\ი\\ს\\ dd\\ mm\\,\\ dddd;@', '[$-437]yyyy\\ \\წ\\ლ\\ი\\ს\\ dd\\ mm\\,\\ dddd;@'); - t.validFormat('[$-438]d\\.\\ mmmm\\ yyyy;@', '[$-438]d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-43F]d\\ mmmm\\ yyyy\\ "ж.";@', '[$-43F]d\\ mmmm\\ yyyy\\ "ж.";@'); - t.validFormat('[$-444]d\\ mmmm\\ yyyy;@', '[$-444]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-449]dd\\ mmmm\\ yyyy;@', '[$-449]dd\\ mmmm\\ yyyy;@'); - t.validFormat('[$-44E]d\\ mmmm\\ yyyy;@', '[$-44E]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-44F]dd\\ mmmm\\ yyyy\\ dddd;@', '[$-44F]dd\\ mmmm\\ yyyy\\ dddd;@'); - t.validFormat('[$-457]dd\\ mmmm\\ yyyy;@', '[$-457]dd\\ mmmm\\ yyyy;@'); - t.validFormat('[$-813]dddd\\ d\\ mmmm\\ yyyy;@', '[$-813]dddd\\ d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-81A]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', '[$-81A]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-82C]d\\ mmmm\\ yyyy;@', '[$-82C]d\\ mmmm\\ yyyy;@'); - t.validFormat('[$-843]yyyy\\ "й""и""л"\\ d/mmmm;@', '[$-843]yyyy\\ "й""и""л"\\ d/mmmm;@'); - t.validFormat('[$-C07]dddd\\,\\ dd\\.\\ mmmm\\ yyyy;@', '[$-C07]dddd\\,\\ dd\\.\\ mmmm\\ yyyy;@'); - t.validFormat('[$-FC19]yyyy\\,\\ dd\\ mmmm;@', '[$-FC19]yyyy\\,\\ dd\\ mmmm;@'); - t.validFormat('[$-FC22]d\\ mmmm\\ yyyy" р.";@', '[$-FC22]d\\ mmmm\\ yyyy" р.";@'); - t.validFormat('[$-FC23]d\\ mmmm\\ yyyy;@', '[$-FC23]d\\ mmmm\\ yyyy;@'); - t.validFormat('[GREEN]#,###', '[GREEN]#,###'); - t.validFormat('[Green]#,###', '[Green]#,###'); - t.validFormat('[HH]', '[HH]'); - t.validFormat('[$-2060401]d/mm/yyyy\\ h:mm\\ AM/PM;@', '[$-2060401]d/mm/yyyy\\ h:mm\\ AM/PM;@'); - t.validFormat('[$-2060401]d\\ mmmm\\ yyyy;@', '[$-2060401]d\\ mmmm\\ yyyy;@'); - t.validFormat('[H]', '[H]'); - t.validFormat('[$-411]gggyy"年"m"月"d"日"\\ dddd;@', '[$-411]gggyy"年"m"月"d"日"\\ dddd;@'); - t.validFormat('[MAGENTA]0.00', '[MAGENTA]0.00'); - t.validFormat('[Magenta]0.00', '[Magenta]0.00'); - t.validFormat('[RED]#.##', '[RED]#.##'); - t.validFormat('[Red]#.##', '[Red]#.##'); - t.validFormat('[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General\\ ', '[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General\\ '); - t.validFormat('[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', '[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General'); - t.validFormat('[Red][<>50]General;[Blue]000', '[Red][<>50]General;[Blue]000'); - t.validFormat('[Red][=50]General;[Blue]000', '[Red][=50]General;[Blue]000'); - t.validFormat('[SS]', '[SS]'); - t.validFormat('[S]', '[S]'); - t.validFormat('[DBNum1][$-404]y"年"m"月"d"日";@', '[DBNum1][$-404]y"年"m"月"d"日";@'); - t.validFormat('[WHITE]0.0', '[WHITE]0.0'); - t.validFormat('[White]0.0', '[White]0.0'); - t.validFormat('[YELLOW]@', '[YELLOW]@'); - t.validFormat('[Yellow]@', '[Yellow]@'); - t.validFormat('[h]', '[h]'); - t.validFormat('[h]:mm:ss', '[h]:mm:ss'); - t.validFormat('[h]:mm:ss;@', '[h]:mm:ss;@'); - t.validFormat('[h]\\.mm" Uhr ";@', '[h]\\.mm" Uhr ";@'); - t.validFormat('[hh]', '[hh]'); - t.validFormat('[s]', '[s]'); - t.validFormat('[ss]', '[ss]'); - t.validFormat('\\#\\r\\e\\c', '\\#\\r\\e\\c'); - t.validFormat('\\$#,##0_);[Red]"($"#,##0\\)', '\\$#,##0_);[Red]"($"#,##0\\)'); - t.validFormat('\\$0.00', '\\$0.00'); - t.validFormat('\\C\\O\\B\\ \\o\\n\\ @', '\\C\\O\\B\\ \\o\\n\\ @'); - t.validFormat('\\C\\R\\O\\N\\T\\A\\B\\ \\o\\n\\ @', '\\C\\R\\O\\N\\T\\A\\B\\ \\o\\n\\ @'); - t.validFormat('\\R\\e\\s\\u\\l\\t\\ \\o\\n\\ @', '\\R\\e\\s\\u\\l\\t\\ \\o\\n\\ @'); - t.validFormat('\\S\\Q\\L\\ \\:\\ @', '\\S\\Q\\L\\ \\:\\ @'); - t.validFormat('\\S\\Q\\L\\ \\R\\e\\q\\u\\e\\s\\t\\ \\f\\o\\r\\ @', '\\S\\Q\\L\\ \\R\\e\\q\\u\\e\\s\\t\\ \\f\\o\\r\\ @'); - t.validFormat('\\c\\c\\c?????0"aaaa"0"bbbb"000000.00%', '\\c\\c\\c?????0"aaaa"0"bbbb"000000.00%'); - t.validFormat('\\u\\n\\t\\i\\l\\ h:mm;@', '\\u\\n\\t\\i\\l\\ h:mm;@'); - t.validFormat('_ "¥"* #,##0.00_ "Positive";_ "¥"* \\-#,##0.00_ ;_ "¥"* "-"??_ "Negtive";_ @_ \\ "Zero"', '_ "¥"* #,##0.00_ "Positive";_ "¥"* \\-#,##0.00_ ;_ "¥"* "-"??_ "Negtive";_ @_ \\ "Zero"'); - t.validFormat('_ * #,##0.00_)[$﷼-429]_ ;_ * \\(#,##0.00\\)[$﷼-429]_ ;_ * "-"??_)[$﷼-429]_ ;_ @_ ', '_ * #,##0.00_)[$﷼-429]_ ;_ * \\(#,##0.00\\)[$﷼-429]_ ;_ * "-"??_)[$﷼-429]_ ;_ @_ '); - t.validFormat('_ * #,##0_ ;_ * \\-#,##0_ ;[Red]_ * "-"_ ;_ @_ ', '_ * #,##0_ ;_ * \\-#,##0_ ;[Red]_ * "-"_ ;_ @_ '); - t.validFormat('_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)', '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'); - t.validFormat('_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"??_);_(@_)', '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"??_);_(@_)'); - t.validFormat('_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)'); - t.validFormat('_(* #,##0.0000_);_(* \\(#,##0.0000\\);_(* "-"??_);_(@_)', '_(* #,##0.0000_);_(* \\(#,##0.0000\\);_(* "-"??_);_(@_)'); - t.validFormat('_(* #,##0.000_);_(* \\(#,##0.000\\);_(* "-"??_);_(@_)', '_(* #,##0.000_);_(* \\(#,##0.000\\);_(* "-"??_);_(@_)'); - t.validFormat('_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)'); - t.validFormat('_(* #,##0.0_);_(* \\(#,##0.0\\);_(* "-"??_);_(@_)', '_(* #,##0.0_);_(* \\(#,##0.0\\);_(* "-"??_);_(@_)'); - t.validFormat('_(* #,##0_);_(* \\(#,##0\\);_(* "-"??_);_(@_)', '_(* #,##0_);_(* \\(#,##0\\);_(* "-"??_);_(@_)'); - t.validFormat('_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)'); - t.validFormat('_([$ANG]\\ * #,##0.0_);_([$ANG]\\ * \\(#,##0.0\\);_([$ANG]\\ * "-"?_);_(@_)', '_([$ANG]\\ * #,##0.0_);_([$ANG]\\ * \\(#,##0.0\\);_([$ANG]\\ * "-"?_);_(@_)'); - t.validFormat('_-"€"\\ * #,##0.00_-;_-"€"\\ * #,##0.00\\-;_-"€"\\ * "-"??_-;_-@_-', '_-"€"\\ * #,##0.00_-;_-"€"\\ * #,##0.00\\-;_-"€"\\ * "-"??_-;_-@_-'); - t.validFormat('_-* #,##0.00" TL"_-;\\-* #,##0.00" TL"_-;_-* \\-??" TL"_-;_-@_-', '_-* #,##0.00" TL"_-;\\-* #,##0.00" TL"_-;_-* \\-??" TL"_-;_-@_-'); - t.validFormat('_-* #,##0.00" €"_-;\\-* #,##0.00" €"_-;_-* \\-??" €"_-;_-@_-', '_-* #,##0.00" €"_-;\\-* #,##0.00" €"_-;_-* \\-??" €"_-;_-@_-'); - t.validFormat('_-* #,##0.00\\ "р."_-;\\-* #,##0.00\\ "р."_-;_-* "-"??\\ "р."_-;_-@_-', '_-* #,##0.00\\ "р."_-;\\-* #,##0.00\\ "р."_-;_-* "-"??\\ "р."_-;_-@_-'); - t.validFormat('_-* #,##0.00\\ "€"_-;\\-* #,##0.00\\ "€"_-;_-* "-"??\\ "€"_-;_-@_-', '_-* #,##0.00\\ "€"_-;\\-* #,##0.00\\ "€"_-;_-* "-"??\\ "€"_-;_-@_-'); - t.validFormat('_-* #,##0.00\\ [$€-407]_-;\\-* #,##0.00\\ [$€-407]_-;_-* \\-??\\ [$€-407]_-;_-@_-', '_-* #,##0.00\\ [$€-407]_-;\\-* #,##0.00\\ [$€-407]_-;_-* \\-??\\ [$€-407]_-;_-@_-'); - t.validFormat('_-* #,##0.0\\ _F_-;\\-* #,##0.0\\ _F_-;_-* "-"??\\ _F_-;_-@_-', '_-* #,##0.0\\ _F_-;\\-* #,##0.0\\ _F_-;_-* "-"??\\ _F_-;_-@_-'); - t.validFormat('_-* #,##0\\ "€"_-;\\-* #,##0\\ "€"_-;_-* "-"\\ "€"_-;_-@_-', '_-* #,##0\\ "€"_-;\\-* #,##0\\ "€"_-;_-* "-"\\ "€"_-;_-@_-'); - t.validFormat('_-* #,##0_-;\\-* #,##0_-;_-* "-"??_-;_-@_-', '_-* #,##0_-;\\-* #,##0_-;_-* "-"??_-;_-@_-'); - t.validFormat('_-\\$* #,##0.0_ ;_-\\$* \\-#,##0.0\\ ;_-\\$* "-"?_ ;_-@_ ', '_-\\$* #,##0.0_ ;_-\\$* \\-#,##0.0\\ ;_-\\$* "-"?_ ;_-@_ '); - t.validFormat('d', 'd'); - t.validFormat('d-mmm', 'd-mmm'); - t.validFormat('d-mmm-yy', 'd-mmm-yy'); - t.validFormat('d/m', 'd/m'); - t.validFormat('d/m/yy;@', 'd/m/yy;@'); - t.validFormat('d/m/yyyy;@', 'd/m/yyyy;@'); - t.validFormat('d/mm/yy;@', 'd/mm/yy;@'); - t.validFormat('d/mm/yyyy;@', 'd/mm/yyyy;@'); - t.validFormat('d\\-mmm', 'd\\-mmm'); - t.validFormat('d\\-mmm\\-yyyy', 'd\\-mmm\\-yyyy'); - t.validFormat('dd', 'dd'); - t.validFormat('dd"-"mmm"-"yyyy', 'dd"-"mmm"-"yyyy'); - t.validFormat('dd/m/yyyy', 'dd/m/yyyy'); - t.validFormat('dd/mm/yy', 'dd/mm/yy'); - t.validFormat('dd/mm/yy;@', 'dd/mm/yy;@'); - t.validFormat('dd/mm/yy\\ hh:mm', 'dd/mm/yy\\ hh:mm'); - t.validFormat('dd/mm/yyyy', 'dd/mm/yyyy'); - t.validFormat('dd/mm/yyyy\\ hh:mm:ss', 'dd/mm/yyyy\\ hh:mm:ss'); - t.validFormat('dd/mmm', 'dd/mmm'); - t.validFormat('dd\\-mm\\-yy', 'dd\\-mm\\-yy'); - t.validFormat('dd\\-mmm\\-yy', 'dd\\-mmm\\-yy'); - t.validFormat('dd\\-mmm\\-yyyy\\ hh:mm:ss.000', 'dd\\-mmm\\-yyyy\\ hh:mm:ss.000'); - t.validFormat('dd\\/mm\\/yy', 'dd\\/mm\\/yy'); - t.validFormat('dd\\/mm\\/yyyy', 'dd\\/mm\\/yyyy'); - t.validFormat('ddd', 'ddd'); - t.validFormat('dddd', 'dddd'); - t.validFormat('dddd, mmmm dd, yyyy', 'dddd, mmmm dd, yyyy'); - t.validFormat('h', 'h'); - t.validFormat('h"时"mm"分"ss"秒";@', 'h"时"mm"分"ss"秒";@'); - t.validFormat('h"時"mm"分"ss"秒";@', 'h"時"mm"分"ss"秒";@'); - t.validFormat('h:mm', 'h:mm'); - t.validFormat('h:mm AM/PM', 'h:mm AM/PM'); - t.validFormat('h:mm:ss', 'h:mm:ss'); - t.validFormat('h:mm:ss AM/PM', 'h:mm:ss AM/PM'); - t.validFormat('h:mm:ss;@', 'h:mm:ss;@'); - t.validFormat('h:mm;@', 'h:mm;@'); - t.validFormat('h\\.mm" Uhr ";@', 'h\\.mm" Uhr ";@'); - t.validFormat('h\\.mm" h";@', 'h\\.mm" h";@'); - t.validFormat('h\\.mm" u.";@', 'h\\.mm" u.";@'); - t.validFormat('hh":"mm AM/PM', 'hh":"mm AM/PM'); - t.validFormat('hh:mm:ss', 'hh:mm:ss'); - t.validFormat('hh:mm:ss\\ AM/PM', 'hh:mm:ss\\ AM/PM'); - t.validFormat('hh\\.mm" h";@', 'hh\\.mm" h";@'); - t.validFormat('hhm', 'hhm'); - t.validFormat('hhmm', 'hhmm'); - t.validFormat('m"月"d"日"', 'm"月"d"日"'); - t.validFormat('m/d/yy', 'm/d/yy'); - t.validFormat('m/d/yy h:mm', 'm/d/yy h:mm'); - t.validFormat('m/d/yy;@', 'm/d/yy;@'); - t.validFormat('m/d/yy\\ h:mm', 'm/d/yy\\ h:mm'); - t.validFormat('m/d/yy\\ h:mm;@', 'm/d/yy\\ h:mm;@'); - t.validFormat('m/d/yyyy', 'm/d/yyyy'); - t.validFormat('m/d/yyyy;@', 'm/d/yyyy;@'); - t.validFormat('m/d/yyyy\\ h:mm:ss;@', 'm/d/yyyy\\ h:mm:ss;@'); - t.validFormat('m/d;@', 'm/d;@'); - t.validFormat('m\\/d\\/yyyy', 'm\\/d\\/yyyy'); - t.validFormat('mm/dd', 'mm/dd'); - t.validFormat('mm/dd/yy', 'mm/dd/yy'); - t.validFormat('mm/dd/yy;@', 'mm/dd/yy;@'); - t.validFormat('mm/dd/yyyy', 'mm/dd/yyyy'); - t.validFormat('mm:ss', 'mm:ss'); - t.validFormat('mm:ss.0;@', 'mm:ss.0;@'); - t.validFormat('mmm d, yyyy', 'mmm d, yyyy'); - t.validFormat('mmm" "d", "yyyy', 'mmm" "d", "yyyy'); - t.validFormat('mmm-yy', 'mmm-yy'); - t.validFormat('mmm-yy;@', 'mmm-yy;@'); - t.validFormat('mmm/yy', 'mmm/yy'); - t.validFormat('mmm\\-yy', 'mmm\\-yy'); - t.validFormat('mmm\\-yy;@', 'mmm\\-yy;@'); - t.validFormat('mmm\\-yyyy', 'mmm\\-yyyy'); - t.validFormat('mmmm\\ d\\,\\ yyyy', 'mmmm\\ d\\,\\ yyyy'); - t.validFormat('mmmm\\ yyyy', 'mmmm\\ yyyy'); - t.validFormat('mmss.0', 'mmss.0'); - t.validFormat('s', 's'); - t.validFormat('ss', 'ss'); - t.validFormat('yy', 'yy'); - t.validFormat('yy/mm/dd', 'yy/mm/dd'); - t.validFormat('yy\\.mm\\.dd', 'yy\\.mm\\.dd'); - t.validFormat('yym', 'yym'); - t.validFormat('yymm', 'yymm'); - t.validFormat('yymmm', 'yymmm'); - t.validFormat('yymmmm', 'yymmmm'); - t.validFormat('yymmmmm', 'yymmmmm'); - t.validFormat('yyyy', 'yyyy'); - t.validFormat('yyyy"년"\\ m"월"\\ d"일";@', 'yyyy"년"\\ m"월"\\ d"일";@'); - t.validFormat('yyyy-m-d h:mm AM/PM', 'yyyy-m-d h:mm AM/PM'); - t.validFormat('yyyy-mm-dd', 'yyyy-mm-dd'); - t.validFormat('yyyy/mm/dd', 'yyyy/mm/dd'); - t.validFormat('yyyy\\-m\\-d\\ hh:mm:ss', 'yyyy\\-m\\-d\\ hh:mm:ss'); - t.validFormat('yyyy\\-mm\\-dd', 'yyyy\\-mm\\-dd'); - t.validFormat('yyyy\\-mm\\-dd;@', 'yyyy\\-mm\\-dd;@'); - t.validFormat('yyyy\\-mm\\-dd\\ h:mm', 'yyyy\\-mm\\-dd\\ h:mm'); - t.validFormat('yyyy\\-mm\\-dd\\Thh:mm', 'yyyy\\-mm\\-dd\\Thh:mm'); - t.validFormat('yyyy\\-mm\\-dd\\Thhmmss.000', 'yyyy\\-mm\\-dd\\Thhmmss.000'); - - t.end(); -}); - diff --git a/test/ssf-valid.spec.ts b/test/ssf-valid.spec.ts new file mode 100644 index 0000000..85afd8b --- /dev/null +++ b/test/ssf-valid.spec.ts @@ -0,0 +1,454 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Validity tests', () => { + expect(() => format('" Excellent"', 1)).not.toThrow(); + expect(() => format('" Fair"', 1)).not.toThrow(); + expect(() => format('" Good"', 1)).not.toThrow(); + expect(() => format('" Poor"', 1)).not.toThrow(); + expect(() => format('" Very Good"', 1)).not.toThrow(); + expect(() => format('"$"#,##0', 1)).not.toThrow(); + expect(() => format('"$"#,##0.00', 1)).not.toThrow(); + expect(() => format('"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('"$"#,##0.00_);\\("$"#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('"$"#,##0;[Red]\\-"$"#,##0', 1)).not.toThrow(); + expect(() => format('"$"#,##0_);[Red]\\("$"#,##0\\)', 1)).not.toThrow(); + expect(() => format('"$"#,##0_);\\("$"#,##0\\)', 1)).not.toThrow(); + expect(() => format('"Haha!"\\ @\\ "Yeah!"', 1)).not.toThrow(); + expect(() => format('"TRUE";"TRUE";"FALSE"', 1)).not.toThrow(); + expect(() => format('"True";"True";"False";@', 1)).not.toThrow(); + expect(() => format('"Years: "0', 1)).not.toThrow(); + expect(() => format('"Yes";"Yes";"No";@', 1)).not.toThrow(); + expect(() => format('"kl "hh:mm:ss;@', 1)).not.toThrow(); + expect(() => format('"£"#,##0.00', 1)).not.toThrow(); + expect(() => format('"£"#,##0;[Red]\\-"£"#,##0', 1)).not.toThrow(); + expect(() => format('"€"#,##0.00', 1)).not.toThrow(); + expect(() => format('"€"\\ #,##0.00_-', 1)).not.toThrow(); + expect(() => format('"上午/下午 "hh"時"mm"分"ss"秒 "', 1)).not.toThrow(); + expect(() => format('"¥"#,##0.00;"¥"\\-#,##0.00', 1)).not.toThrow(); + expect(() => format('#', 1)).not.toThrow(); + expect(() => format('# ?/?', 1)).not.toThrow(); + expect(() => format('# ??/??', 1)).not.toThrow(); + expect(() => format('#" "?/?', 1)).not.toThrow(); + expect(() => format('#" "??/??', 1)).not.toThrow(); + expect(() => format('#"abded"\\ ??/??', 1)).not.toThrow(); + expect(() => format('###0.00;-###0.00', 1)).not.toThrow(); + expect(() => format('###0;-###0', 1)).not.toThrow(); + expect(() => format('##0.0E+0', 1)).not.toThrow(); + expect(() => format('#,##0', 1)).not.toThrow(); + expect(() => format('#,##0 ;(#,##0)', 1)).not.toThrow(); + expect(() => format('#,##0 ;[Red](#,##0)', 1)).not.toThrow(); + expect(() => format('#,##0"р.";[Red]\\-#,##0"р."', 1)).not.toThrow(); + expect(() => format('#,##0.0', 1)).not.toThrow(); + expect(() => format('#,##0.00', 1)).not.toThrow(); + expect(() => format('#,##0.00 "�"', 1)).not.toThrow(); + expect(() => format('#,##0.00 €;-#,##0.00 €', 1)).not.toThrow(); + expect(() => format('#,##0.00"р.";[Red]\\-#,##0.00"р."', 1)).not.toThrow(); + expect(() => format('#,##0.000', 1)).not.toThrow(); + expect(() => format('#,##0.0000', 1)).not.toThrow(); + expect(() => format('#,##0.00000', 1)).not.toThrow(); + expect(() => format('#,##0.000000', 1)).not.toThrow(); + expect(() => format('#,##0.0000000', 1)).not.toThrow(); + expect(() => format('#,##0.00000000', 1)).not.toThrow(); + expect(() => format('#,##0.000000000', 1)).not.toThrow(); + expect(() => format('#,##0.00000000;[Red]#,##0.00000000', 1)).not.toThrow(); + expect(() => format('#,##0.0000_ ', 1)).not.toThrow(); + expect(() => format('#,##0.000_ ', 1)).not.toThrow(); + expect(() => format('#,##0.000_);\\(#,##0.000\\)', 1)).not.toThrow(); + expect(() => format('#,##0.00;(#,##0.00)', 1)).not.toThrow(); + expect(() => format('#,##0.00;(#,##0.00);0.00', 1)).not.toThrow(); + expect(() => format('#,##0.00;[Red](#,##0.00)', 1)).not.toThrow(); + expect(() => format('#,##0.00;[Red]\\(#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('#,##0.00;\\(#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('#,##0.00[$₹-449]_);\\(#,##0.00[$₹-449]\\)', 1)).not.toThrow(); + expect(() => format('#,##0.00\\ "р."', 1)).not.toThrow(); + expect(() => format('#,##0.00\\ "р.";[Red]\\-#,##0.00\\ "р."', 1)).not.toThrow(); + expect(() => format('#,##0.00\\ [$€-407]', 1)).not.toThrow(); + expect(() => format('#,##0.00\\ [$€-40C]', 1)).not.toThrow(); + expect(() => format('#,##0.00_);\\(#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('#,##0.00_р_.;[Red]\\-#,##0.00_р_.', 1)).not.toThrow(); + expect(() => format('#,##0.00_р_.;\\-#,##0.00_р_.', 1)).not.toThrow(); + expect(() => format('#,##0.0;[Red]#,##0.0', 1)).not.toThrow(); + expect(() => format('#,##0.0_ ;\\-#,##0.0\\ ', 1)).not.toThrow(); + expect(() => format('#,##0.0_);[Red]\\(#,##0.0\\)', 1)).not.toThrow(); + expect(() => format('#,##0.0_);\\(#,##0.0\\)', 1)).not.toThrow(); + expect(() => format('#,##0;\\-#,##0;0', 1)).not.toThrow(); + expect(() => format('#,##0\\ "р.";[Red]\\-#,##0\\ "р."', 1)).not.toThrow(); + expect(() => format('#,##0\\ "р.";\\-#,##0\\ "р."', 1)).not.toThrow(); + expect(() => format('#,##0\\ ;[Red]\\(#,##0\\)', 1)).not.toThrow(); + expect(() => format('#,##0\\ ;\\(#,##0\\)', 1)).not.toThrow(); + expect(() => format('#,##0_ ', 1)).not.toThrow(); + expect(() => format('#,##0_ ;[Red]\\-#,##0\\ ', 1)).not.toThrow(); + expect(() => format('#,##0_);[Red]\\(#,##0\\)', 1)).not.toThrow(); + expect(() => format('#,##0_р_.;[Red]\\-#,##0_р_.', 1)).not.toThrow(); + expect(() => format('#,##0_р_.;\\-#,##0_р_.', 1)).not.toThrow(); + expect(() => format('#.0000,,', 1)).not.toThrow(); + expect(() => format('#0', 1)).not.toThrow(); + expect(() => format('#0.00', 1)).not.toThrow(); + expect(() => format('#0.0000', 1)).not.toThrow(); + expect(() => format('#\\ ?/10', 1)).not.toThrow(); + expect(() => format('#\\ ?/2', 1)).not.toThrow(); + expect(() => format('#\\ ?/4', 1)).not.toThrow(); + expect(() => format('#\\ ?/8', 1)).not.toThrow(); + expect(() => format('#\\ ?/?', 1)).not.toThrow(); + expect(() => format('#\\ ??/100', 1)).not.toThrow(); + expect(() => format('#\\ ??/100;[Red]\\(#\\ ??/16\\)', 1)).not.toThrow(); + expect(() => format('#\\ ??/16', 1)).not.toThrow(); + expect(() => format('#\\ ??/??', 1)).not.toThrow(); + expect(() => format('#\\ ??/?????????', 1)).not.toThrow(); + expect(() => format('#\\ ???/???', 1)).not.toThrow(); + expect(() => format('**\\ #,###,#00,000.00,**', 1)).not.toThrow(); + expect(() => format('0', 1)).not.toThrow(); + expect(() => format('0"abde".0"??"000E+00', 1)).not.toThrow(); + expect(() => format('0%', 1)).not.toThrow(); + expect(() => format('0.0', 1)).not.toThrow(); + expect(() => format('0.0%', 1)).not.toThrow(); + expect(() => format('0.00', 1)).not.toThrow(); + expect(() => format('0.00"°"', 1)).not.toThrow(); + expect(() => format('0.00%', 1)).not.toThrow(); + expect(() => format('0.000', 1)).not.toThrow(); + expect(() => format('0.000%', 1)).not.toThrow(); + expect(() => format('0.0000', 1)).not.toThrow(); + expect(() => format('0.000000', 1)).not.toThrow(); + expect(() => format('0.00000000', 1)).not.toThrow(); + expect(() => format('0.000000000', 1)).not.toThrow(); + expect(() => format('0.000000000%', 1)).not.toThrow(); + expect(() => format('0.00000000000', 1)).not.toThrow(); + expect(() => format('0.000000000000000', 1)).not.toThrow(); + expect(() => format('0.00000000E+00', 1)).not.toThrow(); + expect(() => format('0.0000E+00', 1)).not.toThrow(); + expect(() => format('0.00;[Red]0.00', 1)).not.toThrow(); + expect(() => format('0.00E+00', 1)).not.toThrow(); + expect(() => format('0.00_);[Red]\\(0.00\\)', 1)).not.toThrow(); + expect(() => format('0.00_);\\(0.00\\)', 1)).not.toThrow(); + expect(() => format('0.0_ ', 1)).not.toThrow(); + expect(() => format('00.00.00.000', 1)).not.toThrow(); + expect(() => format('00.000%', 1)).not.toThrow(); + expect(() => format('0000', 1)).not.toThrow(); + expect(() => format('00000', 1)).not.toThrow(); + expect(() => format('00000000', 1)).not.toThrow(); + expect(() => format('000000000', 1)).not.toThrow(); + expect(() => format('00000\\-0000', 1)).not.toThrow(); + expect(() => format('00000\\-00000', 1)).not.toThrow(); + expect(() => format('000\\-00\\-0000', 1)).not.toThrow(); + expect(() => format('0;[Red]0', 1)).not.toThrow(); + expect(() => format('0\\-00000\\-00000\\-0', 1)).not.toThrow(); + expect(() => format('0_);[Red]\\(0\\)', 1)).not.toThrow(); + expect(() => format('0_);\\(0\\)', 1)).not.toThrow(); + expect(() => format('@', 1)).not.toThrow(); + expect(() => format('A/P', 1)).not.toThrow(); + expect(() => format('AM/PM', 1)).not.toThrow(); + expect(() => format('AM/PMh"時"mm"分"ss"秒";@', 1)).not.toThrow(); + expect(() => format('D', 1)).not.toThrow(); + expect(() => format('DD', 1)).not.toThrow(); + expect(() => format('DD/MM/YY;@', 1)).not.toThrow(); + expect(() => format('DD/MM/YYYY', 1)).not.toThrow(); + expect(() => format('DD/MM/YYYY;@', 1)).not.toThrow(); + expect(() => format('DDD', 1)).not.toThrow(); + expect(() => format('DDDD', 1)).not.toThrow(); + expect(() => format('DDDD", "MMMM\\ DD", "YYYY', 1)).not.toThrow(); + expect(() => format('GENERAL', 1)).not.toThrow(); + expect(() => format('General', 1)).not.toThrow(); + expect(() => format('H', 1)).not.toThrow(); + expect(() => format('H:MM:SS\\ AM/PM', 1)).not.toThrow(); + expect(() => format('HH:MM', 1)).not.toThrow(); + expect(() => format('HH:MM:SS\\ AM/PM', 1)).not.toThrow(); + expect(() => format('HHM', 1)).not.toThrow(); + expect(() => format('HHMM', 1)).not.toThrow(); + expect(() => format('HH[MM]', 1)).not.toThrow(); + expect(() => format('HH[M]', 1)).not.toThrow(); + expect(() => format('M/D/YYYY', 1)).not.toThrow(); + expect(() => format('M/D/YYYY\\ H:MM', 1)).not.toThrow(); + expect(() => format('MM/DD/YY', 1)).not.toThrow(); + expect(() => format('S', 1)).not.toThrow(); + expect(() => format('SS', 1)).not.toThrow(); + expect(() => format('YY', 1)).not.toThrow(); + expect(() => format('YYM', 1)).not.toThrow(); + expect(() => format('YYMM', 1)).not.toThrow(); + expect(() => format('YYMMM', 1)).not.toThrow(); + expect(() => format('YYMMMM', 1)).not.toThrow(); + expect(() => format('YYMMMMM', 1)).not.toThrow(); + expect(() => format('YYYY', 1)).not.toThrow(); + expect(() => format('YYYY-MM-DD HH:MM:SS', 1)).not.toThrow(); + expect(() => format('YYYY\\-MM\\-DD', 1)).not.toThrow(); + expect(() => format('[$$-409]#,##0', 1)).not.toThrow(); + expect(() => format('[$$-409]#,##0.00', 1)).not.toThrow(); + expect(() => format('[$$-409]#,##0.00_);[Red]\\([$$-409]#,##0.00\\)', 1)).not.toThrow(); + expect(() => format('[$$-C09]#,##0.00', 1)).not.toThrow(); + expect(() => format('[$-100042A]h:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-1010409]0.000%', 1)).not.toThrow(); + expect(() => format('[$-1010409]General', 1)).not.toThrow(); + expect(() => format('[$-1010409]d/m/yyyy\\ h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-1010409]dddd, mmmm dd, yyyy', 1)).not.toThrow(); + expect(() => format('[$-1010409]m/d/yyyy', 1)).not.toThrow(); + expect(() => format('[$-1409]h:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-2000000]h:mm:ss;@', 1)).not.toThrow(); + expect(() => format('[$-2010401]d/mm/yyyy\\ h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-4000439]h:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-4010439]d/m/yyyy\\ h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-409]AM/PM\\ hh:mm:ss;@', 1)).not.toThrow(); + expect(() => format('[$-409]d/m/yyyy\\ hh:mm;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm\\-yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-409]dd/mm/yyyy\\ hh:mm;@', 1)).not.toThrow(); + expect(() => format('[$-409]dd\\-mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]h:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-409]h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-409]m/d/yy\\ h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmm\\ d\\,\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmmm;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-40E]h\\ "óra"\\ m\\ "perckor"\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-412]AM/PM\\ h"시"\\ mm"분"\\ ss"초";@', 1)).not.toThrow(); + expect(() => format('[$-41C]h:mm:ss\\.AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-449]hh:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-44E]hh:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-44F]hh:mm:ss\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-D000409]h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-D010000]d/mm/yyyy\\ h:mm\\ "น.";@', 1)).not.toThrow(); + expect(() => format('[$-F400]h:mm:ss\\ AM/PM', 1)).not.toThrow(); + expect(() => format('[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy', 1)).not.toThrow(); + expect(() => format('[$AUD]\\ #,##0.00', 1)).not.toThrow(); + expect(() => format('[$RD$-1C0A]#,##0.00;[Red]\\-[$RD$-1C0A]#,##0.00', 1)).not.toThrow(); + expect(() => format('[$SFr.-810]\\ #,##0.00_);[Red]\\([$SFr.-810]\\ #,##0.00\\)', 1)).not.toThrow(); + expect(() => format('[$£-809]#,##0.00;[Red][$£-809]#,##0.00', 1)).not.toThrow(); + expect(() => format('[$¥-411]#,##0.00', 1)).not.toThrow(); + expect(() => format('[$¥-804]#,##0.00', 1)).not.toThrow(); + expect(() => format('[<0]"";0%', 1)).not.toThrow(); + expect(() => format('[<=9999999]###\\-####;\\(###\\)\\ ###\\-####', 1)).not.toThrow(); + expect(() => format('[=0]?;#,##0.00', 1)).not.toThrow(); + expect(() => format('[=0]?;0%', 1)).not.toThrow(); + expect(() => format('[=0]?;[<4.16666666666667][hh]:mm:ss;[hh]:mm', 1)).not.toThrow(); + expect(() => format('[>999999]#,,"M";[>999]#,"K";#', 1)).not.toThrow(); + expect(() => format('[>999999]#.000,,"M";[>999]#.000,"K";#.000', 1)).not.toThrow(); + expect(() => format("[>=100000]0.000\\ \\\";[Red]0.000\\ \\<\\ \\>\\ \\\"\\ \\&\\ \\'\\ ", 1)).not.toThrow(); + expect(() => format('[>=100000]0.000\\ \\<;[Red]0.000\\ \\>', 1)).not.toThrow(); + expect(() => format('[BLACK]@', 1)).not.toThrow(); + expect(() => format('[BLUE]GENERAL', 1)).not.toThrow(); + expect(() => format('[Black]@', 1)).not.toThrow(); + expect(() => format('[Blue]General', 1)).not.toThrow(); + expect(() => format('[CYAN]@', 1)).not.toThrow(); + expect(() => format('[Cyan]@', 1)).not.toThrow(); + expect(() => format('[DBNum1][$-804]AM/PMh"时"mm"分";@', 1)).not.toThrow(); + expect(() => format('[DBNum1][$-804]General', 1)).not.toThrow(); + expect(() => format('[DBNum1][$-804]h"时"mm"分";@', 1)).not.toThrow(); + expect(() => format('[$-1004]dddd\\,\\ d\\ mmmm\\,\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-101040D]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-101042A]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-140C]dddd\\ "YeahWoo!"\\ ddd\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-2C0A]dddd\\ d" de "mmmm" de "yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-402]dd\\ mmmm\\ yyyy\\ "г.";@', 1)).not.toThrow(); + expect(() => format('[$-403]dddd\\,\\ d" / "mmmm" / "yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-405]d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-408]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]d\\-mmm\\-yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-409]dd\\-mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmm\\ d\\,\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-409]mmmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('[$-40B]d\\.\\ mmmm\\t\\a\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-40C]d/mmm/yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-40E]yyyy/\\ mmmm\\ d\\.;@', 1)).not.toThrow(); + expect(() => format('[$-40F]dd\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-410]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-415]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-416]d\\ \\ mmmm\\,\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-418]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-41A]d\\.\\ mmmm\\ yyyy\\.;@', 1)).not.toThrow(); + expect(() => format('[$-41B]d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-41D]"den "\\ d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-420]dddd\\,\\ dd\\ mmmm\\,\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-421]dd\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-424]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-425]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-426]dddd\\,\\ yyyy". gada "d\\.\\ mmmm;@', 1)).not.toThrow(); + expect(() => format('[$-427]yyyy\\ "m."\\ mmmm\\ d\\ "d.";@', 1)).not.toThrow(); + expect(() => format('[$-42B]dddd\\,\\ d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-42C]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-42D]yyyy"(e)ko"\\ mmmm"ren"\\ d"a";@', 1)).not.toThrow(); + expect(() => format('[$-42F]dddd\\,\\ dd\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-437]yyyy\\ \\წ\\ლ\\ი\\ს\\ dd\\ mm\\,\\ dddd;@', 1)).not.toThrow(); + expect(() => format('[$-438]d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-43F]d\\ mmmm\\ yyyy\\ "ж.";@', 1)).not.toThrow(); + expect(() => format('[$-444]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-449]dd\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-44E]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-44F]dd\\ mmmm\\ yyyy\\ dddd;@', 1)).not.toThrow(); + expect(() => format('[$-457]dd\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-813]dddd\\ d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-81A]dddd\\,\\ d\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-82C]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-843]yyyy\\ "й""и""л"\\ d/mmmm;@', 1)).not.toThrow(); + expect(() => format('[$-C07]dddd\\,\\ dd\\.\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[$-FC19]yyyy\\,\\ dd\\ mmmm;@', 1)).not.toThrow(); + expect(() => format('[$-FC22]d\\ mmmm\\ yyyy" р.";@', 1)).not.toThrow(); + expect(() => format('[$-FC23]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[GREEN]#,###', 1)).not.toThrow(); + expect(() => format('[Green]#,###', 1)).not.toThrow(); + expect(() => format('[HH]', 1)).not.toThrow(); + expect(() => format('[$-2060401]d/mm/yyyy\\ h:mm\\ AM/PM;@', 1)).not.toThrow(); + expect(() => format('[$-2060401]d\\ mmmm\\ yyyy;@', 1)).not.toThrow(); + expect(() => format('[H]', 1)).not.toThrow(); + expect(() => format('[$-411]gggyy"年"m"月"d"日"\\ dddd;@', 1)).not.toThrow(); + expect(() => format('[MAGENTA]0.00', 1)).not.toThrow(); + expect(() => format('[Magenta]0.00', 1)).not.toThrow(); + expect(() => format('[RED]#.##', 1)).not.toThrow(); + expect(() => format('[Red]#.##', 1)).not.toThrow(); + expect(() => format('[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General\\ ', 1)).not.toThrow(); + expect(() => format('[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', 1)).not.toThrow(); + expect(() => format('[Red][<>50]General;[Blue]000', 1)).not.toThrow(); + expect(() => format('[Red][=50]General;[Blue]000', 1)).not.toThrow(); + expect(() => format('[SS]', 1)).not.toThrow(); + expect(() => format('[S]', 1)).not.toThrow(); + expect(() => format('[DBNum1][$-404]y"年"m"月"d"日";@', 1)).not.toThrow(); + expect(() => format('[WHITE]0.0', 1)).not.toThrow(); + expect(() => format('[White]0.0', 1)).not.toThrow(); + expect(() => format('[YELLOW]@', 1)).not.toThrow(); + expect(() => format('[Yellow]@', 1)).not.toThrow(); + expect(() => format('[h]', 1)).not.toThrow(); + expect(() => format('[h]:mm:ss', 1)).not.toThrow(); + expect(() => format('[h]:mm:ss;@', 1)).not.toThrow(); + expect(() => format('[h]\\.mm" Uhr ";@', 1)).not.toThrow(); + expect(() => format('[hh]', 1)).not.toThrow(); + expect(() => format('[s]', 1)).not.toThrow(); + expect(() => format('[ss]', 1)).not.toThrow(); + expect(() => format('\\#\\r\\e\\c', 1)).not.toThrow(); + expect(() => format('\\$#,##0_);[Red]"($"#,##0\\)', 1)).not.toThrow(); + expect(() => format('\\$0.00', 1)).not.toThrow(); + expect(() => format('\\C\\O\\B\\ \\o\\n\\ @', 1)).not.toThrow(); + expect(() => format('\\C\\R\\O\\N\\T\\A\\B\\ \\o\\n\\ @', 1)).not.toThrow(); + expect(() => format('\\R\\e\\s\\u\\l\\t\\ \\o\\n\\ @', 1)).not.toThrow(); + expect(() => format('\\S\\Q\\L\\ \\:\\ @', 1)).not.toThrow(); + expect(() => format('\\S\\Q\\L\\ \\R\\e\\q\\u\\e\\s\\t\\ \\f\\o\\r\\ @', 1)).not.toThrow(); + expect(() => format('\\c\\c\\c?????0"aaaa"0"bbbb"000000.00%', 1)).not.toThrow(); + expect(() => format('\\u\\n\\t\\i\\l\\ h:mm;@', 1)).not.toThrow(); + expect( + () => format('_ "¥"* #,##0.00_ "Positive";_ "¥"* \\-#,##0.00_ ;_ "¥"* "-"??_ "Negtive";_ @_ \\ "Zero"', 1) + ).not.toThrow(); + expect( + () => format('_ * #,##0.00_)[$﷼-429]_ ;_ * \\(#,##0.00\\)[$﷼-429]_ ;_ * "-"??_)[$﷼-429]_ ;_ @_ ', 1) + ).not.toThrow(); + expect(() => format('_ * #,##0_ ;_ * \\-#,##0_ ;[Red]_ * "-"_ ;_ @_ ', 1)).not.toThrow(); + expect(() => format('_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0.0000_);_(* \\(#,##0.0000\\);_(* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0.000_);_(* \\(#,##0.000\\);_(* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0.0_);_(* \\(#,##0.0\\);_(* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0_);_(* \\(#,##0\\);_(* "-"??_);_(@_)', 1)).not.toThrow(); + expect(() => format('_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', 1)).not.toThrow(); + expect(() => format('_([$ANG]\\ * #,##0.0_);_([$ANG]\\ * \\(#,##0.0\\);_([$ANG]\\ * "-"?_);_(@_)', 1)).not.toThrow(); + expect(() => format('_-"€"\\ * #,##0.00_-;_-"€"\\ * #,##0.00\\-;_-"€"\\ * "-"??_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0.00" TL"_-;\\-* #,##0.00" TL"_-;_-* \\-??" TL"_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0.00" €"_-;\\-* #,##0.00" €"_-;_-* \\-??" €"_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0.00\\ "р."_-;\\-* #,##0.00\\ "р."_-;_-* "-"??\\ "р."_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0.00\\ "€"_-;\\-* #,##0.00\\ "€"_-;_-* "-"??\\ "€"_-;_-@_-', 1)).not.toThrow(); + expect( + () => format('_-* #,##0.00\\ [$€-407]_-;\\-* #,##0.00\\ [$€-407]_-;_-* \\-??\\ [$€-407]_-;_-@_-', 1) + ).not.toThrow(); + expect(() => format('_-* #,##0.0\\ _F_-;\\-* #,##0.0\\ _F_-;_-* "-"??\\ _F_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0\\ "€"_-;\\-* #,##0\\ "€"_-;_-* "-"\\ "€"_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-* #,##0_-;\\-* #,##0_-;_-* "-"??_-;_-@_-', 1)).not.toThrow(); + expect(() => format('_-\\$* #,##0.0_ ;_-\\$* \\-#,##0.0\\ ;_-\\$* "-"?_ ;_-@_ ', 1)).not.toThrow(); + expect(() => format('d', 1)).not.toThrow(); + expect(() => format('d-mmm', 1)).not.toThrow(); + expect(() => format('d-mmm-yy', 1)).not.toThrow(); + expect(() => format('d/m', 1)).not.toThrow(); + expect(() => format('d/m/yy;@', 1)).not.toThrow(); + expect(() => format('d/m/yyyy;@', 1)).not.toThrow(); + expect(() => format('d/mm/yy;@', 1)).not.toThrow(); + expect(() => format('d/mm/yyyy;@', 1)).not.toThrow(); + expect(() => format('d\\-mmm', 1)).not.toThrow(); + expect(() => format('d\\-mmm\\-yyyy', 1)).not.toThrow(); + expect(() => format('dd', 1)).not.toThrow(); + expect(() => format('dd"-"mmm"-"yyyy', 1)).not.toThrow(); + expect(() => format('dd/m/yyyy', 1)).not.toThrow(); + expect(() => format('dd/mm/yy', 1)).not.toThrow(); + expect(() => format('dd/mm/yy;@', 1)).not.toThrow(); + expect(() => format('dd/mm/yy\\ hh:mm', 1)).not.toThrow(); + expect(() => format('dd/mm/yyyy', 1)).not.toThrow(); + expect(() => format('dd/mm/yyyy\\ hh:mm:ss', 1)).not.toThrow(); + expect(() => format('dd/mmm', 1)).not.toThrow(); + expect(() => format('dd\\-mm\\-yy', 1)).not.toThrow(); + expect(() => format('dd\\-mmm\\-yy', 1)).not.toThrow(); + expect(() => format('dd\\-mmm\\-yyyy\\ hh:mm:ss.000', 1)).not.toThrow(); + expect(() => format('dd\\/mm\\/yy', 1)).not.toThrow(); + expect(() => format('dd\\/mm\\/yyyy', 1)).not.toThrow(); + expect(() => format('ddd', 1)).not.toThrow(); + expect(() => format('dddd', 1)).not.toThrow(); + expect(() => format('dddd, mmmm dd, yyyy', 1)).not.toThrow(); + expect(() => format('h', 1)).not.toThrow(); + expect(() => format('h"时"mm"分"ss"秒";@', 1)).not.toThrow(); + expect(() => format('h"時"mm"分"ss"秒";@', 1)).not.toThrow(); + expect(() => format('h:mm', 1)).not.toThrow(); + expect(() => format('h:mm AM/PM', 1)).not.toThrow(); + expect(() => format('h:mm:ss', 1)).not.toThrow(); + expect(() => format('h:mm:ss AM/PM', 1)).not.toThrow(); + expect(() => format('h:mm:ss;@', 1)).not.toThrow(); + expect(() => format('h:mm;@', 1)).not.toThrow(); + expect(() => format('h\\.mm" Uhr ";@', 1)).not.toThrow(); + expect(() => format('h\\.mm" h";@', 1)).not.toThrow(); + expect(() => format('h\\.mm" u.";@', 1)).not.toThrow(); + expect(() => format('hh":"mm AM/PM', 1)).not.toThrow(); + expect(() => format('hh:mm:ss', 1)).not.toThrow(); + expect(() => format('hh:mm:ss\\ AM/PM', 1)).not.toThrow(); + expect(() => format('hh\\.mm" h";@', 1)).not.toThrow(); + expect(() => format('hhm', 1)).not.toThrow(); + expect(() => format('hhmm', 1)).not.toThrow(); + expect(() => format('m"月"d"日"', 1)).not.toThrow(); + expect(() => format('m/d/yy', 1)).not.toThrow(); + expect(() => format('m/d/yy h:mm', 1)).not.toThrow(); + expect(() => format('m/d/yy;@', 1)).not.toThrow(); + expect(() => format('m/d/yy\\ h:mm', 1)).not.toThrow(); + expect(() => format('m/d/yy\\ h:mm;@', 1)).not.toThrow(); + expect(() => format('m/d/yyyy', 1)).not.toThrow(); + expect(() => format('m/d/yyyy;@', 1)).not.toThrow(); + expect(() => format('m/d/yyyy\\ h:mm:ss;@', 1)).not.toThrow(); + expect(() => format('m/d;@', 1)).not.toThrow(); + expect(() => format('m\\/d\\/yyyy', 1)).not.toThrow(); + expect(() => format('mm/dd', 1)).not.toThrow(); + expect(() => format('mm/dd/yy', 1)).not.toThrow(); + expect(() => format('mm/dd/yy;@', 1)).not.toThrow(); + expect(() => format('mm/dd/yyyy', 1)).not.toThrow(); + expect(() => format('mm:ss', 1)).not.toThrow(); + expect(() => format('mm:ss.0;@', 1)).not.toThrow(); + expect(() => format('mmm d, yyyy', 1)).not.toThrow(); + expect(() => format('mmm" "d", "yyyy', 1)).not.toThrow(); + expect(() => format('mmm-yy', 1)).not.toThrow(); + expect(() => format('mmm-yy;@', 1)).not.toThrow(); + expect(() => format('mmm/yy', 1)).not.toThrow(); + expect(() => format('mmm\\-yy', 1)).not.toThrow(); + expect(() => format('mmm\\-yy;@', 1)).not.toThrow(); + expect(() => format('mmm\\-yyyy', 1)).not.toThrow(); + expect(() => format('mmmm\\ d\\,\\ yyyy', 1)).not.toThrow(); + expect(() => format('mmmm\\ yyyy', 1)).not.toThrow(); + expect(() => format('mmss.0', 1)).not.toThrow(); + expect(() => format('s', 1)).not.toThrow(); + expect(() => format('ss', 1)).not.toThrow(); + expect(() => format('yy', 1)).not.toThrow(); + expect(() => format('yy/mm/dd', 1)).not.toThrow(); + expect(() => format('yy\\.mm\\.dd', 1)).not.toThrow(); + expect(() => format('yym', 1)).not.toThrow(); + expect(() => format('yymm', 1)).not.toThrow(); + expect(() => format('yymmm', 1)).not.toThrow(); + expect(() => format('yymmmm', 1)).not.toThrow(); + expect(() => format('yymmmmm', 1)).not.toThrow(); + expect(() => format('yyyy', 1)).not.toThrow(); + expect(() => format('yyyy"년"\\ m"월"\\ d"일";@', 1)).not.toThrow(); + expect(() => format('yyyy-m-d h:mm AM/PM', 1)).not.toThrow(); + expect(() => format('yyyy-mm-dd', 1)).not.toThrow(); + expect(() => format('yyyy/mm/dd', 1)).not.toThrow(); + expect(() => format('yyyy\\-m\\-d\\ hh:mm:ss', 1)).not.toThrow(); + expect(() => format('yyyy\\-mm\\-dd', 1)).not.toThrow(); + expect(() => format('yyyy\\-mm\\-dd;@', 1)).not.toThrow(); + expect(() => format('yyyy\\-mm\\-dd\\ h:mm', 1)).not.toThrow(); + expect(() => format('yyyy\\-mm\\-dd\\Thh:mm', 1)).not.toThrow(); + expect(() => format('yyyy\\-mm\\-dd\\Thhmmss.000', 1)).not.toThrow(); +}); + diff --git a/test/text-test.js b/test/text-test.js deleted file mode 100644 index 992ecd3..0000000 --- a/test/text-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { format } from '../lib/index.js'; -import test from './utils.js'; - -test('Errors', t => { - // no more than a single text section - t.throws(() => format('@;@'), '@;@'); - t.end(); -}); - -test('Repeated @ in same pattern', t => { - t.format('@@', 1, '1'); - t.format('@@', -1, '-1'); - t.format('@@', 0, '0'); - t.format('@@', 'text', 'texttext'); - t.end(); -}); - -test('Text in combination with other things', t => { - t.format('@ "foo"', 1, '1'); - t.format('@ "foo"', -1, '-1'); - t.format('@ "foo"', 0, '0'); - t.format('@ "foo"', 'text', 'text foo'); - - t.format('"bar" @ "foo"', 1, '1'); - t.format('"bar" @ "foo"', -1, '-1'); - t.format('"bar" @ "foo"', 0, '0'); - t.format('"bar" @ "foo"', 'text', 'bar text foo'); - t.end(); -}); diff --git a/test/text.spec.ts b/test/text.spec.ts new file mode 100644 index 0000000..68a69a5 --- /dev/null +++ b/test/text.spec.ts @@ -0,0 +1,26 @@ +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +test('Errors', () => { + // no more than a single text section + expect(() => format('@;@'), '@;@').toThrow(); +}); + +test('Repeated @ in same pattern', () => { + expect(format('@@', 1)).toBe('1'); + expect(format('@@', -1)).toBe('-1'); + expect(format('@@', 0)).toBe('0'); + expect(format('@@', 'text')).toBe('texttext'); +}); + +test('Text in combination with other things', () => { + expect(format('@ "foo"', 1)).toBe('1'); + expect(format('@ "foo"', -1)).toBe('-1'); + expect(format('@ "foo"', 0)).toBe('0'); + expect(format('@ "foo"', 'text')).toBe('text foo'); + + expect(format('"bar" @ "foo"', 1)).toBe('1'); + expect(format('"bar" @ "foo"', -1)).toBe('-1'); + expect(format('"bar" @ "foo"', 0)).toBe('0'); + expect(format('"bar" @ "foo"', 'text')).toBe('bar text foo'); +}); diff --git a/test/utils.js b/test/utils.js deleted file mode 100644 index bb7853d..0000000 --- a/test/utils.js +++ /dev/null @@ -1,183 +0,0 @@ -import test, { Test } from 'tape'; -import { format, formatColor, getFormatDateInfo, getFormatInfo } from '../lib/index.js'; -import fs from 'fs'; -import path from 'path'; -import zlib from 'zlib'; -import { fileURLToPath } from 'url'; - -const VALUE_ERROR = '#VALUE!'; - -function getTimeZoneName () { - const ds = new Date().toString(); - return ds.replace(/^.*GMT\+\d{4} \((.*?)\)$/, '$1'); -} - -function getTimeZoneOffset (d) { - const temp = new Date(); - temp.setUTCFullYear( - d.getFullYear(), - d.getMonth(), - d.getDate() - ); - temp.setUTCHours( - d.getHours(), - d.getMinutes(), - d.getSeconds(), - d.getMilliseconds() - ); - return (d - temp) / 60000; -} - -function isLeapYear (year) { - return !!(!(year % 4) && year % 100) || !(year % 400); -} - -Test.prototype.runTable = function runSSFTable (pathToTable) { - const filename = fileURLToPath(new URL(pathToTable, import.meta.url)); - // eslint-disable-next-line - if (process.env.SKIPTABLES) { return; } - const tableFN = path.join(filename) + '.gz'; - const table = zlib.gunzipSync(fs.readFileSync(tableFN)) - .toString('utf8') - .replace(/\r/g, '') - .split('\n') - .map(d => d.replace(/#{255}/g, '').split('\t')); - - const headers = table[0]; - const startPos = 1; - const endPos = table.length; - headers.slice(1).forEach((code, hi) => { - this.test('Pattern: ' + code, t => { - let failCount = 0; - for (let i = startPos; i < endPos; i++) { - const d = table[i]; - if (!d[0]) { break; } - let exp = d[hi + 1]; - if (exp === '######') { - // some tables use #VALUE!, others '######' - exp = VALUE_ERROR; - } - let res; - try { - res = format(code, parseFloat(d[0]), { - dateSpanLarge: false, - dateErrorNumber: false, - dateErrorThrows: true - }); - } - catch (err) { - res = VALUE_ERROR; - } - if (res !== exp) { - failCount++; - t.fail(`${i - 1}: numfmt('${code}', ${d[0]}) => ${res} !== ${exp}`); - } - } - if (!failCount) { - t.pass('OK'); - } - t.end(); - }); - }); -}; - -function formatMessage (pattern, value, options) { - let message = pattern; - const suffix = (typeof value === 'bigint') ? 'n' : ''; - message += '\x1b[36m <=> ' + value + suffix; - const o = JSON.stringify(options); - if (o !== '{}') { - message += '\x1b[2m\x1b[33m [ OPTIONS=' + o + ' ]'; - } - message += '\x1b[0m'; - return message; -} - -// extend tape to be able to omit descriptions - -Test.prototype.format = function assertFormat (pattern, value, expected, options = {}) { - const output = format(pattern, value, options); - this.is(output, expected, formatMessage(pattern, value, options)); -}; - -Test.prototype.validFormat = function assertFormatParses (pattern, options = {}) { - const message = formatMessage(pattern, null, options); - try { - format(pattern, 1); - this.pass(message); - } - catch (err) { - this.fail(message); - } -}; - -Test.prototype.formatColor = function assertFormat (pattern, value, expected, options = {}) { - const output = formatColor(pattern, value, options); - this.is(output, expected, formatMessage(pattern, value, options)); -}; - -Test.prototype.formatInvalid = function assertFormatThrows (pattern, options = {}) { - this.throws( - () => { - format(pattern, '', options); - }, - null, - formatMessage(pattern, null, options) - ); -}; - -Test.prototype.formatThrows = function assertFormatThrows (pattern, value, expected, options = {}) { - this.throws( - () => format(pattern, value, options), - expected, - formatMessage(pattern, value, options) - ); -}; - -const commonProps = { - isDate: false, - isText: false, - isPercent: false, - maxDecimals: 0, - grouped: 0, - parentheses: 0, - color: 0, - scale: 1, - level: 0 -}; - -function alphabetizeProps (obj) { - const keys = Object.keys(obj).sort(); - return keys.reduce((a, c) => { a[c] = obj[c]; return a; }, {}); -} - -Test.prototype.assertInfo = function (fmtString, expectProps) { - const output = { ...getFormatInfo(fmtString) }; - this.deepEqual( - alphabetizeProps(output), - alphabetizeProps({ ...commonProps, ...expectProps }), - fmtString - ); -}; - -const commonDateProps = { - year: false, - month: false, - day: false, - hours: false, - minutes: false, - seconds: false, - clockType: 24 -}; - -Test.prototype.assertDateInfo = function (fmtString, expectProps) { - const output = getFormatDateInfo(fmtString); - this.deepEqual( - alphabetizeProps(output), - alphabetizeProps({ ...commonDateProps, ...expectProps }), - fmtString - ); -}; - -export { test, Test, getTimeZoneName, getTimeZoneOffset, isLeapYear }; -export default test; diff --git a/test/utils.ts b/test/utils.ts new file mode 100644 index 0000000..92bb583 --- /dev/null +++ b/test/utils.ts @@ -0,0 +1,79 @@ +import fs from 'node:fs'; +import zlib from 'node:zlib'; +import { fileURLToPath } from 'node:url'; +import { expect, test } from 'vitest'; +import { format } from '../lib/index.js'; + +const VALUE_ERROR = '#VALUE!'; + +export function getTimeZoneName (): string { + const ds = new Date().toString(); + return ds.replace(/^.*GMT\+\d{4} \((.*?)\)$/, '$1'); +} + +export function getTimeZoneOffset (d: Date): number { + const temp = new Date(); + temp.setUTCFullYear( + d.getFullYear(), + d.getMonth(), + d.getDate() + ); + temp.setUTCHours( + d.getHours(), + d.getMinutes(), + d.getSeconds(), + d.getMilliseconds() + ); + return (d.getTime() - temp.getTime()) / 60000; +} + +export function isLeapYear (year: number): boolean { + return !!(!(year % 4) && year % 100) || !(year % 400); +} + +export function runTable (pathToTable: string): void { + if (process.env.SKIPTABLES) { + test.skip('Table: ' + pathToTable); + return; + } + const filename = fileURLToPath(new URL(pathToTable, import.meta.url)); + const tableFN = filename + '.gz'; + const table = zlib.gunzipSync(fs.readFileSync(tableFN)) + .toString('utf8') + .replace(/\r/g, '') + .split('\n') + .map(d => d.replace(/#{255}/g, '').split('\t')); + + const headers = table[0]; + const startPos = 1; + const endPos = table.length; + headers.slice(1).forEach((code, hi) => { + test('Pattern: ' + code, () => { + const failures: string[] = []; + for (let i = startPos; i < endPos; i++) { + const d = table[i]; + if (!d[0]) { break; } + let exp = d[hi + 1]; + if (exp === '######') { + // some tables use #VALUE!, others '######' + exp = VALUE_ERROR; + } + let res; + try { + res = format(code, parseFloat(d[0]), { + dateSpanLarge: false, + dateErrorNumber: false, + dateErrorThrows: true + }); + } + catch { + res = VALUE_ERROR; + } + if (res !== exp) { + failures.push(`${i - 1}: numfmt('${code}', ${d[0]}) => ${res} !== ${exp}`); + } + } + expect(failures, failures.join('\n')).toEqual([]); + }); + }); +}