diff --git a/.eslintrc.json b/.eslintrc.json
index 8287875..7e80b00 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -5,9 +5,7 @@
"ecmaVersion": 8
},
"env": {
- "es6": true,
- "node": true,
- "browser": true
+ "es6": true
},
"rules": {
"no-cond-assign": 0
diff --git a/.github/eslint.json b/.github/eslint.json
new file mode 100644
index 0000000..c280fdb
--- /dev/null
+++ b/.github/eslint.json
@@ -0,0 +1,18 @@
+{
+ "problemMatcher": [
+ {
+ "owner": "eslint-compact",
+ "pattern": [
+ {
+ "regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$",
+ "file": 1,
+ "line": 2,
+ "column": 3,
+ "severity": 4,
+ "message": 5,
+ "code": 6
+ }
+ ]
+ }
+ ]
+}
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
new file mode 100644
index 0000000..7e5ee59
--- /dev/null
+++ b/.github/workflows/node.js.yml
@@ -0,0 +1,30 @@
+# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [14.x]
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - run: yarn --frozen-lockfile
+ - run: |
+ echo ::add-matcher::.github/eslint.json
+ yarn run eslint src test --format=compact
+ - run: yarn test
diff --git a/LICENSE b/LICENSE
index 4f0b022..b014515 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,27 +1,13 @@
-Copyright 2010-2015 Mike Bostock
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the author nor the names of contributors may be used to
- endorse or promote products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright 2010-2021 Mike Bostock
+
+Permission to use, copy, modify, and/or distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright notice
+and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
diff --git a/README.md b/README.md
index 45eb099..9b6c6fe 100644
--- a/README.md
+++ b/README.md
@@ -20,19 +20,31 @@ For a longer introduction, see these recommended tutorials:
## Installing
-If you use NPM, `npm install d3-scale`. Otherwise, download the [latest release](https://github.com/d3/d3-scale/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-scale.v3.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
+If you use npm, `npm install d3-scale`. You can also download the [latest release on GitHub](https://github.com/d3/d3-scale/releases/latest). For vanilla HTML in modern browsers, import d3-scale from Skypack:
```html
-
-
-
-
-
-
-
+
+```
+
+For legacy environments, you can load d3-scale’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
+
+```html
+
+
+
+
+
+
+
```
diff --git a/d3-scale.sublime-project b/d3-scale.sublime-project
deleted file mode 100644
index 772dfa5..0000000
--- a/d3-scale.sublime-project
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "folders": [
- {
- "path": ".",
- "file_exclude_patterns": ["*.sublime-workspace"],
- "folder_exclude_patterns": ["dist"]
- }
- ],
- "build_systems": [
- {
- "name": "yarn test",
- "cmd": ["yarn", "test"],
- "file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)",
- "working_dir": "$project_path"
- }
- ]
-}
diff --git a/package.json b/package.json
index 53b2e06..3b144ea 100644
--- a/package.json
+++ b/package.json
@@ -2,49 +2,56 @@
"name": "d3-scale",
"version": "3.3.0",
"description": "Encodings that map abstract data to visual representation.",
+ "homepage": "https://d3js.org/d3-scale/",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/d3/d3-scale.git"
+ },
"keywords": [
"d3",
"d3-module",
"scale",
"visualization"
],
- "homepage": "https://d3js.org/d3-scale/",
- "license": "BSD-3-Clause",
+ "license": "ISC",
"author": {
"name": "Mike Bostock",
- "url": "http://bost.ocks.org/mike"
- },
- "main": "dist/d3-scale.js",
- "unpkg": "dist/d3-scale.min.js",
- "jsdelivr": "dist/d3-scale.min.js",
- "module": "src/index.js",
- "repository": {
- "type": "git",
- "url": "https://github.com/d3/d3-scale.git"
+ "url": "https://bost.ocks.org/mike"
},
+ "type": "module",
"files": [
"dist/**/*.js",
"src/**/*.js"
],
- "scripts": {
- "pretest": "rollup -c",
- "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src",
- "prepublishOnly": "rm -rf dist && yarn test",
- "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
+ "module": "src/index.js",
+ "main": "src/index.js",
+ "jsdelivr": "dist/d3-scale.min.js",
+ "unpkg": "dist/d3-scale.min.js",
+ "exports": {
+ "umd": "./dist/d3-scale.min.js",
+ "default": "./src/index.js"
},
"sideEffects": false,
"dependencies": {
- "d3-array": "^2.3.0",
- "d3-format": "1 - 2",
- "d3-interpolate": "1.2.0 - 2",
- "d3-time": "^2.1.1",
- "d3-time-format": "2 - 3"
+ "d3-array": "2.3.0 - 3",
+ "d3-format": "1 - 3",
+ "d3-interpolate": "1.2.0 - 3",
+ "d3-time": "2.1.1 - 3",
+ "d3-time-format": "2 - 4"
},
"devDependencies": {
- "d3-color": "1 - 2",
+ "d3-color": "1 - 3",
"eslint": "7",
+ "mocha": "8",
"rollup": "2",
- "rollup-plugin-terser": "7",
- "tape": "4"
+ "rollup-plugin-terser": "7"
+ },
+ "scripts": {
+ "test": "TZ=America/Los_Angeles mocha 'test/**/*-test.js' && eslint src test",
+ "prepublishOnly": "rm -rf dist && yarn test && rollup -c",
+ "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"
+ },
+ "engines": {
+ "node": ">=12"
}
}
diff --git a/rollup.config.js b/rollup.config.js
index 804bba8..4c6ccad 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,6 +1,14 @@
+import {readFileSync} from "fs";
import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";
+// Extract copyrights from the LICENSE.
+const copyright = readFileSync("./LICENSE", "utf-8")
+ .split(/\n/g)
+ .filter(line => /^Copyright\s+/.test(line))
+ .map(line => line.replace(/^Copyright\s+/, ""))
+ .join(", ");
+
const config = {
input: "src/index.js",
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
@@ -10,7 +18,7 @@ const config = {
format: "umd",
indent: false,
extend: true,
- banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
+ banner: `// ${meta.homepage} v${meta.version} Copyright ${copyright}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
},
plugins: []
diff --git a/test/.eslintrc.json b/test/.eslintrc.json
new file mode 100644
index 0000000..0a29431
--- /dev/null
+++ b/test/.eslintrc.json
@@ -0,0 +1,13 @@
+{
+ "extends": "eslint:recommended",
+ "parserOptions": {
+ "sourceType": "module",
+ "ecmaVersion": 8
+ },
+ "env": {
+ "mocha": true
+ },
+ "rules": {
+ "no-sparse-arrays": 0
+ }
+}
diff --git a/test/asserts.js b/test/asserts.js
new file mode 100644
index 0000000..1d44e17
--- /dev/null
+++ b/test/asserts.js
@@ -0,0 +1,28 @@
+import assert from "assert";
+
+export function assertInDelta(actual, expected, delta = 1e-6) {
+ assert(inDelta(actual, expected, delta), `${actual} should be within ${delta} of ${expected}`);
+}
+
+function inDelta(actual, expected, delta) {
+ return (Array.isArray(expected) ? inDeltaArray
+ : typeof expected === "object" ? inDeltaObject
+ : inDeltaNumber)(actual, expected, delta);
+}
+
+function inDeltaArray(actual, expected, delta) {
+ let n = expected.length, i = -1;
+ if (actual.length !== n) return false;
+ while (++i < n) if (!inDelta(actual[i], expected[i], delta)) return false;
+ return true;
+}
+
+function inDeltaObject(actual, expected, delta) {
+ for (let i in expected) if (!inDelta(actual[i], expected[i], delta)) return false;
+ for (let i in actual) if (!(i in expected)) return false;
+ return true;
+}
+
+function inDeltaNumber(actual, expected, delta) {
+ return actual >= expected - delta && actual <= expected + delta;
+}
diff --git a/test/band-test.js b/test/band-test.js
index 2fef80e..2a76cb5 100644
--- a/test/band-test.js
+++ b/test/band-test.js
@@ -1,278 +1,250 @@
-var tape = require("tape"),
- scale = require("../");
-
-tape("scaleBand() has the expected defaults", function(test) {
- var s = scale.scaleBand();
- test.deepEqual(s.domain(), []);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.bandwidth(), 1);
- test.equal(s.step(), 1);
- test.equal(s.round(), false);
- test.equal(s.paddingInner(), 0);
- test.equal(s.paddingOuter(), 0);
- test.equal(s.align(), 0.5);
- test.end();
-});
-
-tape("band(value) computes discrete bands in a continuous range", function(test) {
- var s = scale.scaleBand([0, 960]);
- test.equal(s("foo"), undefined);
+import assert from "assert";
+import {scaleBand} from "../src/index.js";
+
+it("scaleBand() has the expected defaults", () => {
+ const s = scaleBand();
+ assert.deepStrictEqual(s.domain(), []);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.bandwidth(), 1);
+ assert.strictEqual(s.step(), 1);
+ assert.strictEqual(s.round(), false);
+ assert.strictEqual(s.paddingInner(), 0);
+ assert.strictEqual(s.paddingOuter(), 0);
+ assert.strictEqual(s.align(), 0.5);
+});
+
+it("band(value) computes discrete bands in a continuous range", () => {
+ const s = scaleBand([0, 960]);
+ assert.strictEqual(s("foo"), undefined);
s.domain(["foo", "bar"]);
- test.equal(s("foo"), 0);
- test.equal(s("bar"), 480);
+ assert.strictEqual(s("foo"), 0);
+ assert.strictEqual(s("bar"), 480);
s.domain(["a", "b", "c"]).range([0, 120]);
- test.deepEqual(s.domain().map(s), [0, 40, 80]);
- test.equal(s.bandwidth(), 40);
+ assert.deepStrictEqual(s.domain().map(s), [0, 40, 80]);
+ assert.strictEqual(s.bandwidth(), 40);
s.padding(0.2);
- test.deepEqual(s.domain().map(s), [7.5, 45, 82.5]);
- test.equal(s.bandwidth(), 30);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [7.5, 45, 82.5]);
+ assert.strictEqual(s.bandwidth(), 30);
});
-tape("band(value) returns undefined for values outside the domain", function(test) {
- var s = scale.scaleBand(["a", "b", "c"], [0, 1]);
- test.equal(s("d"), undefined);
- test.equal(s("e"), undefined);
- test.equal(s("f"), undefined);
- test.end();
+it("band(value) returns undefined for values outside the domain", () => {
+ const s = scaleBand(["a", "b", "c"], [0, 1]);
+ assert.strictEqual(s("d"), undefined);
+ assert.strictEqual(s("e"), undefined);
+ assert.strictEqual(s("f"), undefined);
});
-tape("band(value) does not implicitly add values to the domain", function(test) {
- var s = scale.scaleBand(["a", "b", "c"], [0, 1]);
+it("band(value) does not implicitly add values to the domain", () => {
+ const s = scaleBand(["a", "b", "c"], [0, 1]);
s("d");
s("e");
- test.deepEqual(s.domain(), ["a", "b", "c"]);
- test.end();
+ assert.deepStrictEqual(s.domain(), ["a", "b", "c"]);
});
-tape("band.step() returns the distance between the starts of adjacent bands", function(test) {
- var s = scale.scaleBand([0, 960]);
- test.equal(s.domain(["foo"]).step(), 960);
- test.equal(s.domain(["foo", "bar"]).step(), 480);
- test.equal(s.domain(["foo", "bar", "baz"]).step(), 320);
+it("band.step() returns the distance between the starts of adjacent bands", () => {
+ const s = scaleBand([0, 960]);
+ assert.strictEqual(s.domain(["foo"]).step(), 960);
+ assert.strictEqual(s.domain(["foo", "bar"]).step(), 480);
+ assert.strictEqual(s.domain(["foo", "bar", "baz"]).step(), 320);
s.padding(0.5);
- test.equal(s.domain(["foo"]).step(), 640);
- test.equal(s.domain(["foo", "bar"]).step(), 384);
- test.end();
+ assert.strictEqual(s.domain(["foo"]).step(), 640);
+ assert.strictEqual(s.domain(["foo", "bar"]).step(), 384);
});
-tape("band.bandwidth() returns the width of the band", function(test) {
- var s = scale.scaleBand([0, 960]);
- test.equal(s.domain([]).bandwidth(), 960);
- test.equal(s.domain(["foo"]).bandwidth(), 960);
- test.equal(s.domain(["foo", "bar"]).bandwidth(), 480);
- test.equal(s.domain(["foo", "bar", "baz"]).bandwidth(), 320);
+it("band.bandwidth() returns the width of the band", () => {
+ const s = scaleBand([0, 960]);
+ assert.strictEqual(s.domain([]).bandwidth(), 960);
+ assert.strictEqual(s.domain(["foo"]).bandwidth(), 960);
+ assert.strictEqual(s.domain(["foo", "bar"]).bandwidth(), 480);
+ assert.strictEqual(s.domain(["foo", "bar", "baz"]).bandwidth(), 320);
s.padding(0.5);
- test.equal(s.domain([]).bandwidth(), 480);
- test.equal(s.domain(["foo"]).bandwidth(), 320);
- test.equal(s.domain(["foo", "bar"]).bandwidth(), 192);
- test.end();
+ assert.strictEqual(s.domain([]).bandwidth(), 480);
+ assert.strictEqual(s.domain(["foo"]).bandwidth(), 320);
+ assert.strictEqual(s.domain(["foo", "bar"]).bandwidth(), 192);
});
-tape("band.domain([]) computes reasonable band and step values", function(test) {
- var s = scale.scaleBand([0, 960]).domain([]);
- test.equal(s.step(), 960);
- test.equal(s.bandwidth(), 960);
+it("band.domain([]) computes reasonable band and step values", () => {
+ const s = scaleBand([0, 960]).domain([]);
+ assert.strictEqual(s.step(), 960);
+ assert.strictEqual(s.bandwidth(), 960);
s.padding(0.5);
- test.equal(s.step(), 960);
- test.equal(s.bandwidth(), 480);
+ assert.strictEqual(s.step(), 960);
+ assert.strictEqual(s.bandwidth(), 480);
s.padding(1);
- test.equal(s.step(), 960);
- test.equal(s.bandwidth(), 0);
- test.end();
+ assert.strictEqual(s.step(), 960);
+ assert.strictEqual(s.bandwidth(), 0);
});
-tape("band.domain([value]) computes a reasonable singleton band, even with padding", function(test) {
- var s = scale.scaleBand([0, 960]).domain(["foo"]);
- test.equal(s("foo"), 0);
- test.equal(s.step(), 960);
- test.equal(s.bandwidth(), 960);
+it("band.domain([value]) computes a reasonable singleton band, even with padding", () => {
+ const s = scaleBand([0, 960]).domain(["foo"]);
+ assert.strictEqual(s("foo"), 0);
+ assert.strictEqual(s.step(), 960);
+ assert.strictEqual(s.bandwidth(), 960);
s.padding(0.5);
- test.equal(s("foo"), 320);
- test.equal(s.step(), 640);
- test.equal(s.bandwidth(), 320);
+ assert.strictEqual(s("foo"), 320);
+ assert.strictEqual(s.step(), 640);
+ assert.strictEqual(s.bandwidth(), 320);
s.padding(1);
- test.equal(s("foo"), 480);
- test.equal(s.step(), 480);
- test.equal(s.bandwidth(), 0);
- test.end();
+ assert.strictEqual(s("foo"), 480);
+ assert.strictEqual(s.step(), 480);
+ assert.strictEqual(s.bandwidth(), 0);
});
-tape("band.domain(values) recomputes the bands", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).rangeRound([0, 100]);
- test.deepEqual(s.domain().map(s), [1, 34, 67]);
- test.equal(s.bandwidth(), 33);
+it("band.domain(values) recomputes the bands", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).rangeRound([0, 100]);
+ assert.deepStrictEqual(s.domain().map(s), [1, 34, 67]);
+ assert.strictEqual(s.bandwidth(), 33);
s.domain(["a", "b", "c", "d"]);
- test.deepEqual(s.domain().map(s), [0, 25, 50, 75]);
- test.equal(s.bandwidth(), 25);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [0, 25, 50, 75]);
+ assert.strictEqual(s.bandwidth(), 25);
});
-tape("band.domain(domain) accepts an iterable", function(test) {
- test.deepEqual(scale.scaleBand().domain(new Set(["a", "b", "c"])).domain(), ["a", "b", "c"]);
- test.end();
+it("band.domain(domain) accepts an iterable", () => {
+ assert.deepStrictEqual(scaleBand().domain(new Set(["a", "b", "c"])).domain(), ["a", "b", "c"]);
});
-tape("band.domain(values) makes a copy of the specified domain values", function(test) {
- var domain = ["red", "green"],
- s = scale.scaleBand().domain(domain);
+it("band.domain(values) makes a copy of the specified domain values", () => {
+ const domain = ["red", "green"];
+ const s = scaleBand().domain(domain);
domain.push("blue");
- test.deepEqual(s.domain(), ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(s.domain(), ["red", "green"]);
});
-tape("band.domain() returns a copy of the domain", function(test) {
- var s = scale.scaleBand().domain(["red", "green"]),
- domain = s.domain();
- test.deepEqual(domain, ["red", "green"]);
+it("band.domain() returns a copy of the domain", () => {
+ const s = scaleBand().domain(["red", "green"]);
+ const domain = s.domain();
+ assert.deepStrictEqual(domain, ["red", "green"]);
domain.push("blue");
- test.deepEqual(s.domain(), ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(s.domain(), ["red", "green"]);
});
-tape("band.range(values) can be descending", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).range([120, 0]);
- test.deepEqual(s.domain().map(s), [80, 40, 0]);
- test.equal(s.bandwidth(), 40);
+it("band.range(values) can be descending", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).range([120, 0]);
+ assert.deepStrictEqual(s.domain().map(s), [80, 40, 0]);
+ assert.strictEqual(s.bandwidth(), 40);
s.padding(0.2);
- test.deepEqual(s.domain().map(s), [82.5, 45, 7.5]);
- test.equal(s.bandwidth(), 30);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [82.5, 45, 7.5]);
+ assert.strictEqual(s.bandwidth(), 30);
});
-tape("band.range(values) makes a copy of the specified range values", function(test) {
- var range = [1, 2],
- s = scale.scaleBand().range(range);
+it("band.range(values) makes a copy of the specified range values", () => {
+ const range = [1, 2];
+ const s = scaleBand().range(range);
range.push("blue");
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.range() returns a copy of the range", function(test) {
- var s = scale.scaleBand().range([1, 2]),
- range = s.range();
- test.deepEqual(range, [1, 2]);
+it("band.range() returns a copy of the range", () => {
+ const s = scaleBand().range([1, 2]);
+ const range = s.range();
+ assert.deepStrictEqual(range, [1, 2]);
range.push("blue");
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.range(values) accepts an iterable", function(test) {
- var s = scale.scaleBand().range(new Set([1, 2]));
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+it("band.range(values) accepts an iterable", () => {
+ const s = scaleBand().range(new Set([1, 2]));
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.rangeRound(values) accepts an iterable", function(test) {
- var s = scale.scaleBand().rangeRound(new Set([1, 2]));
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+it("band.rangeRound(values) accepts an iterable", () => {
+ const s = scaleBand().rangeRound(new Set([1, 2]));
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.range(values) coerces values to numbers", function(test) {
- var s = scale.scaleBand().range(["1.0", "2.0"]);
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+it("band.range(values) coerces values to numbers", () => {
+ const s = scaleBand().range(["1.0", "2.0"]);
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.rangeRound(values) coerces values to numbers", function(test) {
- var s = scale.scaleBand().rangeRound(["1.0", "2.0"]);
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+it("band.rangeRound(values) coerces values to numbers", () => {
+ const s = scaleBand().rangeRound(["1.0", "2.0"]);
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("band.paddingInner(p) specifies the inner padding p", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).range([120, 0]).paddingInner(0.1).round(true);
- test.deepEqual(s.domain().map(s), [83, 42, 1]);
- test.equal(s.bandwidth(), 37);
+it("band.paddingInner(p) specifies the inner padding p", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).range([120, 0]).paddingInner(0.1).round(true);
+ assert.deepStrictEqual(s.domain().map(s), [83, 42, 1]);
+ assert.strictEqual(s.bandwidth(), 37);
s.paddingInner(0.2);
- test.deepEqual(s.domain().map(s), [85, 43, 1]);
- test.equal(s.bandwidth(), 34);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [85, 43, 1]);
+ assert.strictEqual(s.bandwidth(), 34);
});
-tape("band.paddingInner(p) coerces p to a number <= 1", function(test) {
- var s = scale.scaleBand();
- test.equal(s.paddingInner("1.0").paddingInner(), 1);
- test.equal(s.paddingInner("-1.0").paddingInner(), -1);
- test.equal(s.paddingInner("2.0").paddingInner(), 1);
- test.ok(Number.isNaN(s.paddingInner(NaN).paddingInner()));
- test.end();
+it("band.paddingInner(p) coerces p to a number <= 1", () => {
+ const s = scaleBand();
+ assert.strictEqual(s.paddingInner("1.0").paddingInner(), 1);
+ assert.strictEqual(s.paddingInner("-1.0").paddingInner(), -1);
+ assert.strictEqual(s.paddingInner("2.0").paddingInner(), 1);
+ assert(Number.isNaN(s.paddingInner(NaN).paddingInner()));
});
-tape("band.paddingOuter(p) specifies the outer padding p", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).range([120, 0]).paddingInner(0.2).paddingOuter(0.1);
- test.deepEqual(s.domain().map(s), [84, 44, 4]);
- test.equal(s.bandwidth(), 32);
+it("band.paddingOuter(p) specifies the outer padding p", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).range([120, 0]).paddingInner(0.2).paddingOuter(0.1);
+ assert.deepStrictEqual(s.domain().map(s), [84, 44, 4]);
+ assert.strictEqual(s.bandwidth(), 32);
s.paddingOuter(1);
- test.deepEqual(s.domain().map(s), [75, 50, 25]);
- test.equal(s.bandwidth(), 20);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [75, 50, 25]);
+ assert.strictEqual(s.bandwidth(), 20);
});
-tape("band.paddingOuter(p) coerces p to a number", function(test) {
- var s = scale.scaleBand();
- test.equal(s.paddingOuter("1.0").paddingOuter(), 1);
- test.equal(s.paddingOuter("-1.0").paddingOuter(), -1);
- test.equal(s.paddingOuter("2.0").paddingOuter(), 2);
- test.ok(Number.isNaN(s.paddingOuter(NaN).paddingOuter()));
- test.end();
+it("band.paddingOuter(p) coerces p to a number", () => {
+ const s = scaleBand();
+ assert.strictEqual(s.paddingOuter("1.0").paddingOuter(), 1);
+ assert.strictEqual(s.paddingOuter("-1.0").paddingOuter(), -1);
+ assert.strictEqual(s.paddingOuter("2.0").paddingOuter(), 2);
+ assert(Number.isNaN(s.paddingOuter(NaN).paddingOuter()));
});
-tape("band.rangeRound(values) is an alias for band.range(values).round(true)", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).rangeRound([0, 100]);
- test.deepEqual(s.range(), [0, 100]);
- test.equal(s.round(), true);
- test.end();
+it("band.rangeRound(values) is an alias for band.range(values).round(true)", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).rangeRound([0, 100]);
+ assert.deepStrictEqual(s.range(), [0, 100]);
+ assert.strictEqual(s.round(), true);
});
-tape("band.round(true) computes discrete rounded bands in a continuous range", function(test) {
- var s = scale.scaleBand().domain(["a", "b", "c"]).range([0, 100]).round(true);
- test.deepEqual(s.domain().map(s), [1, 34, 67]);
- test.equal(s.bandwidth(), 33);
+it("band.round(true) computes discrete rounded bands in a continuous range", () => {
+ const s = scaleBand().domain(["a", "b", "c"]).range([0, 100]).round(true);
+ assert.deepStrictEqual(s.domain().map(s), [1, 34, 67]);
+ assert.strictEqual(s.bandwidth(), 33);
s.padding(0.2);
- test.deepEqual(s.domain().map(s), [7, 38, 69]);
- test.equal(s.bandwidth(), 25);
- test.end();
+ assert.deepStrictEqual(s.domain().map(s), [7, 38, 69]);
+ assert.strictEqual(s.bandwidth(), 25);
});
-tape("band.copy() copies all fields", function(test) {
- var s1 = scale.scaleBand().domain(["red", "green"]).range([1, 2]).round(true).paddingInner(0.1).paddingOuter(0.2),
- s2 = s1.copy();
- test.deepEqual(s2.domain(), s1.domain());
- test.deepEqual(s2.range(), s1.range());
- test.equal(s2.round(), s1.round());
- test.equal(s2.paddingInner(), s1.paddingInner());
- test.equal(s2.paddingOuter(), s1.paddingOuter());
- test.end();
+it("band.copy() copies all fields", () => {
+ const s1 = scaleBand().domain(["red", "green"]).range([1, 2]).round(true).paddingInner(0.1).paddingOuter(0.2);
+ const s2 = s1.copy();
+ assert.deepStrictEqual(s2.domain(), s1.domain());
+ assert.deepStrictEqual(s2.range(), s1.range());
+ assert.strictEqual(s2.round(), s1.round());
+ assert.strictEqual(s2.paddingInner(), s1.paddingInner());
+ assert.strictEqual(s2.paddingOuter(), s1.paddingOuter());
});
-tape("band.copy() isolates changes to the domain", function(test) {
- var s1 = scale.scaleBand().domain(["foo", "bar"]).range([0, 2]),
- s2 = s1.copy();
+it("band.copy() isolates changes to the domain", () => {
+ const s1 = scaleBand().domain(["foo", "bar"]).range([0, 2]);
+ const s2 = s1.copy();
s1.domain(["red", "blue"]);
- test.deepEqual(s2.domain(), ["foo", "bar"]);
- test.deepEqual(s1.domain().map(s1), [0, 1]);
- test.deepEqual(s2.domain().map(s2), [0, 1]);
+ assert.deepStrictEqual(s2.domain(), ["foo", "bar"]);
+ assert.deepStrictEqual(s1.domain().map(s1), [0, 1]);
+ assert.deepStrictEqual(s2.domain().map(s2), [0, 1]);
s2.domain(["red", "blue"]);
- test.deepEqual(s1.domain(), ["red", "blue"]);
- test.deepEqual(s1.domain().map(s1), [0, 1]);
- test.deepEqual(s2.domain().map(s2), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s1.domain(), ["red", "blue"]);
+ assert.deepStrictEqual(s1.domain().map(s1), [0, 1]);
+ assert.deepStrictEqual(s2.domain().map(s2), [0, 1]);
});
-tape("band.copy() isolates changes to the range", function(test) {
- var s1 = scale.scaleBand().domain(["foo", "bar"]).range([0, 2]),
- s2 = s1.copy();
+it("band.copy() isolates changes to the range", () => {
+ const s1 = scaleBand().domain(["foo", "bar"]).range([0, 2]);
+ const s2 = s1.copy();
s1.range([3, 5]);
- test.deepEqual(s2.range(), [0, 2]);
- test.deepEqual(s1.domain().map(s1), [3, 4]);
- test.deepEqual(s2.domain().map(s2), [0, 1]);
+ assert.deepStrictEqual(s2.range(), [0, 2]);
+ assert.deepStrictEqual(s1.domain().map(s1), [3, 4]);
+ assert.deepStrictEqual(s2.domain().map(s2), [0, 1]);
s2.range([5, 7]);
- test.deepEqual(s1.range(), [3, 5]);
- test.deepEqual(s1.domain().map(s1), [3, 4]);
- test.deepEqual(s2.domain().map(s2), [5, 6]);
- test.end();
+ assert.deepStrictEqual(s1.range(), [3, 5]);
+ assert.deepStrictEqual(s1.domain().map(s1), [3, 4]);
+ assert.deepStrictEqual(s2.domain().map(s2), [5, 6]);
});
// TODO align tests for padding & round
diff --git a/test/date.js b/test/date.js
index ae99e0f..46a4e23 100644
--- a/test/date.js
+++ b/test/date.js
@@ -1,4 +1,4 @@
-exports.local = function(year, month, day, hours, minutes, seconds, milliseconds) {
+export function local(year, month, day, hours, minutes, seconds, milliseconds) {
if (year == null) year = 0;
if (month == null) month = 0;
if (day == null) day = 1;
@@ -7,14 +7,14 @@ exports.local = function(year, month, day, hours, minutes, seconds, milliseconds
if (seconds == null) seconds = 0;
if (milliseconds == null) milliseconds = 0;
if (0 <= year && year < 100) {
- var date = new Date(-1, month, day, hours, minutes, seconds, milliseconds);
+ const date = new Date(-1, month, day, hours, minutes, seconds, milliseconds);
date.setFullYear(year);
return date;
}
return new Date(year, month, day, hours, minutes, seconds, milliseconds);
-};
+}
-exports.utc = function(year, month, day, hours, minutes, seconds, milliseconds) {
+export function utc(year, month, day, hours, minutes, seconds, milliseconds) {
if (year == null) year = 0;
if (month == null) month = 0;
if (day == null) day = 1;
@@ -23,9 +23,9 @@ exports.utc = function(year, month, day, hours, minutes, seconds, milliseconds)
if (seconds == null) seconds = 0;
if (milliseconds == null) milliseconds = 0;
if (0 <= year && year < 100) {
- var date = new Date(Date.UTC(-1, month, day, hours, minutes, seconds, milliseconds));
+ const date = new Date(Date.UTC(-1, month, day, hours, minutes, seconds, milliseconds));
date.setUTCFullYear(year);
return date;
}
return new Date(Date.UTC(year, month, day, hours, minutes, seconds, milliseconds));
-};
+}
diff --git a/test/diverging-test.js b/test/diverging-test.js
index 5e7f5c0..a3de2be 100644
--- a/test/diverging-test.js
+++ b/test/diverging-test.js
@@ -1,164 +1,148 @@
-var tape = require("tape"),
- scale = require("../");
-
-tape("scaleDiverging() has the expected defaults", function(test) {
- var s = scale.scaleDiverging();
- test.deepEqual(s.domain(), [0, 0.5, 1]);
- test.equal(s.interpolator()(0.42), 0.42);
- test.equal(s.clamp(), false);
- test.equal(s(-0.5), -0.5);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 0.5);
- test.equal(s( 1.0), 1.0);
- test.equal(s( 1.5), 1.5);
- test.end();
-});
-
-tape("diverging.clamp(true) enables clamping", function(test) {
- var s = scale.scaleDiverging().clamp(true);
- test.equal(s.clamp(), true);
- test.equal(s(-0.5), 0.0);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 0.5);
- test.equal(s( 1.0), 1.0);
- test.equal(s( 1.5), 1.0);
- test.end();
-});
-
-tape("diverging.domain() coerces domain values to numbers", function(test) {
- var s = scale.scaleDiverging().domain(["-1.20", " 0", "2.40"]);
- test.deepEqual(s.domain(), [-1.2, 0, 2.4]);
- test.equal(s(-1.2), 0.000);
- test.equal(s( 0.6), 0.625);
- test.equal(s( 2.4), 1.000);
- test.end();
-});
-
-tape("diverging.domain() accepts an iterable", function(test) {
- var s = scale.scaleDiverging().domain(new Set([-1.2, 0, 2.4]));
- test.deepEqual(s.domain(), [-1.2, 0, 2.4]);
- test.end();
-});
-
-tape("diverging.domain() handles a degenerate domain", function(test) {
- var s = scale.scaleDiverging().domain([2, 2, 3]);
- test.deepEqual(s.domain(), [2, 2, 3]);
- test.equal(s(-1.2), 0.5);
- test.equal(s( 0.6), 0.5);
- test.equal(s( 2.4), 0.7);
- test.deepEqual(s.domain([1, 2, 2]).domain(), [1, 2, 2]);
- test.equal(s(-1.0), -1);
- test.equal(s( 0.5), -0.25);
- test.equal(s( 2.4), 0.5);
- test.deepEqual(s.domain([2, 2, 2]).domain(), [2, 2, 2]);
- test.equal(s(-1.0), 0.5);
- test.equal(s( 0.5), 0.5);
- test.equal(s( 2.4), 0.5);
- test.end();
-});
-
-tape("diverging.domain() handles a descending domain", function(test) {
- var s = scale.scaleDiverging().domain([4, 2, 1]);
- test.deepEqual(s.domain(), [4, 2, 1]);
- test.equal(s(1.2), 0.9);
- test.equal(s(2.0), 0.5);
- test.equal(s(3.0), 0.25);
- test.end();
-});
-
-tape("divergingLog.domain() handles a descending domain", function(test) {
- var s = scale.scaleDivergingLog().domain([3, 2, 1]);
- test.deepEqual(s.domain(), [3, 2, 1]);
- test.equal(s(1.2), 1 - 0.1315172029168969);
- test.equal(s(2.0), 1 - 0.5000000000000000);
- test.equal(s(2.8), 1 - 0.9149213210862197);
- test.end();
-});
-
-tape("divergingLog.domain() handles a descending negative domain", function(test) {
- var s = scale.scaleDivergingLog().domain([-1, -2, -3]);
- test.deepEqual(s.domain(), [-1, -2, -3]);
- test.equal(s(-1.2), 0.1315172029168969);
- test.equal(s(-2.0), 0.5000000000000000);
- test.equal(s(-2.8), 0.9149213210862197);
- test.end();
-});
-
-tape("diverging.domain() handles a non-numeric domain", function(test) {
- var s = scale.scaleDiverging().domain([NaN, 2, 3]);
- test.equal(isNaN(s.domain()[0]), true);
- test.equal(isNaN(s(-1.2)), true);
- test.equal(isNaN(s( 0.6)), true);
- test.equal(s( 2.4), 0.7);
- test.equal(isNaN(s.domain([1, NaN, 2]).domain()[1]), true);
- test.equal(isNaN(s(-1.0)), true);
- test.equal(isNaN(s( 0.5)), true);
- test.equal(isNaN(s( 2.4)), true);
- test.equal(isNaN(s.domain([0, 1, NaN]).domain()[2]), true);
- test.equal(s(-1.0), -0.5);
- test.equal(s( 0.5), 0.25);
- test.equal(isNaN(s( 2.4)), true);
- test.end();
-});
-
-tape("diverging.domain() only considers the first three elements of the domain", function(test) {
- var s = scale.scaleDiverging().domain([-1, 100, 200, 3]);
- test.deepEqual(s.domain(), [-1, 100, 200]);
- test.end();
-});
-
-tape("diverging.copy() returns an isolated copy of the scale", function(test) {
- var s1 = scale.scaleDiverging().domain([1, 2, 3]).clamp(true),
- s2 = s1.copy();
- test.deepEqual(s2.domain(), [1, 2, 3]);
- test.equal(s2.clamp(), true);
+import assert from "assert";
+import {scaleDiverging, scaleDivergingLog} from "../src/index.js";
+
+it("scaleDiverging() has the expected defaults", () => {
+ const s = scaleDiverging();
+ assert.deepStrictEqual(s.domain(), [0, 0.5, 1]);
+ assert.strictEqual(s.interpolator()(0.42), 0.42);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s(-0.5), -0.5);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 0.5);
+ assert.strictEqual(s( 1.0), 1.0);
+ assert.strictEqual(s( 1.5), 1.5);
+});
+
+it("diverging.clamp(true) enables clamping", () => {
+ const s = scaleDiverging().clamp(true);
+ assert.strictEqual(s.clamp(), true);
+ assert.strictEqual(s(-0.5), 0.0);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 0.5);
+ assert.strictEqual(s( 1.0), 1.0);
+ assert.strictEqual(s( 1.5), 1.0);
+});
+
+it("diverging.domain() coerces domain values to numbers", () => {
+ const s = scaleDiverging().domain(["-1.20", " 0", "2.40"]);
+ assert.deepStrictEqual(s.domain(), [-1.2, 0, 2.4]);
+ assert.strictEqual(s(-1.2), 0.000);
+ assert.strictEqual(s( 0.6), 0.625);
+ assert.strictEqual(s( 2.4), 1.000);
+});
+
+it("diverging.domain() accepts an iterable", () => {
+ const s = scaleDiverging().domain(new Set([-1.2, 0, 2.4]));
+ assert.deepStrictEqual(s.domain(), [-1.2, 0, 2.4]);
+});
+
+it("diverging.domain() handles a degenerate domain", () => {
+ const s = scaleDiverging().domain([2, 2, 3]);
+ assert.deepStrictEqual(s.domain(), [2, 2, 3]);
+ assert.strictEqual(s(-1.2), 0.5);
+ assert.strictEqual(s( 0.6), 0.5);
+ assert.strictEqual(s( 2.4), 0.7);
+ assert.deepStrictEqual(s.domain([1, 2, 2]).domain(), [1, 2, 2]);
+ assert.strictEqual(s(-1.0), -1);
+ assert.strictEqual(s( 0.5), -0.25);
+ assert.strictEqual(s( 2.4), 0.5);
+ assert.deepStrictEqual(s.domain([2, 2, 2]).domain(), [2, 2, 2]);
+ assert.strictEqual(s(-1.0), 0.5);
+ assert.strictEqual(s( 0.5), 0.5);
+ assert.strictEqual(s( 2.4), 0.5);
+});
+
+it("diverging.domain() handles a descending domain", () => {
+ const s = scaleDiverging().domain([4, 2, 1]);
+ assert.deepStrictEqual(s.domain(), [4, 2, 1]);
+ assert.strictEqual(s(1.2), 0.9);
+ assert.strictEqual(s(2.0), 0.5);
+ assert.strictEqual(s(3.0), 0.25);
+});
+
+it("divergingLog.domain() handles a descending domain", () => {
+ const s = scaleDivergingLog().domain([3, 2, 1]);
+ assert.deepStrictEqual(s.domain(), [3, 2, 1]);
+ assert.strictEqual(s(1.2), 1 - 0.1315172029168969);
+ assert.strictEqual(s(2.0), 1 - 0.5000000000000000);
+ assert.strictEqual(s(2.8), 1 - 0.9149213210862197);
+});
+
+it("divergingLog.domain() handles a descending negative domain", () => {
+ const s = scaleDivergingLog().domain([-1, -2, -3]);
+ assert.deepStrictEqual(s.domain(), [-1, -2, -3]);
+ assert.strictEqual(s(-1.2), 0.1315172029168969);
+ assert.strictEqual(s(-2.0), 0.5000000000000000);
+ assert.strictEqual(s(-2.8), 0.9149213210862197);
+});
+
+it("diverging.domain() handles a non-numeric domain", () => {
+ const s = scaleDiverging().domain([NaN, 2, 3]);
+ assert.strictEqual(isNaN(s.domain()[0]), true);
+ assert.strictEqual(isNaN(s(-1.2)), true);
+ assert.strictEqual(isNaN(s( 0.6)), true);
+ assert.strictEqual(s( 2.4), 0.7);
+ assert.strictEqual(isNaN(s.domain([1, NaN, 2]).domain()[1]), true);
+ assert.strictEqual(isNaN(s(-1.0)), true);
+ assert.strictEqual(isNaN(s( 0.5)), true);
+ assert.strictEqual(isNaN(s( 2.4)), true);
+ assert.strictEqual(isNaN(s.domain([0, 1, NaN]).domain()[2]), true);
+ assert.strictEqual(s(-1.0), -0.5);
+ assert.strictEqual(s( 0.5), 0.25);
+ assert.strictEqual(isNaN(s( 2.4)), true);
+});
+
+it("diverging.domain() only considers the first three elements of the domain", () => {
+ const s = scaleDiverging().domain([-1, 100, 200, 3]);
+ assert.deepStrictEqual(s.domain(), [-1, 100, 200]);
+});
+
+it("diverging.copy() returns an isolated copy of the scale", () => {
+ const s1 = scaleDiverging().domain([1, 2, 3]).clamp(true);
+ const s2 = s1.copy();
+ assert.deepStrictEqual(s2.domain(), [1, 2, 3]);
+ assert.strictEqual(s2.clamp(), true);
s1.domain([-1, 1, 2]);
- test.deepEqual(s2.domain(), [1, 2, 3]);
+ assert.deepStrictEqual(s2.domain(), [1, 2, 3]);
s1.clamp(false);
- test.equal(s2.clamp(), true);
+ assert.strictEqual(s2.clamp(), true);
s2.domain([3, 4, 5]);
- test.deepEqual(s1.domain(), [-1, 1, 2]);
+ assert.deepStrictEqual(s1.domain(), [-1, 1, 2]);
s2.clamp(true);
- test.deepEqual(s1.clamp(), false);
- test.end();
+ assert.deepStrictEqual(s1.clamp(), false);
});
-tape("diverging.range() returns the computed range", function(test) {
- var s = scale.scaleDiverging(function(t) { return t * 2 + 1; });
- test.deepEqual(s.range(), [1, 2, 3]);
- test.end();
+it("diverging.range() returns the computed range", () => {
+ const s = scaleDiverging(function(t) { return t * 2 + 1; });
+ assert.deepStrictEqual(s.range(), [1, 2, 3]);
});
-tape("diverging.interpolator(interpolator) sets the interpolator", function(test) {
- var i0 = function(t) { return t; },
- i1 = function(t) { return t * 2; },
- s = scale.scaleDiverging(i0);
- test.equal(s.interpolator(), i0);
- test.equal(s.interpolator(i1), s);
- test.equal(s.interpolator(), i1);
- test.equal(s(-0.5), -1.0);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 1.0);
- test.end();
+it("diverging.interpolator(interpolator) sets the interpolator", () => {
+ const i0 = function(t) { return t; };
+ const i1 = function(t) { return t * 2; };
+ const s = scaleDiverging(i0);
+ assert.strictEqual(s.interpolator(), i0);
+ assert.strictEqual(s.interpolator(i1), s);
+ assert.strictEqual(s.interpolator(), i1);
+ assert.strictEqual(s(-0.5), -1.0);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 1.0);
});
-tape("diverging.range(range) sets the interpolator", function(test) {
- var s = scale.scaleDiverging().range([1, 3, 10]);
- test.equal(s.interpolator()(0.5), 3);
- test.deepEqual(s.range(), [1, 3, 10]);
- test.end();
+it("diverging.range(range) sets the interpolator", () => {
+ const s = scaleDiverging().range([1, 3, 10]);
+ assert.strictEqual(s.interpolator()(0.5), 3);
+ assert.deepStrictEqual(s.range(), [1, 3, 10]);
});
-tape("diverging.range(range) ignores additional values", function(test) {
- var s = scale.scaleDiverging().range([1, 3, 10, 20]);
- test.equal(s.interpolator()(0.5), 3);
- test.deepEqual(s.range(), [1, 3, 10]);
- test.end();
+it("diverging.range(range) ignores additional values", () => {
+ const s = scaleDiverging().range([1, 3, 10, 20]);
+ assert.strictEqual(s.interpolator()(0.5), 3);
+ assert.deepStrictEqual(s.range(), [1, 3, 10]);
});
-tape("scaleDiverging(range) sets the interpolator", function(test) {
- var s = scale.scaleDiverging([1, 3, 10]);
- test.equal(s.interpolator()(0.5), 3);
- test.deepEqual(s.range(), [1, 3, 10]);
- test.end();
+it("scaleDiverging(range) sets the interpolator", () => {
+ const s = scaleDiverging([1, 3, 10]);
+ assert.strictEqual(s.interpolator()(0.5), 3);
+ assert.deepStrictEqual(s.range(), [1, 3, 10]);
});
diff --git a/test/identity-test.js b/test/identity-test.js
index 53a1213..923f512 100644
--- a/test/identity-test.js
+++ b/test/identity-test.js
@@ -1,195 +1,178 @@
-var tape = require("tape"),
- scale = require("../");
-
-tape("scaleIdentity() has the expected defaults", function(test) {
- var s = scale.scaleIdentity();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.end();
-});
-
-tape("scaleIdentity(range) sets the domain and range", function(test) {
- var s = scale.scaleIdentity([1, 2]);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(s.range(), [1, 2]);
- test.end();
-});
-
-tape("identity(x) is the identity function", function(test) {
- var s = scale.scaleIdentity().domain([1, 2]);
- test.equal(s(0.5), 0.5);
- test.equal(s(1), 1);
- test.equal(s(1.5), 1.5);
- test.equal(s(2), 2);
- test.equal(s(2.5), 2.5);
- test.end();
-});
-
-tape("identity(x) coerces input to a number", function(test) {
- var s = scale.scaleIdentity().domain([1, 2]);
- test.equal(s("2"), 2);
- test.end();
-});
-
-tape("identity(undefined) returns unknown", function(test) {
- var s = scale.scaleIdentity().unknown(-1);
- test.equal(s(undefined), -1);
- test.equal(s(null), -1);
- test.equal(s(NaN), -1);
- test.equal(s("N/A"), -1);
- test.equal(s(0.4), 0.4);
- test.end();
-});
-
-tape("identity.invert(y) is the identity function", function(test) {
- var s = scale.scaleIdentity().domain([1, 2]);
- test.equal(s.invert(0.5), 0.5);
- test.equal(s.invert(1), 1);
- test.equal(s.invert(1.5), 1.5);
- test.equal(s.invert(2), 2);
- test.equal(s.invert(2.5), 2.5);
- test.end();
-});
-
-tape("identity.invert(y) coerces range value to numbers", function(test) {
- var s = scale.scaleIdentity().range(["0", "2"]);
- test.equal(s.invert("1"), 1);
+import assert from "assert";
+import {scaleIdentity} from "../src/index.js";
+
+it("scaleIdentity() has the expected defaults", () => {
+ const s = scaleIdentity();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+});
+
+it("scaleIdentity(range) sets the domain and range", () => {
+ const s = scaleIdentity([1, 2]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(s.range(), [1, 2]);
+});
+
+it("identity(x) is the identity function", () => {
+ const s = scaleIdentity().domain([1, 2]);
+ assert.strictEqual(s(0.5), 0.5);
+ assert.strictEqual(s(1), 1);
+ assert.strictEqual(s(1.5), 1.5);
+ assert.strictEqual(s(2), 2);
+ assert.strictEqual(s(2.5), 2.5);
+});
+
+it("identity(x) coerces input to a number", () => {
+ const s = scaleIdentity().domain([1, 2]);
+ assert.strictEqual(s("2"), 2);
+});
+
+it("identity(undefined) returns unknown", () => {
+ const s = scaleIdentity().unknown(-1);
+ assert.strictEqual(s(undefined), -1);
+ assert.strictEqual(s(null), -1);
+ assert.strictEqual(s(NaN), -1);
+ assert.strictEqual(s("N/A"), -1);
+ assert.strictEqual(s(0.4), 0.4);
+});
+
+it("identity.invert(y) is the identity function", () => {
+ const s = scaleIdentity().domain([1, 2]);
+ assert.strictEqual(s.invert(0.5), 0.5);
+ assert.strictEqual(s.invert(1), 1);
+ assert.strictEqual(s.invert(1.5), 1.5);
+ assert.strictEqual(s.invert(2), 2);
+ assert.strictEqual(s.invert(2.5), 2.5);
+});
+
+it("identity.invert(y) coerces range value to numbers", () => {
+ const s = scaleIdentity().range(["0", "2"]);
+ assert.strictEqual(s.invert("1"), 1);
s.range([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
- test.equal(s.invert(new Date(1990, 6, 2, 13)), +new Date(1990, 6, 2, 13));
+ assert.strictEqual(s.invert(new Date(1990, 6, 2, 13)), +new Date(1990, 6, 2, 13));
s.range(["#000", "#fff"]);
- test.ok(isNaN(s.invert("#999")));
- test.end();
+ assert(isNaN(s.invert("#999")));
});
-tape("identity.invert(y) coerces input to a number", function(test) {
- var s = scale.scaleIdentity().domain([1, 2]);
- test.equal(s.invert("2"), 2);
- test.end();
+it("identity.invert(y) coerces input to a number", () => {
+ const s = scaleIdentity().domain([1, 2]);
+ assert.strictEqual(s.invert("2"), 2);
});
-tape("identity.domain() is an alias for scale.range()", function(test) {
- var s = scale.scaleIdentity();
- test.equal(s.domain, s.range);
- test.deepEqual(s.domain(), s.range());
+it("identity.domain() is an alias for range()", () => {
+ const s = scaleIdentity();
+ assert.strictEqual(s.domain, s.range);
+ assert.deepStrictEqual(s.domain(), s.range());
s.domain([-10, 0, 100]);
- test.deepEqual(s.range(), [-10, 0, 100]);
+ assert.deepStrictEqual(s.range(), [-10, 0, 100]);
s.range([-10, 0, 100]);
- test.deepEqual(s.domain(), [-10, 0, 100]);
- test.end();
-});
-
-tape("identity.domain() defaults to [0, 1]", function(test) {
- var s = scale.scaleIdentity();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s(0.5), 0.5);
- test.end();
-});
-
-tape("identity.domain() coerces values to numbers", function(test) {
- var s = scale.scaleIdentity().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
- test.equal(typeof s.domain()[0], "number");
- test.equal(typeof s.domain()[1], "number");
- test.equal(s.domain()[0], +new Date(1990, 0, 1));
- test.equal(s.domain()[1], +new Date(1991, 0, 1));
- test.equal(typeof s(new Date(1989, 9, 20)), "number");
- test.equal(s(new Date(1989, 9, 20)), +new Date(1989, 9, 20));
+ assert.deepStrictEqual(s.domain(), [-10, 0, 100]);
+});
+
+it("identity.domain() defaults to [0, 1]", () => {
+ const s = scaleIdentity();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s(0.5), 0.5);
+});
+
+it("identity.domain() coerces values to numbers", () => {
+ const s = scaleIdentity().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
+ assert.strictEqual(typeof s.domain()[0], "number");
+ assert.strictEqual(typeof s.domain()[1], "number");
+ assert.strictEqual(s.domain()[0], +new Date(1990, 0, 1));
+ assert.strictEqual(s.domain()[1], +new Date(1991, 0, 1));
+ assert.strictEqual(typeof s(new Date(1989, 9, 20)), "number");
+ assert.strictEqual(s(new Date(1989, 9, 20)), +new Date(1989, 9, 20));
s.domain(["0", "1"]);
- test.equal(typeof s.domain()[0], "number");
- test.equal(typeof s.domain()[1], "number");
- test.equal(s(0.5), 0.5);
+ assert.strictEqual(typeof s.domain()[0], "number");
+ assert.strictEqual(typeof s.domain()[1], "number");
+ assert.strictEqual(s(0.5), 0.5);
s.domain([new Number(0), new Number(1)]);
- test.equal(typeof s.domain()[0], "number");
- test.equal(typeof s.domain()[1], "number");
- test.equal(s(0.5), 0.5);
+ assert.strictEqual(typeof s.domain()[0], "number");
+ assert.strictEqual(typeof s.domain()[1], "number");
+ assert.strictEqual(s(0.5), 0.5);
s.range([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
- test.equal(typeof s.range()[0], "number");
- test.equal(typeof s.range()[1], "number");
- test.equal(s.range()[0], +new Date(1990, 0, 1));
- test.equal(s.range()[1], +new Date(1991, 0, 1));
- test.equal(typeof s(new Date(1989, 9, 20)), "number");
- test.equal(s(new Date(1989, 9, 20)), +new Date(1989, 9, 20));
+ assert.strictEqual(typeof s.range()[0], "number");
+ assert.strictEqual(typeof s.range()[1], "number");
+ assert.strictEqual(s.range()[0], +new Date(1990, 0, 1));
+ assert.strictEqual(s.range()[1], +new Date(1991, 0, 1));
+ assert.strictEqual(typeof s(new Date(1989, 9, 20)), "number");
+ assert.strictEqual(s(new Date(1989, 9, 20)), +new Date(1989, 9, 20));
s.range(["0", "1"]);
- test.equal(typeof s.range()[0], "number");
- test.equal(typeof s.range()[1], "number");
- test.equal(s(0.5), 0.5);
+ assert.strictEqual(typeof s.range()[0], "number");
+ assert.strictEqual(typeof s.range()[1], "number");
+ assert.strictEqual(s(0.5), 0.5);
s.range([new Number(0), new Number(1)]);
- test.equal(typeof s.range()[0], "number");
- test.equal(typeof s.range()[1], "number");
- test.equal(s(0.5), 0.5);
- test.end();
+ assert.strictEqual(typeof s.range()[0], "number");
+ assert.strictEqual(typeof s.range()[1], "number");
+ assert.strictEqual(s(0.5), 0.5);
});
-tape("identity.domain() accepts an iterable", function(test) {
- var s = scale.scaleIdentity().domain(new Set([1, 2]));
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(s.range(), [1, 2]);
- test.end();
+it("identity.domain() accepts an iterable", () => {
+ const s = scaleIdentity().domain(new Set([1, 2]));
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(s.range(), [1, 2]);
});
-tape("identity.domain() can specify a polyidentity domain and range", function(test) {
- var s = scale.scaleIdentity().domain([-10, 0, 100]);
- test.deepEqual(s.domain(), [-10, 0, 100]);
- test.equal(s(-5), -5);
- test.equal(s(50), 50);
- test.equal(s(75), 75);
+it("identity.domain() can specify a polyidentity domain and range", () => {
+ const s = scaleIdentity().domain([-10, 0, 100]);
+ assert.deepStrictEqual(s.domain(), [-10, 0, 100]);
+ assert.strictEqual(s(-5), -5);
+ assert.strictEqual(s(50), 50);
+ assert.strictEqual(s(75), 75);
s.range([-10, 0, 100]);
- test.deepEqual(s.range(), [-10, 0, 100]);
- test.equal(s(-5), -5);
- test.equal(s(50), 50);
- test.equal(s(75), 75);
- test.end();
-});
-
-tape("identity.domain() does not affect the identity function", function(test) {
- var s = scale.scaleIdentity().domain([Infinity, NaN]);
- test.equal(s(42), 42);
- test.equal(s.invert(-42), -42);
- test.end();
-});
-
-tape("identity.ticks(count) generates ticks of varying degree", function(test) {
- var s = scale.scaleIdentity();
- test.deepEqual(s.ticks(1).map(s.tickFormat(1)), ["0", "1"]);
- test.deepEqual(s.ticks(2).map(s.tickFormat(2)), ["0.0", "0.5", "1.0"]);
- test.deepEqual(s.ticks(5).map(s.tickFormat(5)), ["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"]);
- test.deepEqual(s.ticks(10).map(s.tickFormat(10)), ["0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"]);
+ assert.deepStrictEqual(s.range(), [-10, 0, 100]);
+ assert.strictEqual(s(-5), -5);
+ assert.strictEqual(s(50), 50);
+ assert.strictEqual(s(75), 75);
+});
+
+it("identity.domain() does not affect the identity function", () => {
+ const s = scaleIdentity().domain([Infinity, NaN]);
+ assert.strictEqual(s(42), 42);
+ assert.strictEqual(s.invert(-42), -42);
+});
+
+it("identity.ticks(count) generates ticks of varying degree", () => {
+ const s = scaleIdentity();
+ assert.deepStrictEqual(s.ticks(1).map(s.tickFormat(1)), ["0", "1"]);
+ assert.deepStrictEqual(s.ticks(2).map(s.tickFormat(2)), ["0.0", "0.5", "1.0"]);
+ assert.deepStrictEqual(s.ticks(5).map(s.tickFormat(5)), ["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"]);
+ assert.deepStrictEqual(s.ticks(10).map(s.tickFormat(10)), ["0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"]);
s.domain([1, 0]);
- test.deepEqual(s.ticks(1).map(s.tickFormat(1)), ["0", "1"].reverse());
- test.deepEqual(s.ticks(2).map(s.tickFormat(2)), ["0.0", "0.5", "1.0"].reverse());
- test.deepEqual(s.ticks(5).map(s.tickFormat(5)), ["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"].reverse());
- test.deepEqual(s.ticks(10).map(s.tickFormat(10)), ["0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"].reverse());
- test.end();
-});
-
-tape("identity.tickFormat(count) formats ticks with the appropriate precision", function(test) {
- var s = scale.scaleIdentity().domain([0.123456789, 1.23456789]);
- test.equal(s.tickFormat(1)(s.ticks(1)[0]), "1");
- test.equal(s.tickFormat(2)(s.ticks(2)[0]), "0.5");
- test.equal(s.tickFormat(4)(s.ticks(4)[0]), "0.2");
- test.equal(s.tickFormat(8)(s.ticks(8)[0]), "0.2");
- test.equal(s.tickFormat(16)(s.ticks(16)[0]), "0.15");
- test.equal(s.tickFormat(32)(s.ticks(32)[0]), "0.15");
- test.equal(s.tickFormat(64)(s.ticks(64)[0]), "0.14");
- test.equal(s.tickFormat(128)(s.ticks(128)[0]), "0.13");
- test.equal(s.tickFormat(256)(s.ticks(256)[0]), "0.125");
- test.end();
-});
-
-tape("identity.copy() isolates changes to the domain or range", function(test) {
- var s1 = scale.scaleIdentity(),
- s2 = s1.copy(),
- s3 = s1.copy();
+ assert.deepStrictEqual(s.ticks(1).map(s.tickFormat(1)), ["0", "1"].reverse());
+ assert.deepStrictEqual(s.ticks(2).map(s.tickFormat(2)), ["0.0", "0.5", "1.0"].reverse());
+ assert.deepStrictEqual(s.ticks(5).map(s.tickFormat(5)), ["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"].reverse());
+ assert.deepStrictEqual(s.ticks(10).map(s.tickFormat(10)), ["0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"].reverse());
+});
+
+it("identity.tickFormat(count) formats ticks with the appropriate precision", () => {
+ const s = scaleIdentity().domain([0.123456789, 1.23456789]);
+ assert.strictEqual(s.tickFormat(1)(s.ticks(1)[0]), "1");
+ assert.strictEqual(s.tickFormat(2)(s.ticks(2)[0]), "0.5");
+ assert.strictEqual(s.tickFormat(4)(s.ticks(4)[0]), "0.2");
+ assert.strictEqual(s.tickFormat(8)(s.ticks(8)[0]), "0.2");
+ assert.strictEqual(s.tickFormat(16)(s.ticks(16)[0]), "0.15");
+ assert.strictEqual(s.tickFormat(32)(s.ticks(32)[0]), "0.15");
+ assert.strictEqual(s.tickFormat(64)(s.ticks(64)[0]), "0.14");
+ assert.strictEqual(s.tickFormat(128)(s.ticks(128)[0]), "0.13");
+ assert.strictEqual(s.tickFormat(256)(s.ticks(256)[0]), "0.125");
+});
+
+it("identity.copy() isolates changes to the domain or range", () => {
+ const s1 = scaleIdentity();
+ const s2 = s1.copy();
+ const s3 = s1.copy();
s1.domain([1, 2]);
- test.deepEqual(s2.domain(), [0, 1]);
+ assert.deepStrictEqual(s2.domain(), [0, 1]);
s2.domain([2, 3]);
- test.deepEqual(s1.domain(), [1, 2]);
- test.deepEqual(s2.domain(), [2, 3]);
- s2 = s3.copy();
+ assert.deepStrictEqual(s1.domain(), [1, 2]);
+ assert.deepStrictEqual(s2.domain(), [2, 3]);
+ const s4 = s3.copy();
s3.range([1, 2]);
- test.deepEqual(s2.range(), [0, 1]);
- s2.range([2, 3]);
- test.deepEqual(s3.range(), [1, 2]);
- test.deepEqual(s2.range(), [2, 3]);
- test.end();
+ assert.deepStrictEqual(s4.range(), [0, 1]);
+ s4.range([2, 3]);
+ assert.deepStrictEqual(s3.range(), [1, 2]);
+ assert.deepStrictEqual(s4.range(), [2, 3]);
});
diff --git a/test/inDelta.js b/test/inDelta.js
deleted file mode 100644
index f3def21..0000000
--- a/test/inDelta.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var tape = require("tape");
-
-tape.Test.prototype.inDelta = function(actual, expected) {
- this._assert(expected - 1e-6 < actual && actual < expected + 1e-6, {
- message: "should be in delta",
- operator: "inDelta",
- actual: actual,
- expected: expected
- });
-};
diff --git a/test/linear-test.js b/test/linear-test.js
index a862d6e..1ea9407 100644
--- a/test/linear-test.js
+++ b/test/linear-test.js
@@ -1,393 +1,343 @@
-var tape = require("tape"),
- scale = require("../"),
- format = require("d3-format"),
- roundEpsilon = require("./roundEpsilon");
-
-format.formatDefaultLocale({
- decimal: ".",
- thousands: ",",
- grouping: [3],
- currency: ["$", ""],
- minus: "-"
-});
-
-tape("scaleLinear() has the expected defaults", function(test) {
- var s = scale.scaleLinear();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.clamp(), false);
- test.equal(s.unknown(), undefined);
- test.deepEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
- test.end();
-});
-
-tape("scaleLinear(range) sets the range", function(test) {
- var s = scale.scaleLinear([1, 2]);
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [1, 2]);
- test.equal(s(0.5), 1.5);
- test.end();
-});
-
-tape("scaleLinear(domain, range) sets the domain and range", function(test) {
- var s = scale.scaleLinear([1, 2], [3, 4]);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(s.range(), [3, 4]);
- test.equal(s(1.5), 3.5);
- test.end();
-});
-
-tape("linear(x) maps a domain value x to a range value y", function(test) {
- test.equal(scale.scaleLinear().range([1, 2])(0.5), 1.5);
- test.end();
-});
-
-tape("linear(x) ignores extra range values if the domain is smaller than the range", function(test) {
- test.equal(scale.scaleLinear().domain([-10, 0]).range([0, 1, 2]).clamp(true)(-5), 0.5);
- test.equal(scale.scaleLinear().domain([-10, 0]).range([0, 1, 2]).clamp(true)(50), 1);
- test.end();
-});
-
-tape("linear(x) ignores extra domain values if the range is smaller than the domain", function(test) {
- test.equal(scale.scaleLinear().domain([-10, 0, 100]).range([0, 1]).clamp(true)(-5), 0.5);
- test.equal(scale.scaleLinear().domain([-10, 0, 100]).range([0, 1]).clamp(true)(50), 1);
- test.end();
-});
-
-tape("linear(x) maps an empty domain to the middle of the range", function(test) {
- test.equal(scale.scaleLinear().domain([0, 0]).range([1, 2])(0), 1.5);
- test.equal(scale.scaleLinear().domain([0, 0]).range([2, 1])(1), 1.5);
- test.end();
-});
-
-tape("linear(x) can map a bilinear domain with two values to the corresponding range", function(test) {
- var s = scale.scaleLinear().domain([1, 2]);
- test.deepEqual(s.domain(), [1, 2]);
- test.equal(s(0.5), -0.5);
- test.equal(s(1.0), 0.0);
- test.equal(s(1.5), 0.5);
- test.equal(s(2.0), 1.0);
- test.equal(s(2.5), 1.5);
- test.equal(s.invert(-0.5), 0.5);
- test.equal(s.invert( 0.0), 1.0);
- test.equal(s.invert( 0.5), 1.5);
- test.equal(s.invert( 1.0), 2.0);
- test.equal(s.invert( 1.5), 2.5);
- test.end();
-});
-
-tape("linear(x) can map a polylinear domain with more than two values to the corresponding range", function(test) {
- var s = scale.scaleLinear().domain([-10, 0, 100]).range(["red", "white", "green"]);
- test.deepEqual(s.domain(), [-10, 0, 100]);
- test.equal(s(-5), "rgb(255, 128, 128)");
- test.equal(s(50), "rgb(128, 192, 128)");
- test.equal(s(75), "rgb(64, 160, 64)");
+import assert from "assert";
+import {scaleLinear} from "../src/index.js";
+import {roundEpsilon} from "./roundEpsilon.js";
+
+it("scaleLinear() has the expected defaults", () => {
+ const s = scaleLinear();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.unknown(), undefined);
+ assert.deepStrictEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
+});
+
+it("scaleLinear(range) sets the range", () => {
+ const s = scaleLinear([1, 2]);
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [1, 2]);
+ assert.strictEqual(s(0.5), 1.5);
+});
+
+it("scaleLinear(domain, range) sets the domain and range", () => {
+ const s = scaleLinear([1, 2], [3, 4]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(s.range(), [3, 4]);
+ assert.strictEqual(s(1.5), 3.5);
+});
+
+it("linear(x) maps a domain value x to a range value y", () => {
+ assert.strictEqual(scaleLinear().range([1, 2])(0.5), 1.5);
+});
+
+it("linear(x) ignores extra range values if the domain is smaller than the range", () => {
+ assert.strictEqual(scaleLinear().domain([-10, 0]).range([0, 1, 2]).clamp(true)(-5), 0.5);
+ assert.strictEqual(scaleLinear().domain([-10, 0]).range([0, 1, 2]).clamp(true)(50), 1);
+});
+
+it("linear(x) ignores extra domain values if the range is smaller than the domain", () => {
+ assert.strictEqual(scaleLinear().domain([-10, 0, 100]).range([0, 1]).clamp(true)(-5), 0.5);
+ assert.strictEqual(scaleLinear().domain([-10, 0, 100]).range([0, 1]).clamp(true)(50), 1);
+});
+
+it("linear(x) maps an empty domain to the middle of the range", () => {
+ assert.strictEqual(scaleLinear().domain([0, 0]).range([1, 2])(0), 1.5);
+ assert.strictEqual(scaleLinear().domain([0, 0]).range([2, 1])(1), 1.5);
+});
+
+it("linear(x) can map a bilinear domain with two values to the corresponding range", () => {
+ const s = scaleLinear().domain([1, 2]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.strictEqual(s(0.5), -0.5);
+ assert.strictEqual(s(1.0), 0.0);
+ assert.strictEqual(s(1.5), 0.5);
+ assert.strictEqual(s(2.0), 1.0);
+ assert.strictEqual(s(2.5), 1.5);
+ assert.strictEqual(s.invert(-0.5), 0.5);
+ assert.strictEqual(s.invert( 0.0), 1.0);
+ assert.strictEqual(s.invert( 0.5), 1.5);
+ assert.strictEqual(s.invert( 1.0), 2.0);
+ assert.strictEqual(s.invert( 1.5), 2.5);
+});
+
+it("linear(x) can map a polylinear domain with more than two values to the corresponding range", () => {
+ const s = scaleLinear().domain([-10, 0, 100]).range(["red", "white", "green"]);
+ assert.deepStrictEqual(s.domain(), [-10, 0, 100]);
+ assert.strictEqual(s(-5), "rgb(255, 128, 128)");
+ assert.strictEqual(s(50), "rgb(128, 192, 128)");
+ assert.strictEqual(s(75), "rgb(64, 160, 64)");
s.domain([4, 2, 1]).range([1, 2, 4]);
- test.equal(s(1.5), 3);
- test.equal(s(3), 1.5);
- test.equal(s.invert(1.5), 3);
- test.equal(s.invert(3), 1.5);
+ assert.strictEqual(s(1.5), 3);
+ assert.strictEqual(s(3), 1.5);
+ assert.strictEqual(s.invert(1.5), 3);
+ assert.strictEqual(s.invert(3), 1.5);
s.domain([1, 2, 4]).range([4, 2, 1]);
- test.equal(s(1.5), 3);
- test.equal(s(3), 1.5);
- test.equal(s.invert(1.5), 3);
- test.equal(s.invert(3), 1.5);
- test.end();
+ assert.strictEqual(s(1.5), 3);
+ assert.strictEqual(s(3), 1.5);
+ assert.strictEqual(s.invert(1.5), 3);
+ assert.strictEqual(s.invert(3), 1.5);
});
-tape("linear.invert(y) maps a range value y to a domain value x", function(test) {
- test.equal(scale.scaleLinear().range([1, 2]).invert(1.5), 0.5);
- test.end();
+it("linear.invert(y) maps a range value y to a domain value x", () => {
+ assert.strictEqual(scaleLinear().range([1, 2]).invert(1.5), 0.5);
});
-tape("linear.invert(y) maps an empty range to the middle of the domain", function(test) {
- test.equal(scale.scaleLinear().domain([1, 2]).range([0, 0]).invert(0), 1.5);
- test.equal(scale.scaleLinear().domain([2, 1]).range([0, 0]).invert(1), 1.5);
- test.end();
+it("linear.invert(y) maps an empty range to the middle of the domain", () => {
+ assert.strictEqual(scaleLinear().domain([1, 2]).range([0, 0]).invert(0), 1.5);
+ assert.strictEqual(scaleLinear().domain([2, 1]).range([0, 0]).invert(1), 1.5);
});
-tape("linear.invert(y) coerces range values to numbers", function(test) {
- test.equal(scale.scaleLinear().range(["0", "2"]).invert("1"), 0.5);
- test.equal(scale.scaleLinear().range([new Date(1990, 0, 1), new Date(1991, 0, 1)]).invert(new Date(1990, 6, 2, 13)), 0.5);
- test.end();
+it("linear.invert(y) coerces range values to numbers", () => {
+ assert.strictEqual(scaleLinear().range(["0", "2"]).invert("1"), 0.5);
+ assert.strictEqual(scaleLinear().range([new Date(1990, 0, 1), new Date(1991, 0, 1)]).invert(new Date(1990, 6, 2, 13)), 0.5);
});
-tape("linear.invert(y) returns NaN if the range is not coercible to number", function(test) {
- test.ok(isNaN(scale.scaleLinear().range(["#000", "#fff"]).invert("#999")));
- test.ok(isNaN(scale.scaleLinear().range([0, "#fff"]).invert("#999")));
- test.end();
+it("linear.invert(y) returns NaN if the range is not coercible to number", () => {
+ assert(isNaN(scaleLinear().range(["#000", "#fff"]).invert("#999")));
+ assert(isNaN(scaleLinear().range([0, "#fff"]).invert("#999")));
});
-tape("linear.domain(domain) accepts an array of numbers", function(test) {
- test.deepEqual(scale.scaleLinear().domain([]).domain(), []);
- test.deepEqual(scale.scaleLinear().domain([1, 0]).domain(), [1, 0]);
- test.deepEqual(scale.scaleLinear().domain([1, 2, 3]).domain(), [1, 2, 3]);
- test.end();
+it("linear.domain(domain) accepts an array of numbers", () => {
+ assert.deepStrictEqual(scaleLinear().domain([]).domain(), []);
+ assert.deepStrictEqual(scaleLinear().domain([1, 0]).domain(), [1, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([1, 2, 3]).domain(), [1, 2, 3]);
});
-tape("linear.domain(domain) coerces domain values to numbers", function(test) {
- test.deepEqual(scale.scaleLinear().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]).domain(), [631180800000, 662716800000]);
- test.deepEqual(scale.scaleLinear().domain(["0.0", "1.0"]).domain(), [0, 1]);
- test.deepEqual(scale.scaleLinear().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
- test.end();
+it("linear.domain(domain) coerces domain values to numbers", () => {
+ assert.deepStrictEqual(scaleLinear().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]).domain(), [631180800000, 662716800000]);
+ assert.deepStrictEqual(scaleLinear().domain(["0.0", "1.0"]).domain(), [0, 1]);
+ assert.deepStrictEqual(scaleLinear().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
});
-tape("linear.domain(domain) accepts an iterable", function(test) {
- test.deepEqual(scale.scaleLinear().domain(new Set([1, 2])).domain(), [1, 2]);
- test.end();
+it("linear.domain(domain) accepts an iterable", () => {
+ assert.deepStrictEqual(scaleLinear().domain(new Set([1, 2])).domain(), [1, 2]);
});
-tape("linear.domain(domain) makes a copy of domain values", function(test) {
- var d = [1, 2], s = scale.scaleLinear().domain(d);
- test.deepEqual(s.domain(), [1, 2]);
+it("linear.domain(domain) makes a copy of domain values", () => {
+ const d = [1, 2], s = scaleLinear().domain(d);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
d.push(3);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(d, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(d, [1, 2, 3]);
});
-tape("linear.domain() returns a copy of domain values", function(test) {
- var s = scale.scaleLinear(), d = s.domain();
- test.deepEqual(d, [0, 1]);
+it("linear.domain() returns a copy of domain values", () => {
+ const s = scaleLinear(), d = s.domain();
+ assert.deepStrictEqual(d, [0, 1]);
d.push(3);
- test.deepEqual(s.domain(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
});
-tape("linear.range(range) does not coerce range to numbers", function(test) {
- var s = scale.scaleLinear().range(["0px", "2px"]);
- test.deepEqual(s.range(), ["0px", "2px"]);
- test.equal(s(0.5), "1px");
- test.end();
+it("linear.range(range) does not coerce range to numbers", () => {
+ const s = scaleLinear().range(["0px", "2px"]);
+ assert.deepStrictEqual(s.range(), ["0px", "2px"]);
+ assert.strictEqual(s(0.5), "1px");
});
-tape("linear.range(range) accepts an iterable", function(test) {
- test.deepEqual(scale.scaleLinear().range(new Set([1, 2])).range(), [1, 2]);
- test.end();
+it("linear.range(range) accepts an iterable", () => {
+ assert.deepStrictEqual(scaleLinear().range(new Set([1, 2])).range(), [1, 2]);
});
-tape("linear.range(range) can accept range values as colors", function(test) {
- test.equal(scale.scaleLinear().range(["red", "blue"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scaleLinear().range(["#ff0000", "#0000ff"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scaleLinear().range(["#f00", "#00f"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scaleLinear().range(["rgb(255,0,0)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scaleLinear().range(["rgb(100%,0%,0%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scaleLinear().range(["hsl(0,100%,50%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.end();
+it("linear.range(range) can accept range values as colors", () => {
+ assert.strictEqual(scaleLinear().range(["red", "blue"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scaleLinear().range(["#ff0000", "#0000ff"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scaleLinear().range(["#f00", "#00f"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scaleLinear().range(["rgb(255,0,0)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scaleLinear().range(["rgb(100%,0%,0%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scaleLinear().range(["hsl(0,100%,50%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
});
-tape("linear.range(range) can accept range values as arrays or objects", function(test) {
- test.deepEqual(scale.scaleLinear().range([{color: "red"}, {color: "blue"}])(0.5), {color: "rgb(128, 0, 128)"});
- test.deepEqual(scale.scaleLinear().range([["red"], ["blue"]])(0.5), ["rgb(128, 0, 128)"]);
- test.end();
+it("linear.range(range) can accept range values as arrays or objects", () => {
+ assert.deepStrictEqual(scaleLinear().range([{color: "red"}, {color: "blue"}])(0.5), {color: "rgb(128, 0, 128)"});
+ assert.deepStrictEqual(scaleLinear().range([["red"], ["blue"]])(0.5), ["rgb(128, 0, 128)"]);
});
-tape("linear.range(range) makes a copy of range values", function(test) {
- var r = [1, 2], s = scale.scaleLinear().range(r);
- test.deepEqual(s.range(), [1, 2]);
+it("linear.range(range) makes a copy of range values", () => {
+ const r = [1, 2], s = scaleLinear().range(r);
+ assert.deepStrictEqual(s.range(), [1, 2]);
r.push(3);
- test.deepEqual(s.range(), [1, 2]);
- test.deepEqual(r, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.range(), [1, 2]);
+ assert.deepStrictEqual(r, [1, 2, 3]);
});
-tape("linear.range() returns a copy of range values", function(test) {
- var s = scale.scaleLinear(), r = s.range();
- test.deepEqual(r, [0, 1]);
+it("linear.range() returns a copy of range values", () => {
+ const s = scaleLinear(), r = s.range();
+ assert.deepStrictEqual(r, [0, 1]);
r.push(3);
- test.deepEqual(s.range(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.range(), [0, 1]);
});
-tape("linear.rangeRound(range) is an alias for linear.range(range).interpolate(interpolateRound)", function(test) {
- test.equal(scale.scaleLinear().rangeRound([0, 10])(0.59), 6);
- test.end();
+it("linear.rangeRound(range) is an alias for linear.range(range).interpolate(interpolateRound)", () => {
+ assert.strictEqual(scaleLinear().rangeRound([0, 10])(0.59), 6);
});
-tape("linear.rangeRound(range) accepts an iterable", function(test) {
- test.deepEqual(scale.scaleLinear().rangeRound(new Set([1, 2])).range(), [1, 2]);
- test.end();
+it("linear.rangeRound(range) accepts an iterable", () => {
+ assert.deepStrictEqual(scaleLinear().rangeRound(new Set([1, 2])).range(), [1, 2]);
});
-tape("linear.unknown(value) sets the return value for undefined, null, and NaN input", function(test) {
- var s = scale.scaleLinear().unknown(-1);
- test.equal(s(null), -1);
- test.equal(s(undefined), -1);
- test.equal(s(NaN), -1);
- test.equal(s("N/A"), -1);
- test.equal(s(0.4), 0.4);
- test.end();
+it("linear.unknown(value) sets the return value for undefined, null, and NaN input", () => {
+ const s = scaleLinear().unknown(-1);
+ assert.strictEqual(s(null), -1);
+ assert.strictEqual(s(undefined), -1);
+ assert.strictEqual(s(NaN), -1);
+ assert.strictEqual(s("N/A"), -1);
+ assert.strictEqual(s(0.4), 0.4);
});
-tape("linear.clamp() is false by default", function(test) {
- test.equal(scale.scaleLinear().clamp(), false);
- test.equal(scale.scaleLinear().range([10, 20])(2), 30);
- test.equal(scale.scaleLinear().range([10, 20])(-1), 0);
- test.equal(scale.scaleLinear().range([10, 20]).invert(30), 2);
- test.equal(scale.scaleLinear().range([10, 20]).invert(0), -1);
- test.end();
+it("linear.clamp() is false by default", () => {
+ assert.strictEqual(scaleLinear().clamp(), false);
+ assert.strictEqual(scaleLinear().range([10, 20])(2), 30);
+ assert.strictEqual(scaleLinear().range([10, 20])(-1), 0);
+ assert.strictEqual(scaleLinear().range([10, 20]).invert(30), 2);
+ assert.strictEqual(scaleLinear().range([10, 20]).invert(0), -1);
});
-tape("linear.clamp(true) restricts output values to the range", function(test) {
- test.equal(scale.scaleLinear().clamp(true).range([10, 20])(2), 20);
- test.equal(scale.scaleLinear().clamp(true).range([10, 20])(-1), 10);
- test.end();
+it("linear.clamp(true) restricts output values to the range", () => {
+ assert.strictEqual(scaleLinear().clamp(true).range([10, 20])(2), 20);
+ assert.strictEqual(scaleLinear().clamp(true).range([10, 20])(-1), 10);
});
-tape("linear.clamp(true) restricts input values to the domain", function(test) {
- test.equal(scale.scaleLinear().clamp(true).range([10, 20]).invert(30), 1);
- test.equal(scale.scaleLinear().clamp(true).range([10, 20]).invert(0), 0);
- test.end();
+it("linear.clamp(true) restricts input values to the domain", () => {
+ assert.strictEqual(scaleLinear().clamp(true).range([10, 20]).invert(30), 1);
+ assert.strictEqual(scaleLinear().clamp(true).range([10, 20]).invert(0), 0);
});
-tape("linear.clamp(clamp) coerces the specified clamp value to a boolean", function(test) {
- test.equal(scale.scaleLinear().clamp("true").clamp(), true);
- test.equal(scale.scaleLinear().clamp(1).clamp(), true);
- test.equal(scale.scaleLinear().clamp("").clamp(), false);
- test.equal(scale.scaleLinear().clamp(0).clamp(), false);
- test.end();
+it("linear.clamp(clamp) coerces the specified clamp value to a boolean", () => {
+ assert.strictEqual(scaleLinear().clamp("true").clamp(), true);
+ assert.strictEqual(scaleLinear().clamp(1).clamp(), true);
+ assert.strictEqual(scaleLinear().clamp("").clamp(), false);
+ assert.strictEqual(scaleLinear().clamp(0).clamp(), false);
});
-tape("linear.interpolate(interpolate) takes a custom interpolator factory", function(test) {
+it("linear.interpolate(interpolate) takes a custom interpolator factory", () => {
function interpolate(a, b) { return function(t) { return [a, b, t]; }; }
- var s = scale.scaleLinear().domain([10, 20]).range(["a", "b"]).interpolate(interpolate);
- test.equal(s.interpolate(), interpolate);
- test.deepEqual(s(15), ["a", "b", 0.5]);
- test.end();
-});
-
-tape("linear.nice() is an alias for linear.nice(10)", function(test) {
- test.deepEqual(scale.scaleLinear().domain([0, 0.96]).nice().domain(), [0, 1]);
- test.deepEqual(scale.scaleLinear().domain([0, 96]).nice().domain(), [0, 100]);
- test.end();
-});
-
-tape("linear.nice(count) extends the domain to match the desired ticks", function(test) {
- test.deepEqual(scale.scaleLinear().domain([0, 0.96]).nice(10).domain(), [0, 1]);
- test.deepEqual(scale.scaleLinear().domain([0, 96]).nice(10).domain(), [0, 100]);
- test.deepEqual(scale.scaleLinear().domain([0.96, 0]).nice(10).domain(), [1, 0]);
- test.deepEqual(scale.scaleLinear().domain([96, 0]).nice(10).domain(), [100, 0]);
- test.deepEqual(scale.scaleLinear().domain([0, -0.96]).nice(10).domain(), [0, -1]);
- test.deepEqual(scale.scaleLinear().domain([0, -96]).nice(10).domain(), [0, -100]);
- test.deepEqual(scale.scaleLinear().domain([-0.96, 0]).nice(10).domain(), [-1, 0]);
- test.deepEqual(scale.scaleLinear().domain([-96, 0]).nice(10).domain(), [-100, 0]);
- test.deepEqual(scale.scaleLinear().domain([-0.1, 51.1]).nice(8).domain(), [-10, 60]);
- test.end();
-});
-
-tape("linear.nice(count) nices the domain, extending it to round numbers", function(test) {
- test.deepEqual(scale.scaleLinear().domain([1.1, 10.9]).nice(10).domain(), [1, 11]);
- test.deepEqual(scale.scaleLinear().domain([10.9, 1.1]).nice(10).domain(), [11, 1]);
- test.deepEqual(scale.scaleLinear().domain([0.7, 11.001]).nice(10).domain(), [0, 12]);
- test.deepEqual(scale.scaleLinear().domain([123.1, 6.7]).nice(10).domain(), [130, 0]);
- test.deepEqual(scale.scaleLinear().domain([0, 0.49]).nice(10).domain(), [0, 0.5]);
- test.deepEqual(scale.scaleLinear().domain([0, 14.1]).nice(5).domain(), [0, 20]);
- test.deepEqual(scale.scaleLinear().domain([0, 15]).nice(5).domain(), [0, 20]);
- test.end();
-});
-
-tape("linear.nice(count) has no effect on degenerate domains", function(test) {
- test.deepEqual(scale.scaleLinear().domain([0, 0]).nice(10).domain(), [0, 0]);
- test.deepEqual(scale.scaleLinear().domain([0.5, 0.5]).nice(10).domain(), [0.5, 0.5]);
- test.end();
-});
-
-tape("linear.nice(count) nicing a polylinear domain only affects the extent", function(test) {
- test.deepEqual(scale.scaleLinear().domain([1.1, 1, 2, 3, 10.9]).nice(10).domain(), [1, 1, 2, 3, 11]);
- test.deepEqual(scale.scaleLinear().domain([123.1, 1, 2, 3, -0.9]).nice(10).domain(), [130, 1, 2, 3, -10]);
- test.end();
-});
-
-tape("linear.nice(count) accepts a tick count to control nicing step", function(test) {
- test.deepEqual(scale.scaleLinear().domain([12, 87]).nice(5).domain(), [0, 100]);
- test.deepEqual(scale.scaleLinear().domain([12, 87]).nice(10).domain(), [10, 90]);
- test.deepEqual(scale.scaleLinear().domain([12, 87]).nice(100).domain(), [12, 87]);
- test.end();
-});
-
-tape("linear.ticks(count) returns the expected ticks for an ascending domain", function(test) {
- var s = scale.scaleLinear();
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
+ const s = scaleLinear().domain([10, 20]).range(["a", "b"]).interpolate(interpolate);
+ assert.strictEqual(s.interpolate(), interpolate);
+ assert.deepStrictEqual(s(15), ["a", "b", 0.5]);
+});
+
+it("linear.nice() is an alias for linear.nice(10)", () => {
+ assert.deepStrictEqual(scaleLinear().domain([0, 0.96]).nice().domain(), [0, 1]);
+ assert.deepStrictEqual(scaleLinear().domain([0, 96]).nice().domain(), [0, 100]);
+});
+
+it("linear.nice(count) extends the domain to match the desired ticks", () => {
+ assert.deepStrictEqual(scaleLinear().domain([0, 0.96]).nice(10).domain(), [0, 1]);
+ assert.deepStrictEqual(scaleLinear().domain([0, 96]).nice(10).domain(), [0, 100]);
+ assert.deepStrictEqual(scaleLinear().domain([0.96, 0]).nice(10).domain(), [1, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([96, 0]).nice(10).domain(), [100, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([0, -0.96]).nice(10).domain(), [0, -1]);
+ assert.deepStrictEqual(scaleLinear().domain([0, -96]).nice(10).domain(), [0, -100]);
+ assert.deepStrictEqual(scaleLinear().domain([-0.96, 0]).nice(10).domain(), [-1, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([-96, 0]).nice(10).domain(), [-100, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([-0.1, 51.1]).nice(8).domain(), [-10, 60]);
+});
+
+it("linear.nice(count) nices the domain, extending it to round numbers", () => {
+ assert.deepStrictEqual(scaleLinear().domain([1.1, 10.9]).nice(10).domain(), [1, 11]);
+ assert.deepStrictEqual(scaleLinear().domain([10.9, 1.1]).nice(10).domain(), [11, 1]);
+ assert.deepStrictEqual(scaleLinear().domain([0.7, 11.001]).nice(10).domain(), [0, 12]);
+ assert.deepStrictEqual(scaleLinear().domain([123.1, 6.7]).nice(10).domain(), [130, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([0, 0.49]).nice(10).domain(), [0, 0.5]);
+ assert.deepStrictEqual(scaleLinear().domain([0, 14.1]).nice(5).domain(), [0, 20]);
+ assert.deepStrictEqual(scaleLinear().domain([0, 15]).nice(5).domain(), [0, 20]);
+});
+
+it("linear.nice(count) has no effect on degenerate domains", () => {
+ assert.deepStrictEqual(scaleLinear().domain([0, 0]).nice(10).domain(), [0, 0]);
+ assert.deepStrictEqual(scaleLinear().domain([0.5, 0.5]).nice(10).domain(), [0.5, 0.5]);
+});
+
+it("linear.nice(count) nicing a polylinear domain only affects the extent", () => {
+ assert.deepStrictEqual(scaleLinear().domain([1.1, 1, 2, 3, 10.9]).nice(10).domain(), [1, 1, 2, 3, 11]);
+ assert.deepStrictEqual(scaleLinear().domain([123.1, 1, 2, 3, -0.9]).nice(10).domain(), [130, 1, 2, 3, -10]);
+});
+
+it("linear.nice(count) accepts a tick count to control nicing step", () => {
+ assert.deepStrictEqual(scaleLinear().domain([12, 87]).nice(5).domain(), [0, 100]);
+ assert.deepStrictEqual(scaleLinear().domain([12, 87]).nice(10).domain(), [10, 90]);
+ assert.deepStrictEqual(scaleLinear().domain([12, 87]).nice(100).domain(), [12, 87]);
+});
+
+it("linear.ticks(count) returns the expected ticks for an ascending domain", () => {
+ const s = scaleLinear();
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
s.domain([-100, 100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(2), [-100, 0, 100]);
- test.deepEqual(s.ticks(1), [ 0 ]);
- test.end();
-});
-
-tape("linear.ticks(count) returns the expected ticks for a descending domain", function(test) {
- var s = scale.scaleLinear().domain([1, 0]);
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100]);
+ assert.deepStrictEqual(s.ticks(1), [ 0 ]);
+});
+
+it("linear.ticks(count) returns the expected ticks for a descending domain", () => {
+ const s = scaleLinear().domain([1, 0]);
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0].reverse());
s.domain([100, -100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(2), [-100, 0, 100].reverse());
- test.deepEqual(s.ticks(1), [ 0 ].reverse());
- test.end();
-});
-
-tape("linear.ticks(count) returns the expected ticks for a polylinear domain", function(test) {
- var s = scale.scaleLinear().domain([0, 0.25, 0.9, 1]);
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100].reverse());
+ assert.deepStrictEqual(s.ticks(1), [ 0 ].reverse());
+});
+
+it("linear.ticks(count) returns the expected ticks for a polylinear domain", () => {
+ const s = scaleLinear().domain([0, 0.25, 0.9, 1]);
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
s.domain([-100, 0, 100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(2), [-100, 0, 100]);
- test.deepEqual(s.ticks(1), [ 0 ]);
- test.end();
-});
-
-tape("linear.ticks(X) spans linear.nice(X).domain()", function(test) {
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100]);
+ assert.deepStrictEqual(s.ticks(1), [ 0 ]);
+});
+
+it("linear.ticks(X) spans linear.nice(X).domain()", () => {
function check(domain, count) {
- var s = scale.scaleLinear().domain(domain).nice(count);
- var ticks = s.ticks(count);
- test.deepEqual([ticks[0], ticks[ticks.length - 1]], s.domain());
+ const s = scaleLinear().domain(domain).nice(count);
+ const ticks = s.ticks(count);
+ assert.deepStrictEqual([ticks[0], ticks[ticks.length - 1]], s.domain());
}
check([1, 9], 2);
check([1, 9], 3);
@@ -406,142 +356,128 @@ tape("linear.ticks(X) spans linear.nice(X).domain()", function(test) {
check([9, 21], 2);
check([10, 21], 2);
check([11, 21], 2);
- test.end();
})
-tape("linear.ticks(count) returns the empty array if count is not a positive integer", function(test) {
- var s = scale.scaleLinear();
- test.deepEqual(s.ticks(NaN), []);
- test.deepEqual(s.ticks(0), []);
- test.deepEqual(s.ticks(-1), []);
- test.deepEqual(s.ticks(Infinity), []);
- test.end();
+it("linear.ticks(count) returns the empty array if count is not a positive integer", () => {
+ const s = scaleLinear();
+ assert.deepStrictEqual(s.ticks(NaN), []);
+ assert.deepStrictEqual(s.ticks(0), []);
+ assert.deepStrictEqual(s.ticks(-1), []);
+ assert.deepStrictEqual(s.ticks(Infinity), []);
});
-tape("linear.ticks() is an alias for linear.ticks(10)", function(test) {
- var s = scale.scaleLinear();
- test.deepEqual(s.ticks(), s.ticks(10));
- test.end();
+it("linear.ticks() is an alias for linear.ticks(10)", () => {
+ const s = scaleLinear();
+ assert.deepStrictEqual(s.ticks(), s.ticks(10));
});
-tape("linear.tickFormat() is an alias for linear.tickFormat(10)", function(test) {
- test.equal(scale.scaleLinear().tickFormat()(0.2), "0.2");
- test.equal(scale.scaleLinear().domain([-100, 100]).tickFormat()(-20), "-20");
- test.end();
+it("linear.tickFormat() is an alias for linear.tickFormat(10)", () => {
+ assert.strictEqual(scaleLinear().tickFormat()(0.2), "0.2");
+ assert.strictEqual(scaleLinear().domain([-100, 100]).tickFormat()(-20), "−20");
});
-tape("linear.tickFormat(count) returns a format suitable for the ticks", function(test) {
- test.equal(scale.scaleLinear().tickFormat(10)(0.2), "0.2");
- test.equal(scale.scaleLinear().tickFormat(20)(0.2), "0.20");
- test.equal(scale.scaleLinear().domain([-100, 100]).tickFormat(10)(-20), "-20");
- test.end();
+it("linear.tickFormat(count) returns a format suitable for the ticks", () => {
+ assert.strictEqual(scaleLinear().tickFormat(10)(0.2), "0.2");
+ assert.strictEqual(scaleLinear().tickFormat(20)(0.2), "0.20");
+ assert.strictEqual(scaleLinear().domain([-100, 100]).tickFormat(10)(-20), "−20");
});
-tape("linear.tickFormat(count, specifier) sets the appropriate fixed precision if not specified", function(test) {
- test.equal(scale.scaleLinear().tickFormat(10, "+f")(0.2), "+0.2");
- test.equal(scale.scaleLinear().tickFormat(20, "+f")(0.2), "+0.20");
- test.equal(scale.scaleLinear().tickFormat(10, "+%")(0.2), "+20%");
- test.equal(scale.scaleLinear().domain([0.19, 0.21]).tickFormat(10, "+%")(0.2), "+20.0%");
- test.end();
+it("linear.tickFormat(count, specifier) sets the appropriate fixed precision if not specified", () => {
+ assert.strictEqual(scaleLinear().tickFormat(10, "+f")(0.2), "+0.2");
+ assert.strictEqual(scaleLinear().tickFormat(20, "+f")(0.2), "+0.20");
+ assert.strictEqual(scaleLinear().tickFormat(10, "+%")(0.2), "+20%");
+ assert.strictEqual(scaleLinear().domain([0.19, 0.21]).tickFormat(10, "+%")(0.2), "+20.0%");
});
-tape("linear.tickFormat(count, specifier) sets the appropriate round precision if not specified", function(test) {
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(10, "")(2.10), "2");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "")(2.01), "2");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "")(2.11), "2.1");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(10, "e")(2.10), "2e+0");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "e")(2.01), "2.0e+0");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "e")(2.11), "2.1e+0");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(10, "g")(2.10), "2");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "g")(2.01), "2.0");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "g")(2.11), "2.1");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(10, "r")(2.10e6), "2000000");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "r")(2.01e6), "2000000");
- test.equal(scale.scaleLinear().domain([0, 9]).tickFormat(100, "r")(2.11e6), "2100000");
- test.equal(scale.scaleLinear().domain([0, 0.9]).tickFormat(10, "p")(0.210), "20%");
- test.equal(scale.scaleLinear().domain([0.19, 0.21]).tickFormat(10, "p")(0.201), "20.1%");
- test.end();
+it("linear.tickFormat(count, specifier) sets the appropriate round precision if not specified", () => {
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(10, "")(2.10), "2");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "")(2.01), "2");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "")(2.11), "2.1");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(10, "e")(2.10), "2e+0");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "e")(2.01), "2.0e+0");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "e")(2.11), "2.1e+0");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(10, "g")(2.10), "2");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "g")(2.01), "2.0");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "g")(2.11), "2.1");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(10, "r")(2.10e6), "2000000");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "r")(2.01e6), "2000000");
+ assert.strictEqual(scaleLinear().domain([0, 9]).tickFormat(100, "r")(2.11e6), "2100000");
+ assert.strictEqual(scaleLinear().domain([0, 0.9]).tickFormat(10, "p")(0.210), "20%");
+ assert.strictEqual(scaleLinear().domain([0.19, 0.21]).tickFormat(10, "p")(0.201), "20.1%");
});
-tape("linear.tickFormat(count, specifier) sets the appropriate prefix precision if not specified", function(test) {
- test.equal(scale.scaleLinear().domain([0, 1e6]).tickFormat(10, "$s")(0.51e6), "$0.5M");
- test.equal(scale.scaleLinear().domain([0, 1e6]).tickFormat(100, "$s")(0.501e6), "$0.50M");
- test.end();
+it("linear.tickFormat(count, specifier) sets the appropriate prefix precision if not specified", () => {
+ assert.strictEqual(scaleLinear().domain([0, 1e6]).tickFormat(10, "$s")(0.51e6), "$0.5M");
+ assert.strictEqual(scaleLinear().domain([0, 1e6]).tickFormat(100, "$s")(0.501e6), "$0.50M");
});
-tape("linear.tickFormat() uses the default precision when the domain is invalid", function(test) {
- var f = scale.scaleLinear().domain([0, NaN]).tickFormat();
- test.equal(f + "", " >-,f");
- test.equal(f(0.12), "0.120000");
- test.end();
+it("linear.tickFormat() uses the default precision when the domain is invalid", () => {
+ const f = scaleLinear().domain([0, NaN]).tickFormat();
+ assert.strictEqual(f + "", " >-,f");
+ assert.strictEqual(f(0.12), "0.120000");
});
-tape("linear.copy() returns a copy with changes to the domain are isolated", function(test) {
- var x = scale.scaleLinear(), y = x.copy();
+it("linear.copy() returns a copy with changes to the domain are isolated", () => {
+ const x = scaleLinear(), y = x.copy();
x.domain([1, 2]);
- test.deepEqual(y.domain(), [0, 1]);
- test.equal(x(1), 0);
- test.equal(y(1), 1);
+ assert.deepStrictEqual(y.domain(), [0, 1]);
+ assert.strictEqual(x(1), 0);
+ assert.strictEqual(y(1), 1);
y.domain([2, 3]);
- test.equal(x(2), 1);
- test.equal(y(2), 0);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [2, 3]);
- y = x.domain([1, 1.9]).copy();
+ assert.strictEqual(x(2), 1);
+ assert.strictEqual(y(2), 0);
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y.domain(), [2, 3]);
+ const y2 = x.domain([1, 1.9]).copy();
x.nice(5);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [1, 1.9]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y2.domain(), [1, 1.9]);
});
-tape("linear.copy() returns a copy with changes to the range are isolated", function(test) {
- var x = scale.scaleLinear(), y = x.copy();
+it("linear.copy() returns a copy with changes to the range are isolated", () => {
+ const x = scaleLinear(), y = x.copy();
x.range([1, 2]);
- test.equal(x.invert(1), 0);
- test.equal(y.invert(1), 1);
- test.deepEqual(y.range(), [0, 1]);
+ assert.strictEqual(x.invert(1), 0);
+ assert.strictEqual(y.invert(1), 1);
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.equal(x.invert(2), 1);
- test.equal(y.invert(2), 0);
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
-});
-
-tape("linear.copy() returns a copy with changes to the interpolator are isolated", function(test) {
- var x = scale.scaleLinear().range(["red", "blue"]),
- y = x.copy(),
- i0 = x.interpolate(),
- i1 = function(a, b) { return function() { return b; }; };
+ assert.strictEqual(x.invert(2), 1);
+ assert.strictEqual(y.invert(2), 0);
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
+});
+
+it("linear.copy() returns a copy with changes to the interpolator are isolated", () => {
+ const x = scaleLinear().range(["red", "blue"]);
+ const y = x.copy();
+ const i0 = x.interpolate();
+ const i1 = function(a, b) { return function() { return b; }; };
x.interpolate(i1);
- test.equal(y.interpolate(), i0);
- test.equal(x(0.5), "blue");
- test.equal(y(0.5), "rgb(128, 0, 128)");
- test.end();
+ assert.strictEqual(y.interpolate(), i0);
+ assert.strictEqual(x(0.5), "blue");
+ assert.strictEqual(y(0.5), "rgb(128, 0, 128)");
});
-tape("linear.copy() returns a copy with changes to clamping are isolated", function(test) {
- var x = scale.scaleLinear().clamp(true), y = x.copy();
+it("linear.copy() returns a copy with changes to clamping are isolated", () => {
+ const x = scaleLinear().clamp(true), y = x.copy();
x.clamp(false);
- test.equal(x(2), 2);
- test.equal(y(2), 1);
- test.equal(y.clamp(), true);
+ assert.strictEqual(x(2), 2);
+ assert.strictEqual(y(2), 1);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.equal(x(2), 2);
- test.equal(y(2), 2);
- test.equal(x.clamp(), false);
- test.end();
+ assert.strictEqual(x(2), 2);
+ assert.strictEqual(y(2), 2);
+ assert.strictEqual(x.clamp(), false);
});
-tape("linear.copy() returns a copy with changes to the unknown value are isolated", function(test) {
- var x = scale.scaleLinear(), y = x.copy();
+it("linear.copy() returns a copy with changes to the unknown value are isolated", () => {
+ const x = scaleLinear(), y = x.copy();
x.unknown(2);
- test.equal(x(NaN), 2);
- test.equal(isNaN(y(NaN)), true);
- test.equal(y.unknown(), undefined);
+ assert.strictEqual(x(NaN), 2);
+ assert.strictEqual(isNaN(y(NaN)), true);
+ assert.strictEqual(y.unknown(), undefined);
y.unknown(3);
- test.equal(x(NaN), 2);
- test.equal(y(NaN), 3);
- test.equal(x.unknown(), 2);
- test.end();
+ assert.strictEqual(x(NaN), 2);
+ assert.strictEqual(y(NaN), 3);
+ assert.strictEqual(x.unknown(), 2);
});
diff --git a/test/log-test.js b/test/log-test.js
index 0e6fa16..42eb7a0 100644
--- a/test/log-test.js
+++ b/test/log-test.js
@@ -1,417 +1,371 @@
-var tape = require("tape"),
- format = require("d3-format"),
- interpolate = require("d3-interpolate"),
- color = require("d3-color"),
- scale = require("../");
-
-require("./inDelta");
-
-format.formatDefaultLocale({
- decimal: ".",
- thousands: ",",
- grouping: [3],
- currency: ["$", ""],
- minus: "-"
-});
-
-tape("scaleLog() has the expected defaults", function(test) {
- var x = scale.scaleLog();
- test.deepEqual(x.domain(), [1, 10]);
- test.deepEqual(x.range(), [0, 1]);
- test.equal(x.clamp(), false);
- test.equal(x.base(), 10);
- test.equal(x.interpolate(), interpolate.interpolate);
- test.deepEqual(x.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
- test.inDelta(x(5), 0.69897);
- test.inDelta(x.invert(0.69897), 5);
- test.inDelta(x(3.162278), 0.5);
- test.inDelta(x.invert(0.5), 3.162278);
- test.end();
-});
-
-tape("log.domain(…) coerces values to numbers", function(test) {
- var x = scale.scaleLog().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
- test.equal(typeof x.domain()[0], "number");
- test.equal(typeof x.domain()[1], "number");
- test.inDelta(x(new Date(1989, 9, 20)), -0.2061048);
- test.inDelta(x(new Date(1990, 0, 1)), 0.0000000);
- test.inDelta(x(new Date(1990, 2, 15)), 0.2039385);
- test.inDelta(x(new Date(1990, 4, 27)), 0.4057544);
- test.inDelta(x(new Date(1991, 0, 1)), 1.0000000);
- test.inDelta(x(new Date(1991, 2, 15)), 1.1942797);
+import assert from "assert";
+import {hsl, rgb} from "d3-color";
+import {interpolate, interpolateHsl} from "d3-interpolate";
+import {format} from "d3-format";
+import {scaleLog} from "../src/index.js";
+import {assertInDelta} from "./asserts.js";
+
+it("scaleLog() has the expected defaults", () => {
+ const x = scaleLog();
+ assert.deepStrictEqual(x.domain(), [1, 10]);
+ assert.deepStrictEqual(x.range(), [0, 1]);
+ assert.strictEqual(x.clamp(), false);
+ assert.strictEqual(x.base(), 10);
+ assert.strictEqual(x.interpolate(), interpolate);
+ assert.deepStrictEqual(x.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
+ assertInDelta(x(5), 0.69897);
+ assertInDelta(x.invert(0.69897), 5);
+ assertInDelta(x(3.162278), 0.5);
+ assertInDelta(x.invert(0.5), 3.162278);
+});
+
+it("log.domain(…) coerces values to numbers", () => {
+ const x = scaleLog().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
+ assert.strictEqual(typeof x.domain()[0], "number");
+ assert.strictEqual(typeof x.domain()[1], "number");
+ assertInDelta(x(new Date(1989, 9, 20)), -0.2061048);
+ assertInDelta(x(new Date(1990, 0, 1)), 0.0000000);
+ assertInDelta(x(new Date(1990, 2, 15)), 0.2039385);
+ assertInDelta(x(new Date(1990, 4, 27)), 0.4057544);
+ assertInDelta(x(new Date(1991, 0, 1)), 1.0000000);
+ assertInDelta(x(new Date(1991, 2, 15)), 1.1942797);
x.domain(["1", "10"]);
- test.equal(typeof x.domain()[0], "number");
- test.equal(typeof x.domain()[1], "number");
- test.inDelta(x(5), 0.69897);
+ assert.strictEqual(typeof x.domain()[0], "number");
+ assert.strictEqual(typeof x.domain()[1], "number");
+ assertInDelta(x(5), 0.69897);
x.domain([new Number(1), new Number(10)]);
- test.equal(typeof x.domain()[0], "number");
- test.equal(typeof x.domain()[1], "number");
- test.inDelta(x(5), 0.69897);
- test.end();
-});
-
-tape("log.domain(…) can take negative values", function(test) {
- var x = scale.scaleLog().domain([-100, -1]);
- test.deepEqual(x.ticks().map(x.tickFormat(Infinity)), [
- "-1e+2",
- "-9e+1", "-8e+1", "-7e+1", "-6e+1", "-5e+1", "-4e+1", "-3e+1", "-2e+1", "-1e+1",
- "-9e+0", "-8e+0", "-7e+0", "-6e+0", "-5e+0", "-4e+0", "-3e+0", "-2e+0", "-1e+0"
+ assert.strictEqual(typeof x.domain()[0], "number");
+ assert.strictEqual(typeof x.domain()[1], "number");
+ assertInDelta(x(5), 0.69897);
+});
+
+it("log.domain(…) can take negative values", () => {
+ const x = scaleLog().domain([-100, -1]);
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(Infinity)), [
+ "−1e+2",
+ "−9e+1", "−8e+1", "−7e+1", "−6e+1", "−5e+1", "−4e+1", "−3e+1", "−2e+1", "−1e+1",
+ "−9e+0", "−8e+0", "−7e+0", "−6e+0", "−5e+0", "−4e+0", "−3e+0", "−2e+0", "−1e+0"
]);
- test.inDelta(x(-50), 0.150515);
- test.end();
+ assertInDelta(x(-50), 0.150515);
});
-tape("log.domain(…).range(…) can take more than two values", function(test) {
- var x = scale.scaleLog().domain([0.1, 1, 100]).range(["red", "white", "green"]);
- test.equal(x(0.5), "rgb(255, 178, 178)");
- test.equal(x(50), "rgb(38, 147, 38)");
- test.equal(x(75), "rgb(16, 136, 16)");
- test.end();
+it("log.domain(…).range(…) can take more than two values", () => {
+ const x = scaleLog().domain([0.1, 1, 100]).range(["red", "white", "green"]);
+ assert.strictEqual(x(0.5), "rgb(255, 178, 178)");
+ assert.strictEqual(x(50), "rgb(38, 147, 38)");
+ assert.strictEqual(x(75), "rgb(16, 136, 16)");
});
-tape("log.domain(…) preserves specified domain exactly, with no floating point error", function(test) {
- var x = scale.scaleLog().domain([0.1, 1000]);
- test.deepEqual(x.domain(), [0.1, 1000]);
- test.end();
+it("log.domain(…) preserves specified domain exactly, with no floating point error", () => {
+ const x = scaleLog().domain([0.1, 1000]);
+ assert.deepStrictEqual(x.domain(), [0.1, 1000]);
});
-tape("log.range(…) does not coerce values to numbers", function(test) {
- var x = scale.scaleLog().range(["0", "2"]);
- test.equal(typeof x.range()[0], "string");
- test.equal(typeof x.range()[1], "string");
- test.end();
+it("log.range(…) does not coerce values to numbers", () => {
+ const x = scaleLog().range(["0", "2"]);
+ assert.strictEqual(typeof x.range()[0], "string");
+ assert.strictEqual(typeof x.range()[1], "string");
});
-tape("log.range(…) can take colors", function(test) {
- var x = scale.scaleLog().range(["red", "blue"]);
- test.equal(x(5), "rgb(77, 0, 178)");
+it("log.range(…) can take colors", () => {
+ const x = scaleLog().range(["red", "blue"]);
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
x.range(["#ff0000", "#0000ff"]);
- test.equal(x(5), "rgb(77, 0, 178)");
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
x.range(["#f00", "#00f"]);
- test.equal(x(5), "rgb(77, 0, 178)");
- x.range([color.rgb(255, 0, 0), color.hsl(240, 1, 0.5)]);
- test.equal(x(5), "rgb(77, 0, 178)");
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
+ x.range([rgb(255, 0, 0), hsl(240, 1, 0.5)]);
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
x.range(["hsl(0,100%,50%)", "hsl(240,100%,50%)"]);
- test.equal(x(5), "rgb(77, 0, 178)");
- test.end();
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
});
-tape("log.range(…) can take arrays or objects", function(test) {
- var x = scale.scaleLog().range([{color: "red"}, {color: "blue"}]);
- test.deepEqual(x(5), {color: "rgb(77, 0, 178)"});
+it("log.range(…) can take arrays or objects", () => {
+ const x = scaleLog().range([{color: "red"}, {color: "blue"}]);
+ assert.deepStrictEqual(x(5), {color: "rgb(77, 0, 178)"});
x.range([["red"], ["blue"]]);
- test.deepEqual(x(5), ["rgb(77, 0, 178)"]);
- test.end();
+ assert.deepStrictEqual(x(5), ["rgb(77, 0, 178)"]);
});
-tape("log.interpolate(f) sets the interpolator", function(test) {
- var x = scale.scaleLog().range(["red", "blue"]);
- test.equal(x.interpolate(), interpolate.interpolate);
- test.equal(x(5), "rgb(77, 0, 178)");
- x.interpolate(interpolate.interpolateHsl);
- test.equal(x(5), "rgb(154, 0, 255)");
- test.end();
+it("log.interpolate(f) sets the interpolator", () => {
+ const x = scaleLog().range(["red", "blue"]);
+ assert.strictEqual(x.interpolate(), interpolate);
+ assert.strictEqual(x(5), "rgb(77, 0, 178)");
+ x.interpolate(interpolateHsl);
+ assert.strictEqual(x(5), "rgb(154, 0, 255)");
});
-tape("log(x) does not clamp by default", function(test) {
- var x = scale.scaleLog();
- test.equal(x.clamp(), false);
- test.inDelta(x(0.5), -0.3010299);
- test.inDelta(x(15), 1.1760913);
- test.end();
+it("log(x) does not clamp by default", () => {
+ const x = scaleLog();
+ assert.strictEqual(x.clamp(), false);
+ assertInDelta(x(0.5), -0.3010299);
+ assertInDelta(x(15), 1.1760913);
});
-tape("log.clamp(true)(x) clamps to the domain", function(test) {
- var x = scale.scaleLog().clamp(true);
- test.inDelta(x(-1), 0);
- test.inDelta(x(5), 0.69897);
- test.inDelta(x(15), 1);
+it("log.clamp(true)(x) clamps to the domain", () => {
+ const x = scaleLog().clamp(true);
+ assertInDelta(x(-1), 0);
+ assertInDelta(x(5), 0.69897);
+ assertInDelta(x(15), 1);
x.domain([10, 1]);
- test.inDelta(x(-1), 1);
- test.inDelta(x(5), 0.30103);
- test.inDelta(x(15), 0);
- test.end();
+ assertInDelta(x(-1), 1);
+ assertInDelta(x(5), 0.30103);
+ assertInDelta(x(15), 0);
});
-tape("log.clamp(true).invert(y) clamps to the range", function(test) {
- var x = scale.scaleLog().clamp(true);
- test.inDelta(x.invert(-0.1), 1);
- test.inDelta(x.invert(0.69897), 5);
- test.inDelta(x.invert(1.5), 10);
+it("log.clamp(true).invert(y) clamps to the range", () => {
+ const x = scaleLog().clamp(true);
+ assertInDelta(x.invert(-0.1), 1);
+ assertInDelta(x.invert(0.69897), 5);
+ assertInDelta(x.invert(1.5), 10);
x.domain([10, 1]);
- test.inDelta(x.invert(-0.1), 10);
- test.inDelta(x.invert(0.30103), 5);
- test.inDelta(x.invert(1.5), 1);
- test.end();
-});
-
-tape("log(x) maps a number x to a number y", function(test) {
- var x = scale.scaleLog().domain([1, 2]);
- test.inDelta(x(0.5), -1.0000000);
- test.inDelta(x(1.0), 0.0000000);
- test.inDelta(x(1.5), 0.5849625);
- test.inDelta(x(2.0), 1.0000000);
- test.inDelta(x(2.5), 1.3219281);
- test.end();
-});
-
-tape("log.invert(y) maps a number y to a number x", function(test) {
- var x = scale.scaleLog().domain([1, 2]);
- test.inDelta(x.invert(-1.0000000), 0.5);
- test.inDelta(x.invert( 0.0000000), 1.0);
- test.inDelta(x.invert( 0.5849625), 1.5);
- test.inDelta(x.invert( 1.0000000), 2.0);
- test.inDelta(x.invert( 1.3219281), 2.5);
- test.end();
-});
-
-tape("log.invert(y) coerces y to number", function(test) {
- var x = scale.scaleLog().range(["0", "2"]);
- test.inDelta(x.invert("1"), 3.1622777);
+ assertInDelta(x.invert(-0.1), 10);
+ assertInDelta(x.invert(0.30103), 5);
+ assertInDelta(x.invert(1.5), 1);
+});
+
+it("log(x) maps a number x to a number y", () => {
+ const x = scaleLog().domain([1, 2]);
+ assertInDelta(x(0.5), -1.0000000);
+ assertInDelta(x(1.0), 0.0000000);
+ assertInDelta(x(1.5), 0.5849625);
+ assertInDelta(x(2.0), 1.0000000);
+ assertInDelta(x(2.5), 1.3219281);
+});
+
+it("log.invert(y) maps a number y to a number x", () => {
+ const x = scaleLog().domain([1, 2]);
+ assertInDelta(x.invert(-1.0000000), 0.5);
+ assertInDelta(x.invert( 0.0000000), 1.0);
+ assertInDelta(x.invert( 0.5849625), 1.5);
+ assertInDelta(x.invert( 1.0000000), 2.0);
+ assertInDelta(x.invert( 1.3219281), 2.5);
+});
+
+it("log.invert(y) coerces y to number", () => {
+ const x = scaleLog().range(["0", "2"]);
+ assertInDelta(x.invert("1"), 3.1622777);
x.range([new Date(1990, 0, 1), new Date(1991, 0, 1)]);
- test.inDelta(x.invert(new Date(1990, 6, 2, 13)), 3.1622777);
+ assertInDelta(x.invert(new Date(1990, 6, 2, 13)), 3.1622777);
x.range(["#000", "#fff"]);
- test.ok(Number.isNaN(x.invert("#999")));
- test.end();
+ assert(Number.isNaN(x.invert("#999")));
});
-tape("log.base(b) sets the log base, changing the ticks", function(test) {
- var x = scale.scaleLog().domain([1, 32]);
- test.deepEqual(x.base(2).ticks().map(x.tickFormat()), ["1", "2", "4", "8", "16", "32"]);
- test.deepEqual(x.base(Math.E).ticks().map(x.tickFormat()), ["1", "2.71828182846", "7.38905609893", "20.0855369232"]);
- test.end();
+it("log.base(b) sets the log base, changing the ticks", () => {
+ const x = scaleLog().domain([1, 32]);
+ assert.deepStrictEqual(x.base(2).ticks().map(x.tickFormat()), ["1", "2", "4", "8", "16", "32"]);
+ assert.deepStrictEqual(x.base(Math.E).ticks().map(x.tickFormat()), ["1", "2.71828182846", "7.38905609893", "20.0855369232"]);
});
-tape("log.nice() nices the domain, extending it to powers of ten", function(test) {
- var x = scale.scaleLog().domain([1.1, 10.9]).nice();
- test.deepEqual(x.domain(), [1, 100]);
+it("log.nice() nices the domain, extending it to powers of ten", () => {
+ const x = scaleLog().domain([1.1, 10.9]).nice();
+ assert.deepStrictEqual(x.domain(), [1, 100]);
x.domain([10.9, 1.1]).nice();
- test.deepEqual(x.domain(), [100, 1]);
+ assert.deepStrictEqual(x.domain(), [100, 1]);
x.domain([0.7, 11.001]).nice();
- test.deepEqual(x.domain(), [0.1, 100]);
+ assert.deepStrictEqual(x.domain(), [0.1, 100]);
x.domain([123.1, 6.7]).nice();
- test.deepEqual(x.domain(), [1000, 1]);
+ assert.deepStrictEqual(x.domain(), [1000, 1]);
x.domain([0.01, 0.49]).nice();
- test.deepEqual(x.domain(), [0.01, 1]);
+ assert.deepStrictEqual(x.domain(), [0.01, 1]);
x.domain([1.5, 50]).nice();
- test.deepEqual(x.domain(), [1, 100]);
- test.inDelta(x(1), 0);
- test.inDelta(x(100), 1);
- test.end();
+ assert.deepStrictEqual(x.domain(), [1, 100]);
+ assertInDelta(x(1), 0);
+ assertInDelta(x(100), 1);
});
-tape("log.nice() works on degenerate domains", function(test) {
- var x = scale.scaleLog().domain([0, 0]).nice();
- test.deepEqual(x.domain(), [0, 0]);
+it("log.nice() works on degenerate domains", () => {
+ const x = scaleLog().domain([0, 0]).nice();
+ assert.deepStrictEqual(x.domain(), [0, 0]);
x.domain([0.5, 0.5]).nice();
- test.deepEqual(x.domain(), [0.1, 1]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [0.1, 1]);
});
-tape("log.nice() on a polylog domain only affects the extent", function(test) {
- var x = scale.scaleLog().domain([1.1, 1.5, 10.9]).nice();
- test.deepEqual(x.domain(), [1, 1.5, 100]);
+it("log.nice() on a polylog domain only affects the extent", () => {
+ const x = scaleLog().domain([1.1, 1.5, 10.9]).nice();
+ assert.deepStrictEqual(x.domain(), [1, 1.5, 100]);
x.domain([-123.1, -1.5, -0.5]).nice();
- test.deepEqual(x.domain(), [-1000, -1.5, -0.1]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [-1000, -1.5, -0.1]);
});
-tape("log.copy() isolates changes to the domain", function(test) {
- var x = scale.scaleLog(), y = x.copy();
+it("log.copy() isolates changes to the domain", () => {
+ const x = scaleLog(), y = x.copy();
x.domain([10, 100]);
- test.deepEqual(y.domain(), [1, 10]);
- test.inDelta(x(10), 0);
- test.inDelta(y(1), 0);
+ assert.deepStrictEqual(y.domain(), [1, 10]);
+ assertInDelta(x(10), 0);
+ assertInDelta(y(1), 0);
y.domain([100, 1000]);
- test.inDelta(x(100), 1);
- test.inDelta(y(100), 0);
- test.deepEqual(x.domain(), [10, 100]);
- test.deepEqual(y.domain(), [100, 1000]);
- test.end();
-});
-
-tape("log.copy() isolates changes to the domain via nice", function(test) {
- var x = scale.scaleLog().domain([1.5, 50]), y = x.copy().nice();
- test.deepEqual(x.domain(), [1.5, 50]);
- test.inDelta(x(1.5), 0);
- test.inDelta(x(50), 1);
- test.inDelta(x.invert(0), 1.5);
- test.inDelta(x.invert(1), 50);
- test.deepEqual(y.domain(), [1, 100]);
- test.inDelta(y(1), 0);
- test.inDelta(y(100), 1);
- test.inDelta(y.invert(0), 1);
- test.inDelta(y.invert(1), 100);
- test.end();
-});
-
-tape("log.copy() isolates changes to the range", function(test) {
- var x = scale.scaleLog(), y = x.copy();
+ assertInDelta(x(100), 1);
+ assertInDelta(y(100), 0);
+ assert.deepStrictEqual(x.domain(), [10, 100]);
+ assert.deepStrictEqual(y.domain(), [100, 1000]);
+});
+
+it("log.copy() isolates changes to the domain via nice", () => {
+ const x = scaleLog().domain([1.5, 50]), y = x.copy().nice();
+ assert.deepStrictEqual(x.domain(), [1.5, 50]);
+ assertInDelta(x(1.5), 0);
+ assertInDelta(x(50), 1);
+ assertInDelta(x.invert(0), 1.5);
+ assertInDelta(x.invert(1), 50);
+ assert.deepStrictEqual(y.domain(), [1, 100]);
+ assertInDelta(y(1), 0);
+ assertInDelta(y(100), 1);
+ assertInDelta(y.invert(0), 1);
+ assertInDelta(y.invert(1), 100);
+});
+
+it("log.copy() isolates changes to the range", () => {
+ const x = scaleLog(), y = x.copy();
x.range([1, 2]);
- test.inDelta(x.invert(1), 1);
- test.inDelta(y.invert(1), 10);
- test.deepEqual(y.range(), [0, 1]);
+ assertInDelta(x.invert(1), 1);
+ assertInDelta(y.invert(1), 10);
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.inDelta(x.invert(2), 10);
- test.inDelta(y.invert(2), 1);
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
+ assertInDelta(x.invert(2), 10);
+ assertInDelta(y.invert(2), 1);
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
});
-tape("log.copy() isolates changes to the interpolator", function(test) {
- var x = scale.scaleLog().range(["red", "blue"]), y = x.copy();
- x.interpolate(interpolate.interpolateHsl);
- test.equal(x(5), "rgb(154, 0, 255)");
- test.equal(y(5), "rgb(77, 0, 178)");
- test.equal(y.interpolate(), interpolate.interpolate);
- test.end();
+it("log.copy() isolates changes to the interpolator", () => {
+ const x = scaleLog().range(["red", "blue"]), y = x.copy();
+ x.interpolate(interpolateHsl);
+ assert.strictEqual(x(5), "rgb(154, 0, 255)");
+ assert.strictEqual(y(5), "rgb(77, 0, 178)");
+ assert.strictEqual(y.interpolate(), interpolate);
});
-tape("log.copy() isolates changes to clamping", function(test) {
- var x = scale.scaleLog().clamp(true), y = x.copy();
+it("log.copy() isolates changes to clamping", () => {
+ const x = scaleLog().clamp(true), y = x.copy();
x.clamp(false);
- test.inDelta(x(0.5), -0.30103);
- test.inDelta(y(0.5), 0);
- test.equal(y.clamp(), true);
+ assertInDelta(x(0.5), -0.30103);
+ assertInDelta(y(0.5), 0);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.inDelta(x(20), 1.30103);
- test.inDelta(y(20), 1.30103);
- test.equal(x.clamp(), false);
- test.end();
+ assertInDelta(x(20), 1.30103);
+ assertInDelta(y(20), 1.30103);
+ assert.strictEqual(x.clamp(), false);
});
-tape("log.ticks() generates the expected power-of-ten for ascending ticks", function(test) {
- var s = scale.scaleLog();
- test.deepEqual(s.domain([1e-1, 1e1]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
- test.deepEqual(s.domain([1e-1, 1e0]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]);
- test.deepEqual(s.domain([-1e0, -1e-1]).ticks().map(round), [-1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1]);
- test.end();
+it("log.ticks() generates the expected power-of-ten for ascending ticks", () => {
+ const s = scaleLog();
+ assert.deepStrictEqual(s.domain([1e-1, 1e1]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+ assert.deepStrictEqual(s.domain([1e-1, 1e0]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]);
+ assert.deepStrictEqual(s.domain([-1e0, -1e-1]).ticks().map(round), [-1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1]);
});
-tape("log.ticks() generates the expected power-of-ten ticks for descending domains", function(test) {
- var s = scale.scaleLog();
- test.deepEqual(s.domain([-1e-1, -1e1]).ticks().map(round), [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1].reverse());
- test.deepEqual(s.domain([-1e-1, -1e0]).ticks().map(round), [-1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1].reverse());
- test.deepEqual(s.domain([1e0, 1e-1]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1].reverse());
- test.end();
+it("log.ticks() generates the expected power-of-ten ticks for descending domains", () => {
+ const s = scaleLog();
+ assert.deepStrictEqual(s.domain([-1e-1, -1e1]).ticks().map(round), [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1].reverse());
+ assert.deepStrictEqual(s.domain([-1e-1, -1e0]).ticks().map(round), [-1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1].reverse());
+ assert.deepStrictEqual(s.domain([1e0, 1e-1]).ticks().map(round), [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1].reverse());
});
-tape("log.ticks() generates the expected power-of-ten ticks for small domains", function(test) {
- var s = scale.scaleLog();
- test.deepEqual(s.domain([1, 5]).ticks(), [1, 2, 3, 4, 5]);
- test.deepEqual(s.domain([5, 1]).ticks(), [5, 4, 3, 2, 1]);
- test.deepEqual(s.domain([-1, -5]).ticks(), [-1, -2, -3, -4, -5]);
- test.deepEqual(s.domain([-5, -1]).ticks(), [-5, -4, -3, -2, -1]);
- test.deepEqual(s.domain([286.9252014, 329.4978332]).ticks(1), [300]);
- test.deepEqual(s.domain([286.9252014, 329.4978332]).ticks(2), [300]);
- test.deepEqual(s.domain([286.9252014, 329.4978332]).ticks(3), [300, 320]);
- test.deepEqual(s.domain([286.9252014, 329.4978332]).ticks(4), [290, 300, 310, 320]);
- test.deepEqual(s.domain([286.9252014, 329.4978332]).ticks(), [290, 295, 300, 305, 310, 315, 320, 325]);
- test.end();
+it("log.ticks() generates the expected power-of-ten ticks for small domains", () => {
+ const s = scaleLog();
+ assert.deepStrictEqual(s.domain([1, 5]).ticks(), [1, 2, 3, 4, 5]);
+ assert.deepStrictEqual(s.domain([5, 1]).ticks(), [5, 4, 3, 2, 1]);
+ assert.deepStrictEqual(s.domain([-1, -5]).ticks(), [-1, -2, -3, -4, -5]);
+ assert.deepStrictEqual(s.domain([-5, -1]).ticks(), [-5, -4, -3, -2, -1]);
+ assert.deepStrictEqual(s.domain([286.9252014, 329.4978332]).ticks(1), [300]);
+ assert.deepStrictEqual(s.domain([286.9252014, 329.4978332]).ticks(2), [300]);
+ assert.deepStrictEqual(s.domain([286.9252014, 329.4978332]).ticks(3), [300, 320]);
+ assert.deepStrictEqual(s.domain([286.9252014, 329.4978332]).ticks(4), [290, 300, 310, 320]);
+ assert.deepStrictEqual(s.domain([286.9252014, 329.4978332]).ticks(), [290, 295, 300, 305, 310, 315, 320, 325]);
});
-tape("log.ticks() generates linear ticks when the domain extent is small", function(test) {
- var s = scale.scaleLog();
- test.deepEqual(s.domain([41, 42]).ticks(), [41, 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8, 41.9, 42]);
- test.deepEqual(s.domain([42, 41]).ticks(), [42, 41.9, 41.8, 41.7, 41.6, 41.5, 41.4, 41.3, 41.2, 41.1, 41]);
- test.deepEqual(s.domain([1600, 1400]).ticks(), [1600, 1580, 1560, 1540, 1520, 1500, 1480, 1460, 1440, 1420, 1400]);
- test.end();
+it("log.ticks() generates linear ticks when the domain extent is small", () => {
+ const s = scaleLog();
+ assert.deepStrictEqual(s.domain([41, 42]).ticks(), [41, 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8, 41.9, 42]);
+ assert.deepStrictEqual(s.domain([42, 41]).ticks(), [42, 41.9, 41.8, 41.7, 41.6, 41.5, 41.4, 41.3, 41.2, 41.1, 41]);
+ assert.deepStrictEqual(s.domain([1600, 1400]).ticks(), [1600, 1580, 1560, 1540, 1520, 1500, 1480, 1460, 1440, 1420, 1400]);
});
-tape("log.base(base).ticks() generates the expected power-of-base ticks", function(test) {
- var s = scale.scaleLog().base(Math.E);
- test.deepEqual(s.domain([0.1, 100]).ticks().map(round), [0.135335283237, 0.367879441171, 1, 2.718281828459, 7.389056098931, 20.085536923188, 54.598150033144]);
- test.end();
+it("log.base(base).ticks() generates the expected power-of-base ticks", () => {
+ const s = scaleLog().base(Math.E);
+ assert.deepStrictEqual(s.domain([0.1, 100]).ticks().map(round), [0.135335283237, 0.367879441171, 1, 2.718281828459, 7.389056098931, 20.085536923188, 54.598150033144]);
});
-tape("log.tickFormat() is equivalent to log.tickFormat(10)", function(test) {
- var s = scale.scaleLog();
- test.deepEqual(s.domain([1e-1, 1e1]).ticks().map(s.tickFormat()), ["1e-1", "2e-1", "3e-1", "4e-1", "5e-1", "", "", "", "", "1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "", "", "", "", "1e+1"]);
- test.end();
+it("log.tickFormat() is equivalent to log.tickFormat(10)", () => {
+ const s = scaleLog();
+ assert.deepStrictEqual(s.domain([1e-1, 1e1]).ticks().map(s.tickFormat()), ["1e-1", "2e-1", "3e-1", "4e-1", "5e-1", "", "", "", "", "1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "", "", "", "", "1e+1"]);
});
-tape("log.tickFormat(count) returns a filtered \".0e\" format", function(test) {
- var s = scale.scaleLog(), t = s.domain([1e-1, 1e1]).ticks();
- test.deepEqual(t.map(s.tickFormat(10)), ["1e-1", "2e-1", "3e-1", "4e-1", "5e-1", "", "", "", "", "1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "", "", "", "", "1e+1"]);
- test.deepEqual(t.map(s.tickFormat(5)), ["1e-1", "2e-1", "", "", "", "", "", "", "", "1e+0", "2e+0", "", "", "", "", "", "", "", "1e+1"]);
- test.deepEqual(t.map(s.tickFormat(1)), ["1e-1", "", "", "", "", "", "", "", "", "1e+0", "", "", "", "", "", "", "", "", "1e+1"]);
- test.deepEqual(t.map(s.tickFormat(0)), ["1e-1", "", "", "", "", "", "", "", "", "1e+0", "", "", "", "", "", "", "", "", "1e+1"]);
- test.end();
+it("log.tickFormat(count) returns a filtered \".0e\" format", () => {
+ const s = scaleLog(), t = s.domain([1e-1, 1e1]).ticks();
+ assert.deepStrictEqual(t.map(s.tickFormat(10)), ["1e-1", "2e-1", "3e-1", "4e-1", "5e-1", "", "", "", "", "1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "", "", "", "", "1e+1"]);
+ assert.deepStrictEqual(t.map(s.tickFormat(5)), ["1e-1", "2e-1", "", "", "", "", "", "", "", "1e+0", "2e+0", "", "", "", "", "", "", "", "1e+1"]);
+ assert.deepStrictEqual(t.map(s.tickFormat(1)), ["1e-1", "", "", "", "", "", "", "", "", "1e+0", "", "", "", "", "", "", "", "", "1e+1"]);
+ assert.deepStrictEqual(t.map(s.tickFormat(0)), ["1e-1", "", "", "", "", "", "", "", "", "1e+0", "", "", "", "", "", "", "", "", "1e+1"]);
});
-tape("log.tickFormat(count, format) returns the specified format, filtered", function(test) {
- var s = scale.scaleLog(), t = s.domain([1e-1, 1e1]).ticks();
- test.deepEqual(t.map(s.tickFormat(10, "+")), ["+0.1", "+0.2", "+0.3", "+0.4", "+0.5", "", "", "", "", "+1", "+2", "+3", "+4", "+5", "", "", "", "", "+10"]);
- test.end();
+it("log.tickFormat(count, format) returns the specified format, filtered", () => {
+ const s = scaleLog(), t = s.domain([1e-1, 1e1]).ticks();
+ assert.deepStrictEqual(t.map(s.tickFormat(10, "+")), ["+0.1", "+0.2", "+0.3", "+0.4", "+0.5", "", "", "", "", "+1", "+2", "+3", "+4", "+5", "", "", "", "", "+10"]);
});
-tape("log.base(base).tickFormat() returns the \",\" format", function(test) {
- var s = scale.scaleLog().base(Math.E);
- test.deepEqual(s.domain([1e-1, 1e1]).ticks().map(s.tickFormat()), ["0.135335283237", "0.367879441171", "1", "2.71828182846", "7.38905609893"]);
- test.end();
+it("log.base(base).tickFormat() returns the \",\" format", () => {
+ const s = scaleLog().base(Math.E);
+ assert.deepStrictEqual(s.domain([1e-1, 1e1]).ticks().map(s.tickFormat()), ["0.135335283237", "0.367879441171", "1", "2.71828182846", "7.38905609893"]);
});
-tape("log.base(base).tickFormat(count) returns a filtered \",\" format", function(test) {
- var s = scale.scaleLog().base(16), t = s.domain([1e-1, 1e1]).ticks();
- test.deepEqual(t.map(s.tickFormat(10)), ["0.125", "0.1875", "0.25", "0.3125", "0.375", "", "", "", "", "", "", "", "", "", "1", "2", "3", "4", "5", "6", "", "", "", ""]);
- test.deepEqual(t.map(s.tickFormat(5)), ["0.125", "0.1875", "", "", "", "", "", "", "", "", "", "", "", "", "1", "2", "3", "", "", "", "", "", "", ""]);
- test.deepEqual(t.map(s.tickFormat(1)), ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "1", "", "", "", "", "", "", "", "", ""]);
- test.end();
+it("log.base(base).tickFormat(count) returns a filtered \",\" format", () => {
+ const s = scaleLog().base(16), t = s.domain([1e-1, 1e1]).ticks();
+ assert.deepStrictEqual(t.map(s.tickFormat(10)), ["0.125", "0.1875", "0.25", "0.3125", "0.375", "", "", "", "", "", "", "", "", "", "1", "2", "3", "4", "5", "6", "", "", "", ""]);
+ assert.deepStrictEqual(t.map(s.tickFormat(5)), ["0.125", "0.1875", "", "", "", "", "", "", "", "", "", "", "", "", "1", "2", "3", "", "", "", "", "", "", ""]);
+ assert.deepStrictEqual(t.map(s.tickFormat(1)), ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "1", "", "", "", "", "", "", "", "", ""]);
});
-tape("log.ticks() generates log ticks", function(test) {
- var x = scale.scaleLog();
- test.deepEqual(x.ticks().map(x.tickFormat(Infinity)), [
+it("log.ticks() generates log ticks", () => {
+ const x = scaleLog();
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(Infinity)), [
"1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "6e+0", "7e+0", "8e+0", "9e+0",
"1e+1"
]);
x.domain([100, 1]);
- test.deepEqual(x.ticks().map(x.tickFormat(Infinity)), [
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(Infinity)), [
"1e+2",
"9e+1", "8e+1", "7e+1", "6e+1", "5e+1", "4e+1", "3e+1", "2e+1", "1e+1",
"9e+0", "8e+0", "7e+0", "6e+0", "5e+0", "4e+0", "3e+0", "2e+0", "1e+0"
]);
x.domain([0.49999, 0.006029505943610648]);
- test.deepEqual(x.ticks().map(x.tickFormat(Infinity)), [
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(Infinity)), [
"4e-1", "3e-1", "2e-1", "1e-1",
"9e-2", "8e-2", "7e-2", "6e-2", "5e-2", "4e-2", "3e-2", "2e-2", "1e-2",
"9e-3", "8e-3", "7e-3"
]);
x.domain([0.95, 1.05e8]);
- test.deepEqual(x.ticks().map(x.tickFormat(8)).filter(String), [
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(8)).filter(String), [
"1e+0", "1e+1", "1e+2", "1e+3", "1e+4", "1e+5", "1e+6", "1e+7", "1e+8"
]);
- test.end();
});
-tape("log.tickFormat(count) filters ticks to about count", function(test) {
- var x = scale.scaleLog();
- test.deepEqual(x.ticks().map(x.tickFormat(5)), [
+it("log.tickFormat(count) filters ticks to about count", () => {
+ const x = scaleLog();
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(5)), [
"1e+0", "2e+0", "3e+0", "4e+0", "5e+0", "", "", "", "",
"1e+1"
]);
x.domain([100, 1]);
- test.deepEqual(x.ticks().map(x.tickFormat(10)), [
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(10)), [
"1e+2",
"", "", "", "", "5e+1", "4e+1", "3e+1", "2e+1", "1e+1",
"", "", "", "", "5e+0", "4e+0", "3e+0", "2e+0", "1e+0"
]);
- test.end();
});
-tape("log.ticks(count) filters powers-of-ten ticks for huge domains", function(test) {
- var x = scale.scaleLog().domain([1e10, 1]);
- test.deepEqual(x.ticks().map(x.tickFormat()), ["1e+10", "1e+9", "1e+8", "1e+7", "1e+6", "1e+5", "1e+4", "1e+3", "1e+2", "1e+1", "1e+0"]);
+it("log.ticks(count) filters powers-of-ten ticks for huge domains", () => {
+ const x = scaleLog().domain([1e10, 1]);
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat()), ["1e+10", "1e+9", "1e+8", "1e+7", "1e+6", "1e+5", "1e+4", "1e+3", "1e+2", "1e+1", "1e+0"]);
x.domain([1e-29, 1e-1]);
- test.deepEqual(x.ticks().map(x.tickFormat()), ["1e-28", "1e-26", "1e-24", "1e-22", "1e-20", "1e-18", "1e-16", "1e-14", "1e-12", "1e-10", "1e-8", "1e-6", "1e-4", "1e-2"]);
- test.end();
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat()), ["1e-28", "1e-26", "1e-24", "1e-22", "1e-20", "1e-18", "1e-16", "1e-14", "1e-12", "1e-10", "1e-8", "1e-6", "1e-4", "1e-2"]);
});
-tape("log.ticks() generates ticks that cover the domain", function(test) {
- var x = scale.scaleLog().domain([0.01, 10000]);
- test.deepEqual(x.ticks(20).map(x.tickFormat(20)), [
+it("log.ticks() generates ticks that cover the domain", () => {
+ const x = scaleLog().domain([0.01, 10000]);
+ assert.deepStrictEqual(x.ticks(20).map(x.tickFormat(20)), [
"1e-2", "2e-2", "3e-2", "", "", "", "", "", "",
"1e-1", "2e-1", "3e-1", "", "", "", "", "", "",
"1e+0", "2e+0", "3e+0", "", "", "", "", "", "",
@@ -420,12 +374,11 @@ tape("log.ticks() generates ticks that cover the domain", function(test) {
"1e+3", "2e+3", "3e+3", "", "", "", "", "", "",
"1e+4"
]);
- test.end();
});
-tape("log.ticks() generates ticks that cover the niced domain", function(test) {
- var x = scale.scaleLog().domain([0.0124123, 1230.4]).nice();
- test.deepEqual(x.ticks(20).map(x.tickFormat(20)), [
+it("log.ticks() generates ticks that cover the niced domain", () => {
+ const x = scaleLog().domain([0.0124123, 1230.4]).nice();
+ assert.deepStrictEqual(x.ticks(20).map(x.tickFormat(20)), [
"1e-2", "2e-2", "3e-2", "", "", "", "", "", "",
"1e-1", "2e-1", "3e-1", "", "", "", "", "", "",
"1e+0", "2e+0", "3e+0", "", "", "", "", "", "",
@@ -434,40 +387,36 @@ tape("log.ticks() generates ticks that cover the niced domain", function(test) {
"1e+3", "2e+3", "3e+3", "", "", "", "", "", "",
"1e+4"
]);
- test.end();
});
-tape("log.tickFormat(count, format) returns a filtered format", function(test) {
- var x = scale.scaleLog().domain([1000.1, 1]);
- test.deepEqual(x.ticks().map(x.tickFormat(10, format.format("+,d"))), [
+it("log.tickFormat(count, format) returns a filtered format", () => {
+ const x = scaleLog().domain([1000.1, 1]);
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(10, format("+,d"))), [
"+1,000",
"", "", "", "", "", "", "+300", "+200", "+100",
"", "", "", "", "", "", "+30", "+20", "+10",
"", "", "", "", "", "", "+3", "+2", "+1"
]);
- test.end();
});
-tape("log.tickFormat(count, specifier) returns a filtered format", function(test) {
- var x = scale.scaleLog().domain([1000.1, 1]);
- test.deepEqual(x.ticks().map(x.tickFormat(10, ".1s")), [
+it("log.tickFormat(count, specifier) returns a filtered format", () => {
+ const x = scaleLog().domain([1000.1, 1]);
+ assert.deepStrictEqual(x.ticks().map(x.tickFormat(10, ".1s")), [
"1k",
"", "", "", "", "", "", "300", "200", "100",
"", "", "", "", "", "", "30", "20", "10",
"", "", "", "", "", "", "3", "2", "1"
]);
- test.end();
-});
-
-tape("log.ticks() returns the empty array when the domain is degenerate", function(test) {
- var x = scale.scaleLog();
- test.deepEqual(x.domain([0, 1]).ticks(), []);
- test.deepEqual(x.domain([1, 0]).ticks(), []);
- test.deepEqual(x.domain([0, -1]).ticks(), []);
- test.deepEqual(x.domain([-1, 0]).ticks(), []);
- test.deepEqual(x.domain([-1, 1]).ticks(), []);
- test.deepEqual(x.domain([0, 0]).ticks(), []);
- test.end();
+});
+
+it("log.ticks() returns the empty array when the domain is degenerate", () => {
+ const x = scaleLog();
+ assert.deepStrictEqual(x.domain([0, 1]).ticks(), []);
+ assert.deepStrictEqual(x.domain([1, 0]).ticks(), []);
+ assert.deepStrictEqual(x.domain([0, -1]).ticks(), []);
+ assert.deepStrictEqual(x.domain([-1, 0]).ticks(), []);
+ assert.deepStrictEqual(x.domain([-1, 1]).ticks(), []);
+ assert.deepStrictEqual(x.domain([0, 0]).ticks(), []);
});
function round(x) {
diff --git a/test/ordinal-test.js b/test/ordinal-test.js
index b8b10ff..4bbf1d1 100644
--- a/test/ordinal-test.js
+++ b/test/ordinal-test.js
@@ -1,216 +1,195 @@
-var tape = require("tape"),
- scale = require("../");
-
-tape("scaleOrdinal() has the expected defaults", function(test) {
- var s = scale.scaleOrdinal();
- test.deepEqual(s.domain(), []);
- test.deepEqual(s.range(), []);
- test.equal(s(0), undefined);
- test.equal(s.unknown(), scale.scaleImplicit);
- test.deepEqual(s.domain(), [0]);
- test.end();
-});
-
-tape("ordinal(x) maps a unique name x in the domain to the corresponding value y in the range", function(test) {
- var s = scale.scaleOrdinal().domain([0, 1]).range(["foo", "bar"]);
- test.equal(s(0), "foo");
- test.equal(s(1), "bar");
+import assert from "assert";
+import {scaleImplicit, scaleOrdinal} from "../src/index.js";
+
+it("scaleOrdinal() has the expected defaults", () => {
+ const s = scaleOrdinal();
+ assert.deepStrictEqual(s.domain(), []);
+ assert.deepStrictEqual(s.range(), []);
+ assert.strictEqual(s(0), undefined);
+ assert.strictEqual(s.unknown(), scaleImplicit);
+ assert.deepStrictEqual(s.domain(), [0]);
+});
+
+it("ordinal(x) maps a unique name x in the domain to the corresponding value y in the range", () => {
+ const s = scaleOrdinal().domain([0, 1]).range(["foo", "bar"]);
+ assert.strictEqual(s(0), "foo");
+ assert.strictEqual(s(1), "bar");
s.range(["a", "b", "c"]);
- test.equal(s(0), "a");
- test.equal(s("0"), "a");
- test.equal(s([0]), "a");
- test.equal(s(1), "b");
- test.equal(s(2.0), "c");
- test.equal(s(new Number(2)), "c");
- test.end();
-});
-
-tape("ordinal(x) implicitly extends the domain when a range is explicitly specified", function(test) {
- var s = scale.scaleOrdinal().range(["foo", "bar"]);
- test.deepEqual(s.domain(), []);
- test.equal(s(0), "foo");
- test.deepEqual(s.domain(), [0]);
- test.equal(s(1), "bar");
- test.deepEqual(s.domain(), [0, 1]);
- test.equal(s(0), "foo");
- test.deepEqual(s.domain(), [0, 1]);
- test.end();
-});
-
-tape("ordinal.domain(x) makes a copy of the domain", function(test) {
- var domain = ["red", "green"],
- s = scale.scaleOrdinal().domain(domain);
+ assert.strictEqual(s(0), "a");
+ assert.strictEqual(s("0"), "a");
+ assert.strictEqual(s([0]), "a");
+ assert.strictEqual(s(1), "b");
+ assert.strictEqual(s(2.0), "c");
+ assert.strictEqual(s(new Number(2)), "c");
+});
+
+it("ordinal(x) implicitly extends the domain when a range is explicitly specified", () => {
+ const s = scaleOrdinal().range(["foo", "bar"]);
+ assert.deepStrictEqual(s.domain(), []);
+ assert.strictEqual(s(0), "foo");
+ assert.deepStrictEqual(s.domain(), [0]);
+ assert.strictEqual(s(1), "bar");
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.strictEqual(s(0), "foo");
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+});
+
+it("ordinal.domain(x) makes a copy of the domain", () => {
+ const domain = ["red", "green"];
+ const s = scaleOrdinal().domain(domain);
domain.push("blue");
- test.deepEqual(s.domain(), ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(s.domain(), ["red", "green"]);
});
-tape("ordinal.domain() returns a copy of the domain", function(test) {
- var s = scale.scaleOrdinal().domain(["red", "green"]),
- domain = s.domain();
+it("ordinal.domain() returns a copy of the domain", () => {
+ const s = scaleOrdinal().domain(["red", "green"]);
+ const domain = s.domain();
s("blue");
- test.deepEqual(domain, ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(domain, ["red", "green"]);
});
-tape("ordinal.domain() accepts an iterable", function(test) {
- var s = scale.scaleOrdinal().domain(new Set(["red", "green"]));
- test.deepEqual(s.domain(), ["red", "green"]);
- test.end();
+it("ordinal.domain() accepts an iterable", () => {
+ const s = scaleOrdinal().domain(new Set(["red", "green"]));
+ assert.deepStrictEqual(s.domain(), ["red", "green"]);
});
-tape("ordinal.domain() replaces previous domain values", function(test) {
- var s = scale.scaleOrdinal().range(["foo", "bar"]);
- test.equal(s(1), "foo");
- test.equal(s(0), "bar");
- test.deepEqual(s.domain(), [1, 0]);
+it("ordinal.domain() replaces previous domain values", () => {
+ const s = scaleOrdinal().range(["foo", "bar"]);
+ assert.strictEqual(s(1), "foo");
+ assert.strictEqual(s(0), "bar");
+ assert.deepStrictEqual(s.domain(), [1, 0]);
s.domain(["0", "1"]);
- test.equal(s(0), "foo"); // it changed!
- test.equal(s(1), "bar");
- test.deepEqual(s.domain(), ["0", "1"]);
- test.end();
+ assert.strictEqual(s(0), "foo"); // it changed!
+ assert.strictEqual(s(1), "bar");
+ assert.deepStrictEqual(s.domain(), ["0", "1"]);
});
-tape("ordinal.domain() uniqueness is based on string coercion", function(test) {
- var s = scale.scaleOrdinal().domain(["foo"]).range([42, 43, 44]);
- test.equal(s(new String("foo")), 42);
- test.equal(s({toString: function() { return "foo"; }}), 42);
- test.equal(s({toString: function() { return "bar"; }}), 43);
- test.end();
+it("ordinal.domain() uniqueness is based on string coercion", () => {
+ const s = scaleOrdinal().domain(["foo"]).range([42, 43, 44]);
+ assert.strictEqual(s(new String("foo")), 42);
+ assert.strictEqual(s({toString: function() { return "foo"; }}), 42);
+ assert.strictEqual(s({toString: function() { return "bar"; }}), 43);
});
-tape("ordinal.domain() does not coerce domain values to strings", function(test) {
- var s = scale.scaleOrdinal().domain([0, 1]);
- test.deepEqual(s.domain(), [0, 1]);
- test.equal(typeof s.domain()[0], "number");
- test.equal(typeof s.domain()[1], "number");
- test.end();
+it("ordinal.domain() does not coerce domain values to strings", () => {
+ const s = scaleOrdinal().domain([0, 1]);
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.strictEqual(typeof s.domain()[0], "number");
+ assert.strictEqual(typeof s.domain()[1], "number");
});
-tape("ordinal.domain() does not barf on object built-ins", function(test) {
- var s = scale.scaleOrdinal().domain(["__proto__", "hasOwnProperty"]).range([42, 43]);
- test.equal(s("__proto__"), 42);
- test.equal(s("hasOwnProperty"), 43);
- test.deepEqual(s.domain(), ["__proto__", "hasOwnProperty"]);
- test.end();
+it("ordinal.domain() does not barf on object built-ins", () => {
+ const s = scaleOrdinal().domain(["__proto__", "hasOwnProperty"]).range([42, 43]);
+ assert.strictEqual(s("__proto__"), 42);
+ assert.strictEqual(s("hasOwnProperty"), 43);
+ assert.deepStrictEqual(s.domain(), ["__proto__", "hasOwnProperty"]);
});
-tape("ordinal.domain() is ordered by appearance", function(test) {
- var s = scale.scaleOrdinal();
+it("ordinal.domain() is ordered by appearance", () => {
+ const s = scaleOrdinal();
s("foo");
s("bar");
s("baz");
- test.deepEqual(s.domain(), ["foo", "bar", "baz"]);
+ assert.deepStrictEqual(s.domain(), ["foo", "bar", "baz"]);
s.domain(["baz", "bar"]);
s("foo");
- test.deepEqual(s.domain(), ["baz", "bar", "foo"]);
+ assert.deepStrictEqual(s.domain(), ["baz", "bar", "foo"]);
s.domain(["baz", "foo"]);
- test.deepEqual(s.domain(), ["baz", "foo"]);
+ assert.deepStrictEqual(s.domain(), ["baz", "foo"]);
s.domain([]);
s("foo");
s("bar");
- test.deepEqual(s.domain(), ["foo", "bar"]);
- test.end();
+ assert.deepStrictEqual(s.domain(), ["foo", "bar"]);
});
-tape("ordinal.range(x) makes a copy of the range", function(test) {
- var range = ["red", "green"],
- s = scale.scaleOrdinal().range(range);
+it("ordinal.range(x) makes a copy of the range", () => {
+ const range = ["red", "green"];
+ const s = scaleOrdinal().range(range);
range.push("blue");
- test.deepEqual(s.range(), ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(s.range(), ["red", "green"]);
});
-tape("ordinal.range() accepts an iterable", function(test) {
- var s = scale.scaleOrdinal().range(new Set(["red", "green"]));
- test.deepEqual(s.range(), ["red", "green"]);
- test.end();
+it("ordinal.range() accepts an iterable", () => {
+ const s = scaleOrdinal().range(new Set(["red", "green"]));
+ assert.deepStrictEqual(s.range(), ["red", "green"]);
});
-tape("ordinal.range() returns a copy of the range", function(test) {
- var s = scale.scaleOrdinal().range(["red", "green"]),
- range = s.range();
- test.deepEqual(range, ["red", "green"]);
+it("ordinal.range() returns a copy of the range", () => {
+ const s = scaleOrdinal().range(["red", "green"]);
+ const range = s.range();
+ assert.deepStrictEqual(range, ["red", "green"]);
range.push("blue");
- test.deepEqual(s.range(), ["red", "green"]);
- test.end();
+ assert.deepStrictEqual(s.range(), ["red", "green"]);
});
-tape("ordinal.range(values) does not discard implicit domain associations", function(test) {
- var s = scale.scaleOrdinal();
- test.equal(s(0), undefined);
- test.equal(s(1), undefined);
+it("ordinal.range(values) does not discard implicit domain associations", () => {
+ const s = scaleOrdinal();
+ assert.strictEqual(s(0), undefined);
+ assert.strictEqual(s(1), undefined);
s.range(["foo", "bar"]);
- test.equal(s(1), "bar");
- test.equal(s(0), "foo");
- test.end();
-});
-
-tape("ordinal(value) recycles values when exhausted", function(test) {
- var s = scale.scaleOrdinal().range(["a", "b", "c"]);
- test.equal(s(0), "a");
- test.equal(s(1), "b");
- test.equal(s(2), "c");
- test.equal(s(3), "a");
- test.equal(s(4), "b");
- test.equal(s(5), "c");
- test.equal(s(2), "c");
- test.equal(s(1), "b");
- test.equal(s(0), "a");
- test.end();
-});
-
-tape("ordinal.unknown(x) sets the output value for unknown inputs", function(test) {
- var s = scale.scaleOrdinal().domain(["foo", "bar"]).unknown("gray").range(["red", "blue"]);
- test.equal(s("foo"), "red");
- test.equal(s("bar"), "blue");
- test.equal(s("baz"), "gray");
- test.equal(s("quux"), "gray");
- test.end();
-});
-
-tape("ordinal.unknown(x) prevents implicit domain extension if x is not implicit", function(test) {
- var s = scale.scaleOrdinal().domain(["foo", "bar"]).unknown(undefined).range(["red", "blue"]);
- test.equal(s("baz"), undefined);
- test.deepEqual(s.domain(), ["foo", "bar"]);
- test.end();
-});
-
-tape("ordinal.copy() copies all fields", function(test) {
- var s1 = scale.scaleOrdinal().domain([1, 2]).range(["red", "green"]).unknown("gray"),
- s2 = s1.copy();
- test.deepEqual(s2.domain(), s1.domain());
- test.deepEqual(s2.range(), s1.range());
- test.deepEqual(s2.unknown(), s1.unknown());
- test.end();
-});
-
-tape("ordinal.copy() changes to the domain are isolated", function(test) {
- var s1 = scale.scaleOrdinal().range(["foo", "bar"]),
- s2 = s1.copy();
+ assert.strictEqual(s(1), "bar");
+ assert.strictEqual(s(0), "foo");
+});
+
+it("ordinal(value) recycles values when exhausted", () => {
+ const s = scaleOrdinal().range(["a", "b", "c"]);
+ assert.strictEqual(s(0), "a");
+ assert.strictEqual(s(1), "b");
+ assert.strictEqual(s(2), "c");
+ assert.strictEqual(s(3), "a");
+ assert.strictEqual(s(4), "b");
+ assert.strictEqual(s(5), "c");
+ assert.strictEqual(s(2), "c");
+ assert.strictEqual(s(1), "b");
+ assert.strictEqual(s(0), "a");
+});
+
+it("ordinal.unknown(x) sets the output value for unknown inputs", () => {
+ const s = scaleOrdinal().domain(["foo", "bar"]).unknown("gray").range(["red", "blue"]);
+ assert.strictEqual(s("foo"), "red");
+ assert.strictEqual(s("bar"), "blue");
+ assert.strictEqual(s("baz"), "gray");
+ assert.strictEqual(s("quux"), "gray");
+});
+
+it("ordinal.unknown(x) prevents implicit domain extension if x is not implicit", () => {
+ const s = scaleOrdinal().domain(["foo", "bar"]).unknown(undefined).range(["red", "blue"]);
+ assert.strictEqual(s("baz"), undefined);
+ assert.deepStrictEqual(s.domain(), ["foo", "bar"]);
+});
+
+it("ordinal.copy() copies all fields", () => {
+ const s1 = scaleOrdinal().domain([1, 2]).range(["red", "green"]).unknown("gray");
+ const s2 = s1.copy();
+ assert.deepStrictEqual(s2.domain(), s1.domain());
+ assert.deepStrictEqual(s2.range(), s1.range());
+ assert.deepStrictEqual(s2.unknown(), s1.unknown());
+});
+
+it("ordinal.copy() changes to the domain are isolated", () => {
+ const s1 = scaleOrdinal().range(["foo", "bar"]);
+ const s2 = s1.copy();
s1.domain([1, 2]);
- test.deepEqual(s2.domain(), []);
- test.equal(s1(1), "foo");
- test.equal(s2(1), "foo");
+ assert.deepStrictEqual(s2.domain(), []);
+ assert.strictEqual(s1(1), "foo");
+ assert.strictEqual(s2(1), "foo");
s2.domain([2, 3]);
- test.equal(s1(2), "bar");
- test.equal(s2(2), "foo");
- test.deepEqual(s1.domain(), [1, 2]);
- test.deepEqual(s2.domain(), [2, 3]);
- test.end();
+ assert.strictEqual(s1(2), "bar");
+ assert.strictEqual(s2(2), "foo");
+ assert.deepStrictEqual(s1.domain(), [1, 2]);
+ assert.deepStrictEqual(s2.domain(), [2, 3]);
});
-tape("ordinal.copy() changes to the range are isolated", function(test) {
- var s1 = scale.scaleOrdinal().range(["foo", "bar"]),
- s2 = s1.copy();
+it("ordinal.copy() changes to the range are isolated", () => {
+ const s1 = scaleOrdinal().range(["foo", "bar"]);
+ const s2 = s1.copy();
s1.range(["bar", "foo"]);
- test.equal(s1(1), "bar");
- test.equal(s2(1), "foo");
- test.deepEqual(s2.range(), ["foo", "bar"]);
+ assert.strictEqual(s1(1), "bar");
+ assert.strictEqual(s2(1), "foo");
+ assert.deepStrictEqual(s2.range(), ["foo", "bar"]);
s2.range(["foo", "baz"]);
- test.equal(s1(2), "foo");
- test.equal(s2(2), "baz");
- test.deepEqual(s1.range(), ["bar", "foo"]);
- test.deepEqual(s2.range(), ["foo", "baz"]);
- test.end();
+ assert.strictEqual(s1(2), "foo");
+ assert.strictEqual(s2(2), "baz");
+ assert.deepStrictEqual(s1.range(), ["bar", "foo"]);
+ assert.deepStrictEqual(s2.range(), ["foo", "baz"]);
});
diff --git a/test/point-test.js b/test/point-test.js
index b61831d..6b2ec3a 100644
--- a/test/point-test.js
+++ b/test/point-test.js
@@ -1,51 +1,46 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleBand, scalePoint} from "../src/index.js";
-tape("scalePoint() has the expected defaults", function(test) {
- var s = scale.scalePoint();
- test.deepEqual(s.domain(), []);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.bandwidth(), 0);
- test.equal(s.step(), 1);
- test.equal(s.round(), false);
- test.equal(s.padding(), 0);
- test.equal(s.align(), 0.5);
- test.end();
+it("scalePoint() has the expected defaults", () => {
+ const s = scalePoint();
+ assert.deepStrictEqual(s.domain(), []);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.bandwidth(), 0);
+ assert.strictEqual(s.step(), 1);
+ assert.strictEqual(s.round(), false);
+ assert.strictEqual(s.padding(), 0);
+ assert.strictEqual(s.align(), 0.5);
});
-tape("scalePoint() does not expose paddingInner and paddingOuter", function(test) {
- var s = scale.scalePoint();
- test.equal(s.paddingInner, undefined);
- test.equal(s.paddingOuter, undefined);
- test.end();
+it("scalePoint() does not expose paddingInner and paddingOuter", () => {
+ const s = scalePoint();
+ assert.strictEqual(s.paddingInner, undefined);
+ assert.strictEqual(s.paddingOuter, undefined);
});
-tape("scalePoint() is similar to scaleBand().paddingInner(1)", function(test) {
- var p = scale.scalePoint().domain(["foo", "bar"]).range([0, 960]),
- b = scale.scaleBand().domain(["foo", "bar"]).range([0, 960]).paddingInner(1);
- test.deepEqual(p.domain().map(p), b.domain().map(b));
- test.equal(p.bandwidth(), b.bandwidth());
- test.equal(p.step(), b.step());
- test.end();
+it("scalePoint() is similar to scaleBand().paddingInner(1)", () => {
+ const p = scalePoint().domain(["foo", "bar"]).range([0, 960]);
+ const b = scaleBand().domain(["foo", "bar"]).range([0, 960]).paddingInner(1);
+ assert.deepStrictEqual(p.domain().map(p), b.domain().map(b));
+ assert.strictEqual(p.bandwidth(), b.bandwidth());
+ assert.strictEqual(p.step(), b.step());
});
-tape("point.padding(p) sets the band outer padding to p", function(test) {
- var p = scale.scalePoint().domain(["foo", "bar"]).range([0, 960]).padding(0.5),
- b = scale.scaleBand().domain(["foo", "bar"]).range([0, 960]).paddingInner(1).paddingOuter(0.5);
- test.deepEqual(p.domain().map(p), b.domain().map(b));
- test.equal(p.bandwidth(), b.bandwidth());
- test.equal(p.step(), b.step());
- test.end();
+it("point.padding(p) sets the band outer padding to p", () => {
+ const p = scalePoint().domain(["foo", "bar"]).range([0, 960]).padding(0.5);
+ const b = scaleBand().domain(["foo", "bar"]).range([0, 960]).paddingInner(1).paddingOuter(0.5);
+ assert.deepStrictEqual(p.domain().map(p), b.domain().map(b));
+ assert.strictEqual(p.bandwidth(), b.bandwidth());
+ assert.strictEqual(p.step(), b.step());
});
-tape("point.copy() returns a copy", function(test) {
- var s = scale.scalePoint();
- test.deepEqual(s.domain(), []);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.bandwidth(), 0);
- test.equal(s.step(), 1);
- test.equal(s.round(), false);
- test.equal(s.padding(), 0);
- test.equal(s.align(), 0.5);
- test.end();
+it("point.copy() returns a copy", () => {
+ const s = scalePoint();
+ assert.deepStrictEqual(s.domain(), []);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.bandwidth(), 0);
+ assert.strictEqual(s.step(), 1);
+ assert.strictEqual(s.round(), false);
+ assert.strictEqual(s.padding(), 0);
+ assert.strictEqual(s.align(), 0.5);
});
diff --git a/test/pow-test.js b/test/pow-test.js
index 180cd72..26f8109 100644
--- a/test/pow-test.js
+++ b/test/pow-test.js
@@ -1,507 +1,447 @@
-var tape = require("tape"),
- scale = require("../"),
- format = require("d3-format"),
- roundEpsilon = require("./roundEpsilon");
-
-format.formatDefaultLocale({
- decimal: ".",
- thousands: ",",
- grouping: [3],
- currency: ["$", ""],
- minus: "-"
-});
-
-require("./inDelta");
-
-tape("scalePow() has the expected defaults", function(test) {
- var s = scale.scalePow();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.clamp(), false);
- test.equal(s.exponent(), 1);
- test.deepEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
- test.end();
-});
-
-tape("pow(x) maps a domain value x to a range value y", function(test) {
- test.equal(scale.scalePow().exponent(0.5)(0.5), Math.SQRT1_2);
- test.end();
-});
-
-tape("pow(x) ignores extra range values if the domain is smaller than the range", function(test) {
- test.equal(scale.scalePow().domain([-10, 0]).range(["red", "white", "green"]).clamp(true)(-5), "rgb(255, 128, 128)");
- test.equal(scale.scalePow().domain([-10, 0]).range(["red", "white", "green"]).clamp(true)(50), "rgb(255, 255, 255)");
- test.end();
-});
-
-tape("pow(x) ignores extra domain values if the range is smaller than the domain", function(test) {
- test.equal(scale.scalePow().domain([-10, 0, 100]).range(["red", "white"]).clamp(true)(-5), "rgb(255, 128, 128)");
- test.equal(scale.scalePow().domain([-10, 0, 100]).range(["red", "white"]).clamp(true)(50), "rgb(255, 255, 255)");
- test.end();
-});
-
-tape("pow(x) maps an empty domain to the middle of the range", function(test) {
- test.equal(scale.scalePow().domain([0, 0]).range([1, 2])(0), 1.5);
- test.equal(scale.scalePow().domain([0, 0]).range([2, 1])(1), 1.5);
- test.end();
-});
-
-tape("pow(x) can map a bipow domain with two values to the corresponding range", function(test) {
- var s = scale.scalePow().domain([1, 2]);
- test.deepEqual(s.domain(), [1, 2]);
- test.equal(s(0.5), -0.5);
- test.equal(s(1.0), 0.0);
- test.equal(s(1.5), 0.5);
- test.equal(s(2.0), 1.0);
- test.equal(s(2.5), 1.5);
- test.equal(s.invert(-0.5), 0.5);
- test.equal(s.invert( 0.0), 1.0);
- test.equal(s.invert( 0.5), 1.5);
- test.equal(s.invert( 1.0), 2.0);
- test.equal(s.invert( 1.5), 2.5);
- test.end();
-});
-
-tape("pow(x) can map a polypow domain with more than two values to the corresponding range", function(test) {
- var s = scale.scalePow().domain([-10, 0, 100]).range(["red", "white", "green"]);
- test.deepEqual(s.domain(), [-10, 0, 100]);
- test.equal(s(-5), "rgb(255, 128, 128)");
- test.equal(s(50), "rgb(128, 192, 128)");
- test.equal(s(75), "rgb(64, 160, 64)");
+import assert from "assert";
+import {scalePow, scaleSqrt} from "../src/index.js";
+import {roundEpsilon} from "./roundEpsilon.js";
+import {assertInDelta} from "./asserts.js";
+
+it("scalePow() has the expected defaults", () => {
+ const s = scalePow();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.exponent(), 1);
+ assert.deepStrictEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
+});
+
+it("pow(x) maps a domain value x to a range value y", () => {
+ assert.strictEqual(scalePow().exponent(0.5)(0.5), Math.SQRT1_2);
+});
+
+it("pow(x) ignores extra range values if the domain is smaller than the range", () => {
+ assert.strictEqual(scalePow().domain([-10, 0]).range(["red", "white", "green"]).clamp(true)(-5), "rgb(255, 128, 128)");
+ assert.strictEqual(scalePow().domain([-10, 0]).range(["red", "white", "green"]).clamp(true)(50), "rgb(255, 255, 255)");
+});
+
+it("pow(x) ignores extra domain values if the range is smaller than the domain", () => {
+ assert.strictEqual(scalePow().domain([-10, 0, 100]).range(["red", "white"]).clamp(true)(-5), "rgb(255, 128, 128)");
+ assert.strictEqual(scalePow().domain([-10, 0, 100]).range(["red", "white"]).clamp(true)(50), "rgb(255, 255, 255)");
+});
+
+it("pow(x) maps an empty domain to the middle of the range", () => {
+ assert.strictEqual(scalePow().domain([0, 0]).range([1, 2])(0), 1.5);
+ assert.strictEqual(scalePow().domain([0, 0]).range([2, 1])(1), 1.5);
+});
+
+it("pow(x) can map a bipow domain with two values to the corresponding range", () => {
+ const s = scalePow().domain([1, 2]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.strictEqual(s(0.5), -0.5);
+ assert.strictEqual(s(1.0), 0.0);
+ assert.strictEqual(s(1.5), 0.5);
+ assert.strictEqual(s(2.0), 1.0);
+ assert.strictEqual(s(2.5), 1.5);
+ assert.strictEqual(s.invert(-0.5), 0.5);
+ assert.strictEqual(s.invert( 0.0), 1.0);
+ assert.strictEqual(s.invert( 0.5), 1.5);
+ assert.strictEqual(s.invert( 1.0), 2.0);
+ assert.strictEqual(s.invert( 1.5), 2.5);
+});
+
+it("pow(x) can map a polypow domain with more than two values to the corresponding range", () => {
+ const s = scalePow().domain([-10, 0, 100]).range(["red", "white", "green"]);
+ assert.deepStrictEqual(s.domain(), [-10, 0, 100]);
+ assert.strictEqual(s(-5), "rgb(255, 128, 128)");
+ assert.strictEqual(s(50), "rgb(128, 192, 128)");
+ assert.strictEqual(s(75), "rgb(64, 160, 64)");
s.domain([4, 2, 1]).range([1, 2, 4]);
- test.equal(s(1.5), 3);
- test.equal(s(3), 1.5);
- test.equal(s.invert(1.5), 3);
- test.equal(s.invert(3), 1.5);
+ assert.strictEqual(s(1.5), 3);
+ assert.strictEqual(s(3), 1.5);
+ assert.strictEqual(s.invert(1.5), 3);
+ assert.strictEqual(s.invert(3), 1.5);
s.domain([1, 2, 4]).range([4, 2, 1]);
- test.equal(s(1.5), 3);
- test.equal(s(3), 1.5);
- test.equal(s.invert(1.5), 3);
- test.equal(s.invert(3), 1.5);
- test.end();
+ assert.strictEqual(s(1.5), 3);
+ assert.strictEqual(s(3), 1.5);
+ assert.strictEqual(s.invert(1.5), 3);
+ assert.strictEqual(s.invert(3), 1.5);
});
-tape("pow.invert(y) maps a range value y to a domain value x", function(test) {
- test.equal(scale.scalePow().range([1, 2]).invert(1.5), 0.5);
- test.end();
+it("pow.invert(y) maps a range value y to a domain value x", () => {
+ assert.strictEqual(scalePow().range([1, 2]).invert(1.5), 0.5);
});
-tape("pow.invert(y) maps an empty range to the middle of the domain", function(test) {
- test.equal(scale.scalePow().domain([1, 2]).range([0, 0]).invert(0), 1.5);
- test.equal(scale.scalePow().domain([2, 1]).range([0, 0]).invert(1), 1.5);
- test.end();
+it("pow.invert(y) maps an empty range to the middle of the domain", () => {
+ assert.strictEqual(scalePow().domain([1, 2]).range([0, 0]).invert(0), 1.5);
+ assert.strictEqual(scalePow().domain([2, 1]).range([0, 0]).invert(1), 1.5);
});
-tape("pow.invert(y) coerces range values to numbers", function(test) {
- test.equal(scale.scalePow().range(["0", "2"]).invert("1"), 0.5);
- test.equal(scale.scalePow().range([new Date(1990, 0, 1), new Date(1991, 0, 1)]).invert(new Date(1990, 6, 2, 13)), 0.5);
- test.end();
+it("pow.invert(y) coerces range values to numbers", () => {
+ assert.strictEqual(scalePow().range(["0", "2"]).invert("1"), 0.5);
+ assert.strictEqual(scalePow().range([new Date(1990, 0, 1), new Date(1991, 0, 1)]).invert(new Date(1990, 6, 2, 13)), 0.5);
});
-tape("pow.invert(y) returns NaN if the range is not coercible to number", function(test) {
- test.ok(isNaN(scale.scalePow().range(["#000", "#fff"]).invert("#999")));
- test.ok(isNaN(scale.scalePow().range([0, "#fff"]).invert("#999")));
- test.end();
+it("pow.invert(y) returns NaN if the range is not coercible to number", () => {
+ assert(isNaN(scalePow().range(["#000", "#fff"]).invert("#999")));
+ assert(isNaN(scalePow().range([0, "#fff"]).invert("#999")));
});
-tape("pow.exponent(exponent) sets the exponent to the specified value", function(test) {
- var x = scale.scalePow().exponent(0.5).domain([1, 2]);
- test.inDelta(x(1), 0, 1e-6);
- test.inDelta(x(1.5), 0.5425821, 1e-6);
- test.inDelta(x(2), 1, 1e-6);
- test.equal(x.exponent(), 0.5);
+it("pow.exponent(exponent) sets the exponent to the specified value", () => {
+ const x = scalePow().exponent(0.5).domain([1, 2]);
+ assertInDelta(x(1), 0, 1e-6);
+ assertInDelta(x(1.5), 0.5425821, 1e-6);
+ assertInDelta(x(2), 1, 1e-6);
+ assert.strictEqual(x.exponent(), 0.5);
x.exponent(2).domain([1, 2]);
- test.inDelta(x(1), 0, 1e-6);
- test.inDelta(x(1.5), 0.41666667, 1e-6);
- test.inDelta(x(2), 1, 1e-6);
- test.equal(x.exponent(), 2);
+ assertInDelta(x(1), 0, 1e-6);
+ assertInDelta(x(1.5), 0.41666667, 1e-6);
+ assertInDelta(x(2), 1, 1e-6);
+ assert.strictEqual(x.exponent(), 2);
x.exponent(-1).domain([1, 2]);
- test.inDelta(x(1), 0, 1e-6);
- test.inDelta(x(1.5), 0.6666667, 1e-6);
- test.inDelta(x(2), 1, 1e-6);
- test.equal(x.exponent(), -1);
- test.end();
+ assertInDelta(x(1), 0, 1e-6);
+ assertInDelta(x(1.5), 0.6666667, 1e-6);
+ assertInDelta(x(2), 1, 1e-6);
+ assert.strictEqual(x.exponent(), -1);
});
-tape("pow.exponent(exponent) changing the exponent does not change the domain or range", function(test) {
- var x = scale.scalePow().domain([1, 2]).range([3, 4]);
+it("pow.exponent(exponent) changing the exponent does not change the domain or range", () => {
+ const x = scalePow().domain([1, 2]).range([3, 4]);
x.exponent(0.5);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(x.range(), [3, 4]);
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(x.range(), [3, 4]);
x.exponent(2);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(x.range(), [3, 4]);
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(x.range(), [3, 4]);
x.exponent(-1);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(x.range(), [3, 4]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(x.range(), [3, 4]);
});
-tape("pow.domain(domain) accepts an array of numbers", function(test) {
- test.deepEqual(scale.scalePow().domain([]).domain(), []);
- test.deepEqual(scale.scalePow().domain([1, 0]).domain(), [1, 0]);
- test.deepEqual(scale.scalePow().domain([1, 2, 3]).domain(), [1, 2, 3]);
- test.end();
+it("pow.domain(domain) accepts an array of numbers", () => {
+ assert.deepStrictEqual(scalePow().domain([]).domain(), []);
+ assert.deepStrictEqual(scalePow().domain([1, 0]).domain(), [1, 0]);
+ assert.deepStrictEqual(scalePow().domain([1, 2, 3]).domain(), [1, 2, 3]);
});
-tape("pow.domain(domain) coerces domain values to numbers", function(test) {
- test.deepEqual(scale.scalePow().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]).domain(), [631180800000, 662716800000]);
- test.deepEqual(scale.scalePow().domain(["0.0", "1.0"]).domain(), [0, 1]);
- test.deepEqual(scale.scalePow().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
- test.end();
+it("pow.domain(domain) coerces domain values to numbers", () => {
+ assert.deepStrictEqual(scalePow().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]).domain(), [631180800000, 662716800000]);
+ assert.deepStrictEqual(scalePow().domain(["0.0", "1.0"]).domain(), [0, 1]);
+ assert.deepStrictEqual(scalePow().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
});
-tape("pow.domain(domain) makes a copy of domain values", function(test) {
- var d = [1, 2], s = scale.scalePow().domain(d);
- test.deepEqual(s.domain(), [1, 2]);
+it("pow.domain(domain) makes a copy of domain values", () => {
+ const d = [1, 2], s = scalePow().domain(d);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
d.push(3);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(d, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(d, [1, 2, 3]);
});
-tape("pow.domain() returns a copy of domain values", function(test) {
- var s = scale.scalePow(), d = s.domain();
- test.deepEqual(d, [0, 1]);
+it("pow.domain() returns a copy of domain values", () => {
+ const s = scalePow(), d = s.domain();
+ assert.deepStrictEqual(d, [0, 1]);
d.push(3);
- test.deepEqual(s.domain(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
});
-tape("pow.range(range) does not coerce range to numbers", function(test) {
- var s = scale.scalePow().range(["0px", "2px"]);
- test.deepEqual(s.range(), ["0px", "2px"]);
- test.equal(s(0.5), "1px");
- test.end();
+it("pow.range(range) does not coerce range to numbers", () => {
+ const s = scalePow().range(["0px", "2px"]);
+ assert.deepStrictEqual(s.range(), ["0px", "2px"]);
+ assert.strictEqual(s(0.5), "1px");
});
-tape("pow.range(range) can accept range values as colors", function(test) {
- test.equal(scale.scalePow().range(["red", "blue"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scalePow().range(["#ff0000", "#0000ff"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scalePow().range(["#f00", "#00f"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scalePow().range(["rgb(255,0,0)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scalePow().range(["rgb(100%,0%,0%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.equal(scale.scalePow().range(["hsl(0,100%,50%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
- test.end();
+it("pow.range(range) can accept range values as colors", () => {
+ assert.strictEqual(scalePow().range(["red", "blue"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scalePow().range(["#ff0000", "#0000ff"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scalePow().range(["#f00", "#00f"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scalePow().range(["rgb(255,0,0)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scalePow().range(["rgb(100%,0%,0%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
+ assert.strictEqual(scalePow().range(["hsl(0,100%,50%)", "hsl(240,100%,50%)"])(0.5), "rgb(128, 0, 128)");
});
-tape("pow.range(range) can accept range values as arrays or objects", function(test) {
- test.deepEqual(scale.scalePow().range([{color: "red"}, {color: "blue"}])(0.5), {color: "rgb(128, 0, 128)"});
- test.deepEqual(scale.scalePow().range([["red"], ["blue"]])(0.5), ["rgb(128, 0, 128)"]);
- test.end();
+it("pow.range(range) can accept range values as arrays or objects", () => {
+ assert.deepStrictEqual(scalePow().range([{color: "red"}, {color: "blue"}])(0.5), {color: "rgb(128, 0, 128)"});
+ assert.deepStrictEqual(scalePow().range([["red"], ["blue"]])(0.5), ["rgb(128, 0, 128)"]);
});
-tape("pow.range(range) makes a copy of range values", function(test) {
- var r = [1, 2], s = scale.scalePow().range(r);
- test.deepEqual(s.range(), [1, 2]);
+it("pow.range(range) makes a copy of range values", () => {
+ const r = [1, 2], s = scalePow().range(r);
+ assert.deepStrictEqual(s.range(), [1, 2]);
r.push(3);
- test.deepEqual(s.range(), [1, 2]);
- test.deepEqual(r, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.range(), [1, 2]);
+ assert.deepStrictEqual(r, [1, 2, 3]);
});
-tape("pow.range() returns a copy of range values", function(test) {
- var s = scale.scalePow(), r = s.range();
- test.deepEqual(r, [0, 1]);
+it("pow.range() returns a copy of range values", () => {
+ const s = scalePow(), r = s.range();
+ assert.deepStrictEqual(r, [0, 1]);
r.push(3);
- test.deepEqual(s.range(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.range(), [0, 1]);
});
-tape("pow.rangeRound(range) is an alias for pow.range(range).interpolate(interpolateRound)", function(test) {
- test.equal(scale.scalePow().rangeRound([0, 10])(0.59), 6);
- test.end();
+it("pow.rangeRound(range) is an alias for pow.range(range).interpolate(interpolateRound)", () => {
+ assert.strictEqual(scalePow().rangeRound([0, 10])(0.59), 6);
});
-tape("pow.clamp() is false by default", function(test) {
- test.equal(scale.scalePow().clamp(), false);
- test.equal(scale.scalePow().range([10, 20])(2), 30);
- test.equal(scale.scalePow().range([10, 20])(-1), 0);
- test.equal(scale.scalePow().range([10, 20]).invert(30), 2);
- test.equal(scale.scalePow().range([10, 20]).invert(0), -1);
- test.end();
+it("pow.clamp() is false by default", () => {
+ assert.strictEqual(scalePow().clamp(), false);
+ assert.strictEqual(scalePow().range([10, 20])(2), 30);
+ assert.strictEqual(scalePow().range([10, 20])(-1), 0);
+ assert.strictEqual(scalePow().range([10, 20]).invert(30), 2);
+ assert.strictEqual(scalePow().range([10, 20]).invert(0), -1);
});
-tape("pow.clamp(true) restricts output values to the range", function(test) {
- test.equal(scale.scalePow().clamp(true).range([10, 20])(2), 20);
- test.equal(scale.scalePow().clamp(true).range([10, 20])(-1), 10);
- test.end();
+it("pow.clamp(true) restricts output values to the range", () => {
+ assert.strictEqual(scalePow().clamp(true).range([10, 20])(2), 20);
+ assert.strictEqual(scalePow().clamp(true).range([10, 20])(-1), 10);
});
-tape("pow.clamp(true) restricts input values to the domain", function(test) {
- test.equal(scale.scalePow().clamp(true).range([10, 20]).invert(30), 1);
- test.equal(scale.scalePow().clamp(true).range([10, 20]).invert(0), 0);
- test.end();
+it("pow.clamp(true) restricts input values to the domain", () => {
+ assert.strictEqual(scalePow().clamp(true).range([10, 20]).invert(30), 1);
+ assert.strictEqual(scalePow().clamp(true).range([10, 20]).invert(0), 0);
});
-tape("pow.clamp(clamp) coerces the specified clamp value to a boolean", function(test) {
- test.equal(scale.scalePow().clamp("true").clamp(), true);
- test.equal(scale.scalePow().clamp(1).clamp(), true);
- test.equal(scale.scalePow().clamp("").clamp(), false);
- test.equal(scale.scalePow().clamp(0).clamp(), false);
- test.end();
+it("pow.clamp(clamp) coerces the specified clamp value to a boolean", () => {
+ assert.strictEqual(scalePow().clamp("true").clamp(), true);
+ assert.strictEqual(scalePow().clamp(1).clamp(), true);
+ assert.strictEqual(scalePow().clamp("").clamp(), false);
+ assert.strictEqual(scalePow().clamp(0).clamp(), false);
});
-tape("pow.interpolate(interpolate) takes a custom interpolator factory", function(test) {
+it("pow.interpolate(interpolate) takes a custom interpolator factory", () => {
function interpolate(a, b) { return function(t) { return [a, b, t]; }; }
- var s = scale.scalePow().domain([10, 20]).range(["a", "b"]).interpolate(interpolate);
- test.equal(s.interpolate(), interpolate);
- test.deepEqual(s(15), ["a", "b", 0.5]);
- test.end();
-});
-
-tape("pow.nice() is an alias for pow.nice(10)", function(test) {
- test.deepEqual(scale.scalePow().domain([0, 0.96]).nice().domain(), [0, 1]);
- test.deepEqual(scale.scalePow().domain([0, 96]).nice().domain(), [0, 100]);
- test.end();
-});
-
-tape("pow.nice(count) extends the domain to match the desired ticks", function(test) {
- test.deepEqual(scale.scalePow().domain([0, 0.96]).nice(10).domain(), [0, 1]);
- test.deepEqual(scale.scalePow().domain([0, 96]).nice(10).domain(), [0, 100]);
- test.deepEqual(scale.scalePow().domain([0.96, 0]).nice(10).domain(), [1, 0]);
- test.deepEqual(scale.scalePow().domain([96, 0]).nice(10).domain(), [100, 0]);
- test.deepEqual(scale.scalePow().domain([0, -0.96]).nice(10).domain(), [0, -1]);
- test.deepEqual(scale.scalePow().domain([0, -96]).nice(10).domain(), [0, -100]);
- test.deepEqual(scale.scalePow().domain([-0.96, 0]).nice(10).domain(), [-1, 0]);
- test.deepEqual(scale.scalePow().domain([-96, 0]).nice(10).domain(), [-100, 0]);
- test.end();
-});
-
-tape("pow.nice(count) nices the domain, extending it to round numbers", function(test) {
- test.deepEqual(scale.scalePow().domain([1.1, 10.9]).nice(10).domain(), [1, 11]);
- test.deepEqual(scale.scalePow().domain([10.9, 1.1]).nice(10).domain(), [11, 1]);
- test.deepEqual(scale.scalePow().domain([0.7, 11.001]).nice(10).domain(), [0, 12]);
- test.deepEqual(scale.scalePow().domain([123.1, 6.7]).nice(10).domain(), [130, 0]);
- test.deepEqual(scale.scalePow().domain([0, 0.49]).nice(10).domain(), [0, 0.5]);
- test.end();
-});
-
-tape("pow.nice(count) has no effect on degenerate domains", function(test) {
- test.deepEqual(scale.scalePow().domain([0, 0]).nice(10).domain(), [0, 0]);
- test.deepEqual(scale.scalePow().domain([0.5, 0.5]).nice(10).domain(), [0.5, 0.5]);
- test.end();
-});
-
-tape("pow.nice(count) nicing a polypow domain only affects the extent", function(test) {
- test.deepEqual(scale.scalePow().domain([1.1, 1, 2, 3, 10.9]).nice(10).domain(), [1, 1, 2, 3, 11]);
- test.deepEqual(scale.scalePow().domain([123.1, 1, 2, 3, -0.9]).nice(10).domain(), [130, 1, 2, 3, -10]);
- test.end();
-});
-
-tape("pow.nice(count) accepts a tick count to control nicing step", function(test) {
- test.deepEqual(scale.scalePow().domain([12, 87]).nice(5).domain(), [0, 100]);
- test.deepEqual(scale.scalePow().domain([12, 87]).nice(10).domain(), [10, 90]);
- test.deepEqual(scale.scalePow().domain([12, 87]).nice(100).domain(), [12, 87]);
- test.end();
-});
-
-tape("pow.ticks(count) returns the expected ticks for an ascending domain", function(test) {
- var s = scale.scalePow();
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
+ const s = scalePow().domain([10, 20]).range(["a", "b"]).interpolate(interpolate);
+ assert.strictEqual(s.interpolate(), interpolate);
+ assert.deepStrictEqual(s(15), ["a", "b", 0.5]);
+});
+
+it("pow.nice() is an alias for pow.nice(10)", () => {
+ assert.deepStrictEqual(scalePow().domain([0, 0.96]).nice().domain(), [0, 1]);
+ assert.deepStrictEqual(scalePow().domain([0, 96]).nice().domain(), [0, 100]);
+});
+
+it("pow.nice(count) extends the domain to match the desired ticks", () => {
+ assert.deepStrictEqual(scalePow().domain([0, 0.96]).nice(10).domain(), [0, 1]);
+ assert.deepStrictEqual(scalePow().domain([0, 96]).nice(10).domain(), [0, 100]);
+ assert.deepStrictEqual(scalePow().domain([0.96, 0]).nice(10).domain(), [1, 0]);
+ assert.deepStrictEqual(scalePow().domain([96, 0]).nice(10).domain(), [100, 0]);
+ assert.deepStrictEqual(scalePow().domain([0, -0.96]).nice(10).domain(), [0, -1]);
+ assert.deepStrictEqual(scalePow().domain([0, -96]).nice(10).domain(), [0, -100]);
+ assert.deepStrictEqual(scalePow().domain([-0.96, 0]).nice(10).domain(), [-1, 0]);
+ assert.deepStrictEqual(scalePow().domain([-96, 0]).nice(10).domain(), [-100, 0]);
+});
+
+it("pow.nice(count) nices the domain, extending it to round numbers", () => {
+ assert.deepStrictEqual(scalePow().domain([1.1, 10.9]).nice(10).domain(), [1, 11]);
+ assert.deepStrictEqual(scalePow().domain([10.9, 1.1]).nice(10).domain(), [11, 1]);
+ assert.deepStrictEqual(scalePow().domain([0.7, 11.001]).nice(10).domain(), [0, 12]);
+ assert.deepStrictEqual(scalePow().domain([123.1, 6.7]).nice(10).domain(), [130, 0]);
+ assert.deepStrictEqual(scalePow().domain([0, 0.49]).nice(10).domain(), [0, 0.5]);
+});
+
+it("pow.nice(count) has no effect on degenerate domains", () => {
+ assert.deepStrictEqual(scalePow().domain([0, 0]).nice(10).domain(), [0, 0]);
+ assert.deepStrictEqual(scalePow().domain([0.5, 0.5]).nice(10).domain(), [0.5, 0.5]);
+});
+
+it("pow.nice(count) nicing a polypow domain only affects the extent", () => {
+ assert.deepStrictEqual(scalePow().domain([1.1, 1, 2, 3, 10.9]).nice(10).domain(), [1, 1, 2, 3, 11]);
+ assert.deepStrictEqual(scalePow().domain([123.1, 1, 2, 3, -0.9]).nice(10).domain(), [130, 1, 2, 3, -10]);
+});
+
+it("pow.nice(count) accepts a tick count to control nicing step", () => {
+ assert.deepStrictEqual(scalePow().domain([12, 87]).nice(5).domain(), [0, 100]);
+ assert.deepStrictEqual(scalePow().domain([12, 87]).nice(10).domain(), [10, 90]);
+ assert.deepStrictEqual(scalePow().domain([12, 87]).nice(100).domain(), [12, 87]);
+});
+
+it("pow.ticks(count) returns the expected ticks for an ascending domain", () => {
+ const s = scalePow();
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
s.domain([-100, 100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(2), [-100, 0, 100]);
- test.deepEqual(s.ticks(1), [ 0 ]);
- test.end();
-});
-
-tape("pow.ticks(count) returns the expected ticks for a descending domain", function(test) {
- var s = scale.scalePow().domain([1, 0]);
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100]);
+ assert.deepStrictEqual(s.ticks(1), [ 0 ]);
+});
+
+it("pow.ticks(count) returns the expected ticks for a descending domain", () => {
+ const s = scalePow().domain([1, 0]);
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0].reverse());
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0].reverse());
s.domain([100, -100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100].reverse());
- test.deepEqual(s.ticks(2), [-100, 0, 100].reverse());
- test.deepEqual(s.ticks(1), [ 0 ].reverse());
- test.end();
-});
-
-tape("pow.ticks(count) returns the expected ticks for a polypow domain", function(test) {
- var s = scale.scalePow().domain([0, 0.25, 0.9, 1]);
- test.deepEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
- test.deepEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
- test.deepEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
- test.deepEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100].reverse());
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100].reverse());
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100].reverse());
+ assert.deepStrictEqual(s.ticks(1), [ 0 ].reverse());
+});
+
+it("pow.ticks(count) returns the expected ticks for a polypow domain", () => {
+ const s = scalePow().domain([0, 0.25, 0.9, 1]);
+ assert.deepStrictEqual(s.ticks(10).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(9).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(8).map(roundEpsilon), [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);
+ assert.deepStrictEqual(s.ticks(7).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(6).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(5).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(4).map(roundEpsilon), [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]);
+ assert.deepStrictEqual(s.ticks(3).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(2).map(roundEpsilon), [0.0, 0.5, 1.0]);
+ assert.deepStrictEqual(s.ticks(1).map(roundEpsilon), [0.0, 1.0]);
s.domain([-100, 0, 100]);
- test.deepEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
- test.deepEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
- test.deepEqual(s.ticks(2), [-100, 0, 100]);
- test.deepEqual(s.ticks(1), [ 0 ]);
- test.end();
-});
-
-tape("pow.ticks(count) returns the empty array if count is not a positive integer", function(test) {
- var s = scale.scalePow();
- test.deepEqual(s.ticks(NaN), []);
- test.deepEqual(s.ticks(0), []);
- test.deepEqual(s.ticks(-1), []);
- test.deepEqual(s.ticks(Infinity), []);
- test.end();
-});
-
-tape("pow.ticks() is an alias for pow.ticks(10)", function(test) {
- var s = scale.scalePow();
- test.deepEqual(s.ticks(), s.ticks(10));
- test.end();
-});
-
-tape("pow.tickFormat() is an alias for pow.tickFormat(10)", function(test) {
- test.equal(scale.scalePow().tickFormat()(0.2), "0.2");
- test.equal(scale.scalePow().domain([-100, 100]).tickFormat()(-20), "-20");
- test.end();
-});
-
-tape("pow.tickFormat(count) returns a format suitable for the ticks", function(test) {
- test.equal(scale.scalePow().tickFormat(10)(0.2), "0.2");
- test.equal(scale.scalePow().tickFormat(20)(0.2), "0.20");
- test.equal(scale.scalePow().domain([-100, 100]).tickFormat(10)(-20), "-20");
- test.end();
-});
-
-tape("pow.tickFormat(count, specifier) sets the appropriate fixed precision if not specified", function(test) {
- test.equal(scale.scalePow().tickFormat(10, "+f")(0.2), "+0.2");
- test.equal(scale.scalePow().tickFormat(20, "+f")(0.2), "+0.20");
- test.equal(scale.scalePow().tickFormat(10, "+%")(0.2), "+20%");
- test.equal(scale.scalePow().domain([0.19, 0.21]).tickFormat(10, "+%")(0.2), "+20.0%");
- test.end();
-});
-
-tape("pow.tickFormat(count, specifier) sets the appropriate round precision if not specified", function(test) {
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(10, "")(2.10), "2");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "")(2.01), "2");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "")(2.11), "2.1");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(10, "e")(2.10), "2e+0");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "e")(2.01), "2.0e+0");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "e")(2.11), "2.1e+0");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(10, "g")(2.10), "2");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "g")(2.01), "2.0");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "g")(2.11), "2.1");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(10, "r")(2.10e6), "2000000");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "r")(2.01e6), "2000000");
- test.equal(scale.scalePow().domain([0, 9]).tickFormat(100, "r")(2.11e6), "2100000");
- test.equal(scale.scalePow().domain([0, 0.9]).tickFormat(10, "p")(0.210), "20%");
- test.equal(scale.scalePow().domain([0.19, 0.21]).tickFormat(10, "p")(0.201), "20.1%");
- test.end();
-});
-
-tape("pow.tickFormat(count, specifier) sets the appropriate prefix precision if not specified", function(test) {
- test.equal(scale.scalePow().domain([0, 1e6]).tickFormat(10, "$s")(0.51e6), "$0.5M");
- test.equal(scale.scalePow().domain([0, 1e6]).tickFormat(100, "$s")(0.501e6), "$0.50M");
- test.end();
-});
-
-tape("pow.copy() returns a copy with changes to the domain are isolated", function(test) {
- var x = scale.scalePow(), y = x.copy();
+ assert.deepStrictEqual(s.ticks(10), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(9), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(8), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(7), [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100]);
+ assert.deepStrictEqual(s.ticks(6), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(5), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(4), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(3), [-100, -50, 0, 50, 100]);
+ assert.deepStrictEqual(s.ticks(2), [-100, 0, 100]);
+ assert.deepStrictEqual(s.ticks(1), [ 0 ]);
+});
+
+it("pow.ticks(count) returns the empty array if count is not a positive integer", () => {
+ const s = scalePow();
+ assert.deepStrictEqual(s.ticks(NaN), []);
+ assert.deepStrictEqual(s.ticks(0), []);
+ assert.deepStrictEqual(s.ticks(-1), []);
+ assert.deepStrictEqual(s.ticks(Infinity), []);
+});
+
+it("pow.ticks() is an alias for pow.ticks(10)", () => {
+ const s = scalePow();
+ assert.deepStrictEqual(s.ticks(), s.ticks(10));
+});
+
+it("pow.tickFormat() is an alias for pow.tickFormat(10)", () => {
+ assert.strictEqual(scalePow().tickFormat()(0.2), "0.2");
+ assert.strictEqual(scalePow().domain([-100, 100]).tickFormat()(-20), "−20");
+});
+
+it("pow.tickFormat(count) returns a format suitable for the ticks", () => {
+ assert.strictEqual(scalePow().tickFormat(10)(0.2), "0.2");
+ assert.strictEqual(scalePow().tickFormat(20)(0.2), "0.20");
+ assert.strictEqual(scalePow().domain([-100, 100]).tickFormat(10)(-20), "−20");
+});
+
+it("pow.tickFormat(count, specifier) sets the appropriate fixed precision if not specified", () => {
+ assert.strictEqual(scalePow().tickFormat(10, "+f")(0.2), "+0.2");
+ assert.strictEqual(scalePow().tickFormat(20, "+f")(0.2), "+0.20");
+ assert.strictEqual(scalePow().tickFormat(10, "+%")(0.2), "+20%");
+ assert.strictEqual(scalePow().domain([0.19, 0.21]).tickFormat(10, "+%")(0.2), "+20.0%");
+});
+
+it("pow.tickFormat(count, specifier) sets the appropriate round precision if not specified", () => {
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(10, "")(2.10), "2");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "")(2.01), "2");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "")(2.11), "2.1");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(10, "e")(2.10), "2e+0");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "e")(2.01), "2.0e+0");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "e")(2.11), "2.1e+0");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(10, "g")(2.10), "2");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "g")(2.01), "2.0");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "g")(2.11), "2.1");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(10, "r")(2.10e6), "2000000");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "r")(2.01e6), "2000000");
+ assert.strictEqual(scalePow().domain([0, 9]).tickFormat(100, "r")(2.11e6), "2100000");
+ assert.strictEqual(scalePow().domain([0, 0.9]).tickFormat(10, "p")(0.210), "20%");
+ assert.strictEqual(scalePow().domain([0.19, 0.21]).tickFormat(10, "p")(0.201), "20.1%");
+});
+
+it("pow.tickFormat(count, specifier) sets the appropriate prefix precision if not specified", () => {
+ assert.strictEqual(scalePow().domain([0, 1e6]).tickFormat(10, "$s")(0.51e6), "$0.5M");
+ assert.strictEqual(scalePow().domain([0, 1e6]).tickFormat(100, "$s")(0.501e6), "$0.50M");
+});
+
+it("pow.copy() returns a copy with changes to the domain are isolated", () => {
+ const x = scalePow(), y = x.copy();
x.domain([1, 2]);
- test.deepEqual(y.domain(), [0, 1]);
- test.equal(x(1), 0);
- test.equal(y(1), 1);
+ assert.deepStrictEqual(y.domain(), [0, 1]);
+ assert.strictEqual(x(1), 0);
+ assert.strictEqual(y(1), 1);
y.domain([2, 3]);
- test.equal(x(2), 1);
- test.equal(y(2), 0);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [2, 3]);
- y = x.domain([1, 1.9]).copy();
+ assert.strictEqual(x(2), 1);
+ assert.strictEqual(y(2), 0);
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y.domain(), [2, 3]);
+ const y2 = x.domain([1, 1.9]).copy();
x.nice(5);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [1, 1.9]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y2.domain(), [1, 1.9]);
});
-tape("pow.copy() returns a copy with changes to the range are isolated", function(test) {
- var x = scale.scalePow(), y = x.copy();
+it("pow.copy() returns a copy with changes to the range are isolated", () => {
+ const x = scalePow(), y = x.copy();
x.range([1, 2]);
- test.equal(x.invert(1), 0);
- test.equal(y.invert(1), 1);
- test.deepEqual(y.range(), [0, 1]);
+ assert.strictEqual(x.invert(1), 0);
+ assert.strictEqual(y.invert(1), 1);
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.equal(x.invert(2), 1);
- test.equal(y.invert(2), 0);
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
+ assert.strictEqual(x.invert(2), 1);
+ assert.strictEqual(y.invert(2), 0);
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
});
-tape("pow.copy() returns a copy with changes to the interpolator are isolated", function(test) {
- var x = scale.scalePow().range(["red", "blue"]),
+it("pow.copy() returns a copy with changes to the interpolator are isolated", () => {
+ const x = scalePow().range(["red", "blue"]),
y = x.copy(),
i0 = x.interpolate(),
i1 = function(a, b) { return function() { return b; }; };
x.interpolate(i1);
- test.equal(y.interpolate(), i0);
- test.equal(x(0.5), "blue");
- test.equal(y(0.5), "rgb(128, 0, 128)");
- test.end();
+ assert.strictEqual(y.interpolate(), i0);
+ assert.strictEqual(x(0.5), "blue");
+ assert.strictEqual(y(0.5), "rgb(128, 0, 128)");
});
-tape("pow.copy() returns a copy with changes to clamping are isolated", function(test) {
- var x = scale.scalePow().clamp(true), y = x.copy();
+it("pow.copy() returns a copy with changes to clamping are isolated", () => {
+ const x = scalePow().clamp(true), y = x.copy();
x.clamp(false);
- test.equal(x(2), 2);
- test.equal(y(2), 1);
- test.equal(y.clamp(), true);
+ assert.strictEqual(x(2), 2);
+ assert.strictEqual(y(2), 1);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.equal(x(2), 2);
- test.equal(y(2), 2);
- test.equal(x.clamp(), false);
- test.end();
+ assert.strictEqual(x(2), 2);
+ assert.strictEqual(y(2), 2);
+ assert.strictEqual(x.clamp(), false);
});
-tape("pow().clamp(true).invert(x) cannot return a value outside the domain", function(test) {
- var x = scale.scalePow().exponent(0.5).domain([1, 20]).clamp(true);
- test.equal(x.invert(0), 1);
- test.equal(x.invert(1), 20);
- test.end();
+it("pow().clamp(true).invert(x) cannot return a value outside the domain", () => {
+ const x = scalePow().exponent(0.5).domain([1, 20]).clamp(true);
+ assert.strictEqual(x.invert(0), 1);
+ assert.strictEqual(x.invert(1), 20);
});
-tape("scaleSqrt() is an alias for pow().exponent(0.5)", function(test) {
- var s = scale.scaleSqrt();
- test.equal(s.exponent(), 0.5);
- test.inDelta(s(0.5), Math.SQRT1_2, 1e-6);
- test.inDelta(s.invert(Math.SQRT1_2), 0.5, 1e-6);
- test.end();
+it("scaleSqrt() is an alias for pow().exponent(0.5)", () => {
+ const s = scaleSqrt();
+ assert.strictEqual(s.exponent(), 0.5);
+ assertInDelta(s(0.5), Math.SQRT1_2, 1e-6);
+ assertInDelta(s.invert(Math.SQRT1_2), 0.5, 1e-6);
});
diff --git a/test/quantile-test.js b/test/quantile-test.js
index b88b46e..d3d4530 100644
--- a/test/quantile-test.js
+++ b/test/quantile-test.js
@@ -1,142 +1,125 @@
-var tape = require("tape"),
- scale = require("../");
-
-tape("scaleQuantile() has the expected default", function(test) {
- var s = scale.scaleQuantile();
- test.deepEqual(s.domain(), []);
- test.deepEqual(s.range(), []);
- test.equal(s.unknown(), undefined);
- test.end();
-});
-
-tape("quantile(x) uses the R-7 algorithm to compute quantiles", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.deepEqual([3, 6, 6.9, 7, 7.1].map(s), [0, 0, 0, 0, 0]);
- test.deepEqual([8, 8.9].map(s), [1, 1]);
- test.deepEqual([9, 9.1, 10, 13].map(s), [2, 2, 2, 2]);
- test.deepEqual([14.9, 15, 15.1, 16, 20].map(s), [3, 3, 3, 3, 3]);
+import assert from "assert";
+import {scaleQuantile} from "../src/index.js";
+
+it("scaleQuantile() has the expected default", () => {
+ const s = scaleQuantile();
+ assert.deepStrictEqual(s.domain(), []);
+ assert.deepStrictEqual(s.range(), []);
+ assert.strictEqual(s.unknown(), undefined);
+});
+
+it("quantile(x) uses the R-7 algorithm to compute quantiles", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
+ assert.deepStrictEqual([3, 6, 6.9, 7, 7.1].map(s), [0, 0, 0, 0, 0]);
+ assert.deepStrictEqual([8, 8.9].map(s), [1, 1]);
+ assert.deepStrictEqual([9, 9.1, 10, 13].map(s), [2, 2, 2, 2]);
+ assert.deepStrictEqual([14.9, 15, 15.1, 16, 20].map(s), [3, 3, 3, 3, 3]);
s.domain([3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.deepEqual([3, 6, 6.9, 7, 7.1].map(s), [0, 0, 0, 0, 0]);
- test.deepEqual([8, 8.9].map(s), [1, 1]);
- test.deepEqual([9, 9.1, 10, 13].map(s), [2, 2, 2, 2]);
- test.deepEqual([14.9, 15, 15.1, 16, 20].map(s), [3, 3, 3, 3, 3]);
- test.end();
+ assert.deepStrictEqual([3, 6, 6.9, 7, 7.1].map(s), [0, 0, 0, 0, 0]);
+ assert.deepStrictEqual([8, 8.9].map(s), [1, 1]);
+ assert.deepStrictEqual([9, 9.1, 10, 13].map(s), [2, 2, 2, 2]);
+ assert.deepStrictEqual([14.9, 15, 15.1, 16, 20].map(s), [3, 3, 3, 3, 3]);
});
-tape("quantile(x) returns undefined if the input value is NaN", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.equal(s(NaN), undefined);
- test.end();
+it("quantile(x) returns undefined if the input value is NaN", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
+ assert.strictEqual(s(NaN), undefined);
});
-tape("quantile.domain() values are sorted in ascending order", function(test) {
- var s = scale.scaleQuantile().domain([6, 3, 7, 8, 8, 13, 20, 15, 16, 10]);
- test.deepEqual(s.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
- test.end();
+it("quantile.domain() values are sorted in ascending order", () => {
+ const s = scaleQuantile().domain([6, 3, 7, 8, 8, 13, 20, 15, 16, 10]);
+ assert.deepStrictEqual(s.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
});
-tape("quantile.domain() values are coerced to numbers", function(test) {
- var s = scale.scaleQuantile().domain(["6", "13", "20"]);
- test.deepEqual(s.domain(), [6, 13, 20]);
- test.end();
+it("quantile.domain() values are coerced to numbers", () => {
+ const s = scaleQuantile().domain(["6", "13", "20"]);
+ assert.deepStrictEqual(s.domain(), [6, 13, 20]);
});
-tape("quantile.domain() accepts an iterable", function(test) {
- var s = scale.scaleQuantile().domain(new Set([6, 13, 20]));
- test.deepEqual(s.domain(), [6, 13, 20]);
- test.end();
+it("quantile.domain() accepts an iterable", () => {
+ const s = scaleQuantile().domain(new Set([6, 13, 20]));
+ assert.deepStrictEqual(s.domain(), [6, 13, 20]);
});
-tape("quantile.domain() values are allowed to be zero", function(test) {
- var s = scale.scaleQuantile().domain([1, 2, 0, 0, null]);
- test.deepEqual(s.domain(), [0, 0, 1, 2]);
- test.end();
+it("quantile.domain() values are allowed to be zero", () => {
+ const s = scaleQuantile().domain([1, 2, 0, 0, null]);
+ assert.deepStrictEqual(s.domain(), [0, 0, 1, 2]);
});
-tape("quantile.domain() non-numeric values are ignored", function(test) {
- var s = scale.scaleQuantile().domain([6, 3, NaN, undefined, 7, 8, 8, 13, null, 20, 15, 16, 10, NaN]);
- test.deepEqual(s.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
- test.end();
+it("quantile.domain() non-numeric values are ignored", () => {
+ const s = scaleQuantile().domain([6, 3, NaN, undefined, 7, 8, 8, 13, null, 20, 15, 16, 10, NaN]);
+ assert.deepStrictEqual(s.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
});
-tape("quantile.quantiles() returns the inner thresholds", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.deepEqual(s.quantiles(), [7.25, 9, 14.5]);
+it("quantile.quantiles() returns the inner thresholds", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
+ assert.deepStrictEqual(s.quantiles(), [7.25, 9, 14.5]);
s.domain([3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.deepEqual(s.quantiles(), [7.5, 9, 14]);
- test.end();
-});
-
-tape("quantile.range() cardinality determines the number of quantiles", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
- test.deepEqual(s.range([0, 1, 2, 3]).quantiles(), [7.25, 9, 14.5]);
- test.deepEqual(s.range([0, 1]).quantiles(), [9]);
- test.deepEqual(s.range([,,,,,]).quantiles(), [6.8, 8, 11.2, 15.2]);
- test.deepEqual(s.range([,,,,,,]).quantiles(), [6.5, 8, 9, 13, 15.5]);
- test.end();
-});
-
-tape("quantile.range() accepts an iterable", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range(new Set([0, 1, 2, 3]));
- test.deepEqual(s.range(), [0, 1, 2, 3]);
- test.end();
-});
-
-tape("quantile.range() values are arbitrary", function(test) {
- var a = {},
- b = {},
- c = {},
- s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([a, b, c, a]);
- test.deepEqual([3, 6, 6.9, 7, 7.1].map(s), [a, a, a, a, a]);
- test.deepEqual([8, 8.9].map(s), [b, b]);
- test.deepEqual([9, 9.1, 10, 13].map(s), [c, c, c, c]);
- test.deepEqual([14.9, 15, 15.1, 16, 20].map(s), [a, a, a, a, a]);
- test.end();
-});
-
-tape("quantile.invertExtent() maps a value in the range to a domain extent", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
- test.deepEqual(s.invertExtent(0), [3, 7.25]);
- test.deepEqual(s.invertExtent(1), [7.25, 9]);
- test.deepEqual(s.invertExtent(2), [9, 14.5]);
- test.deepEqual(s.invertExtent(3), [14.5, 20]);
- test.end();
-});
-
-tape("quantile.invertExtent() allows arbitrary range values", function(test) {
- var a = {},
- b = {},
- s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([a, b]);
- test.deepEqual(s.invertExtent(a), [3, 9]);
- test.deepEqual(s.invertExtent(b), [9, 20]);
- test.end();
-});
-
-tape("quantile.invertExtent() returns [NaN, NaN] when the given value is not in the range", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
- test.ok(s.invertExtent(-1).every(isNaN));
- test.ok(s.invertExtent(0.5).every(isNaN));
- test.ok(s.invertExtent(2).every(isNaN));
- test.ok(s.invertExtent('a').every(isNaN));
- test.end();
-});
-
-tape("quantile.invertExtent() returns the first match if duplicate values exist in the range", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 0]);
- test.deepEqual(s.invertExtent(0), [3, 7.25]);
- test.deepEqual(s.invertExtent(1), [7.25, 9]);
- test.deepEqual(s.invertExtent(2), [9, 14.5]);
- test.end();
-});
-
-tape("quantile.unknown(value) sets the return value for undefined, null, and NaN input", function(test) {
- var s = scale.scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]).unknown(-1);
- test.equal(s(undefined), -1);
- test.equal(s(null), -1);
- test.equal(s(NaN), -1);
- test.equal(s("N/A"), -1);
- test.equal(s(2), 0);
- test.equal(s(3), 0);
- test.equal(s(21), 3);
- test.end();
+ assert.deepStrictEqual(s.quantiles(), [7.5, 9, 14]);
+});
+
+it("quantile.range() cardinality determines the number of quantiles", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
+ assert.deepStrictEqual(s.range([0, 1, 2, 3]).quantiles(), [7.25, 9, 14.5]);
+ assert.deepStrictEqual(s.range([0, 1]).quantiles(), [9]);
+ assert.deepStrictEqual(s.range([,,,,,]).quantiles(), [6.8, 8, 11.2, 15.2]);
+ assert.deepStrictEqual(s.range([,,,,,,]).quantiles(), [6.5, 8, 9, 13, 15.5]);
+});
+
+it("quantile.range() accepts an iterable", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range(new Set([0, 1, 2, 3]));
+ assert.deepStrictEqual(s.range(), [0, 1, 2, 3]);
+});
+
+it("quantile.range() values are arbitrary", () => {
+ const a = {};
+ const b = {};
+ const c = {};
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([a, b, c, a]);
+ assert.deepStrictEqual([3, 6, 6.9, 7, 7.1].map(s), [a, a, a, a, a]);
+ assert.deepStrictEqual([8, 8.9].map(s), [b, b]);
+ assert.deepStrictEqual([9, 9.1, 10, 13].map(s), [c, c, c, c]);
+ assert.deepStrictEqual([14.9, 15, 15.1, 16, 20].map(s), [a, a, a, a, a]);
+});
+
+it("quantile.invertExtent() maps a value in the range to a domain extent", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]);
+ assert.deepStrictEqual(s.invertExtent(0), [3, 7.25]);
+ assert.deepStrictEqual(s.invertExtent(1), [7.25, 9]);
+ assert.deepStrictEqual(s.invertExtent(2), [9, 14.5]);
+ assert.deepStrictEqual(s.invertExtent(3), [14.5, 20]);
+});
+
+it("quantile.invertExtent() allows arbitrary range values", () => {
+ const a = {};
+ const b = {};
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([a, b]);
+ assert.deepStrictEqual(s.invertExtent(a), [3, 9]);
+ assert.deepStrictEqual(s.invertExtent(b), [9, 20]);
+});
+
+it("quantile.invertExtent() returns [NaN, NaN] when the given value is not in the range", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
+ assert(s.invertExtent(-1).every(isNaN));
+ assert(s.invertExtent(0.5).every(isNaN));
+ assert(s.invertExtent(2).every(isNaN));
+ assert(s.invertExtent('a').every(isNaN));
+});
+
+it("quantile.invertExtent() returns the first match if duplicate values exist in the range", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 0]);
+ assert.deepStrictEqual(s.invertExtent(0), [3, 7.25]);
+ assert.deepStrictEqual(s.invertExtent(1), [7.25, 9]);
+ assert.deepStrictEqual(s.invertExtent(2), [9, 14.5]);
+});
+
+it("quantile.unknown(value) sets the return value for undefined, null, and NaN input", () => {
+ const s = scaleQuantile().domain([3, 6, 7, 8, 8, 10, 13, 15, 16, 20]).range([0, 1, 2, 3]).unknown(-1);
+ assert.strictEqual(s(undefined), -1);
+ assert.strictEqual(s(null), -1);
+ assert.strictEqual(s(NaN), -1);
+ assert.strictEqual(s("N/A"), -1);
+ assert.strictEqual(s(2), 0);
+ assert.strictEqual(s(3), 0);
+ assert.strictEqual(s(21), 3);
});
diff --git a/test/quantize-test.js b/test/quantize-test.js
index fc51978..5553c93 100644
--- a/test/quantize-test.js
+++ b/test/quantize-test.js
@@ -1,137 +1,122 @@
-var tape = require("tape"),
- array = require("d3-array"),
- scale = require("../");
+import assert from "assert";
+import {range} from "d3-array";
+import {scaleQuantize} from "../src/index.js";
+import {assertInDelta} from "./asserts.js";
-require("./inDelta");
-
-tape("scaleQuantize() has the expected defaults", function(test) {
- var s = scale.scaleQuantize();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.deepEqual(s.thresholds(), [0.5]);
- test.equal(s(0.25), 0);
- test.equal(s(0.75), 1);
- test.end();
+it("scaleQuantize() has the expected defaults", () => {
+ const s = scaleQuantize();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.deepStrictEqual(s.thresholds(), [0.5]);
+ assert.strictEqual(s(0.25), 0);
+ assert.strictEqual(s(0.75), 1);
});
-tape("quantize(value) maps a number to a discrete value in the range", function(test) {
- var s = scale.scaleQuantize().range([0, 1, 2]);
- test.deepEqual(s.thresholds(), [1 / 3, 2 / 3]);
- test.equal(s(0.0), 0);
- test.equal(s(0.2), 0);
- test.equal(s(0.4), 1);
- test.equal(s(0.6), 1);
- test.equal(s(0.8), 2);
- test.equal(s(1.0), 2);
- test.end();
+it("quantize(value) maps a number to a discrete value in the range", () => {
+ const s = scaleQuantize().range([0, 1, 2]);
+ assert.deepStrictEqual(s.thresholds(), [1 / 3, 2 / 3]);
+ assert.strictEqual(s(0.0), 0);
+ assert.strictEqual(s(0.2), 0);
+ assert.strictEqual(s(0.4), 1);
+ assert.strictEqual(s(0.6), 1);
+ assert.strictEqual(s(0.8), 2);
+ assert.strictEqual(s(1.0), 2);
});
-tape("quantize(value) clamps input values to the domain", function(test) {
- var a = {},
- b = {},
- c = {},
- s = scale.scaleQuantize().range([a, b, c]);
- test.equal(s(-0.5), a);
- test.equal(s(+1.5), c);
- test.end();
+it("quantize(value) clamps input values to the domain", () => {
+ const a = {};
+ const b = {};
+ const c = {};
+ const s = scaleQuantize().range([a, b, c]);
+ assert.strictEqual(s(-0.5), a);
+ assert.strictEqual(s(+1.5), c);
});
-tape("quantize.unknown(value) sets the return value for undefined, null, and NaN input", function(test) {
- var s = scale.scaleQuantize().range([0, 1, 2]).unknown(-1);
- test.equal(s(undefined), -1);
- test.equal(s(null), -1);
- test.equal(s(NaN), -1);
- test.end();
+it("quantize.unknown(value) sets the return value for undefined, null, and NaN input", () => {
+ const s = scaleQuantize().range([0, 1, 2]).unknown(-1);
+ assert.strictEqual(s(undefined), -1);
+ assert.strictEqual(s(null), -1);
+ assert.strictEqual(s(NaN), -1);
});
-tape("quantize.domain() coerces domain values to numbers", function(test) {
- var s = scale.scaleQuantize().domain(["-1.20", "2.40"]);
- test.deepEqual(s.domain(), [-1.2, 2.4]);
- test.equal(s(-1.2), 0);
- test.equal(s( 0.5), 0);
- test.equal(s( 0.7), 1);
- test.equal(s( 2.4), 1);
- test.end();
+it("quantize.domain() coerces domain values to numbers", () => {
+ const s = scaleQuantize().domain(["-1.20", "2.40"]);
+ assert.deepStrictEqual(s.domain(), [-1.2, 2.4]);
+ assert.strictEqual(s(-1.2), 0);
+ assert.strictEqual(s( 0.5), 0);
+ assert.strictEqual(s( 0.7), 1);
+ assert.strictEqual(s( 2.4), 1);
});
-tape("quantize.domain() accepts an iterable", function(test) {
- var s = scale.scaleQuantize().domain(new Set([1, 2]));
- test.deepEqual(s.domain(), [1, 2]);
- test.end();
+it("quantize.domain() accepts an iterable", () => {
+ const s = scaleQuantize().domain(new Set([1, 2]));
+ assert.deepStrictEqual(s.domain(), [1, 2]);
});
-tape("quantize.domain() only considers the first and second element of the domain", function(test) {
- var s = scale.scaleQuantize().domain([-1, 100, 200]);
- test.deepEqual(s.domain(), [-1, 100]);
- test.end();
+it("quantize.domain() only considers the first and second element of the domain", () => {
+ const s = scaleQuantize().domain([-1, 100, 200]);
+ assert.deepStrictEqual(s.domain(), [-1, 100]);
});
-tape("quantize.range() cardinality determines the degree of quantization", function(test) {
- var s = scale.scaleQuantize();
- test.inDelta(s.range(array.range(0, 1.001, 0.001))(1/3), 0.333, 1e-6);
- test.inDelta(s.range(array.range(0, 1.010, 0.010))(1/3), 0.330, 1e-6);
- test.inDelta(s.range(array.range(0, 1.100, 0.100))(1/3), 0.300, 1e-6);
- test.inDelta(s.range(array.range(0, 1.200, 0.200))(1/3), 0.400, 1e-6);
- test.inDelta(s.range(array.range(0, 1.250, 0.250))(1/3), 0.250, 1e-6);
- test.inDelta(s.range(array.range(0, 1.500, 0.500))(1/3), 0.500, 1e-6);
- test.inDelta(s.range(array.range(1))(1/3), 0, 1e-6);
- test.end();
+it("quantize.range() cardinality determines the degree of quantization", () => {
+ const s = scaleQuantize();
+ assertInDelta(s.range(range(0, 1.001, 0.001))(1/3), 0.333, 1e-6);
+ assertInDelta(s.range(range(0, 1.010, 0.010))(1/3), 0.330, 1e-6);
+ assertInDelta(s.range(range(0, 1.100, 0.100))(1/3), 0.300, 1e-6);
+ assertInDelta(s.range(range(0, 1.200, 0.200))(1/3), 0.400, 1e-6);
+ assertInDelta(s.range(range(0, 1.250, 0.250))(1/3), 0.250, 1e-6);
+ assertInDelta(s.range(range(0, 1.500, 0.500))(1/3), 0.500, 1e-6);
+ assertInDelta(s.range(range(1))(1/3), 0, 1e-6);
});
-tape("quantize.range() values are arbitrary", function(test) {
- var a = {},
- b = {},
- c = {},
- s = scale.scaleQuantize().range([a, b, c]);
- test.equal(s(0.0), a);
- test.equal(s(0.2), a);
- test.equal(s(0.4), b);
- test.equal(s(0.6), b);
- test.equal(s(0.8), c);
- test.equal(s(1.0), c);
- test.end();
+it("quantize.range() values are arbitrary", () => {
+ const a = {};
+ const b = {};
+ const c = {};
+ const s = scaleQuantize().range([a, b, c]);
+ assert.strictEqual(s(0.0), a);
+ assert.strictEqual(s(0.2), a);
+ assert.strictEqual(s(0.4), b);
+ assert.strictEqual(s(0.6), b);
+ assert.strictEqual(s(0.8), c);
+ assert.strictEqual(s(1.0), c);
});
-tape("quantize.invertExtent() maps a value in the range to a domain extent", function(test) {
- var s = scale.scaleQuantize().range([0, 1, 2, 3]);
- test.deepEqual(s.invertExtent(0), [0.00, 0.25]);
- test.deepEqual(s.invertExtent(1), [0.25, 0.50]);
- test.deepEqual(s.invertExtent(2), [0.50, 0.75]);
- test.deepEqual(s.invertExtent(3), [0.75, 1.00]);
- test.end();
+it("quantize.invertExtent() maps a value in the range to a domain extent", () => {
+ const s = scaleQuantize().range([0, 1, 2, 3]);
+ assert.deepStrictEqual(s.invertExtent(0), [0.00, 0.25]);
+ assert.deepStrictEqual(s.invertExtent(1), [0.25, 0.50]);
+ assert.deepStrictEqual(s.invertExtent(2), [0.50, 0.75]);
+ assert.deepStrictEqual(s.invertExtent(3), [0.75, 1.00]);
});
-tape("quantize.invertExtent() allows arbitrary range values", function(test) {
- var a = {},
- b = {},
- s = scale.scaleQuantize().range([a, b]);
- test.deepEqual(s.invertExtent(a), [0.0, 0.5]);
- test.deepEqual(s.invertExtent(b), [0.5, 1.0]);
- test.end();
+it("quantize.invertExtent() allows arbitrary range values", () => {
+ const a = {};
+ const b = {};
+ const s = scaleQuantize().range([a, b]);
+ assert.deepStrictEqual(s.invertExtent(a), [0.0, 0.5]);
+ assert.deepStrictEqual(s.invertExtent(b), [0.5, 1.0]);
});
-tape("quantize.invertExtent() returns [NaN, NaN] when the given value is not in the range", function(test) {
- var s = scale.scaleQuantize();
- test.ok(s.invertExtent(-1).every(Number.isNaN));
- test.ok(s.invertExtent(0.5).every(Number.isNaN));
- test.ok(s.invertExtent(2).every(Number.isNaN));
- test.ok(s.invertExtent("a").every(Number.isNaN));
- test.end();
+it("quantize.invertExtent() returns [NaN, NaN] when the given value is not in the range", () => {
+ const s = scaleQuantize();
+ assert(s.invertExtent(-1).every(Number.isNaN));
+ assert(s.invertExtent(0.5).every(Number.isNaN));
+ assert(s.invertExtent(2).every(Number.isNaN));
+ assert(s.invertExtent("a").every(Number.isNaN));
});
-tape("quantize.invertExtent() returns the first match if duplicate values exist in the range", function(test) {
- var s = scale.scaleQuantize().range([0, 1, 2, 0]);
- test.deepEqual(s.invertExtent(0), [0.00, 0.25]);
- test.deepEqual(s.invertExtent(1), [0.25, 0.50]);
- test.end();
+it("quantize.invertExtent() returns the first match if duplicate values exist in the range", () => {
+ const s = scaleQuantize().range([0, 1, 2, 0]);
+ assert.deepStrictEqual(s.invertExtent(0), [0.00, 0.25]);
+ assert.deepStrictEqual(s.invertExtent(1), [0.25, 0.50]);
});
-tape("quantize.invertExtent(y) is exactly consistent with quantize(x)", function(test) {
- var s = scale.scaleQuantize().domain([4.2, 6.2]).range(array.range(10));
+it("quantize.invertExtent(y) is exactly consistent with quantize(x)", () => {
+ const s = scaleQuantize().domain([4.2, 6.2]).range(range(10));
s.range().forEach(function(y) {
- var e = s.invertExtent(y);
- test.equal(s(e[0]), y);
- test.equal(s(e[1]), y < 9 ? y + 1 : y);
+ const e = s.invertExtent(y);
+ assert.strictEqual(s(e[0]), y);
+ assert.strictEqual(s(e[1]), y < 9 ? y + 1 : y);
});
- test.end();
});
diff --git a/test/radial-test.js b/test/radial-test.js
index 762d66c..1d73069 100644
--- a/test/radial-test.js
+++ b/test/radial-test.js
@@ -1,92 +1,80 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleRadial} from "../src/index.js";
-tape("scaleRadial() has the expected defaults", function(test) {
- var s = scale.scaleRadial();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.clamp(), false);
- test.equal(s.round(), false);
- test.end();
+it("scaleRadial() has the expected defaults", () => {
+ const s = scaleRadial();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.round(), false);
});
-tape("scaleRadial(range) sets the range", function(test) {
- var s = scale.scaleRadial([100, 200]);
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [100, 200]);
- test.equal(s(0.5), 158.11388300841898);
- test.end();
+it("scaleRadial(range) sets the range", () => {
+ const s = scaleRadial([100, 200]);
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [100, 200]);
+ assert.strictEqual(s(0.5), 158.11388300841898);
});
-tape("scaleRadial(domain, range) sets the range", function(test) {
- var s = scale.scaleRadial([1, 2], [10, 20]);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(s.range(), [10, 20]);
- test.equal(s(1.5), 15.811388300841896);
- test.end();
+it("scaleRadial(domain, range) sets the range", () => {
+ const s = scaleRadial([1, 2], [10, 20]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(s.range(), [10, 20]);
+ assert.strictEqual(s(1.5), 15.811388300841896);
});
-tape("radial(x) maps a domain value x to a range value y", function(test) {
- test.equal(scale.scaleRadial([1, 2])(0.5), 1.5811388300841898);
- test.end();
+it("radial(x) maps a domain value x to a range value y", () => {
+ assert.strictEqual(scaleRadial([1, 2])(0.5), 1.5811388300841898);
});
-tape("radial(x) ignores extra range values if the domain is smaller than the range", function(test) {
- test.equal(scale.scaleRadial().domain([-10, 0]).range([2, 3, 4]).clamp(true)(-5), 2.5495097567963922);
- test.equal(scale.scaleRadial().domain([-10, 0]).range([2, 3, 4]).clamp(true)(50), 3);
- test.end();
+it("radial(x) ignores extra range values if the domain is smaller than the range", () => {
+ assert.strictEqual(scaleRadial().domain([-10, 0]).range([2, 3, 4]).clamp(true)(-5), 2.5495097567963922);
+ assert.strictEqual(scaleRadial().domain([-10, 0]).range([2, 3, 4]).clamp(true)(50), 3);
});
-tape("radial(x) ignores extra domain values if the range is smaller than the domain", function(test) {
- test.equal(scale.scaleRadial().domain([-10, 0, 100]).range([2, 3]).clamp(true)(-5), 2.5495097567963922);
- test.equal(scale.scaleRadial().domain([-10, 0, 100]).range([2, 3]).clamp(true)(50), 3);
- test.end();
+it("radial(x) ignores extra domain values if the range is smaller than the domain", () => {
+ assert.strictEqual(scaleRadial().domain([-10, 0, 100]).range([2, 3]).clamp(true)(-5), 2.5495097567963922);
+ assert.strictEqual(scaleRadial().domain([-10, 0, 100]).range([2, 3]).clamp(true)(50), 3);
});
-tape("radial(x) maps an empty domain to the middle of the range", function(test) {
- test.equal(scale.scaleRadial().domain([0, 0]).range([1, 2])(0), 1.5811388300841898);
- test.equal(scale.scaleRadial().domain([0, 0]).range([2, 1])(1), 1.5811388300841898);
- test.end();
+it("radial(x) maps an empty domain to the middle of the range", () => {
+ assert.strictEqual(scaleRadial().domain([0, 0]).range([1, 2])(0), 1.5811388300841898);
+ assert.strictEqual(scaleRadial().domain([0, 0]).range([2, 1])(1), 1.5811388300841898);
});
-tape("radial(x) can map a bilinear domain with two values to the corresponding range", function(test) {
- var s = scale.scaleRadial().domain([1, 2]);
- test.deepEqual(s.domain(), [1, 2]);
- test.equal(s(0.5), -0.7071067811865476);
- test.equal(s(1.0), 0.0);
- test.equal(s(1.5), 0.7071067811865476);
- test.equal(s(2.0), 1.0);
- test.equal(s(2.5), 1.224744871391589);
- test.equal(s.invert(-0.5), 0.75);
- test.equal(s.invert( 0.0), 1.0);
- test.equal(s.invert( 0.5), 1.25);
- test.equal(s.invert( 1.0), 2.0);
- test.equal(s.invert( 1.5), 3.25);
- test.end();
+it("radial(x) can map a bilinear domain with two values to the corresponding range", () => {
+ const s = scaleRadial().domain([1, 2]);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.strictEqual(s(0.5), -0.7071067811865476);
+ assert.strictEqual(s(1.0), 0.0);
+ assert.strictEqual(s(1.5), 0.7071067811865476);
+ assert.strictEqual(s(2.0), 1.0);
+ assert.strictEqual(s(2.5), 1.224744871391589);
+ assert.strictEqual(s.invert(-0.5), 0.75);
+ assert.strictEqual(s.invert( 0.0), 1.0);
+ assert.strictEqual(s.invert( 0.5), 1.25);
+ assert.strictEqual(s.invert( 1.0), 2.0);
+ assert.strictEqual(s.invert( 1.5), 3.25);
});
-tape("radial(NaN) returns undefined", function(test) {
- var s = scale.scaleRadial();
- test.strictEqual(s(NaN), undefined);
- test.strictEqual(s(undefined), undefined);
- test.strictEqual(s("foo"), undefined);
- test.strictEqual(s({}), undefined);
- test.end();
+it("radial(NaN) returns undefined", () => {
+ const s = scaleRadial();
+ assert.strictEqual(s(NaN), undefined);
+ assert.strictEqual(s(undefined), undefined);
+ assert.strictEqual(s("foo"), undefined);
+ assert.strictEqual(s({}), undefined);
});
-tape("radial.unknown(unknown)(NaN) returns the specified unknown value", function(test) {
- test.strictEqual(scale.scaleRadial().unknown("foo")(NaN), "foo");
- test.end();
+it("radial.unknown(unknown)(NaN) returns the specified unknown value", () => {
+ assert.strictEqual(scaleRadial().unknown("foo")(NaN), "foo");
});
-tape("radial(x) can handle a negative range", function(test) {
- test.equal(scale.scaleRadial([-1, -2])(0.5), -1.5811388300841898);
- test.end();
+it("radial(x) can handle a negative range", () => {
+ assert.strictEqual(scaleRadial([-1, -2])(0.5), -1.5811388300841898);
});
-tape("radial(x) can clamp negative values", function(test) {
- test.equal(scale.scaleRadial([-1, -2]).clamp(true)(-0.5), -1);
- test.equal(scale.scaleRadial().clamp(true)(-0.5), 0);
- test.equal(scale.scaleRadial([-0.25, 0], [1, 2]).clamp(true)(-0.5), 1);
- test.end();
+it("radial(x) can clamp negative values", () => {
+ assert.strictEqual(scaleRadial([-1, -2]).clamp(true)(-0.5), -1);
+ assert.strictEqual(scaleRadial().clamp(true)(-0.5), 0);
+ assert.strictEqual(scaleRadial([-0.25, 0], [1, 2]).clamp(true)(-0.5), 1);
});
diff --git a/test/roundEpsilon.js b/test/roundEpsilon.js
index 89682ac..fdc1023 100644
--- a/test/roundEpsilon.js
+++ b/test/roundEpsilon.js
@@ -1,3 +1,3 @@
-module.exports = function(x) {
+export function roundEpsilon(x) {
return Math.round(x * 1e12) / 1e12;
-};
+}
diff --git a/test/sequential-test.js b/test/sequential-test.js
index 9ba7837..7385426 100644
--- a/test/sequential-test.js
+++ b/test/sequential-test.js
@@ -1,133 +1,119 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleSequential} from "../src/index.js";
-tape("scaleSequential() has the expected defaults", function(test) {
- var s = scale.scaleSequential();
- test.deepEqual(s.domain(), [0, 1]);
- test.equal(s.interpolator()(0.42), 0.42);
- test.equal(s.clamp(), false);
- test.equal(s.unknown(), undefined);
- test.equal(s(-0.5), -0.5);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 0.5);
- test.equal(s( 1.0), 1.0);
- test.equal(s( 1.5), 1.5);
- test.end();
+it("scaleSequential() has the expected defaults", () => {
+ const s = scaleSequential();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.strictEqual(s.interpolator()(0.42), 0.42);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.unknown(), undefined);
+ assert.strictEqual(s(-0.5), -0.5);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 0.5);
+ assert.strictEqual(s( 1.0), 1.0);
+ assert.strictEqual(s( 1.5), 1.5);
});
-tape("sequential.clamp(true) enables clamping", function(test) {
- var s = scale.scaleSequential().clamp(true);
- test.equal(s.clamp(), true);
- test.equal(s(-0.5), 0.0);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 0.5);
- test.equal(s( 1.0), 1.0);
- test.equal(s( 1.5), 1.0);
- test.end();
+it("sequential.clamp(true) enables clamping", () => {
+ const s = scaleSequential().clamp(true);
+ assert.strictEqual(s.clamp(), true);
+ assert.strictEqual(s(-0.5), 0.0);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 0.5);
+ assert.strictEqual(s( 1.0), 1.0);
+ assert.strictEqual(s( 1.5), 1.0);
});
-tape("sequential.unknown(value) sets the return value for undefined and NaN input", function(test) {
- var s = scale.scaleSequential().unknown(-1);
- test.equal(s.unknown(), -1);
- test.equal(s(undefined), -1);
- test.equal(s(NaN), -1);
- test.equal(s("N/A"), -1);
- test.equal(s(0.4), 0.4);
- test.end();
+it("sequential.unknown(value) sets the return value for undefined and NaN input", () => {
+ const s = scaleSequential().unknown(-1);
+ assert.strictEqual(s.unknown(), -1);
+ assert.strictEqual(s(undefined), -1);
+ assert.strictEqual(s(NaN), -1);
+ assert.strictEqual(s("N/A"), -1);
+ assert.strictEqual(s(0.4), 0.4);
});
-tape("sequential.domain() coerces domain values to numbers", function(test) {
- var s = scale.scaleSequential().domain(["-1.20", "2.40"]);
- test.deepEqual(s.domain(), [-1.2, 2.4]);
- test.equal(s(-1.2), 0.0);
- test.equal(s( 0.6), 0.5);
- test.equal(s( 2.4), 1.0);
- test.end();
+it("sequential.domain() coerces domain values to numbers", () => {
+ const s = scaleSequential().domain(["-1.20", "2.40"]);
+ assert.deepStrictEqual(s.domain(), [-1.2, 2.4]);
+ assert.strictEqual(s(-1.2), 0.0);
+ assert.strictEqual(s( 0.6), 0.5);
+ assert.strictEqual(s( 2.4), 1.0);
});
-tape("sequential.domain() accepts an iterable", function(test) {
- var s = scale.scaleSequential().domain(new Set(["-1.20", "2.40"]));
- test.deepEqual(s.domain(), [-1.2, 2.4]);
- test.end();
+it("sequential.domain() accepts an iterable", () => {
+ const s = scaleSequential().domain(new Set(["-1.20", "2.40"]));
+ assert.deepStrictEqual(s.domain(), [-1.2, 2.4]);
});
-tape("sequential.domain() handles a degenerate domain", function(test) {
- var s = scale.scaleSequential().domain([2, 2]);
- test.deepEqual(s.domain(), [2, 2]);
- test.equal(s(-1.2), 0.5);
- test.equal(s( 0.6), 0.5);
- test.equal(s( 2.4), 0.5);
- test.end();
+it("sequential.domain() handles a degenerate domain", () => {
+ const s = scaleSequential().domain([2, 2]);
+ assert.deepStrictEqual(s.domain(), [2, 2]);
+ assert.strictEqual(s(-1.2), 0.5);
+ assert.strictEqual(s( 0.6), 0.5);
+ assert.strictEqual(s( 2.4), 0.5);
});
-tape("sequential.domain() handles a non-numeric domain", function(test) {
- var s = scale.scaleSequential().domain([NaN, 2]);
- test.equal(isNaN(s.domain()[0]), true);
- test.equal(s.domain()[1], 2);
- test.equal(isNaN(s(-1.2)), true);
- test.equal(isNaN(s( 0.6)), true);
- test.equal(isNaN(s( 2.4)), true);
- test.end();
+it("sequential.domain() handles a non-numeric domain", () => {
+ const s = scaleSequential().domain([NaN, 2]);
+ assert.strictEqual(isNaN(s.domain()[0]), true);
+ assert.strictEqual(s.domain()[1], 2);
+ assert.strictEqual(isNaN(s(-1.2)), true);
+ assert.strictEqual(isNaN(s( 0.6)), true);
+ assert.strictEqual(isNaN(s( 2.4)), true);
});
-tape("sequential.domain() only considers the first and second element of the domain", function(test) {
- var s = scale.scaleSequential().domain([-1, 100, 200]);
- test.deepEqual(s.domain(), [-1, 100]);
- test.end();
+it("sequential.domain() only considers the first and second element of the domain", () => {
+ const s = scaleSequential().domain([-1, 100, 200]);
+ assert.deepStrictEqual(s.domain(), [-1, 100]);
});
-tape("sequential.copy() returns an isolated copy of the scale", function(test) {
- var s1 = scale.scaleSequential().domain([1, 3]).clamp(true),
- s2 = s1.copy();
- test.deepEqual(s2.domain(), [1, 3]);
- test.equal(s2.clamp(), true);
+it("sequential.copy() returns an isolated copy of the scale", () => {
+ const s1 = scaleSequential().domain([1, 3]).clamp(true);
+ const s2 = s1.copy();
+ assert.deepStrictEqual(s2.domain(), [1, 3]);
+ assert.strictEqual(s2.clamp(), true);
s1.domain([-1, 2]);
- test.deepEqual(s2.domain(), [1, 3]);
+ assert.deepStrictEqual(s2.domain(), [1, 3]);
s1.clamp(false);
- test.equal(s2.clamp(), true);
+ assert.strictEqual(s2.clamp(), true);
s2.domain([3, 4]);
- test.deepEqual(s1.domain(), [-1, 2]);
+ assert.deepStrictEqual(s1.domain(), [-1, 2]);
s2.clamp(true);
- test.deepEqual(s1.clamp(), false);
- test.end();
+ assert.deepStrictEqual(s1.clamp(), false);
});
-tape("sequential.interpolator(interpolator) sets the interpolator", function(test) {
- var i0 = function(t) { return t; },
- i1 = function(t) { return t * 2; },
- s = scale.scaleSequential(i0);
- test.equal(s.interpolator(), i0);
- test.equal(s.interpolator(i1), s);
- test.equal(s.interpolator(), i1);
- test.equal(s(-0.5), -1.0);
- test.equal(s( 0.0), 0.0);
- test.equal(s( 0.5), 1.0);
- test.end();
+it("sequential.interpolator(interpolator) sets the interpolator", () => {
+ const i0 = function(t) { return t; };
+ const i1 = function(t) { return t * 2; };
+ const s = scaleSequential(i0);
+ assert.strictEqual(s.interpolator(), i0);
+ assert.strictEqual(s.interpolator(i1), s);
+ assert.strictEqual(s.interpolator(), i1);
+ assert.strictEqual(s(-0.5), -1.0);
+ assert.strictEqual(s( 0.0), 0.0);
+ assert.strictEqual(s( 0.5), 1.0);
});
-tape("sequential.range() returns the computed range", function(test) {
- var s = scale.scaleSequential(function(t) { return t * 2 + 1; });
- test.deepEqual(s.range(), [1, 3]);
- test.end();
+it("sequential.range() returns the computed range", () => {
+ const s = scaleSequential(function(t) { return t * 2 + 1; });
+ assert.deepStrictEqual(s.range(), [1, 3]);
});
-tape("sequential.range(range) sets the interpolator", function(test) {
- var s = scale.scaleSequential().range([1, 3]);
- test.equal(s.interpolator()(0.5), 2);
- test.deepEqual(s.range(), [1, 3]);
- test.end();
+it("sequential.range(range) sets the interpolator", () => {
+ const s = scaleSequential().range([1, 3]);
+ assert.strictEqual(s.interpolator()(0.5), 2);
+ assert.deepStrictEqual(s.range(), [1, 3]);
});
-tape("sequential.range(range) ignores additional values", function(test) {
- var s = scale.scaleSequential().range([1, 3, 10]);
- test.equal(s.interpolator()(0.5), 2);
- test.deepEqual(s.range(), [1, 3]);
- test.end();
+it("sequential.range(range) ignores additional values", () => {
+ const s = scaleSequential().range([1, 3, 10]);
+ assert.strictEqual(s.interpolator()(0.5), 2);
+ assert.deepStrictEqual(s.range(), [1, 3]);
});
-tape("scaleSequential(range) sets the interpolator", function(test) {
- var s = scale.scaleSequential([1, 3]);
- test.equal(s.interpolator()(0.5), 2);
- test.deepEqual(s.range(), [1, 3]);
- test.end();
+it("scaleSequential(range) sets the interpolator", () => {
+ const s = scaleSequential([1, 3]);
+ assert.strictEqual(s.interpolator()(0.5), 2);
+ assert.deepStrictEqual(s.range(), [1, 3]);
});
diff --git a/test/sequentialQuantile-test.js b/test/sequentialQuantile-test.js
index 5f02d82..0a7f6ae 100644
--- a/test/sequentialQuantile-test.js
+++ b/test/sequentialQuantile-test.js
@@ -1,30 +1,26 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleSequentialQuantile} from "../src/index.js";
-tape("sequentialQuantile() clamps", function(test) {
- var s = scale.scaleSequentialQuantile().domain([0, 1, 2, 3, 10]);
- test.equal(s(-1), 0);
- test.equal(s(0), 0);
- test.equal(s(1), 0.25);
- test.equal(s(10), 1);
- test.equal(s(20), 1);
- test.end();
+it("sequentialQuantile() clamps", () => {
+ const s = scaleSequentialQuantile().domain([0, 1, 2, 3, 10]);
+ assert.strictEqual(s(-1), 0);
+ assert.strictEqual(s(0), 0);
+ assert.strictEqual(s(1), 0.25);
+ assert.strictEqual(s(10), 1);
+ assert.strictEqual(s(20), 1);
});
-tape("sequentialQuantile().domain() sorts the domain", function(test) {
- var s = scale.scaleSequentialQuantile().domain([0, 2, 9, 0.1, 10]);
- test.deepEqual(s.domain(), [0, 0.1, 2, 9, 10]);
- test.end();
+it("sequentialQuantile().domain() sorts the domain", () => {
+ const s = scaleSequentialQuantile().domain([0, 2, 9, 0.1, 10]);
+ assert.deepStrictEqual(s.domain(), [0, 0.1, 2, 9, 10]);
});
-tape("sequentialQuantile().range() returns the computed range", function(test) {
- var s = scale.scaleSequentialQuantile().domain([0, 2, 9, 0.1, 10]);
- test.deepEqual(s.range(), [0 / 4, 1 / 4, 2 / 4, 3 / 4, 4 / 4]);
- test.end();
+it("sequentialQuantile().range() returns the computed range", () => {
+ const s = scaleSequentialQuantile().domain([0, 2, 9, 0.1, 10]);
+ assert.deepStrictEqual(s.range(), [0 / 4, 1 / 4, 2 / 4, 3 / 4, 4 / 4]);
});
-tape("sequentialQuantile().quantiles(n) computes n + 1 quantiles", function(test) {
- var s = scale.scaleSequentialQuantile().domain(Array.from({length: 2000}, (_, i) => 2 * i / 1999));
- test.deepEqual(s.quantiles(4), [0, 0.5, 1, 1.5, 2]);
- test.end();
+it("sequentialQuantile().quantiles(n) computes n + 1 quantiles", () => {
+ const s = scaleSequentialQuantile().domain(Array.from({length: 2000}, (_, i) => 2 * i / 1999));
+ assert.deepStrictEqual(s.quantiles(4), [0, 0.5, 1, 1.5, 2]);
});
diff --git a/test/sqrt-test.js b/test/sqrt-test.js
index 42dac03..8767cd4 100644
--- a/test/sqrt-test.js
+++ b/test/sqrt-test.js
@@ -1,19 +1,15 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleSqrt} from "../src/index.js";
-require("./inDelta");
-
-tape("scaleSqrt() has the expected defaults", function(test) {
- var s = scale.scaleSqrt();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.clamp(), false);
- test.equal(s.exponent(), 0.5);
- test.deepEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
- test.end();
+it("scaleSqrt() has the expected defaults", () => {
+ const s = scaleSqrt();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.exponent(), 0.5);
+ assert.deepStrictEqual(s.interpolate()({array: ["red"]}, {array: ["blue"]})(0.5), {array: ["rgb(128, 0, 128)"]});
});
-tape("sqrt(x) maps a domain value x to a range value y", function(test) {
- test.equal(scale.scaleSqrt()(0.5), Math.SQRT1_2);
- test.end();
+it("sqrt(x) maps a domain value x to a range value y", () => {
+ assert.strictEqual(scaleSqrt()(0.5), Math.SQRT1_2);
});
diff --git a/test/symlog-test.js b/test/symlog-test.js
index 4f34215..7b65749 100644
--- a/test/symlog-test.js
+++ b/test/symlog-test.js
@@ -1,195 +1,170 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleSymlog} from "../src/index.js";
+import {assertInDelta} from "./asserts.js";
-require("./inDelta");
-
-tape("scaleSymlog() has the expected defaults", function(test) {
- var s = scale.scaleSymlog();
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.equal(s.clamp(), false);
- test.equal(s.constant(), 1);
- test.end();
+it("scaleSymlog() has the expected defaults", () => {
+ const s = scaleSymlog();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
+ assert.strictEqual(s.clamp(), false);
+ assert.strictEqual(s.constant(), 1);
});
-tape("symlog(x) maps a domain value x to a range value y", function(test) {
- var s = scale.scaleSymlog().domain([-100, 100]);
- test.equal(s(-100), 0);
- test.equal(s(100), 1);
- test.equal(s(0), 0.5);
- test.end();
+it("symlog(x) maps a domain value x to a range value y", () => {
+ const s = scaleSymlog().domain([-100, 100]);
+ assert.strictEqual(s(-100), 0);
+ assert.strictEqual(s(100), 1);
+ assert.strictEqual(s(0), 0.5);
});
-tape("symlog.invert(y) maps a range value y to a domain value x", function(test) {
- var s = scale.scaleSymlog().domain([-100, 100]);
- test.inDelta(s.invert(1), 100);
- test.end();
+it("symlog.invert(y) maps a range value y to a domain value x", () => {
+ const s = scaleSymlog().domain([-100, 100]);
+ assertInDelta(s.invert(1), 100);
});
-tape("symlog.invert(y) coerces range values to numbers", function(test) {
- var s = scale.scaleSymlog().range(["-3", "3"]);
- test.deepEqual(s.invert(3), 1);
- test.end();
+it("symlog.invert(y) coerces range values to numbers", () => {
+ const s = scaleSymlog().range(["-3", "3"]);
+ assert.deepStrictEqual(s.invert(3), 1);
});
-tape("symlog.invert(y) returns NaN if the range is not coercible to number", function(test) {
- test.ok(isNaN(scale.scaleSymlog().range(["#000", "#fff"]).invert("#999")));
- test.ok(isNaN(scale.scaleSymlog().range([0, "#fff"]).invert("#999")));
- test.end();
+it("symlog.invert(y) returns NaN if the range is not coercible to number", () => {
+ assert(isNaN(scaleSymlog().range(["#000", "#fff"]).invert("#999")));
+ assert(isNaN(scaleSymlog().range([0, "#fff"]).invert("#999")));
});
-tape("symlog.constant(constant) sets the constant to the specified value", function(test) {
- var s = scale.scaleSymlog().constant(5);
- test.equal(s.constant(), 5);
- test.end();
+it("symlog.constant(constant) sets the constant to the specified value", () => {
+ const s = scaleSymlog().constant(5);
+ assert.strictEqual(s.constant(), 5);
});
-tape("symlog.constant(constant) changing the constant does not change the domain or range", function(test) {
- var s = scale.scaleSymlog().constant(2);
- test.deepEqual(s.domain(), [0, 1]);
- test.deepEqual(s.range(), [0, 1]);
- test.end();
+it("symlog.constant(constant) changing the constant does not change the domain or range", () => {
+ const s = scaleSymlog().constant(2);
+ assert.deepStrictEqual(s.domain(), [0, 1]);
+ assert.deepStrictEqual(s.range(), [0, 1]);
});
-tape("symlog.domain(domain) accepts an array of numbers", function(test) {
- test.deepEqual(scale.scaleSymlog().domain([]).domain(), []);
- test.deepEqual(scale.scaleSymlog().domain([1, 0]).domain(), [1, 0]);
- test.deepEqual(scale.scaleSymlog().domain([1, 2, 3]).domain(), [1, 2, 3]);
- test.end();
+it("symlog.domain(domain) accepts an array of numbers", () => {
+ assert.deepStrictEqual(scaleSymlog().domain([]).domain(), []);
+ assert.deepStrictEqual(scaleSymlog().domain([1, 0]).domain(), [1, 0]);
+ assert.deepStrictEqual(scaleSymlog().domain([1, 2, 3]).domain(), [1, 2, 3]);
});
-tape("symlog.domain(domain) coerces domain values to numbers", function(test) {
- test.deepEqual(scale.scaleSymlog().domain([new Date(1990, 0, 1), new Date(1991, 0, 1)]).domain(), [631180800000, 662716800000]);
- test.deepEqual(scale.scaleSymlog().domain(["0.0", "1.0"]).domain(), [0, 1]);
- test.deepEqual(scale.scaleSymlog().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
- test.end();
+it("symlog.domain(domain) coerces domain values to numbers", () => {
+ assert.deepStrictEqual(scaleSymlog().domain([new Date(Date.UTC(1990, 0, 1)), new Date(Date.UTC(1991, 0, 1))]).domain(), [631152000000, 662688000000]);
+ assert.deepStrictEqual(scaleSymlog().domain(["0.0", "1.0"]).domain(), [0, 1]);
+ assert.deepStrictEqual(scaleSymlog().domain([new Number(0), new Number(1)]).domain(), [0, 1]);
});
-tape("symlog.domain(domain) makes a copy of domain values", function(test) {
- var d = [1, 2], s = scale.scaleSymlog().domain(d);
- test.deepEqual(s.domain(), [1, 2]);
+it("symlog.domain(domain) makes a copy of domain values", () => {
+ const d = [1, 2], s = scaleSymlog().domain(d);
+ assert.deepStrictEqual(s.domain(), [1, 2]);
d.push(3);
- test.deepEqual(s.domain(), [1, 2]);
- test.deepEqual(d, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [1, 2]);
+ assert.deepStrictEqual(d, [1, 2, 3]);
});
-tape("symlog.domain() returns a copy of domain values", function(test) {
- var s = scale.scaleSymlog(), d = s.domain();
- test.deepEqual(d, [0, 1]);
+it("symlog.domain() returns a copy of domain values", () => {
+ const s = scaleSymlog(), d = s.domain();
+ assert.deepStrictEqual(d, [0, 1]);
d.push(3);
- test.deepEqual(s.domain(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.domain(), [0, 1]);
});
-tape("symlog.range(range) does not coerce range to numbers", function(test) {
- var s = scale.scaleSymlog().range(["0px", "2px"]);
- test.deepEqual(s.range(), ["0px", "2px"]);
- test.equal(s(1), "2px");
- test.end();
+it("symlog.range(range) does not coerce range to numbers", () => {
+ const s = scaleSymlog().range(["0px", "2px"]);
+ assert.deepStrictEqual(s.range(), ["0px", "2px"]);
+ assert.strictEqual(s(1), "2px");
});
-tape("symlog.range(range) can accept range values as arrays or objects", function(test) {
- test.deepEqual(scale.scaleSymlog().range([{color: "red"}, {color: "blue"}])(1), {color: "rgb(0, 0, 255)"});
- test.deepEqual(scale.scaleSymlog().range([["red"], ["blue"]])(0), ["rgb(255, 0, 0)"]);
- test.end();
+it("symlog.range(range) can accept range values as arrays or objects", () => {
+ assert.deepStrictEqual(scaleSymlog().range([{color: "red"}, {color: "blue"}])(1), {color: "rgb(0, 0, 255)"});
+ assert.deepStrictEqual(scaleSymlog().range([["red"], ["blue"]])(0), ["rgb(255, 0, 0)"]);
});
-tape("symlog.range(range) makes a copy of range values", function(test) {
- var r = [1, 2], s = scale.scaleSymlog().range(r);
- test.deepEqual(s.range(), [1, 2]);
+it("symlog.range(range) makes a copy of range values", () => {
+ const r = [1, 2], s = scaleSymlog().range(r);
+ assert.deepStrictEqual(s.range(), [1, 2]);
r.push(3);
- test.deepEqual(s.range(), [1, 2]);
- test.deepEqual(r, [1, 2, 3]);
- test.end();
+ assert.deepStrictEqual(s.range(), [1, 2]);
+ assert.deepStrictEqual(r, [1, 2, 3]);
});
-tape("symlog.range() returns a copy of range values", function(test) {
- var s = scale.scaleSymlog(), r = s.range();
- test.deepEqual(r, [0, 1]);
+it("symlog.range() returns a copy of range values", () => {
+ const s = scaleSymlog(), r = s.range();
+ assert.deepStrictEqual(r, [0, 1]);
r.push(3);
- test.deepEqual(s.range(), [0, 1]);
- test.end();
+ assert.deepStrictEqual(s.range(), [0, 1]);
});
-tape("symlog.clamp() is false by default", function(test) {
- test.equal(scale.scaleSymlog().clamp(), false);
- test.equal(scale.scaleSymlog().range([10, 20])(3), 30);
- test.equal(scale.scaleSymlog().range([10, 20])(-1), 0);
- test.equal(scale.scaleSymlog().range([10, 20]).invert(30), 3);
- test.equal(scale.scaleSymlog().range([10, 20]).invert(0), -1);
- test.end();
+it("symlog.clamp() is false by default", () => {
+ assert.strictEqual(scaleSymlog().clamp(), false);
+ assert.strictEqual(scaleSymlog().range([10, 20])(3), 30);
+ assert.strictEqual(scaleSymlog().range([10, 20])(-1), 0);
+ assert.strictEqual(scaleSymlog().range([10, 20]).invert(30), 3);
+ assert.strictEqual(scaleSymlog().range([10, 20]).invert(0), -1);
});
-tape("symlog.clamp(true) restricts output values to the range", function(test) {
- test.equal(scale.scaleSymlog().clamp(true).range([10, 20])(2), 20);
- test.equal(scale.scaleSymlog().clamp(true).range([10, 20])(-1), 10);
- test.end();
+it("symlog.clamp(true) restricts output values to the range", () => {
+ assert.strictEqual(scaleSymlog().clamp(true).range([10, 20])(2), 20);
+ assert.strictEqual(scaleSymlog().clamp(true).range([10, 20])(-1), 10);
});
-tape("symlog.clamp(true) restricts input values to the domain", function(test) {
- test.equal(scale.scaleSymlog().clamp(true).range([10, 20]).invert(30), 1);
- test.equal(scale.scaleSymlog().clamp(true).range([10, 20]).invert(0), 0);
- test.end();
+it("symlog.clamp(true) restricts input values to the domain", () => {
+ assert.strictEqual(scaleSymlog().clamp(true).range([10, 20]).invert(30), 1);
+ assert.strictEqual(scaleSymlog().clamp(true).range([10, 20]).invert(0), 0);
});
-tape("symlog.clamp(clamp) coerces the specified clamp value to a boolean", function(test) {
- test.equal(scale.scaleSymlog().clamp("true").clamp(), true);
- test.equal(scale.scaleSymlog().clamp(1).clamp(), true);
- test.equal(scale.scaleSymlog().clamp("").clamp(), false);
- test.equal(scale.scaleSymlog().clamp(0).clamp(), false);
- test.end();
+it("symlog.clamp(clamp) coerces the specified clamp value to a boolean", () => {
+ assert.strictEqual(scaleSymlog().clamp("true").clamp(), true);
+ assert.strictEqual(scaleSymlog().clamp(1).clamp(), true);
+ assert.strictEqual(scaleSymlog().clamp("").clamp(), false);
+ assert.strictEqual(scaleSymlog().clamp(0).clamp(), false);
});
-tape("symlog.copy() returns a copy with changes to the domain are isolated", function(test) {
- var x = scale.scaleSymlog(), y = x.copy();
+it("symlog.copy() returns a copy with changes to the domain are isolated", () => {
+ const x = scaleSymlog(), y = x.copy();
x.domain([1, 2]);
- test.deepEqual(y.domain(), [0, 1]);
- test.equal(x(1), 0);
- test.equal(y(1), 1);
+ assert.deepStrictEqual(y.domain(), [0, 1]);
+ assert.strictEqual(x(1), 0);
+ assert.strictEqual(y(1), 1);
y.domain([2, 3]);
- test.equal(x(2), 1);
- test.equal(y(2), 0);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [2, 3]);
- y = x.domain([1, 1.9]).copy();
+ assert.strictEqual(x(2), 1);
+ assert.strictEqual(y(2), 0);
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y.domain(), [2, 3]);
+ const y2 = x.domain([1, 1.9]).copy();
x.nice(5);
- test.deepEqual(x.domain(), [1, 2]);
- test.deepEqual(y.domain(), [1, 1.9]);
- test.end();
+ assert.deepStrictEqual(x.domain(), [1, 2]);
+ assert.deepStrictEqual(y2.domain(), [1, 1.9]);
});
-tape("symlog.copy() returns a copy with changes to the range are isolated", function(test) {
- var x = scale.scaleSymlog(), y = x.copy();
+it("symlog.copy() returns a copy with changes to the range are isolated", () => {
+ const x = scaleSymlog(), y = x.copy();
x.range([1, 2]);
- test.equal(x.invert(1), 0);
- test.equal(y.invert(1), 1);
- test.deepEqual(y.range(), [0, 1]);
+ assert.strictEqual(x.invert(1), 0);
+ assert.strictEqual(y.invert(1), 1);
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.equal(x.invert(2), 1);
- test.equal(y.invert(2), 0);
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
+ assert.strictEqual(x.invert(2), 1);
+ assert.strictEqual(y.invert(2), 0);
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
});
-tape("symlog.copy() returns a copy with changes to clamping are isolated", function(test) {
- var x = scale.scaleSymlog().clamp(true), y = x.copy();
+it("symlog.copy() returns a copy with changes to clamping are isolated", () => {
+ const x = scaleSymlog().clamp(true), y = x.copy();
x.clamp(false);
- test.equal(x(3), 2);
- test.equal(y(2), 1);
- test.equal(y.clamp(), true);
+ assert.strictEqual(x(3), 2);
+ assert.strictEqual(y(2), 1);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.equal(x(3), 2);
- test.equal(y(3), 2);
- test.equal(x.clamp(), false);
- test.end();
+ assert.strictEqual(x(3), 2);
+ assert.strictEqual(y(3), 2);
+ assert.strictEqual(x.clamp(), false);
});
-tape("symlog().clamp(true).invert(x) cannot return a value outside the domain", function(test) {
- var x = scale.scaleSymlog().domain([1, 20]).clamp(true);
- test.equal(x.invert(0), 1);
- test.equal(x.invert(1), 20);
- test.end();
+it("symlog().clamp(true).invert(x) cannot return a value outside the domain", () => {
+ const x = scaleSymlog().domain([1, 20]).clamp(true);
+ assert.strictEqual(x.invert(0), 1);
+ assert.strictEqual(x.invert(1), 20);
});
-
diff --git a/test/threshold-test.js b/test/threshold-test.js
index a6c1fcf..a79d603 100644
--- a/test/threshold-test.js
+++ b/test/threshold-test.js
@@ -1,73 +1,65 @@
-var tape = require("tape"),
- scale = require("../");
+import assert from "assert";
+import {scaleThreshold} from "../src/index.js";
-tape("scaleThreshold() has the expected defaults", function(test) {
- var x = scale.scaleThreshold();
- test.deepEqual(x.domain(), [0.5]);
- test.deepEqual(x.range(), [0, 1]);
- test.equal(x(0.50), 1);
- test.equal(x(0.49), 0);
- test.end();
+it("scaleThreshold() has the expected defaults", () => {
+ const x = scaleThreshold();
+ assert.deepStrictEqual(x.domain(), [0.5]);
+ assert.deepStrictEqual(x.range(), [0, 1]);
+ assert.strictEqual(x(0.50), 1);
+ assert.strictEqual(x(0.49), 0);
});
-tape("threshold(x) maps a number to a discrete value in the range", function(test) {
- var x = scale.scaleThreshold().domain([1/3, 2/3]).range(["a", "b", "c"]);
- test.equal(x(0), "a");
- test.equal(x(0.2), "a");
- test.equal(x(0.4), "b");
- test.equal(x(0.6), "b");
- test.equal(x(0.8), "c");
- test.equal(x(1), "c");
- test.end();
+it("threshold(x) maps a number to a discrete value in the range", () => {
+ const x = scaleThreshold().domain([1/3, 2/3]).range(["a", "b", "c"]);
+ assert.strictEqual(x(0), "a");
+ assert.strictEqual(x(0.2), "a");
+ assert.strictEqual(x(0.4), "b");
+ assert.strictEqual(x(0.6), "b");
+ assert.strictEqual(x(0.8), "c");
+ assert.strictEqual(x(1), "c");
});
-tape("threshold(x) returns undefined if the specified value x is not orderable", function(test) {
- var x = scale.scaleThreshold().domain([1/3, 2/3]).range(["a", "b", "c"]);
- test.equal(x(), undefined);
- test.equal(x(undefined), undefined);
- test.equal(x(NaN), undefined);
- test.equal(x(null), undefined);
- test.end();
+it("threshold(x) returns undefined if the specified value x is not orderable", () => {
+ const x = scaleThreshold().domain([1/3, 2/3]).range(["a", "b", "c"]);
+ assert.strictEqual(x(), undefined);
+ assert.strictEqual(x(undefined), undefined);
+ assert.strictEqual(x(NaN), undefined);
+ assert.strictEqual(x(null), undefined);
});
-tape("threshold.domain(…) supports arbitrary orderable values", function(test) {
- var x = scale.scaleThreshold().domain(["10", "2"]).range([0, 1, 2]);
- test.strictEqual(x.domain()[0], "10");
- test.strictEqual(x.domain()[1], "2");
- test.equal(x("0"), 0);
- test.equal(x("12"), 1);
- test.equal(x("3"), 2);
- test.end();
+it("threshold.domain(…) supports arbitrary orderable values", () => {
+ const x = scaleThreshold().domain(["10", "2"]).range([0, 1, 2]);
+ assert.strictEqual(x.domain()[0], "10");
+ assert.strictEqual(x.domain()[1], "2");
+ assert.strictEqual(x("0"), 0);
+ assert.strictEqual(x("12"), 1);
+ assert.strictEqual(x("3"), 2);
});
-tape("threshold.domain(…) accepts an iterable", function(test) {
- var x = scale.scaleThreshold().domain(new Set(["10", "2"])).range([0, 1, 2]);
- test.deepEqual(x.domain(), ["10", "2"]);
- test.end();
+it("threshold.domain(…) accepts an iterable", () => {
+ const x = scaleThreshold().domain(new Set(["10", "2"])).range([0, 1, 2]);
+ assert.deepStrictEqual(x.domain(), ["10", "2"]);
});
-tape("threshold.range(…) supports arbitrary values", function(test) {
- var a = {}, b = {}, c = {}, x = scale.scaleThreshold().domain([1/3, 2/3]).range([a, b, c]);
- test.equal(x(0), a);
- test.equal(x(0.2), a);
- test.equal(x(0.4), b);
- test.equal(x(0.6), b);
- test.equal(x(0.8), c);
- test.equal(x(1), c);
- test.end();
+it("threshold.range(…) supports arbitrary values", () => {
+ const a = {}, b = {}, c = {}, x = scaleThreshold().domain([1/3, 2/3]).range([a, b, c]);
+ assert.strictEqual(x(0), a);
+ assert.strictEqual(x(0.2), a);
+ assert.strictEqual(x(0.4), b);
+ assert.strictEqual(x(0.6), b);
+ assert.strictEqual(x(0.8), c);
+ assert.strictEqual(x(1), c);
});
-tape("threshold.range(…) accepts an iterable", function(test) {
- var x = scale.scaleThreshold().domain(["10", "2"]).range(new Set([0, 1, 2]));
- test.deepEqual(x.range(), [0, 1, 2]);
- test.end();
+it("threshold.range(…) accepts an iterable", () => {
+ const x = scaleThreshold().domain(["10", "2"]).range(new Set([0, 1, 2]));
+ assert.deepStrictEqual(x.range(), [0, 1, 2]);
});
-tape("threshold.invertExtent(y) returns the domain extent for the specified range value", function(test) {
- var a = {}, b = {}, c = {}, x = scale.scaleThreshold().domain([1/3, 2/3]).range([a, b, c]);
- test.deepEqual(x.invertExtent(a), [undefined, 1/3]);
- test.deepEqual(x.invertExtent(b), [1/3, 2/3]);
- test.deepEqual(x.invertExtent(c), [2/3, undefined]);
- test.deepEqual(x.invertExtent({}), [undefined, undefined]);
- test.end();
+it("threshold.invertExtent(y) returns the domain extent for the specified range value", () => {
+ const a = {}, b = {}, c = {}, x = scaleThreshold().domain([1/3, 2/3]).range([a, b, c]);
+ assert.deepStrictEqual(x.invertExtent(a), [undefined, 1/3]);
+ assert.deepStrictEqual(x.invertExtent(b), [1/3, 2/3]);
+ assert.deepStrictEqual(x.invertExtent(c), [2/3, undefined]);
+ assert.deepStrictEqual(x.invertExtent({}), [undefined, undefined]);
});
diff --git a/test/tickFormat-test.js b/test/tickFormat-test.js
index 5a6d398..613e477 100644
--- a/test/tickFormat-test.js
+++ b/test/tickFormat-test.js
@@ -1,57 +1,43 @@
-var tape = require("tape"),
- scale = require("../"),
- format = require("d3-format");
+import assert from "assert";
+import {tickFormat} from "../src/index.js";
-format.formatDefaultLocale({
- decimal: ".",
- thousands: ",",
- grouping: [3],
- currency: ["$", ""],
- minus: "-"
+it("tickFormat(start, stop, count) returns a format suitable for the ticks", () => {
+ assert.strictEqual(tickFormat(0, 1, 10)(0.2), "0.2");
+ assert.strictEqual(tickFormat(0, 1, 20)(0.2), "0.20");
+ assert.strictEqual(tickFormat(-100, 100, 10)(-20), "−20");
});
-tape("d3.tickFormat(start, stop, count) returns a format suitable for the ticks", function(test) {
- test.equal(scale.tickFormat(0, 1, 10)(0.2), "0.2");
- test.equal(scale.tickFormat(0, 1, 20)(0.2), "0.20");
- test.equal(scale.tickFormat(-100, 100, 10)(-20), "-20");
- test.end();
+it("tickFormat(start, stop, count, specifier) sets the appropriate fixed precision if not specified", () => {
+ assert.strictEqual(tickFormat(0, 1, 10, "+f")(0.2), "+0.2");
+ assert.strictEqual(tickFormat(0, 1, 20, "+f")(0.2), "+0.20");
+ assert.strictEqual(tickFormat(0, 1, 10, "+%")(0.2), "+20%");
+ assert.strictEqual(tickFormat(0.19, 0.21, 10, "+%")(0.2), "+20.0%");
});
-tape("d3.tickFormat(start, stop, count, specifier) sets the appropriate fixed precision if not specified", function(test) {
- test.equal(scale.tickFormat(0, 1, 10, "+f")(0.2), "+0.2");
- test.equal(scale.tickFormat(0, 1, 20, "+f")(0.2), "+0.20");
- test.equal(scale.tickFormat(0, 1, 10, "+%")(0.2), "+20%");
- test.equal(scale.tickFormat(0.19, 0.21, 10, "+%")(0.2), "+20.0%");
- test.end();
+it("tickFormat(start, stop, count, specifier) sets the appropriate round precision if not specified", () => {
+ assert.strictEqual(tickFormat(0, 9, 10, "")(2.10), "2");
+ assert.strictEqual(tickFormat(0, 9, 100, "")(2.01), "2");
+ assert.strictEqual(tickFormat(0, 9, 100, "")(2.11), "2.1");
+ assert.strictEqual(tickFormat(0, 9, 10, "e")(2.10), "2e+0");
+ assert.strictEqual(tickFormat(0, 9, 100, "e")(2.01), "2.0e+0");
+ assert.strictEqual(tickFormat(0, 9, 100, "e")(2.11), "2.1e+0");
+ assert.strictEqual(tickFormat(0, 9, 10, "g")(2.10), "2");
+ assert.strictEqual(tickFormat(0, 9, 100, "g")(2.01), "2.0");
+ assert.strictEqual(tickFormat(0, 9, 100, "g")(2.11), "2.1");
+ assert.strictEqual(tickFormat(0, 9, 10, "r")(2.10e6), "2000000");
+ assert.strictEqual(tickFormat(0, 9, 100, "r")(2.01e6), "2000000");
+ assert.strictEqual(tickFormat(0, 9, 100, "r")(2.11e6), "2100000");
+ assert.strictEqual(tickFormat(0, 0.9, 10, "p")(0.210), "20%");
+ assert.strictEqual(tickFormat(0.19, 0.21, 10, "p")(0.201), "20.1%");
});
-tape("d3.tickFormat(start, stop, count, specifier) sets the appropriate round precision if not specified", function(test) {
- test.equal(scale.tickFormat(0, 9, 10, "")(2.10), "2");
- test.equal(scale.tickFormat(0, 9, 100, "")(2.01), "2");
- test.equal(scale.tickFormat(0, 9, 100, "")(2.11), "2.1");
- test.equal(scale.tickFormat(0, 9, 10, "e")(2.10), "2e+0");
- test.equal(scale.tickFormat(0, 9, 100, "e")(2.01), "2.0e+0");
- test.equal(scale.tickFormat(0, 9, 100, "e")(2.11), "2.1e+0");
- test.equal(scale.tickFormat(0, 9, 10, "g")(2.10), "2");
- test.equal(scale.tickFormat(0, 9, 100, "g")(2.01), "2.0");
- test.equal(scale.tickFormat(0, 9, 100, "g")(2.11), "2.1");
- test.equal(scale.tickFormat(0, 9, 10, "r")(2.10e6), "2000000");
- test.equal(scale.tickFormat(0, 9, 100, "r")(2.01e6), "2000000");
- test.equal(scale.tickFormat(0, 9, 100, "r")(2.11e6), "2100000");
- test.equal(scale.tickFormat(0, 0.9, 10, "p")(0.210), "20%");
- test.equal(scale.tickFormat(0.19, 0.21, 10, "p")(0.201), "20.1%");
- test.end();
+it("tickFormat(start, stop, count, specifier) sets the appropriate prefix precision if not specified", () => {
+ assert.strictEqual(tickFormat(0, 1e6, 10, "$s")(0.51e6), "$0.5M");
+ assert.strictEqual(tickFormat(0, 1e6, 100, "$s")(0.501e6), "$0.50M");
});
-tape("d3.tickFormat(start, stop, count, specifier) sets the appropriate prefix precision if not specified", function(test) {
- test.equal(scale.tickFormat(0, 1e6, 10, "$s")(0.51e6), "$0.5M");
- test.equal(scale.tickFormat(0, 1e6, 100, "$s")(0.501e6), "$0.50M");
- test.end();
-});
-
-tape("d3.tickFormat(start, stop, count) uses the default precision when the domain is invalid", function(test) {
- var f = scale.tickFormat(0, NaN, 10);
- test.equal(f + "", " >-,f");
- test.equal(f(0.12), "0.120000");
- test.end();
+it("tickFormat(start, stop, count) uses the default precision when the domain is invalid", () => {
+ const f = tickFormat(0, NaN, 10);
+ assert.strictEqual(f + "", " >-,f");
+ assert.strictEqual(f(0.12), "0.120000");
});
diff --git a/test/time-test.js b/test/time-test.js
index 613f452..0fc6837 100644
--- a/test/time-test.js
+++ b/test/time-test.js
@@ -1,464 +1,416 @@
-var tape = require("tape"),
- interpolate = require("d3-interpolate"),
- time = require("d3-time"),
- scale = require("../"),
- date = require("./date");
+import assert from "assert";
+import {interpolateHsl} from "d3-interpolate";
+import {timeDay, timeMinute, timeMonth, timeWeek, timeYear} from "d3-time";
+import {scaleTime} from "../src/index.js";
+import {local} from "./date.js";
-tape("time.domain([-1e50, 1e50]) is equivalent to time.domain([NaN, NaN])", function(test) {
- var x = scale.scaleTime().domain([-1e50, 1e50]);
- test.equal(isNaN(x.domain()[0]), true); // Note: also coerced on retrieval, so insufficient test!
- test.equal(isNaN(x.domain()[1]), true);
- test.deepEqual(x.ticks(10), []);
- test.end();
+it("time.domain([-1e50, 1e50]) is equivalent to time.domain([NaN, NaN])", () => {
+ const x = scaleTime().domain([-1e50, 1e50]);
+ assert.strictEqual(isNaN(x.domain()[0]), true); // Note: also coerced on retrieval, so insufficient test!
+ assert.strictEqual(isNaN(x.domain()[1]), true);
+ assert.deepStrictEqual(x.ticks(10), []);
});
-tape("time.domain(domain) accepts an iterable", function(test) {
- var x = scale.scaleTime().domain(new Set([date.local(2009), date.local(2010)]));
- test.deepEqual(x.domain(), [date.local(2009), date.local(2010)]);
- test.end();
+it("time.domain(domain) accepts an iterable", () => {
+ const x = scaleTime().domain(new Set([local(2009), local(2010)]));
+ assert.deepStrictEqual(x.domain(), [local(2009), local(2010)]);
});
-tape("time.nice() is an alias for time.nice(10)", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 17), date.local(2009, 0, 1, 23, 42)]);
- test.deepEqual(x.nice().domain(), [date.local(2009, 0, 1), date.local(2009, 0, 2)]);
- test.end();
+it("time.nice() is an alias for time.nice(10)", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 17), local(2009, 0, 1, 23, 42)]);
+ assert.deepStrictEqual(x.nice().domain(), [local(2009, 0, 1), local(2009, 0, 2)]);
});
-tape("time.nice() can nice sub-second domains", function(test) {
- var x = scale.scaleTime().domain([date.local(2013, 0, 1, 12, 0, 0, 0), date.local(2013, 0, 1, 12, 0, 0, 128)]);
- test.deepEqual(x.nice().domain(), [date.local(2013, 0, 1, 12, 0, 0, 0), date.local(2013, 0, 1, 12, 0, 0, 130)]);
- test.end();
+it("time.nice() can nice sub-second domains", () => {
+ const x = scaleTime().domain([local(2013, 0, 1, 12, 0, 0, 0), local(2013, 0, 1, 12, 0, 0, 128)]);
+ assert.deepStrictEqual(x.nice().domain(), [local(2013, 0, 1, 12, 0, 0, 0), local(2013, 0, 1, 12, 0, 0, 130)]);
});
-tape("time.nice() can nice multi-year domains", function(test) {
- var x = scale.scaleTime().domain([date.local(2001, 0, 1), date.local(2138, 0, 1)]);
- test.deepEqual(x.nice().domain(), [date.local(2000, 0, 1), date.local(2140, 0, 1)]);
- test.end();
+it("time.nice() can nice multi-year domains", () => {
+ const x = scaleTime().domain([local(2001, 0, 1), local(2138, 0, 1)]);
+ assert.deepStrictEqual(x.nice().domain(), [local(2000, 0, 1), local(2140, 0, 1)]);
});
-tape("time.nice() can nice empty domains", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 0, 12)]);
- test.deepEqual(x.nice().domain(), [date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 0, 12)]);
- test.end();
+it("time.nice() can nice empty domains", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 12), local(2009, 0, 1, 0, 12)]);
+ assert.deepStrictEqual(x.nice().domain(), [local(2009, 0, 1, 0, 12), local(2009, 0, 1, 0, 12)]);
});
-tape("time.nice(count) nices using the specified tick count", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 17), date.local(2009, 0, 1, 23, 42)]);
- test.deepEqual(x.nice(100).domain(), [date.local(2009, 0, 1, 0, 15), date.local(2009, 0, 1, 23, 45)]);
- test.deepEqual(x.nice(10).domain(), [date.local(2009, 0, 1), date.local(2009, 0, 2)]);
- test.end();
+it("time.nice(count) nices using the specified tick count", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 17), local(2009, 0, 1, 23, 42)]);
+ assert.deepStrictEqual(x.nice(100).domain(), [local(2009, 0, 1, 0, 15), local(2009, 0, 1, 23, 45)]);
+ assert.deepStrictEqual(x.nice(10).domain(), [local(2009, 0, 1), local(2009, 0, 2)]);
});
-tape("time.nice(interval) nices using the specified time interval", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 23, 48)]);
- test.deepEqual(x.nice(time.timeDay).domain(), [date.local(2009, 0, 1), date.local(2009, 0, 2)]);
- test.deepEqual(x.nice(time.timeWeek).domain(), [date.local(2008, 11, 28), date.local(2009, 0, 4)]);
- test.deepEqual(x.nice(time.timeMonth).domain(), [date.local(2008, 11, 1), date.local(2009, 1, 1)]);
- test.deepEqual(x.nice(time.timeYear).domain(), [date.local(2008, 0, 1), date.local(2010, 0, 1)]);
- test.end();
+it("time.nice(interval) nices using the specified time interval", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 12), local(2009, 0, 1, 23, 48)]);
+ assert.deepStrictEqual(x.nice(timeDay).domain(), [local(2009, 0, 1), local(2009, 0, 2)]);
+ assert.deepStrictEqual(x.nice(timeWeek).domain(), [local(2008, 11, 28), local(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(timeMonth).domain(), [local(2008, 11, 1), local(2009, 1, 1)]);
+ assert.deepStrictEqual(x.nice(timeYear).domain(), [local(2008, 0, 1), local(2010, 0, 1)]);
});
-tape("time.nice(interval) can nice empty domains", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 0, 12)]);
- test.deepEqual(x.nice(time.timeDay).domain(), [date.local(2009, 0, 1), date.local(2009, 0, 2)]);
- test.end();
+it("time.nice(interval) can nice empty domains", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 12), local(2009, 0, 1, 0, 12)]);
+ assert.deepStrictEqual(x.nice(timeDay).domain(), [local(2009, 0, 1), local(2009, 0, 2)]);
});
-tape("time.nice(interval) can nice a polylinear domain, only affecting its extent", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 23, 48), date.local(2009, 0, 2, 23, 48)]).nice(time.timeDay);
- test.deepEqual(x.domain(), [date.local(2009, 0, 1), date.local(2009, 0, 1, 23, 48), date.local(2009, 0, 3)]);
- test.end();
+it("time.nice(interval) can nice a polylinear domain, only affecting its extent", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 12), local(2009, 0, 1, 23, 48), local(2009, 0, 2, 23, 48)]).nice(timeDay);
+ assert.deepStrictEqual(x.domain(), [local(2009, 0, 1), local(2009, 0, 1, 23, 48), local(2009, 0, 3)]);
});
-tape("time.nice(interval.every(step)) nices using the specified time interval and step", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1, 0, 12), date.local(2009, 0, 1, 23, 48)]);
- test.deepEqual(x.nice(time.timeDay.every(3)).domain(), [date.local(2009, 0, 1), date.local(2009, 0, 4)]);
- test.deepEqual(x.nice(time.timeWeek.every(2)).domain(), [date.local(2008, 11, 21), date.local(2009, 0, 4)]);
- test.deepEqual(x.nice(time.timeMonth.every(3)).domain(), [date.local(2008, 9, 1), date.local(2009, 3, 1)]);
- test.deepEqual(x.nice(time.timeYear.every(10)).domain(), [date.local(2000, 0, 1), date.local(2010, 0, 1)]);
- test.end();
+it("time.nice(interval.every(step)) nices using the specified time interval and step", () => {
+ const x = scaleTime().domain([local(2009, 0, 1, 0, 12), local(2009, 0, 1, 23, 48)]);
+ assert.deepStrictEqual(x.nice(timeDay.every(3)).domain(), [local(2009, 0, 1), local(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(timeWeek.every(2)).domain(), [local(2008, 11, 21), local(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(timeMonth.every(3)).domain(), [local(2008, 9, 1), local(2009, 3, 1)]);
+ assert.deepStrictEqual(x.nice(timeYear.every(10)).domain(), [local(2000, 0, 1), local(2010, 0, 1)]);
});
-tape("time.copy() isolates changes to the domain", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1), date.local(2010, 0, 1)]), y = x.copy();
- x.domain([date.local(2010, 0, 1), date.local(2011, 0, 1)]);
- test.deepEqual(y.domain(), [date.local(2009, 0, 1), date.local(2010, 0, 1)]);
- test.equal(x(date.local(2010, 0, 1)), 0);
- test.equal(y(date.local(2010, 0, 1)), 1);
- y.domain([date.local(2011, 0, 1), date.local(2012, 0, 1)]);
- test.equal(x(date.local(2011, 0, 1)), 1);
- test.equal(y(date.local(2011, 0, 1)), 0);
- test.deepEqual(x.domain(), [date.local(2010, 0, 1), date.local(2011, 0, 1)]);
- test.deepEqual(y.domain(), [date.local(2011, 0, 1), date.local(2012, 0, 1)]);
- test.end();
+it("time.copy() isolates changes to the domain", () => {
+ const x = scaleTime().domain([local(2009, 0, 1), local(2010, 0, 1)]), y = x.copy();
+ x.domain([local(2010, 0, 1), local(2011, 0, 1)]);
+ assert.deepStrictEqual(y.domain(), [local(2009, 0, 1), local(2010, 0, 1)]);
+ assert.strictEqual(x(local(2010, 0, 1)), 0);
+ assert.strictEqual(y(local(2010, 0, 1)), 1);
+ y.domain([local(2011, 0, 1), local(2012, 0, 1)]);
+ assert.strictEqual(x(local(2011, 0, 1)), 1);
+ assert.strictEqual(y(local(2011, 0, 1)), 0);
+ assert.deepStrictEqual(x.domain(), [local(2010, 0, 1), local(2011, 0, 1)]);
+ assert.deepStrictEqual(y.domain(), [local(2011, 0, 1), local(2012, 0, 1)]);
});
-tape("time.copy() isolates changes to the range", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1), date.local(2010, 0, 1)]), y = x.copy();
+it("time.copy() isolates changes to the range", () => {
+ const x = scaleTime().domain([local(2009, 0, 1), local(2010, 0, 1)]), y = x.copy();
x.range([1, 2]);
- test.deepEqual(x.invert(1), date.local(2009, 0, 1));
- test.deepEqual(y.invert(1), date.local(2010, 0, 1));
- test.deepEqual(y.range(), [0, 1]);
+ assert.deepStrictEqual(x.invert(1), local(2009, 0, 1));
+ assert.deepStrictEqual(y.invert(1), local(2010, 0, 1));
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.deepEqual(x.invert(2), date.local(2010, 0, 1));
- test.deepEqual(y.invert(2), date.local(2009, 0, 1));
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
+ assert.deepStrictEqual(x.invert(2), local(2010, 0, 1));
+ assert.deepStrictEqual(y.invert(2), local(2009, 0, 1));
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
});
-tape("time.copy() isolates changes to the interpolator", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1), date.local(2010, 0, 1)]).range(["red", "blue"]),
+it("time.copy() isolates changes to the interpolator", () => {
+ const x = scaleTime().domain([local(2009, 0, 1), local(2010, 0, 1)]).range(["red", "blue"]),
i = x.interpolate(),
y = x.copy();
- x.interpolate(interpolate.interpolateHsl);
- test.equal(x(date.local(2009, 6, 1)), "rgb(255, 0, 253)");
- test.equal(y(date.local(2009, 6, 1)), "rgb(129, 0, 126)");
- test.equal(y.interpolate(), i);
- test.end();
+ x.interpolate(interpolateHsl);
+ assert.strictEqual(x(local(2009, 6, 1)), "rgb(255, 0, 253)");
+ assert.strictEqual(y(local(2009, 6, 1)), "rgb(129, 0, 126)");
+ assert.strictEqual(y.interpolate(), i);
});
-tape("time.copy() isolates changes to clamping", function(test) {
- var x = scale.scaleTime().domain([date.local(2009, 0, 1), date.local(2010, 0, 1)]).clamp(true), y = x.copy();
+it("time.copy() isolates changes to clamping", () => {
+ const x = scaleTime().domain([local(2009, 0, 1), local(2010, 0, 1)]).clamp(true), y = x.copy();
x.clamp(false);
- test.equal(x(date.local(2011, 0, 1)), 2);
- test.equal(y(date.local(2011, 0, 1)), 1);
- test.equal(y.clamp(), true);
+ assert.strictEqual(x(local(2011, 0, 1)), 2);
+ assert.strictEqual(y(local(2011, 0, 1)), 1);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.equal(x(date.local(2011, 0, 1)), 2);
- test.equal(y(date.local(2011, 0, 1)), 2);
- test.equal(x.clamp(), false);
- test.end();
-});
-
-tape("time.clamp(true).invert(value) never returns a value outside the domain", function(test) {
- var x = scale.scaleTime().clamp(true);
- test.ok(x.invert(0) instanceof Date);
- test.ok(x.invert(0) !== x.invert(0)); // returns a distinct copy
- test.equal(+x.invert(-1), +x.domain()[0]);
- test.equal(+x.invert(0), +x.domain()[0]);
- test.equal(+x.invert(1), +x.domain()[1]);
- test.equal(+x.invert(2), +x.domain()[1]);
- test.end();
-});
-
-tape("time.ticks(interval) observes the specified tick interval", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 1, 0), date.local(2011, 0, 1, 12, 4, 4)]);
- test.deepEqual(x.ticks(time.timeMinute), [
- date.local(2011, 0, 1, 12, 1),
- date.local(2011, 0, 1, 12, 2),
- date.local(2011, 0, 1, 12, 3),
- date.local(2011, 0, 1, 12, 4)
+ assert.strictEqual(x(local(2011, 0, 1)), 2);
+ assert.strictEqual(y(local(2011, 0, 1)), 2);
+ assert.strictEqual(x.clamp(), false);
+});
+
+it("time.clamp(true).invert(value) never returns a value outside the domain", () => {
+ const x = scaleTime().clamp(true);
+ assert(x.invert(0) instanceof Date);
+ assert(x.invert(0) !== x.invert(0)); // returns a distinct copy
+ assert.strictEqual(+x.invert(-1), +x.domain()[0]);
+ assert.strictEqual(+x.invert(0), +x.domain()[0]);
+ assert.strictEqual(+x.invert(1), +x.domain()[1]);
+ assert.strictEqual(+x.invert(2), +x.domain()[1]);
+});
+
+it("time.ticks(interval) observes the specified tick interval", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 1, 0), local(2011, 0, 1, 12, 4, 4)]);
+ assert.deepStrictEqual(x.ticks(timeMinute), [
+ local(2011, 0, 1, 12, 1),
+ local(2011, 0, 1, 12, 2),
+ local(2011, 0, 1, 12, 3),
+ local(2011, 0, 1, 12, 4)
]);
- test.end();
});
-tape("time.ticks(interval.every(step)) observes the specified tick interval and step", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 33, 4)]);
- test.deepEqual(x.ticks(time.timeMinute.every(10)), [
- date.local(2011, 0, 1, 12, 0),
- date.local(2011, 0, 1, 12, 10),
- date.local(2011, 0, 1, 12, 20),
- date.local(2011, 0, 1, 12, 30)
+it("time.ticks(interval.every(step)) observes the specified tick interval and step", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 33, 4)]);
+ assert.deepStrictEqual(x.ticks(timeMinute.every(10)), [
+ local(2011, 0, 1, 12, 0),
+ local(2011, 0, 1, 12, 10),
+ local(2011, 0, 1, 12, 20),
+ local(2011, 0, 1, 12, 30)
]);
- test.end();
-});
-
-tape("time.ticks(count) can generate sub-second ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 0, 1)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 0, 0, 0),
- date.local(2011, 0, 1, 12, 0, 0, 200),
- date.local(2011, 0, 1, 12, 0, 0, 400),
- date.local(2011, 0, 1, 12, 0, 0, 600),
- date.local(2011, 0, 1, 12, 0, 0, 800),
- date.local(2011, 0, 1, 12, 0, 1, 0)
+});
+
+it("time.ticks(count) can generate sub-second ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 0, 1)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 0, 0, 0),
+ local(2011, 0, 1, 12, 0, 0, 200),
+ local(2011, 0, 1, 12, 0, 0, 400),
+ local(2011, 0, 1, 12, 0, 0, 600),
+ local(2011, 0, 1, 12, 0, 0, 800),
+ local(2011, 0, 1, 12, 0, 1, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-second ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 0, 4)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 0, 0),
- date.local(2011, 0, 1, 12, 0, 1),
- date.local(2011, 0, 1, 12, 0, 2),
- date.local(2011, 0, 1, 12, 0, 3),
- date.local(2011, 0, 1, 12, 0, 4)
+it("time.ticks(count) can generate 1-second ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 0, 4)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 0, 0),
+ local(2011, 0, 1, 12, 0, 1),
+ local(2011, 0, 1, 12, 0, 2),
+ local(2011, 0, 1, 12, 0, 3),
+ local(2011, 0, 1, 12, 0, 4)
]);
- test.end();
});
-tape("time.ticks(count) can generate 5-second ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 0, 20)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 0, 0),
- date.local(2011, 0, 1, 12, 0, 5),
- date.local(2011, 0, 1, 12, 0, 10),
- date.local(2011, 0, 1, 12, 0, 15),
- date.local(2011, 0, 1, 12, 0, 20)
+it("time.ticks(count) can generate 5-second ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 0, 20)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 0, 0),
+ local(2011, 0, 1, 12, 0, 5),
+ local(2011, 0, 1, 12, 0, 10),
+ local(2011, 0, 1, 12, 0, 15),
+ local(2011, 0, 1, 12, 0, 20)
]);
- test.end();
});
-tape("time.ticks(count) can generate 15-second ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 0, 50)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 0, 0),
- date.local(2011, 0, 1, 12, 0, 15),
- date.local(2011, 0, 1, 12, 0, 30),
- date.local(2011, 0, 1, 12, 0, 45)
+it("time.ticks(count) can generate 15-second ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 0, 50)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 0, 0),
+ local(2011, 0, 1, 12, 0, 15),
+ local(2011, 0, 1, 12, 0, 30),
+ local(2011, 0, 1, 12, 0, 45)
]);
- test.end();
});
-tape("time.ticks(count) can generate 30-second ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 0), date.local(2011, 0, 1, 12, 1, 50)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 0, 0),
- date.local(2011, 0, 1, 12, 0, 30),
- date.local(2011, 0, 1, 12, 1, 0),
- date.local(2011, 0, 1, 12, 1, 30)
+it("time.ticks(count) can generate 30-second ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 0), local(2011, 0, 1, 12, 1, 50)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 0, 0),
+ local(2011, 0, 1, 12, 0, 30),
+ local(2011, 0, 1, 12, 1, 0),
+ local(2011, 0, 1, 12, 1, 30)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-minute ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 0, 27), date.local(2011, 0, 1, 12, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 1),
- date.local(2011, 0, 1, 12, 2),
- date.local(2011, 0, 1, 12, 3),
- date.local(2011, 0, 1, 12, 4)
+it("time.ticks(count) can generate 1-minute ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 0, 27), local(2011, 0, 1, 12, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 1),
+ local(2011, 0, 1, 12, 2),
+ local(2011, 0, 1, 12, 3),
+ local(2011, 0, 1, 12, 4)
]);
- test.end();
});
-tape("time.ticks(count) can generate 5-minute ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 3, 27), date.local(2011, 0, 1, 12, 21, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 5),
- date.local(2011, 0, 1, 12, 10),
- date.local(2011, 0, 1, 12, 15),
- date.local(2011, 0, 1, 12, 20)
+it("time.ticks(count) can generate 5-minute ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 3, 27), local(2011, 0, 1, 12, 21, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 5),
+ local(2011, 0, 1, 12, 10),
+ local(2011, 0, 1, 12, 15),
+ local(2011, 0, 1, 12, 20)
]);
- test.end();
});
-tape("time.ticks(count) can generate 15-minute ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 8, 27), date.local(2011, 0, 1, 13, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 15),
- date.local(2011, 0, 1, 12, 30),
- date.local(2011, 0, 1, 12, 45),
- date.local(2011, 0, 1, 13, 0)
+it("time.ticks(count) can generate 15-minute ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 8, 27), local(2011, 0, 1, 13, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 15),
+ local(2011, 0, 1, 12, 30),
+ local(2011, 0, 1, 12, 45),
+ local(2011, 0, 1, 13, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 30-minute ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 28, 27), date.local(2011, 0, 1, 14, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 12, 30),
- date.local(2011, 0, 1, 13, 0),
- date.local(2011, 0, 1, 13, 30),
- date.local(2011, 0, 1, 14, 0)
+it("time.ticks(count) can generate 30-minute ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 28, 27), local(2011, 0, 1, 14, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 12, 30),
+ local(2011, 0, 1, 13, 0),
+ local(2011, 0, 1, 13, 30),
+ local(2011, 0, 1, 14, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-hour ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 12, 28, 27), date.local(2011, 0, 1, 16, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 13, 0),
- date.local(2011, 0, 1, 14, 0),
- date.local(2011, 0, 1, 15, 0),
- date.local(2011, 0, 1, 16, 0)
+it("time.ticks(count) can generate 1-hour ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 12, 28, 27), local(2011, 0, 1, 16, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 13, 0),
+ local(2011, 0, 1, 14, 0),
+ local(2011, 0, 1, 15, 0),
+ local(2011, 0, 1, 16, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 3-hour ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 14, 28, 27), date.local(2011, 0, 2, 1, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 15, 0),
- date.local(2011, 0, 1, 18, 0),
- date.local(2011, 0, 1, 21, 0),
- date.local(2011, 0, 2, 0, 0)
+it("time.ticks(count) can generate 3-hour ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 14, 28, 27), local(2011, 0, 2, 1, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 15, 0),
+ local(2011, 0, 1, 18, 0),
+ local(2011, 0, 1, 21, 0),
+ local(2011, 0, 2, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 6-hour ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 16, 28, 27), date.local(2011, 0, 2, 14, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 18, 0),
- date.local(2011, 0, 2, 0, 0),
- date.local(2011, 0, 2, 6, 0),
- date.local(2011, 0, 2, 12, 0)
+it("time.ticks(count) can generate 6-hour ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 16, 28, 27), local(2011, 0, 2, 14, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 18, 0),
+ local(2011, 0, 2, 0, 0),
+ local(2011, 0, 2, 6, 0),
+ local(2011, 0, 2, 12, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 12-hour ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 16, 28, 27), date.local(2011, 0, 3, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 2, 0, 0),
- date.local(2011, 0, 2, 12, 0),
- date.local(2011, 0, 3, 0, 0),
- date.local(2011, 0, 3, 12, 0)
+it("time.ticks(count) can generate 12-hour ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 16, 28, 27), local(2011, 0, 3, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 2, 0, 0),
+ local(2011, 0, 2, 12, 0),
+ local(2011, 0, 3, 0, 0),
+ local(2011, 0, 3, 12, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-day ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 16, 28, 27), date.local(2011, 0, 5, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 2, 0, 0),
- date.local(2011, 0, 3, 0, 0),
- date.local(2011, 0, 4, 0, 0),
- date.local(2011, 0, 5, 0, 0)
+it("time.ticks(count) can generate 1-day ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 16, 28, 27), local(2011, 0, 5, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 2, 0, 0),
+ local(2011, 0, 3, 0, 0),
+ local(2011, 0, 4, 0, 0),
+ local(2011, 0, 5, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 2-day ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 2, 16, 28, 27), date.local(2011, 0, 9, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 3, 0, 0),
- date.local(2011, 0, 5, 0, 0),
- date.local(2011, 0, 7, 0, 0),
- date.local(2011, 0, 9, 0, 0)
+it("time.ticks(count) can generate 2-day ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 2, 16, 28, 27), local(2011, 0, 9, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 3, 0, 0),
+ local(2011, 0, 5, 0, 0),
+ local(2011, 0, 7, 0, 0),
+ local(2011, 0, 9, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-week ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 1, 16, 28, 27), date.local(2011, 0, 23, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 2, 0, 0),
- date.local(2011, 0, 9, 0, 0),
- date.local(2011, 0, 16, 0, 0),
- date.local(2011, 0, 23, 0, 0)
+it("time.ticks(count) can generate 1-week ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 1, 16, 28, 27), local(2011, 0, 23, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 2, 0, 0),
+ local(2011, 0, 9, 0, 0),
+ local(2011, 0, 16, 0, 0),
+ local(2011, 0, 23, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-month ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2011, 0, 18), date.local(2011, 4, 2)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 1, 1, 0, 0),
- date.local(2011, 2, 1, 0, 0),
- date.local(2011, 3, 1, 0, 0),
- date.local(2011, 4, 1, 0, 0)
+it("time.ticks(count) can generate 1-month ticks", () => {
+ const x = scaleTime().domain([local(2011, 0, 18), local(2011, 4, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 1, 1, 0, 0),
+ local(2011, 2, 1, 0, 0),
+ local(2011, 3, 1, 0, 0),
+ local(2011, 4, 1, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 3-month ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2010, 11, 18), date.local(2011, 10, 2)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 0, 0),
- date.local(2011, 3, 1, 0, 0),
- date.local(2011, 6, 1, 0, 0),
- date.local(2011, 9, 1, 0, 0)
+it("time.ticks(count) can generate 3-month ticks", () => {
+ const x = scaleTime().domain([local(2010, 11, 18), local(2011, 10, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 0, 0),
+ local(2011, 3, 1, 0, 0),
+ local(2011, 6, 1, 0, 0),
+ local(2011, 9, 1, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate 1-year ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(2010, 11, 18), date.local(2014, 2, 2)]);
- test.deepEqual(x.ticks(4), [
- date.local(2011, 0, 1, 0, 0),
- date.local(2012, 0, 1, 0, 0),
- date.local(2013, 0, 1, 0, 0),
- date.local(2014, 0, 1, 0, 0)
+it("time.ticks(count) can generate 1-year ticks", () => {
+ const x = scaleTime().domain([local(2010, 11, 18), local(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ local(2011, 0, 1, 0, 0),
+ local(2012, 0, 1, 0, 0),
+ local(2013, 0, 1, 0, 0),
+ local(2014, 0, 1, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) can generate multi-year ticks", function(test) {
- var x = scale.scaleTime().domain([date.local(0, 11, 18), date.local(2014, 2, 2)]);
- test.deepEqual(x.ticks(6), [
- date.local( 500, 0, 1, 0, 0),
- date.local(1000, 0, 1, 0, 0),
- date.local(1500, 0, 1, 0, 0),
- date.local(2000, 0, 1, 0, 0)
+it("time.ticks(count) can generate multi-year ticks", () => {
+ const x = scaleTime().domain([local(0, 11, 18), local(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(6), [
+ local( 500, 0, 1, 0, 0),
+ local(1000, 0, 1, 0, 0),
+ local(1500, 0, 1, 0, 0),
+ local(2000, 0, 1, 0, 0)
]);
- test.end();
});
-tape("time.ticks(count) returns one tick for an empty domain", function(test) {
- var x = scale.scaleTime().domain([date.local(2014, 2, 2), date.local(2014, 2, 2)]);
- test.deepEqual(x.ticks(6), [date.local(2014, 2, 2)]);
- test.end();
+it("time.ticks(count) returns one tick for an empty domain", () => {
+ const x = scaleTime().domain([local(2014, 2, 2), local(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(6), [local(2014, 2, 2)]);
});
-tape("time.ticks() returns descending ticks for a descending domain", function(test) {
- var x = scale.scaleTime();
- test.deepEqual(x.domain([date.local(2014, 2, 2), date.local(2010, 11, 18)]).ticks(4), [date.local(2014, 0, 1, 0, 0), date.local(2013, 0, 1, 0, 0), date.local(2012, 0, 1, 0, 0), date.local(2011, 0, 1, 0, 0)]);
- test.deepEqual(x.domain([date.local(2011, 10, 2), date.local(2010, 11, 18)]).ticks(4), [date.local(2011, 9, 1, 0, 0), date.local(2011, 6, 1, 0, 0), date.local(2011, 3, 1, 0, 0), date.local(2011, 0, 1, 0, 0)]);
- test.end();
+it("time.ticks() returns descending ticks for a descending domain", () => {
+ const x = scaleTime();
+ assert.deepStrictEqual(x.domain([local(2014, 2, 2), local(2010, 11, 18)]).ticks(4), [local(2014, 0, 1, 0, 0), local(2013, 0, 1, 0, 0), local(2012, 0, 1, 0, 0), local(2011, 0, 1, 0, 0)]);
+ assert.deepStrictEqual(x.domain([local(2011, 10, 2), local(2010, 11, 18)]).ticks(4), [local(2011, 9, 1, 0, 0), local(2011, 6, 1, 0, 0), local(2011, 3, 1, 0, 0), local(2011, 0, 1, 0, 0)]);
});
-tape("time.tickFormat()(date) formats year on New Year's", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 0, 1)), "2011");
- test.equal(f(date.local(2012, 0, 1)), "2012");
- test.equal(f(date.local(2013, 0, 1)), "2013");
- test.end();
+it("time.tickFormat()(date) formats year on New Year's", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 0, 1)), "2011");
+ assert.strictEqual(f(local(2012, 0, 1)), "2012");
+ assert.strictEqual(f(local(2013, 0, 1)), "2013");
});
-tape("time.tickFormat()(date) formats month on the 1st of each month", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 1)), "February");
- test.equal(f(date.local(2011, 2, 1)), "March");
- test.equal(f(date.local(2011, 3, 1)), "April");
- test.end();
+it("time.tickFormat()(date) formats month on the 1st of each month", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 1)), "February");
+ assert.strictEqual(f(local(2011, 2, 1)), "March");
+ assert.strictEqual(f(local(2011, 3, 1)), "April");
});
-tape("time.tickFormat()(date) formats week on Sunday midnight", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 6)), "Feb 06");
- test.equal(f(date.local(2011, 1, 13)), "Feb 13");
- test.equal(f(date.local(2011, 1, 20)), "Feb 20");
- test.end();
+it("time.tickFormat()(date) formats week on Sunday midnight", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 6)), "Feb 06");
+ assert.strictEqual(f(local(2011, 1, 13)), "Feb 13");
+ assert.strictEqual(f(local(2011, 1, 20)), "Feb 20");
});
-tape("time.tickFormat()(date) formats date on midnight", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 2)), "Wed 02");
- test.equal(f(date.local(2011, 1, 3)), "Thu 03");
- test.equal(f(date.local(2011, 1, 4)), "Fri 04");
- test.end();
+it("time.tickFormat()(date) formats date on midnight", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 2)), "Wed 02");
+ assert.strictEqual(f(local(2011, 1, 3)), "Thu 03");
+ assert.strictEqual(f(local(2011, 1, 4)), "Fri 04");
});
-tape("time.tickFormat()(date) formats hour on minute zero", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 2, 11)), "11 AM");
- test.equal(f(date.local(2011, 1, 2, 12)), "12 PM");
- test.equal(f(date.local(2011, 1, 2, 13)), "01 PM");
- test.end();
+it("time.tickFormat()(date) formats hour on minute zero", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 2, 11)), "11 AM");
+ assert.strictEqual(f(local(2011, 1, 2, 12)), "12 PM");
+ assert.strictEqual(f(local(2011, 1, 2, 13)), "01 PM");
});
-tape("time.tickFormat()(date) formats minute on second zero", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 2, 11, 59)), "11:59");
- test.equal(f(date.local(2011, 1, 2, 12, 1)), "12:01");
- test.equal(f(date.local(2011, 1, 2, 12, 2)), "12:02");
- test.end();
+it("time.tickFormat()(date) formats minute on second zero", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 2, 11, 59)), "11:59");
+ assert.strictEqual(f(local(2011, 1, 2, 12, 1)), "12:01");
+ assert.strictEqual(f(local(2011, 1, 2, 12, 2)), "12:02");
});
-tape("time.tickFormat()(date) otherwise, formats second", function(test) {
- var f = scale.scaleTime().tickFormat();
- test.equal(f(date.local(2011, 1, 2, 12, 1, 9)), ":09");
- test.equal(f(date.local(2011, 1, 2, 12, 1, 10)), ":10");
- test.equal(f(date.local(2011, 1, 2, 12, 1, 11)), ":11");
- test.end();
+it("time.tickFormat()(date) otherwise, formats second", () => {
+ const f = scaleTime().tickFormat();
+ assert.strictEqual(f(local(2011, 1, 2, 12, 1, 9)), ":09");
+ assert.strictEqual(f(local(2011, 1, 2, 12, 1, 10)), ":10");
+ assert.strictEqual(f(local(2011, 1, 2, 12, 1, 11)), ":11");
});
-tape("time.tickFormat(count, specifier) returns a time format for the specified specifier", function(test) {
- var f = scale.scaleTime().tickFormat(10, "%c");
- test.equal(f(date.local(2011, 1, 2, 12)), "2/2/2011, 12:00:00 PM");
- test.end();
+it("time.tickFormat(count, specifier) returns a time format for the specified specifier", () => {
+ const f = scaleTime().tickFormat(10, "%c");
+ assert.strictEqual(f(local(2011, 1, 2, 12)), "2/2/2011, 12:00:00 PM");
});
diff --git a/test/utcTime-test.js b/test/utcTime-test.js
index f5c6c5f..729feaa 100644
--- a/test/utcTime-test.js
+++ b/test/utcTime-test.js
@@ -1,443 +1,398 @@
-var tape = require("tape"),
- interpolate = require("d3-interpolate"),
- time = require("d3-time"),
- scale = require("../"),
- date = require("./date");
+import assert from "assert";
+import {interpolateHsl} from "d3-interpolate";
+import {utcDay, utcMinute, utcMonth, utcWeek, utcYear} from "d3-time";
+import {scaleUtc} from "../src/index.js";
+import {utc} from "./date.js";
-tape("scaleUtc.nice() is an alias for scaleUtc.nice(10)", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 17), date.utc(2009, 0, 1, 23, 42)]);
- test.deepEqual(x.nice().domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 2)]);
- test.end();
+it("scaleUtc.nice() is an alias for scaleUtc.nice(10)", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 17), utc(2009, 0, 1, 23, 42)]);
+ assert.deepStrictEqual(x.nice().domain(), [utc(2009, 0, 1), utc(2009, 0, 2)]);
});
-tape("scaleUtc.nice() can nice sub-second domains", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2013, 0, 1, 12, 0, 0, 0), date.utc(2013, 0, 1, 12, 0, 0, 128)]);
- test.deepEqual(x.nice().domain(), [date.utc(2013, 0, 1, 12, 0, 0, 0), date.utc(2013, 0, 1, 12, 0, 0, 130)]);
- test.end();
+it("scaleUtc.nice() can nice sub-second domains", () => {
+ const x = scaleUtc().domain([utc(2013, 0, 1, 12, 0, 0, 0), utc(2013, 0, 1, 12, 0, 0, 128)]);
+ assert.deepStrictEqual(x.nice().domain(), [utc(2013, 0, 1, 12, 0, 0, 0), utc(2013, 0, 1, 12, 0, 0, 130)]);
});
-tape("scaleUtc.nice() can nice multi-year domains", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2001, 0, 1), date.utc(2138, 0, 1)]);
- test.deepEqual(x.nice().domain(), [date.utc(2000, 0, 1), date.utc(2140, 0, 1)]);
- test.end();
+it("scaleUtc.nice() can nice multi-year domains", () => {
+ const x = scaleUtc().domain([utc(2001, 0, 1), utc(2138, 0, 1)]);
+ assert.deepStrictEqual(x.nice().domain(), [utc(2000, 0, 1), utc(2140, 0, 1)]);
});
-tape("scaleUtc.nice() can nice empty domains", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 0, 12)]);
- test.deepEqual(x.nice().domain(), [date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 0, 12)]);
- test.end();
+it("scaleUtc.nice() can nice empty domains", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 0, 12)]);
+ assert.deepStrictEqual(x.nice().domain(), [utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 0, 12)]);
});
-tape("scaleUtc.nice(count) nices using the specified tick count", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 17), date.utc(2009, 0, 1, 23, 42)]);
- test.deepEqual(x.nice(100).domain(), [date.utc(2009, 0, 1, 0, 15), date.utc(2009, 0, 1, 23, 45)]);
- test.deepEqual(x.nice(10).domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 2)]);
- test.end();
+it("scaleUtc.nice(count) nices using the specified tick count", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 17), utc(2009, 0, 1, 23, 42)]);
+ assert.deepStrictEqual(x.nice(100).domain(), [utc(2009, 0, 1, 0, 15), utc(2009, 0, 1, 23, 45)]);
+ assert.deepStrictEqual(x.nice(10).domain(), [utc(2009, 0, 1), utc(2009, 0, 2)]);
});
-tape("scaleUtc.nice(interval) nices using the specified time interval", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 23, 48)]);
- test.deepEqual(x.nice(time.utcDay).domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 2)]);
- test.deepEqual(x.nice(time.utcWeek).domain(), [date.utc(2008, 11, 28), date.utc(2009, 0, 4)]);
- test.deepEqual(x.nice(time.utcMonth).domain(), [date.utc(2008, 11, 1), date.utc(2009, 1, 1)]);
- test.deepEqual(x.nice(time.utcYear).domain(), [date.utc(2008, 0, 1), date.utc(2010, 0, 1)]);
- test.end();
+it("scaleUtc.nice(interval) nices using the specified time interval", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 23, 48)]);
+ assert.deepStrictEqual(x.nice(utcDay).domain(), [utc(2009, 0, 1), utc(2009, 0, 2)]);
+ assert.deepStrictEqual(x.nice(utcWeek).domain(), [utc(2008, 11, 28), utc(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(utcMonth).domain(), [utc(2008, 11, 1), utc(2009, 1, 1)]);
+ assert.deepStrictEqual(x.nice(utcYear).domain(), [utc(2008, 0, 1), utc(2010, 0, 1)]);
});
-tape("scaleUtc.nice(interval) can nice empty domains", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 0, 12)]);
- test.deepEqual(x.nice(time.utcDay).domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 2)]);
- test.end();
+it("scaleUtc.nice(interval) can nice empty domains", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 0, 12)]);
+ assert.deepStrictEqual(x.nice(utcDay).domain(), [utc(2009, 0, 1), utc(2009, 0, 2)]);
});
-tape("scaleUtc.nice(interval) can nice a polylinear domain, only affecting its extent", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 23, 48), date.utc(2009, 0, 2, 23, 48)]).nice(time.utcDay);
- test.deepEqual(x.domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 1, 23, 48), date.utc(2009, 0, 3)]);
- test.end();
+it("scaleUtc.nice(interval) can nice a polylinear domain, only affecting its extent", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 23, 48), utc(2009, 0, 2, 23, 48)]).nice(utcDay);
+ assert.deepStrictEqual(x.domain(), [utc(2009, 0, 1), utc(2009, 0, 1, 23, 48), utc(2009, 0, 3)]);
});
-tape("scaleUtc.nice(interval.every(step)) nices using the specified time interval and step", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1, 0, 12), date.utc(2009, 0, 1, 23, 48)]);
- test.deepEqual(x.nice(time.utcDay.every(3)).domain(), [date.utc(2009, 0, 1), date.utc(2009, 0, 4)]);
- test.deepEqual(x.nice(time.utcWeek.every(2)).domain(), [date.utc(2008, 11, 21), date.utc(2009, 0, 4)]);
- test.deepEqual(x.nice(time.utcMonth.every(3)).domain(), [date.utc(2008, 9, 1), date.utc(2009, 3, 1)]);
- test.deepEqual(x.nice(time.utcYear.every(10)).domain(), [date.utc(2000, 0, 1), date.utc(2010, 0, 1)]);
- test.end();
+it("scaleUtc.nice(interval.every(step)) nices using the specified time interval and step", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1, 0, 12), utc(2009, 0, 1, 23, 48)]);
+ assert.deepStrictEqual(x.nice(utcDay.every(3)).domain(), [utc(2009, 0, 1), utc(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(utcWeek.every(2)).domain(), [utc(2008, 11, 21), utc(2009, 0, 4)]);
+ assert.deepStrictEqual(x.nice(utcMonth.every(3)).domain(), [utc(2008, 9, 1), utc(2009, 3, 1)]);
+ assert.deepStrictEqual(x.nice(utcYear.every(10)).domain(), [utc(2000, 0, 1), utc(2010, 0, 1)]);
});
-tape("scaleUtc.copy() isolates changes to the domain", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1), date.utc(2010, 0, 1)]), y = x.copy();
- x.domain([date.utc(2010, 0, 1), date.utc(2011, 0, 1)]);
- test.deepEqual(y.domain(), [date.utc(2009, 0, 1), date.utc(2010, 0, 1)]);
- test.equal(x(date.utc(2010, 0, 1)), 0);
- test.equal(y(date.utc(2010, 0, 1)), 1);
- y.domain([date.utc(2011, 0, 1), date.utc(2012, 0, 1)]);
- test.equal(x(date.utc(2011, 0, 1)), 1);
- test.equal(y(date.utc(2011, 0, 1)), 0);
- test.deepEqual(x.domain(), [date.utc(2010, 0, 1), date.utc(2011, 0, 1)]);
- test.deepEqual(y.domain(), [date.utc(2011, 0, 1), date.utc(2012, 0, 1)]);
- test.end();
+it("scaleUtc.copy() isolates changes to the domain", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1), utc(2010, 0, 1)]), y = x.copy();
+ x.domain([utc(2010, 0, 1), utc(2011, 0, 1)]);
+ assert.deepStrictEqual(y.domain(), [utc(2009, 0, 1), utc(2010, 0, 1)]);
+ assert.strictEqual(x(utc(2010, 0, 1)), 0);
+ assert.strictEqual(y(utc(2010, 0, 1)), 1);
+ y.domain([utc(2011, 0, 1), utc(2012, 0, 1)]);
+ assert.strictEqual(x(utc(2011, 0, 1)), 1);
+ assert.strictEqual(y(utc(2011, 0, 1)), 0);
+ assert.deepStrictEqual(x.domain(), [utc(2010, 0, 1), utc(2011, 0, 1)]);
+ assert.deepStrictEqual(y.domain(), [utc(2011, 0, 1), utc(2012, 0, 1)]);
});
-tape("scaleUtc.copy() isolates changes to the range", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1), date.utc(2010, 0, 1)]), y = x.copy();
+it("scaleUtc.copy() isolates changes to the range", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1), utc(2010, 0, 1)]), y = x.copy();
x.range([1, 2]);
- test.deepEqual(x.invert(1), date.utc(2009, 0, 1));
- test.deepEqual(y.invert(1), date.utc(2010, 0, 1));
- test.deepEqual(y.range(), [0, 1]);
+ assert.deepStrictEqual(x.invert(1), utc(2009, 0, 1));
+ assert.deepStrictEqual(y.invert(1), utc(2010, 0, 1));
+ assert.deepStrictEqual(y.range(), [0, 1]);
y.range([2, 3]);
- test.deepEqual(x.invert(2), date.utc(2010, 0, 1));
- test.deepEqual(y.invert(2), date.utc(2009, 0, 1));
- test.deepEqual(x.range(), [1, 2]);
- test.deepEqual(y.range(), [2, 3]);
- test.end();
-});
-
-tape("scaleUtc.copy() isolates changes to the interpolator", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1), date.utc(2010, 0, 1)]).range(["red", "blue"]),
- i = x.interpolate(),
- y = x.copy();
- x.interpolate(interpolate.interpolateHsl);
- test.equal(x(date.utc(2009, 6, 1)), "rgb(255, 0, 253)");
- test.equal(y(date.utc(2009, 6, 1)), "rgb(129, 0, 126)");
- test.equal(y.interpolate(), i);
- test.end();
-});
-
-tape("scaleUtc.copy() isolates changes to clamping", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2009, 0, 1), date.utc(2010, 0, 1)]).clamp(true), y = x.copy();
+ assert.deepStrictEqual(x.invert(2), utc(2010, 0, 1));
+ assert.deepStrictEqual(y.invert(2), utc(2009, 0, 1));
+ assert.deepStrictEqual(x.range(), [1, 2]);
+ assert.deepStrictEqual(y.range(), [2, 3]);
+});
+
+it("scaleUtc.copy() isolates changes to the interpolator", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1), utc(2010, 0, 1)]).range(["red", "blue"]);
+ const i = x.interpolate();
+ const y = x.copy();
+ x.interpolate(interpolateHsl);
+ assert.strictEqual(x(utc(2009, 6, 1)), "rgb(255, 0, 253)");
+ assert.strictEqual(y(utc(2009, 6, 1)), "rgb(129, 0, 126)");
+ assert.strictEqual(y.interpolate(), i);
+});
+
+it("scaleUtc.copy() isolates changes to clamping", () => {
+ const x = scaleUtc().domain([utc(2009, 0, 1), utc(2010, 0, 1)]).clamp(true), y = x.copy();
x.clamp(false);
- test.equal(x(date.utc(2011, 0, 1)), 2);
- test.equal(y(date.utc(2011, 0, 1)), 1);
- test.equal(y.clamp(), true);
+ assert.strictEqual(x(utc(2011, 0, 1)), 2);
+ assert.strictEqual(y(utc(2011, 0, 1)), 1);
+ assert.strictEqual(y.clamp(), true);
y.clamp(false);
- test.equal(x(date.utc(2011, 0, 1)), 2);
- test.equal(y(date.utc(2011, 0, 1)), 2);
- test.equal(x.clamp(), false);
- test.end();
-});
-
-tape("scaleUtc.ticks(interval) observes the specified tick interval", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 1, 0), date.utc(2011, 0, 1, 12, 4, 4)]);
- test.deepEqual(x.ticks(time.utcMinute), [
- date.utc(2011, 0, 1, 12, 1),
- date.utc(2011, 0, 1, 12, 2),
- date.utc(2011, 0, 1, 12, 3),
- date.utc(2011, 0, 1, 12, 4)
+ assert.strictEqual(x(utc(2011, 0, 1)), 2);
+ assert.strictEqual(y(utc(2011, 0, 1)), 2);
+ assert.strictEqual(x.clamp(), false);
+});
+
+it("scaleUtc.ticks(interval) observes the specified tick interval", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 1, 0), utc(2011, 0, 1, 12, 4, 4)]);
+ assert.deepStrictEqual(x.ticks(utcMinute), [
+ utc(2011, 0, 1, 12, 1),
+ utc(2011, 0, 1, 12, 2),
+ utc(2011, 0, 1, 12, 3),
+ utc(2011, 0, 1, 12, 4)
]);
- test.end();
});
-tape("scaleUtc.ticks(interval) observes the specified named tick interval", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 1, 0), date.utc(2011, 0, 1, 12, 4, 4)]);
- test.deepEqual(x.ticks(time.utcMinute), [
- date.utc(2011, 0, 1, 12, 1),
- date.utc(2011, 0, 1, 12, 2),
- date.utc(2011, 0, 1, 12, 3),
- date.utc(2011, 0, 1, 12, 4)
+it("scaleUtc.ticks(interval) observes the specified named tick interval", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 1, 0), utc(2011, 0, 1, 12, 4, 4)]);
+ assert.deepStrictEqual(x.ticks(utcMinute), [
+ utc(2011, 0, 1, 12, 1),
+ utc(2011, 0, 1, 12, 2),
+ utc(2011, 0, 1, 12, 3),
+ utc(2011, 0, 1, 12, 4)
]);
- test.end();
});
-tape("scaleUtc.ticks(interval.every(step)) observes the specified tick interval and step", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 33, 4)]);
- test.deepEqual(x.ticks(time.utcMinute.every(10)), [
- date.utc(2011, 0, 1, 12, 0),
- date.utc(2011, 0, 1, 12, 10),
- date.utc(2011, 0, 1, 12, 20),
- date.utc(2011, 0, 1, 12, 30)
+it("scaleUtc.ticks(interval.every(step)) observes the specified tick interval and step", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 33, 4)]);
+ assert.deepStrictEqual(x.ticks(utcMinute.every(10)), [
+ utc(2011, 0, 1, 12, 0),
+ utc(2011, 0, 1, 12, 10),
+ utc(2011, 0, 1, 12, 20),
+ utc(2011, 0, 1, 12, 30)
]);
- test.end();
-});
-
-tape("scaleUtc.ticks(count) can generate sub-second ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 0, 1)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 0, 0, 0),
- date.utc(2011, 0, 1, 12, 0, 0, 200),
- date.utc(2011, 0, 1, 12, 0, 0, 400),
- date.utc(2011, 0, 1, 12, 0, 0, 600),
- date.utc(2011, 0, 1, 12, 0, 0, 800),
- date.utc(2011, 0, 1, 12, 0, 1, 0)
+});
+
+it("scaleUtc.ticks(count) can generate sub-second ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 0, 1)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 0, 0, 0),
+ utc(2011, 0, 1, 12, 0, 0, 200),
+ utc(2011, 0, 1, 12, 0, 0, 400),
+ utc(2011, 0, 1, 12, 0, 0, 600),
+ utc(2011, 0, 1, 12, 0, 0, 800),
+ utc(2011, 0, 1, 12, 0, 1, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-second ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 0, 4)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 0, 0),
- date.utc(2011, 0, 1, 12, 0, 1),
- date.utc(2011, 0, 1, 12, 0, 2),
- date.utc(2011, 0, 1, 12, 0, 3),
- date.utc(2011, 0, 1, 12, 0, 4)
+it("scaleUtc.ticks(count) can generate 1-second ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 0, 4)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 0, 0),
+ utc(2011, 0, 1, 12, 0, 1),
+ utc(2011, 0, 1, 12, 0, 2),
+ utc(2011, 0, 1, 12, 0, 3),
+ utc(2011, 0, 1, 12, 0, 4)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 5-second ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 0, 20)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 0, 0),
- date.utc(2011, 0, 1, 12, 0, 5),
- date.utc(2011, 0, 1, 12, 0, 10),
- date.utc(2011, 0, 1, 12, 0, 15),
- date.utc(2011, 0, 1, 12, 0, 20)
+it("scaleUtc.ticks(count) can generate 5-second ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 0, 20)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 0, 0),
+ utc(2011, 0, 1, 12, 0, 5),
+ utc(2011, 0, 1, 12, 0, 10),
+ utc(2011, 0, 1, 12, 0, 15),
+ utc(2011, 0, 1, 12, 0, 20)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 15-second ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 0, 50)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 0, 0),
- date.utc(2011, 0, 1, 12, 0, 15),
- date.utc(2011, 0, 1, 12, 0, 30),
- date.utc(2011, 0, 1, 12, 0, 45)
+it("scaleUtc.ticks(count) can generate 15-second ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 0, 50)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 0, 0),
+ utc(2011, 0, 1, 12, 0, 15),
+ utc(2011, 0, 1, 12, 0, 30),
+ utc(2011, 0, 1, 12, 0, 45)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 30-second ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 0), date.utc(2011, 0, 1, 12, 1, 50)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 0, 0),
- date.utc(2011, 0, 1, 12, 0, 30),
- date.utc(2011, 0, 1, 12, 1, 0),
- date.utc(2011, 0, 1, 12, 1, 30)
+it("scaleUtc.ticks(count) can generate 30-second ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 0), utc(2011, 0, 1, 12, 1, 50)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 0, 0),
+ utc(2011, 0, 1, 12, 0, 30),
+ utc(2011, 0, 1, 12, 1, 0),
+ utc(2011, 0, 1, 12, 1, 30)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-minute ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 0, 27), date.utc(2011, 0, 1, 12, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 1),
- date.utc(2011, 0, 1, 12, 2),
- date.utc(2011, 0, 1, 12, 3),
- date.utc(2011, 0, 1, 12, 4)
+it("scaleUtc.ticks(count) can generate 1-minute ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 0, 27), utc(2011, 0, 1, 12, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 1),
+ utc(2011, 0, 1, 12, 2),
+ utc(2011, 0, 1, 12, 3),
+ utc(2011, 0, 1, 12, 4)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 5-minute ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 3, 27), date.utc(2011, 0, 1, 12, 21, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 5),
- date.utc(2011, 0, 1, 12, 10),
- date.utc(2011, 0, 1, 12, 15),
- date.utc(2011, 0, 1, 12, 20)
+it("scaleUtc.ticks(count) can generate 5-minute ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 3, 27), utc(2011, 0, 1, 12, 21, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 5),
+ utc(2011, 0, 1, 12, 10),
+ utc(2011, 0, 1, 12, 15),
+ utc(2011, 0, 1, 12, 20)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 15-minute ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 8, 27), date.utc(2011, 0, 1, 13, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 15),
- date.utc(2011, 0, 1, 12, 30),
- date.utc(2011, 0, 1, 12, 45),
- date.utc(2011, 0, 1, 13, 0)
+it("scaleUtc.ticks(count) can generate 15-minute ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 8, 27), utc(2011, 0, 1, 13, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 15),
+ utc(2011, 0, 1, 12, 30),
+ utc(2011, 0, 1, 12, 45),
+ utc(2011, 0, 1, 13, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 30-minute ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 28, 27), date.utc(2011, 0, 1, 14, 4, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 12, 30),
- date.utc(2011, 0, 1, 13, 0),
- date.utc(2011, 0, 1, 13, 30),
- date.utc(2011, 0, 1, 14, 0)
+it("scaleUtc.ticks(count) can generate 30-minute ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 28, 27), utc(2011, 0, 1, 14, 4, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 12, 30),
+ utc(2011, 0, 1, 13, 0),
+ utc(2011, 0, 1, 13, 30),
+ utc(2011, 0, 1, 14, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-hour ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 12, 28, 27), date.utc(2011, 0, 1, 16, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 13, 0),
- date.utc(2011, 0, 1, 14, 0),
- date.utc(2011, 0, 1, 15, 0),
- date.utc(2011, 0, 1, 16, 0)
+it("scaleUtc.ticks(count) can generate 1-hour ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 12, 28, 27), utc(2011, 0, 1, 16, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 13, 0),
+ utc(2011, 0, 1, 14, 0),
+ utc(2011, 0, 1, 15, 0),
+ utc(2011, 0, 1, 16, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 3-hour ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 14, 28, 27), date.utc(2011, 0, 2, 1, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 15, 0),
- date.utc(2011, 0, 1, 18, 0),
- date.utc(2011, 0, 1, 21, 0),
- date.utc(2011, 0, 2, 0, 0)
+it("scaleUtc.ticks(count) can generate 3-hour ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 14, 28, 27), utc(2011, 0, 2, 1, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 15, 0),
+ utc(2011, 0, 1, 18, 0),
+ utc(2011, 0, 1, 21, 0),
+ utc(2011, 0, 2, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 6-hour ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 16, 28, 27), date.utc(2011, 0, 2, 14, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 18, 0),
- date.utc(2011, 0, 2, 0, 0),
- date.utc(2011, 0, 2, 6, 0),
- date.utc(2011, 0, 2, 12, 0)
+it("scaleUtc.ticks(count) can generate 6-hour ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 16, 28, 27), utc(2011, 0, 2, 14, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 18, 0),
+ utc(2011, 0, 2, 0, 0),
+ utc(2011, 0, 2, 6, 0),
+ utc(2011, 0, 2, 12, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 12-hour ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 16, 28, 27), date.utc(2011, 0, 3, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 2, 0, 0),
- date.utc(2011, 0, 2, 12, 0),
- date.utc(2011, 0, 3, 0, 0),
- date.utc(2011, 0, 3, 12, 0)
+it("scaleUtc.ticks(count) can generate 12-hour ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 16, 28, 27), utc(2011, 0, 3, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 2, 0, 0),
+ utc(2011, 0, 2, 12, 0),
+ utc(2011, 0, 3, 0, 0),
+ utc(2011, 0, 3, 12, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-day ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 16, 28, 27), date.utc(2011, 0, 5, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 2, 0, 0),
- date.utc(2011, 0, 3, 0, 0),
- date.utc(2011, 0, 4, 0, 0),
- date.utc(2011, 0, 5, 0, 0)
+it("scaleUtc.ticks(count) can generate 1-day ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 16, 28, 27), utc(2011, 0, 5, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 2, 0, 0),
+ utc(2011, 0, 3, 0, 0),
+ utc(2011, 0, 4, 0, 0),
+ utc(2011, 0, 5, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 2-day ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 2, 16, 28, 27), date.utc(2011, 0, 9, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 3, 0, 0),
- date.utc(2011, 0, 5, 0, 0),
- date.utc(2011, 0, 7, 0, 0),
- date.utc(2011, 0, 9, 0, 0)
+it("scaleUtc.ticks(count) can generate 2-day ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 2, 16, 28, 27), utc(2011, 0, 9, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 3, 0, 0),
+ utc(2011, 0, 5, 0, 0),
+ utc(2011, 0, 7, 0, 0),
+ utc(2011, 0, 9, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-week ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 1, 16, 28, 27), date.utc(2011, 0, 23, 21, 34, 12)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 2, 0, 0),
- date.utc(2011, 0, 9, 0, 0),
- date.utc(2011, 0, 16, 0, 0),
- date.utc(2011, 0, 23, 0, 0)
+it("scaleUtc.ticks(count) can generate 1-week ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 1, 16, 28, 27), utc(2011, 0, 23, 21, 34, 12)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 2, 0, 0),
+ utc(2011, 0, 9, 0, 0),
+ utc(2011, 0, 16, 0, 0),
+ utc(2011, 0, 23, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-month ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2011, 0, 18), date.utc(2011, 4, 2)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 1, 1, 0, 0),
- date.utc(2011, 2, 1, 0, 0),
- date.utc(2011, 3, 1, 0, 0),
- date.utc(2011, 4, 1, 0, 0)
+it("scaleUtc.ticks(count) can generate 1-month ticks", () => {
+ const x = scaleUtc().domain([utc(2011, 0, 18), utc(2011, 4, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 1, 1, 0, 0),
+ utc(2011, 2, 1, 0, 0),
+ utc(2011, 3, 1, 0, 0),
+ utc(2011, 4, 1, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 3-month ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2010, 11, 18), date.utc(2011, 10, 2)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 0, 0),
- date.utc(2011, 3, 1, 0, 0),
- date.utc(2011, 6, 1, 0, 0),
- date.utc(2011, 9, 1, 0, 0)
+it("scaleUtc.ticks(count) can generate 3-month ticks", () => {
+ const x = scaleUtc().domain([utc(2010, 11, 18), utc(2011, 10, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 0, 0),
+ utc(2011, 3, 1, 0, 0),
+ utc(2011, 6, 1, 0, 0),
+ utc(2011, 9, 1, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate 1-year ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2010, 11, 18), date.utc(2014, 2, 2)]);
- test.deepEqual(x.ticks(4), [
- date.utc(2011, 0, 1, 0, 0),
- date.utc(2012, 0, 1, 0, 0),
- date.utc(2013, 0, 1, 0, 0),
- date.utc(2014, 0, 1, 0, 0)
+it("scaleUtc.ticks(count) can generate 1-year ticks", () => {
+ const x = scaleUtc().domain([utc(2010, 11, 18), utc(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(4), [
+ utc(2011, 0, 1, 0, 0),
+ utc(2012, 0, 1, 0, 0),
+ utc(2013, 0, 1, 0, 0),
+ utc(2014, 0, 1, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) can generate multi-year ticks", function(test) {
- var x = scale.scaleUtc().domain([date.utc(0, 11, 18), date.utc(2014, 2, 2)]);
- test.deepEqual(x.ticks(6), [
- date.utc( 500, 0, 1, 0, 0),
- date.utc(1000, 0, 1, 0, 0),
- date.utc(1500, 0, 1, 0, 0),
- date.utc(2000, 0, 1, 0, 0)
+it("scaleUtc.ticks(count) can generate multi-year ticks", () => {
+ const x = scaleUtc().domain([utc(0, 11, 18), utc(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(6), [
+ utc( 500, 0, 1, 0, 0),
+ utc(1000, 0, 1, 0, 0),
+ utc(1500, 0, 1, 0, 0),
+ utc(2000, 0, 1, 0, 0)
]);
- test.end();
});
-tape("scaleUtc.ticks(count) returns one tick for an empty domain", function(test) {
- var x = scale.scaleUtc().domain([date.utc(2014, 2, 2), date.utc(2014, 2, 2)]);
- test.deepEqual(x.ticks(6), [date.utc(2014, 2, 2)]);
- test.end();
+it("scaleUtc.ticks(count) returns one tick for an empty domain", () => {
+ const x = scaleUtc().domain([utc(2014, 2, 2), utc(2014, 2, 2)]);
+ assert.deepStrictEqual(x.ticks(6), [utc(2014, 2, 2)]);
});
-tape("scaleUtc.tickFormat()(date) formats year on New Year's", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 0, 1)), "2011");
- test.equal(f(date.utc(2012, 0, 1)), "2012");
- test.equal(f(date.utc(2013, 0, 1)), "2013");
- test.end();
+it("scaleUtc.tickFormat()(date) formats year on New Year's", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 0, 1)), "2011");
+ assert.strictEqual(f(utc(2012, 0, 1)), "2012");
+ assert.strictEqual(f(utc(2013, 0, 1)), "2013");
});
-tape("scaleUtc.tickFormat()(date) formats month on the 1st of each month", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 1)), "February");
- test.equal(f(date.utc(2011, 2, 1)), "March");
- test.equal(f(date.utc(2011, 3, 1)), "April");
- test.end();
+it("scaleUtc.tickFormat()(date) formats month on the 1st of each month", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 1)), "February");
+ assert.strictEqual(f(utc(2011, 2, 1)), "March");
+ assert.strictEqual(f(utc(2011, 3, 1)), "April");
});
-tape("scaleUtc.tickFormat()(date) formats week on Sunday midnight", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 6)), "Feb 06");
- test.equal(f(date.utc(2011, 1, 13)), "Feb 13");
- test.equal(f(date.utc(2011, 1, 20)), "Feb 20");
- test.end();
+it("scaleUtc.tickFormat()(date) formats week on Sunday midnight", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 6)), "Feb 06");
+ assert.strictEqual(f(utc(2011, 1, 13)), "Feb 13");
+ assert.strictEqual(f(utc(2011, 1, 20)), "Feb 20");
});
-tape("scaleUtc.tickFormat()(date) formats date on midnight", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 2)), "Wed 02");
- test.equal(f(date.utc(2011, 1, 3)), "Thu 03");
- test.equal(f(date.utc(2011, 1, 4)), "Fri 04");
- test.end();
+it("scaleUtc.tickFormat()(date) formats date on midnight", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 2)), "Wed 02");
+ assert.strictEqual(f(utc(2011, 1, 3)), "Thu 03");
+ assert.strictEqual(f(utc(2011, 1, 4)), "Fri 04");
});
-tape("scaleUtc.tickFormat()(date) formats hour on minute zero", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 2, 11)), "11 AM");
- test.equal(f(date.utc(2011, 1, 2, 12)), "12 PM");
- test.equal(f(date.utc(2011, 1, 2, 13)), "01 PM");
- test.end();
+it("scaleUtc.tickFormat()(date) formats hour on minute zero", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 2, 11)), "11 AM");
+ assert.strictEqual(f(utc(2011, 1, 2, 12)), "12 PM");
+ assert.strictEqual(f(utc(2011, 1, 2, 13)), "01 PM");
});
-tape("scaleUtc.tickFormat()(date) formats minute on second zero", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 2, 11, 59)), "11:59");
- test.equal(f(date.utc(2011, 1, 2, 12, 1)), "12:01");
- test.equal(f(date.utc(2011, 1, 2, 12, 2)), "12:02");
- test.end();
+it("scaleUtc.tickFormat()(date) formats minute on second zero", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 2, 11, 59)), "11:59");
+ assert.strictEqual(f(utc(2011, 1, 2, 12, 1)), "12:01");
+ assert.strictEqual(f(utc(2011, 1, 2, 12, 2)), "12:02");
});
-tape("scaleUtc.tickFormat()(date) otherwise, formats second", function(test) {
- var f = scale.scaleUtc().tickFormat();
- test.equal(f(date.utc(2011, 1, 2, 12, 1, 9)), ":09");
- test.equal(f(date.utc(2011, 1, 2, 12, 1, 10)), ":10");
- test.equal(f(date.utc(2011, 1, 2, 12, 1, 11)), ":11");
- test.end();
+it("scaleUtc.tickFormat()(date) otherwise, formats second", () => {
+ const f = scaleUtc().tickFormat();
+ assert.strictEqual(f(utc(2011, 1, 2, 12, 1, 9)), ":09");
+ assert.strictEqual(f(utc(2011, 1, 2, 12, 1, 10)), ":10");
+ assert.strictEqual(f(utc(2011, 1, 2, 12, 1, 11)), ":11");
});
-tape("scaleUtc.tickFormat(count, specifier) returns a time format for the specified specifier", function(test) {
- var f = scale.scaleUtc().tickFormat(10, "%c");
- test.equal(f(date.utc(2011, 1, 2, 12)), "2/2/2011, 12:00:00 PM");
- test.end();
+it("scaleUtc.tickFormat(count, specifier) returns a time format for the specified specifier", () => {
+ const f = scaleUtc().tickFormat(10, "%c");
+ assert.strictEqual(f(utc(2011, 1, 2, 12)), "2/2/2011, 12:00:00 PM");
});
diff --git a/yarn.lock b/yarn.lock
index 66537f1..136e3a2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -16,29 +16,29 @@
dependencies:
"@babel/highlight" "^7.12.13"
-"@babel/helper-validator-identifier@^7.12.11":
- version "7.12.11"
- resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
- integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
+"@babel/helper-validator-identifier@^7.14.0":
+ version "7.14.0"
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288"
+ integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==
"@babel/highlight@^7.10.4", "@babel/highlight@^7.12.13":
- version "7.13.10"
- resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1"
- integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==
+ version "7.14.0"
+ resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf"
+ integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==
dependencies:
- "@babel/helper-validator-identifier" "^7.12.11"
+ "@babel/helper-validator-identifier" "^7.14.0"
chalk "^2.0.0"
js-tokens "^4.0.0"
-"@eslint/eslintrc@^0.4.0":
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547"
- integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==
+"@eslint/eslintrc@^0.4.2":
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.2.tgz#f63d0ef06f5c0c57d76c4ab5f63d3835c51b0179"
+ integrity sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
espree "^7.3.0"
- globals "^12.1.0"
+ globals "^13.9.0"
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
@@ -46,9 +46,14 @@
strip-json-comments "^3.1.1"
"@types/node@*":
- version "14.14.41"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615"
- integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==
+ version "15.12.1"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.1.tgz#9b60797dee1895383a725f828a869c86c6caa5c2"
+ integrity sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==
+
+"@ungap/promise-all-settled@1.1.2":
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"
+ integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==
acorn-jsx@^5.3.1:
version "5.3.1"
@@ -71,20 +76,25 @@ ajv@^6.10.0, ajv@^6.12.4:
uri-js "^4.2.2"
ajv@^8.0.1:
- version "8.1.0"
- resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.1.0.tgz#45d5d3d36c7cdd808930cc3e603cf6200dbeb736"
- integrity sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==
+ version "8.5.0"
+ resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.5.0.tgz#695528274bcb5afc865446aa275484049a18ae4b"
+ integrity sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"
-ansi-colors@^4.1.1:
+ansi-colors@4.1.1, ansi-colors@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==
+ansi-regex@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
+ integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
+
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
@@ -104,6 +114,14 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"
+anymatch@~3.1.1:
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
+ integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==
+ dependencies:
+ normalize-path "^3.0.0"
+ picomatch "^2.0.4"
+
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
@@ -111,6 +129,11 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
+argparse@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
+ integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
+
astral-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
@@ -121,6 +144,11 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
+binary-extensions@^2.0.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
+ integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
+
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -129,24 +157,33 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"
+braces@~3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
+ integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
+ dependencies:
+ fill-range "^7.0.1"
+
+browser-stdout@1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
+ integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
+
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
-call-bind@^1.0.0, call-bind@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
- integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==
- dependencies:
- function-bind "^1.1.1"
- get-intrinsic "^1.0.2"
-
callsites@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
+camelcase@^6.0.0:
+ version "6.2.0"
+ resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
+ integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
+
chalk@^2.0.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
@@ -157,13 +194,37 @@ chalk@^2.0.0:
supports-color "^5.3.0"
chalk@^4.0.0:
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
- integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad"
+ integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
+chokidar@3.5.1:
+ version "3.5.1"
+ resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
+ integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==
+ dependencies:
+ anymatch "~3.1.1"
+ braces "~3.0.2"
+ glob-parent "~5.1.0"
+ is-binary-path "~2.1.0"
+ is-glob "~4.0.1"
+ normalize-path "~3.0.0"
+ readdirp "~3.5.0"
+ optionalDependencies:
+ fsevents "~2.3.1"
+
+cliui@^7.0.2:
+ version "7.0.4"
+ resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
+ integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
+ dependencies:
+ string-width "^4.2.0"
+ strip-ansi "^6.0.0"
+ wrap-ansi "^7.0.0"
+
color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
@@ -207,79 +268,65 @@ cross-spawn@^7.0.2:
shebang-command "^2.0.0"
which "^2.0.1"
-d3-array@2, d3-array@^2.3.0:
- version "2.12.1"
- resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81"
- integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==
+"d3-array@2 - 3", "d3-array@2.3.0 - 3":
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.0.1.tgz#ca45c263f5bb780ab5a34a6e1d3d5883fe4a8d14"
+ integrity sha512-l3Bh5o8RSoC3SBm5ix6ogaFW+J6rOUm42yOtZ2sQPCEvCqUMepeX7zgrlLLGIemxgOyo9s2CsWEidnLv5PwwRw==
dependencies:
- internmap "^1.0.0"
+ internmap "1 - 2"
-"d3-color@1 - 2":
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-2.0.0.tgz#8d625cab42ed9b8f601a1760a389f7ea9189d62e"
- integrity sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==
+"d3-color@1 - 3":
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.0.1.tgz#03316e595955d1fcd39d9f3610ad41bb90194d0a"
+ integrity sha512-6/SlHkDOBLyQSJ1j1Ghs82OIUXpKWlR0hCsw0XrLSQhuUPuCSmLQ1QPH98vpnQxMUQM2/gfAkUEWsupVpd9JGw==
-"d3-format@1 - 2":
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-2.0.0.tgz#a10bcc0f986c372b729ba447382413aabf5b0767"
- integrity sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==
+"d3-format@1 - 3":
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.0.1.tgz#e41b81b2ab79277141ec1404aa5d05001da64084"
+ integrity sha512-hdL7+HBIohpgfolhBxr1KX47VMD6+vVD/oEFrxk5yhmzV2prk99EkFKYpXuhVkFpTgHdJ6/4bYcjdLPPXV4tIA==
-"d3-interpolate@1.2.0 - 2":
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-2.0.1.tgz#98be499cfb8a3b94d4ff616900501a64abc91163"
- integrity sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==
+"d3-interpolate@1.2.0 - 3":
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz#3c47aa5b32c5b3dfb56ef3fd4342078a632b400d"
+ integrity sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==
dependencies:
- d3-color "1 - 2"
+ d3-color "1 - 3"
-"d3-time-format@2 - 3":
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-3.0.0.tgz#df8056c83659e01f20ac5da5fdeae7c08d5f1bb6"
- integrity sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==
+"d3-time-format@2 - 4":
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.0.0.tgz#930ded86a9de761702344760d8a25753467f28b7"
+ integrity sha512-nzaCwlj+ZVBIlFuVOT1RmU+6xb/7D5IcnhHzHQcBgS/aTa5K9fWZNN5LCXA27LgF5WxoSNJqKBbLcGMtM6Ca6A==
dependencies:
- d3-time "1 - 2"
+ d3-time "1 - 3"
-"d3-time@1 - 2", d3-time@^2.1.1:
- version "2.1.1"
- resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-2.1.1.tgz#e9d8a8a88691f4548e68ca085e5ff956724a6682"
- integrity sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==
+"d3-time@1 - 3", "d3-time@2.1.1 - 3":
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.0.0.tgz#65972cb98ae2d4954ef5c932e8704061335d4975"
+ integrity sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==
dependencies:
- d3-array "2"
+ d3-array "2 - 3"
-debug@^4.0.1, debug@^4.1.1:
+debug@4.3.1, debug@^4.0.1, debug@^4.1.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
dependencies:
ms "2.1.2"
-deep-equal@~1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a"
- integrity sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==
- dependencies:
- is-arguments "^1.0.4"
- is-date-object "^1.0.1"
- is-regex "^1.0.4"
- object-is "^1.0.1"
- object-keys "^1.1.1"
- regexp.prototype.flags "^1.2.0"
+decamelize@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
+ integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
deep-is@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
-define-properties@^1.1.3:
- version "1.1.3"
- resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
- integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==
- dependencies:
- object-keys "^1.0.12"
-
-defined@~1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
- integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=
+diff@5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b"
+ integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==
doctrine@^3.0.0:
version "3.0.0"
@@ -288,13 +335,6 @@ doctrine@^3.0.0:
dependencies:
esutils "^2.0.2"
-dotignore@~0.1.2:
- version "0.1.2"
- resolved "https://registry.yarnpkg.com/dotignore/-/dotignore-0.1.2.tgz#f942f2200d28c3a76fbdd6f0ee9f3257c8a2e905"
- integrity sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==
- dependencies:
- minimatch "^3.0.4"
-
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
@@ -307,36 +347,15 @@ enquirer@^2.3.5:
dependencies:
ansi-colors "^4.1.1"
-es-abstract@^1.18.0-next.2:
- version "1.18.0"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4"
- integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==
- dependencies:
- call-bind "^1.0.2"
- es-to-primitive "^1.2.1"
- function-bind "^1.1.1"
- get-intrinsic "^1.1.1"
- has "^1.0.3"
- has-symbols "^1.0.2"
- is-callable "^1.2.3"
- is-negative-zero "^2.0.1"
- is-regex "^1.1.2"
- is-string "^1.0.5"
- object-inspect "^1.9.0"
- object-keys "^1.1.1"
- object.assign "^4.1.2"
- string.prototype.trimend "^1.0.4"
- string.prototype.trimstart "^1.0.4"
- unbox-primitive "^1.0.0"
-
-es-to-primitive@^1.2.1:
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a"
- integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==
- dependencies:
- is-callable "^1.1.4"
- is-date-object "^1.0.1"
- is-symbol "^1.0.2"
+escalade@^3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
+ integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
+
+escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
+ integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
escape-string-regexp@^1.0.5:
version "1.0.5"
@@ -364,32 +383,34 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint-visitor-keys@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
- integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
+ integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
eslint@7:
- version "7.24.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.24.0.tgz#2e44fa62d93892bfdb100521f17345ba54b8513a"
- integrity sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ==
+ version "7.28.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.28.0.tgz#435aa17a0b82c13bb2be9d51408b617e49c1e820"
+ integrity sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==
dependencies:
"@babel/code-frame" "7.12.11"
- "@eslint/eslintrc" "^0.4.0"
+ "@eslint/eslintrc" "^0.4.2"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
debug "^4.0.1"
doctrine "^3.0.0"
enquirer "^2.3.5"
+ escape-string-regexp "^4.0.0"
eslint-scope "^5.1.1"
eslint-utils "^2.1.0"
eslint-visitor-keys "^2.0.0"
espree "^7.3.1"
esquery "^1.4.0"
esutils "^2.0.2"
+ fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
functional-red-black-tree "^1.0.1"
- glob-parent "^5.0.0"
+ glob-parent "^5.1.2"
globals "^13.6.0"
ignore "^4.0.6"
import-fresh "^3.0.0"
@@ -398,7 +419,7 @@ eslint@7:
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
- lodash "^4.17.21"
+ lodash.merge "^4.6.2"
minimatch "^3.0.4"
natural-compare "^1.4.0"
optionator "^0.9.1"
@@ -407,7 +428,7 @@ eslint@7:
semver "^7.2.1"
strip-ansi "^6.0.0"
strip-json-comments "^3.1.0"
- table "^6.0.4"
+ table "^6.0.9"
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
@@ -454,7 +475,7 @@ esutils@^2.0.2:
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
-fast-deep-equal@^3.1.1:
+fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
@@ -476,6 +497,21 @@ file-entry-cache@^6.0.1:
dependencies:
flat-cache "^3.0.4"
+fill-range@^7.0.1:
+ version "7.0.1"
+ resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
+ integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
+ dependencies:
+ to-regex-range "^5.0.1"
+
+find-up@5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
+ integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
+ dependencies:
+ locate-path "^6.0.0"
+ path-exists "^4.0.0"
+
flat-cache@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
@@ -484,18 +520,16 @@ flat-cache@^3.0.4:
flatted "^3.1.0"
rimraf "^3.0.2"
+flat@^5.0.2:
+ version "5.0.2"
+ resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
+ integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
+
flatted@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
-for-each@~0.3.3:
- version "0.3.3"
- resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
- integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==
- dependencies:
- is-callable "^1.1.3"
-
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -506,33 +540,24 @@ fsevents@~2.3.1:
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
-function-bind@^1.1.1, function-bind@~1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
- integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
-
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
-get-intrinsic@^1.0.2, get-intrinsic@^1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6"
- integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==
- dependencies:
- function-bind "^1.1.1"
- has "^1.0.3"
- has-symbols "^1.0.1"
+get-caller-file@^2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
+ integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
-glob-parent@^5.0.0:
+glob-parent@^5.1.2, glob-parent@~5.1.0:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"
-glob@^7.1.3, glob@~7.1.6:
+glob@7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
@@ -544,24 +569,29 @@ glob@^7.1.3, glob@~7.1.6:
once "^1.3.0"
path-is-absolute "^1.0.0"
-globals@^12.1.0:
- version "12.4.0"
- resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8"
- integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==
+glob@^7.1.3:
+ version "7.1.7"
+ resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
+ integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==
dependencies:
- type-fest "^0.8.1"
+ fs.realpath "^1.0.0"
+ inflight "^1.0.4"
+ inherits "2"
+ minimatch "^3.0.4"
+ once "^1.3.0"
+ path-is-absolute "^1.0.0"
-globals@^13.6.0:
- version "13.8.0"
- resolved "https://registry.yarnpkg.com/globals/-/globals-13.8.0.tgz#3e20f504810ce87a8d72e55aecf8435b50f4c1b3"
- integrity sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q==
+globals@^13.6.0, globals@^13.9.0:
+ version "13.9.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-13.9.0.tgz#4bf2bf635b334a173fb1daf7c5e6b218ecdc06cb"
+ integrity sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==
dependencies:
type-fest "^0.20.2"
-has-bigints@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113"
- integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==
+growl@1.10.5:
+ version "1.10.5"
+ resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
+ integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
has-flag@^3.0.0:
version "3.0.0"
@@ -573,17 +603,10 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
-has-symbols@^1.0.1, has-symbols@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423"
- integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==
-
-has@^1.0.3, has@~1.0.3:
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
- integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
- dependencies:
- function-bind "^1.1.1"
+he@1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
+ integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
ignore@^4.0.6:
version "4.0.6"
@@ -611,98 +634,54 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
-inherits@2, inherits@~2.0.4:
+inherits@2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
-internmap@^1.0.0:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95"
- integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==
-
-is-arguments@^1.0.4:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9"
- integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==
- dependencies:
- call-bind "^1.0.0"
-
-is-bigint@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.1.tgz#6923051dfcbc764278540b9ce0e6b3213aa5ebc2"
- integrity sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==
+"internmap@1 - 2":
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.1.tgz#33d0fa016185397549fb1a14ea3dbe5a2949d1cd"
+ integrity sha512-Ujwccrj9FkGqjbY3iVoxD1VV+KdZZeENx0rphrtzmRXbFvkFO88L80BL/zeSIguX/7T+y8k04xqtgWgS5vxwxw==
-is-boolean-object@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0"
- integrity sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==
+is-binary-path@~2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
+ integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
dependencies:
- call-bind "^1.0.0"
-
-is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.3:
- version "1.2.3"
- resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e"
- integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==
-
-is-date-object@^1.0.1:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e"
- integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==
+ binary-extensions "^2.0.0"
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
+is-fullwidth-code-point@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
+ integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
+
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
-is-glob@^4.0.0, is-glob@^4.0.1:
+is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
dependencies:
is-extglob "^2.1.1"
-is-negative-zero@^2.0.1:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24"
- integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==
+is-number@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
+ integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
-is-number-object@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197"
- integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==
-
-is-regex@^1.0.4, is-regex@^1.1.2:
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.2.tgz#81c8ebde4db142f2cf1c53fc86d6a45788266251"
- integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==
- dependencies:
- call-bind "^1.0.2"
- has-symbols "^1.0.1"
-
-is-regex@~1.0.5:
- version "1.0.5"
- resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae"
- integrity sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==
- dependencies:
- has "^1.0.3"
-
-is-string@^1.0.5:
- version "1.0.5"
- resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6"
- integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==
-
-is-symbol@^1.0.2, is-symbol@^1.0.3:
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"
- integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==
- dependencies:
- has-symbols "^1.0.1"
+is-plain-obj@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
+ integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
isexe@^2.0.0:
version "2.0.0"
@@ -723,6 +702,13 @@ js-tokens@^4.0.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
+js-yaml@4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f"
+ integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==
+ dependencies:
+ argparse "^2.0.1"
+
js-yaml@^3.13.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
@@ -754,25 +740,34 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"
+locate-path@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
+ integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
+ dependencies:
+ p-locate "^5.0.0"
+
lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
-lodash.flatten@^4.4.0:
- version "4.4.0"
- resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
- integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=
+lodash.merge@^4.6.2:
+ version "4.6.2"
+ resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
+ integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
lodash.truncate@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=
-lodash@^4.17.21:
- version "4.17.21"
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
- integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
+log-symbols@4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920"
+ integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==
+ dependencies:
+ chalk "^4.0.0"
lru-cache@^6.0.0:
version "6.0.0"
@@ -786,60 +781,68 @@ merge-stream@^2.0.0:
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
-minimatch@^3.0.4:
+minimatch@3.0.4, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
-minimist@~1.2.5:
- version "1.2.5"
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
- integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
+mocha@8:
+ version "8.4.0"
+ resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff"
+ integrity sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==
+ dependencies:
+ "@ungap/promise-all-settled" "1.1.2"
+ ansi-colors "4.1.1"
+ browser-stdout "1.3.1"
+ chokidar "3.5.1"
+ debug "4.3.1"
+ diff "5.0.0"
+ escape-string-regexp "4.0.0"
+ find-up "5.0.0"
+ glob "7.1.6"
+ growl "1.10.5"
+ he "1.2.0"
+ js-yaml "4.0.0"
+ log-symbols "4.0.0"
+ minimatch "3.0.4"
+ ms "2.1.3"
+ nanoid "3.1.20"
+ serialize-javascript "5.0.1"
+ strip-json-comments "3.1.1"
+ supports-color "8.1.1"
+ which "2.0.2"
+ wide-align "1.1.3"
+ workerpool "6.1.0"
+ yargs "16.2.0"
+ yargs-parser "20.2.4"
+ yargs-unparser "2.0.0"
ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
+ms@2.1.3:
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
+ integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
+
+nanoid@3.1.20:
+ version "3.1.20"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788"
+ integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==
+
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
-object-inspect@^1.9.0:
- version "1.9.0"
- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a"
- integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==
-
-object-inspect@~1.7.0:
- version "1.7.0"
- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"
- integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==
-
-object-is@^1.0.1:
- version "1.1.5"
- resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac"
- integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==
- dependencies:
- call-bind "^1.0.2"
- define-properties "^1.1.3"
-
-object-keys@^1.0.12, object-keys@^1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
- integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
-
-object.assign@^4.1.2:
- version "4.1.2"
- resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940"
- integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==
- dependencies:
- call-bind "^1.0.0"
- define-properties "^1.1.3"
- has-symbols "^1.0.1"
- object-keys "^1.1.1"
+normalize-path@^3.0.0, normalize-path@~3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
+ integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
once@^1.3.0:
version "1.4.0"
@@ -860,6 +863,20 @@ optionator@^0.9.1:
type-check "^0.4.0"
word-wrap "^1.2.3"
+p-limit@^3.0.2:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
+ integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
+ dependencies:
+ yocto-queue "^0.1.0"
+
+p-locate@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
+ integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
+ dependencies:
+ p-limit "^3.0.2"
+
parent-module@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
@@ -867,6 +884,11 @@ parent-module@^1.0.0:
dependencies:
callsites "^3.0.0"
+path-exists@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
+ integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
+
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
@@ -877,10 +899,10 @@ path-key@^3.1.0:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
-path-parse@^1.0.6:
- version "1.0.6"
- resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
- integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
+picomatch@^2.0.4, picomatch@^2.2.1:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
+ integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
prelude-ls@^1.2.1:
version "1.2.1"
@@ -904,19 +926,23 @@ randombytes@^2.1.0:
dependencies:
safe-buffer "^5.1.0"
-regexp.prototype.flags@^1.2.0:
- version "1.3.1"
- resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26"
- integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==
+readdirp@~3.5.0:
+ version "3.5.0"
+ resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e"
+ integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==
dependencies:
- call-bind "^1.0.2"
- define-properties "^1.1.3"
+ picomatch "^2.2.1"
regexpp@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2"
integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==
+require-directory@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
+ integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
+
require-from-string@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
@@ -927,20 +953,6 @@ resolve-from@^4.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
-resolve@~1.17.0:
- version "1.17.0"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"
- integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==
- dependencies:
- path-parse "^1.0.6"
-
-resumer@~0.0.0:
- version "0.0.0"
- resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759"
- integrity sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=
- dependencies:
- through "~2.3.4"
-
rimraf@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
@@ -959,9 +971,9 @@ rollup-plugin-terser@7:
terser "^5.0.0"
rollup@2:
- version "2.45.2"
- resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.45.2.tgz#8fb85917c9f35605720e92328f3ccbfba6f78b48"
- integrity sha512-kRRU7wXzFHUzBIv0GfoFFIN3m9oteY4uAsKllIpQDId5cfnkWF2J130l+27dzDju0E6MScKiV0ZM5Bw8m4blYQ==
+ version "2.50.6"
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.50.6.tgz#24e2211caf9031081656e98a5e5e94d3b5e786e2"
+ integrity sha512-6c5CJPLVgo0iNaZWWliNu1Kl43tjP9LZcp6D/tkf2eLH2a9/WeHxg9vfTFl8QV/2SOyaJX37CEm9XuGM0rviUg==
optionalDependencies:
fsevents "~2.3.1"
@@ -977,6 +989,13 @@ semver@^7.2.1:
dependencies:
lru-cache "^6.0.0"
+serialize-javascript@5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4"
+ integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==
+ dependencies:
+ randombytes "^2.1.0"
+
serialize-javascript@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa"
@@ -1028,7 +1047,15 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
-string-width@^4.2.0:
+"string-width@^1.0.2 || 2":
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
+ integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
+ dependencies:
+ is-fullwidth-code-point "^2.0.0"
+ strip-ansi "^4.0.0"
+
+string-width@^4.1.0, string-width@^4.2.0:
version "4.2.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5"
integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==
@@ -1037,30 +1064,12 @@ string-width@^4.2.0:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
-string.prototype.trim@~1.2.1:
- version "1.2.4"
- resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz#6014689baf5efaf106ad031a5fa45157666ed1bd"
- integrity sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==
- dependencies:
- call-bind "^1.0.2"
- define-properties "^1.1.3"
- es-abstract "^1.18.0-next.2"
-
-string.prototype.trimend@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
- integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==
- dependencies:
- call-bind "^1.0.2"
- define-properties "^1.1.3"
-
-string.prototype.trimstart@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed"
- integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==
+strip-ansi@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
+ integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
dependencies:
- call-bind "^1.0.2"
- define-properties "^1.1.3"
+ ansi-regex "^3.0.0"
strip-ansi@^6.0.0:
version "6.0.0"
@@ -1069,11 +1078,18 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"
-strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
+strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
+supports-color@8.1.1:
+ version "8.1.1"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
+ integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
+ dependencies:
+ has-flag "^4.0.0"
+
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
@@ -1088,46 +1104,22 @@ supports-color@^7.0.0, supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"
-table@^6.0.4:
- version "6.1.0"
- resolved "https://registry.yarnpkg.com/table/-/table-6.1.0.tgz#676a0cfb206008b59e783fcd94ef8ba7d67d966c"
- integrity sha512-T4G5KMmqIk6X87gLKWyU5exPpTjLjY5KyrFWaIjv3SvgaIUGXV7UEzGEnZJdTA38/yUS6f9PlKezQ0bYXG3iIQ==
+table@^6.0.9:
+ version "6.7.1"
+ resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
+ integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==
dependencies:
ajv "^8.0.1"
- is-boolean-object "^1.1.0"
- is-number-object "^1.0.4"
- is-string "^1.0.5"
lodash.clonedeep "^4.5.0"
- lodash.flatten "^4.4.0"
lodash.truncate "^4.4.2"
slice-ansi "^4.0.0"
string-width "^4.2.0"
-
-tape@4:
- version "4.13.3"
- resolved "https://registry.yarnpkg.com/tape/-/tape-4.13.3.tgz#51b3d91c83668c7a45b1a594b607dee0a0b46278"
- integrity sha512-0/Y20PwRIUkQcTCSi4AASs+OANZZwqPKaipGCEwp10dQMipVvSZwUUCi01Y/OklIGyHKFhIcjock+DKnBfLAFw==
- dependencies:
- deep-equal "~1.1.1"
- defined "~1.0.0"
- dotignore "~0.1.2"
- for-each "~0.3.3"
- function-bind "~1.1.1"
- glob "~7.1.6"
- has "~1.0.3"
- inherits "~2.0.4"
- is-regex "~1.0.5"
- minimist "~1.2.5"
- object-inspect "~1.7.0"
- resolve "~1.17.0"
- resumer "~0.0.0"
- string.prototype.trim "~1.2.1"
- through "~2.3.8"
+ strip-ansi "^6.0.0"
terser@^5.0.0:
- version "5.6.1"
- resolved "https://registry.yarnpkg.com/terser/-/terser-5.6.1.tgz#a48eeac5300c0a09b36854bf90d9c26fb201973c"
- integrity sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw==
+ version "5.7.0"
+ resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.0.tgz#a761eeec206bc87b605ab13029876ead938ae693"
+ integrity sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==
dependencies:
commander "^2.20.0"
source-map "~0.7.2"
@@ -1138,10 +1130,12 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
-through@~2.3.4, through@~2.3.8:
- version "2.3.8"
- resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
- integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
+to-regex-range@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
+ integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
+ dependencies:
+ is-number "^7.0.0"
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
@@ -1155,21 +1149,6 @@ type-fest@^0.20.2:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
-type-fest@^0.8.1:
- version "0.8.1"
- resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
- integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
-
-unbox-primitive@^1.0.0:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"
- integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==
- dependencies:
- function-bind "^1.1.1"
- has-bigints "^1.0.1"
- has-symbols "^1.0.2"
- which-boxed-primitive "^1.0.2"
-
uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
@@ -1182,35 +1161,88 @@ v8-compile-cache@^2.0.3:
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==
-which-boxed-primitive@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6"
- integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==
- dependencies:
- is-bigint "^1.0.1"
- is-boolean-object "^1.1.0"
- is-number-object "^1.0.4"
- is-string "^1.0.5"
- is-symbol "^1.0.3"
-
-which@^2.0.1:
+which@2.0.2, which@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
dependencies:
isexe "^2.0.0"
+wide-align@1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"
+ integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==
+ dependencies:
+ string-width "^1.0.2 || 2"
+
word-wrap@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
+workerpool@6.1.0:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz#a8e038b4c94569596852de7a8ea4228eefdeb37b"
+ integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==
+
+wrap-ansi@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
+ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
+ dependencies:
+ ansi-styles "^4.0.0"
+ string-width "^4.1.0"
+ strip-ansi "^6.0.0"
+
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
+y18n@^5.0.5:
+ version "5.0.8"
+ resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
+ integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
+
yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
+
+yargs-parser@20.2.4:
+ version "20.2.4"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
+ integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
+
+yargs-parser@^20.2.2:
+ version "20.2.7"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a"
+ integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==
+
+yargs-unparser@2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"
+ integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==
+ dependencies:
+ camelcase "^6.0.0"
+ decamelize "^4.0.0"
+ flat "^5.0.2"
+ is-plain-obj "^2.1.0"
+
+yargs@16.2.0:
+ version "16.2.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
+ integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
+ dependencies:
+ cliui "^7.0.2"
+ escalade "^3.1.1"
+ get-caller-file "^2.0.5"
+ require-directory "^2.1.1"
+ string-width "^4.2.0"
+ y18n "^5.0.5"
+ yargs-parser "^20.2.2"
+
+yocto-queue@^0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
+ integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==