Skip to content

Commit ff3d4a6

Browse files
committed
inline d3-array dependency
1 parent 5855eb5 commit ff3d4a6

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"dist/**/*.js"
2323
],
2424
"dependencies": {
25-
"d3-array": "^3.2.0",
2625
"d3-dsv": "^2.0.0",
2726
"d3-require": "^1.3.0"
2827
},

src/array.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// These are copied from d3-array; TODO import once this package adopts type: module.
2+
3+
export function descending(a, b) {
4+
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
5+
}
6+
7+
export function ascending(a, b) {
8+
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
9+
}
10+
11+
export function reverse(values) {
12+
if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
13+
return Array.from(values).reverse();
14+
}

src/table.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ascending, descending, reverse} from "d3-array";
1+
import {ascending, descending, reverse} from "./array.mjs";
22

33
const nChecks = 20; // number of values to check in each array
44

yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,6 @@ cross-spawn@^7.0.2:
487487
shebang-command "^2.0.0"
488488
which "^2.0.1"
489489

490-
d3-array@^3.2.0:
491-
version "3.2.0"
492-
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.0.tgz#15bf96cd9b7333e02eb8de8053d78962eafcff14"
493-
integrity sha512-3yXFQo0oG3QCxbF06rMPFyGRMGJNS7NvsV1+2joOjbBE+9xvWQ8+GcMJAjRCzw06zQ3/arXeJgbPYcjUCuC+3g==
494-
dependencies:
495-
internmap "1 - 2"
496-
497490
d3-dsv@^2.0.0:
498491
version "2.0.0"
499492
resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-2.0.0.tgz#b37b194b6df42da513a120d913ad1be22b5fe7c5"
@@ -923,11 +916,6 @@ inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.0, inherits@~2.0.3:
923916
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
924917
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
925918

926-
"internmap@1 - 2":
927-
version "2.0.3"
928-
resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009"
929-
integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==
930-
931919
is-binary-path@~2.1.0:
932920
version "2.1.0"
933921
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"

0 commit comments

Comments
 (0)