Skip to content

Commit

Permalink
Merge pull request #39 from antvis/refactor-utils
Browse files Browse the repository at this point in the history
Refactor utils
  • Loading branch information
leungwensen authored Aug 9, 2018
2 parents 0eb4d8c + 28180d0 commit ead42aa
Show file tree
Hide file tree
Showing 54 changed files with 154 additions and 156 deletions.
4 changes: 2 additions & 2 deletions demos/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ function startService(port) {
debug('running on electron!');
const app = require('electron').app;
const BrowserWindow = require('electron').BrowserWindow;
const watch = require('@lite-js/torch/lib/watch');
const windowBoundsConfig = require('@lite-js/torch/lib/windowBoundsConfig')(
const watch = require('torchjs/lib/watch');
const windowBoundsConfig = require('torchjs/lib/windowBoundsConfig')(
resolve(app.getPath('userData'), './data-set-config.json')
);

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"author": "https://github.com/orgs/antvis/people",
"license": "MIT",
"devDependencies": {
"@lite-js/torch": "~0.2.6",
"babel-cli": "~6.26.0",
"babel-core": "~6.26.0",
"babel-eslint": "~8.0.3",
Expand All @@ -35,7 +34,7 @@
"connect": "~3.6.5",
"d3-queue": "~3.0.7",
"debug": "~3.1.0",
"electron": "~1.8.4",
"electron": "~2.0.6",
"eslint": "~3.19.0",
"eslint-config-airbnb": "~15.0.1",
"eslint-config-egg": "~4.2.0",
Expand All @@ -44,6 +43,7 @@
"eslint-plugin-react": "^7.7.0",
"get-port": "~3.2.0",
"jszip": "^3.1.5",
"lodash": "~4.17.4",
"nightmare": "~2.10.0",
"nunjucks": "~3.0.1",
"open": "~0.0.5",
Expand All @@ -52,6 +52,7 @@
"serve-static": "~1.13.1",
"shelljs": "~0.7.8",
"string-replace-loader": "^2.1.1",
"torchjs": "~2.0.4",
"uglify-js": "~3.1.10",
"webpack": "~3.10.0"
},
Expand Down Expand Up @@ -86,7 +87,8 @@
"silent": false
},
"dependencies": {
"@antv/hierarchy": "~0.1.0-beta.2",
"@antv/hierarchy": "~0.3.14",
"@antv/util": "~1.1.1",
"d3-array": "~1.2.0",
"d3-composite-projections": "~1.2.0",
"d3-dsv": "~1.0.5",
Expand All @@ -97,7 +99,6 @@
"d3-sankey": "~0.7.1",
"d3-voronoi": "~1.1.2",
"dagre": "~0.8.2",
"lodash": "~4.17.4",
"point-at-length": "~1.0.2",
"regression": "~2.0.0",
"simple-statistics": "~4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/api/geo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const {
geoArea,
geoCentroid,
Expand Down
2 changes: 1 addition & 1 deletion src/api/hierarchy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-cond-assign, no-loop-func */
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const View = require('../view');

assign(View.prototype, {
Expand Down
4 changes: 2 additions & 2 deletions src/api/partition.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assign = require('lodash/assign');
const values = require('lodash/values');
const assign = require('@antv/util/lib/mix');
const values = require('@antv/util/lib/array/values');
const partition = require('../util/partition');
const View = require('../view');

Expand Down
6 changes: 3 additions & 3 deletions src/api/statistics.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const flattenDeep = require('lodash/flattenDeep');
const isArray = require('lodash/isArray');
const assign = require('@antv/util/lib/mix');
const flattenDeep = require('@antv/util/lib/array/flattenDeep');
const isArray = require('@antv/util/lib/type/isArray');
const simpleStatistics = require('simple-statistics');
const View = require('../view');
const pByFraction = require('../util/p-by-fraction');
Expand Down
4 changes: 2 additions & 2 deletions src/connector/default.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const isString = require('lodash/isString');
const cloneDeep = require('lodash/cloneDeep');
const isString = require('@antv/util/lib/type/isString');
const cloneDeep = require('@antv/util/lib/clone');
const {
registerConnector
} = require('../data-set');
Expand Down
2 changes: 1 addition & 1 deletion src/connector/dsv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const isString = require('lodash/isString');
const isString = require('@antv/util/lib/type/isString');
const {
dsvFormat,
csvParse,
Expand Down
2 changes: 1 addition & 1 deletion src/connector/geojson.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const getPointAtLength = require('point-at-length');
const cloneDeep = require('lodash/cloneDeep');
const cloneDeep = require('@antv/util/lib/clone');
const {
geoPath
} = require('d3-geo');
Expand Down
4 changes: 2 additions & 2 deletions src/connector/graph.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assign = require('lodash/assign');
const isFunction = require('lodash/isFunction');
const assign = require('@antv/util/lib/mix');
const isFunction = require('@antv/util/lib/type/isFunction');
const {
GRAPH,
registerConnector
Expand Down
4 changes: 2 additions & 2 deletions src/connector/hexjson.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assign = require('lodash/assign');
const cloneDeep = require('lodash/cloneDeep');
const assign = require('@antv/util/lib/mix');
const cloneDeep = require('@antv/util/lib/clone');
const {
getGridForHexJSON,
renderHexJSON
Expand Down
2 changes: 1 addition & 1 deletion src/connector/hierarchy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const isFunction = require('lodash/isFunction');
const isFunction = require('@antv/util/lib/type/isFunction');
const {
hierarchy
} = require('d3-hierarchy');
Expand Down
2 changes: 1 addition & 1 deletion src/connector/topojson.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const isString = require('lodash/isString');
const isString = require('@antv/util/lib/type/isString');
const {
feature
} = require('topojson-client');
Expand Down
8 changes: 4 additions & 4 deletions src/data-set.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assign = require('lodash/assign');
const isNil = require('lodash/isNil');
const isObject = require('lodash/isObject');
const uniqueId = require('lodash/uniqueId');
const assign = require('@antv/util/lib/mix');
const isNil = require('@antv/util/lib/type/isNil');
const isObject = require('@antv/util/lib/type/isObject');
const uniqueId = require('@antv/util/lib/uniqueId');
const EventEmitter = require('wolfy87-eventemitter');
const View = require('./view');
const CONSTANTS = require('./constants');
Expand Down
14 changes: 7 additions & 7 deletions src/transform/aggregate.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const assign = require('lodash/assign');
const flattenDeep = require('lodash/flattenDeep');
const forIn = require('lodash/forIn');
const isArray = require('lodash/isArray');
const isString = require('lodash/isString');
const keys = require('lodash/keys');
const uniq = require('lodash/uniq');
const assign = require('@antv/util/lib/mix');
const flattenDeep = require('@antv/util/lib/array/flattenDeep');
const forIn = require('@antv/util/lib/each');
const isArray = require('@antv/util/lib/type/isArray');
const isString = require('@antv/util/lib/type/isString');
const keys = require('@antv/util/lib/object/keys');
const uniq = require('@antv/util/lib/array/uniq');
const simpleStatistics = require('simple-statistics');
const partition = require('../util/partition');
const {
Expand Down
6 changes: 3 additions & 3 deletions src/transform/bin/hexagon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const isArray = require('lodash/isArray');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const isArray = require('@antv/util/lib/type/isArray');
const {
registerTransform
} = require('../../data-set');
Expand Down
6 changes: 3 additions & 3 deletions src/transform/bin/histogram.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const pick = require('lodash/pick');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const pick = require('@antv/util/lib/pick');
const partition = require('../../util/partition');
const {
registerTransform
Expand Down
9 changes: 4 additions & 5 deletions src/transform/bin/quantile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const isArray = require('lodash/isArray');
const isString = require('lodash/isString');
// const pick = require('lodash/pick');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const isArray = require('@antv/util/lib/type/isArray');
const isString = require('@antv/util/lib/type/isString');
const {
quantile
} = require('simple-statistics');
Expand Down
4 changes: 2 additions & 2 deletions src/transform/bin/rectangle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const {
registerTransform
} = require('../../data-set');
Expand Down
10 changes: 5 additions & 5 deletions src/transform/diagram/arc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* for Arc Diagram (edges without weight) / Chord Diagram (edges with source and target weight)
* graph data required (nodes, edges)
*/
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const isArray = require('lodash/isArray');
const values = require('lodash/values');
const isFunction = require('lodash/isFunction');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const isArray = require('@antv/util/lib/type/isArray');
const values = require('@antv/util/lib/array/values');
const isFunction = require('@antv/util/lib/type/isFunction');
const {
registerTransform
} = require('../../data-set');
Expand Down
2 changes: 1 addition & 1 deletion src/transform/diagram/dagre.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* for DAG
* graph data required (nodes, edges)
*/
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const dagre = require('dagre');
const {
registerTransform
Expand Down
6 changes: 3 additions & 3 deletions src/transform/diagram/sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* for Sankey Diagram
* graph data required (nodes, edges)
*/
const assign = require('lodash/assign');
const isString = require('lodash/isString');
const isFunction = require('lodash/isFunction');
const assign = require('@antv/util/lib/mix');
const isString = require('@antv/util/lib/type/isString');
const isFunction = require('@antv/util/lib/type/isFunction');
const {
sankey,
sankeyLeft,
Expand Down
4 changes: 2 additions & 2 deletions src/transform/diagram/voronoi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Voronoi = require('d3-voronoi');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
registerTransform
} = require('../../data-set');
Expand Down
4 changes: 2 additions & 2 deletions src/transform/fill-rows.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const partition = require('../util/partition');
const {
registerTransform
Expand Down
6 changes: 3 additions & 3 deletions src/transform/fold.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const difference = require('lodash/difference');
const pick = require('lodash/pick');
const assign = require('@antv/util/lib/mix');
const difference = require('@antv/util/lib/array/difference');
const pick = require('@antv/util/lib/pick');
const {
registerTransform
} = require('../data-set');
Expand Down
6 changes: 3 additions & 3 deletions src/transform/geo/centroid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const isArray = require('lodash/isArray');
const isString = require('lodash/isString');
const assign = require('@antv/util/lib/mix');
const isArray = require('@antv/util/lib/type/isArray');
const isString = require('@antv/util/lib/type/isString');
const {
registerTransform
} = require('../../data-set');
Expand Down
4 changes: 2 additions & 2 deletions src/transform/geo/projection.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Geo = require('d3-geo');
const getPointAtLength = require('point-at-length');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
registerTransform
} = require('../../data-set');
Expand Down
6 changes: 3 additions & 3 deletions src/transform/geo/region.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const isArray = require('lodash/isArray');
const isString = require('lodash/isString');
const assign = require('@antv/util/lib/mix');
const isArray = require('@antv/util/lib/type/isArray');
const isString = require('@antv/util/lib/type/isString');
const {
registerTransform
} = require('../../data-set');
Expand Down
4 changes: 2 additions & 2 deletions src/transform/hierarchy/cluster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Hierarchy = require('d3-hierarchy');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
HIERARCHY,
registerTransform
Expand Down
2 changes: 1 addition & 1 deletion src/transform/hierarchy/compact-box.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const hierarchy = require('@antv/hierarchy');
const hierarchy = require('@antv/hierarchy/lib');
const {
HIERARCHY,
registerTransform
Expand Down
2 changes: 1 addition & 1 deletion src/transform/hierarchy/dendrogram.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const hierarchy = require('@antv/hierarchy');
const hierarchy = require('@antv/hierarchy/lib');
const {
HIERARCHY,
registerTransform
Expand Down
2 changes: 1 addition & 1 deletion src/transform/hierarchy/indented.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const hierarchy = require('@antv/hierarchy');
const hierarchy = require('@antv/hierarchy/lib');
const {
HIERARCHY,
registerTransform
Expand Down
4 changes: 2 additions & 2 deletions src/transform/hierarchy/pack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Hierarchy = require('d3-hierarchy');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
HIERARCHY,
registerTransform
Expand Down
4 changes: 2 additions & 2 deletions src/transform/hierarchy/partition.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Hierarchy = require('d3-hierarchy');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
HIERARCHY,
registerTransform
Expand Down
4 changes: 2 additions & 2 deletions src/transform/hierarchy/tree.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Hierarchy = require('d3-hierarchy');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
HIERARCHY,
registerTransform
Expand Down
4 changes: 2 additions & 2 deletions src/transform/hierarchy/treemap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assign = require('lodash/assign');
const assign = require('@antv/util/lib/mix');
const d3Hierarchy = require('d3-hierarchy');
const isArray = require('lodash/isArray');
const isArray = require('@antv/util/lib/type/isArray');
const {
HIERARCHY,
registerTransform
Expand Down
12 changes: 6 additions & 6 deletions src/transform/impute.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const assign = require('lodash/assign');
const forIn = require('lodash/forIn');
const has = require('lodash/has');
const isFunction = require('lodash/isFunction');
const isUndefined = require('lodash/isUndefined');
const isString = require('lodash/isString');
const assign = require('@antv/util/lib/mix');
const forIn = require('@antv/util/lib/each');
const has = require('@antv/util/lib/object/has');
const isFunction = require('@antv/util/lib/type/isFunction');
const isUndefined = require('@antv/util/lib/type/isUndefined');
const isString = require('@antv/util/lib/type/isString');
const simpleStatistics = require('simple-statistics');
const partition = require('../util/partition');
const {
Expand Down
Loading

0 comments on commit ead42aa

Please sign in to comment.