diff --git a/package.json b/package.json index b401a7ea..262fb558 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "redux": "^4.0.0", "signature_pad": "^3.0.0-beta.3", "translation-web-component": "^0.1.1", - "underscore": "^1.9.0", "zxing-js-es6": "^0.15.3" }, "devDependencies": { diff --git a/util/loc.js b/util/loc.js index faba48bb..2ebe434e 100644 --- a/util/loc.js +++ b/util/loc.js @@ -1,6 +1,3 @@ - -import 'underscore/underscore.js' - export class Loc { /* * @returns FlatLocationList {locations: [ LocationNodeWithParentRef, ... ], locationsLevels: [ ... ]} @@ -179,7 +176,7 @@ export class Loc { static _query (depth, targetDepth, data, levelMap, criteria) { var allChildren, i, j, len, levelData, v; if (depth === targetDepth) { - return _.map(data, function(obj) { + return Object.keys(data).map(key => data[key]).map(function(obj) { return { id: obj.id, label: obj.label @@ -193,12 +190,12 @@ export class Loc { } if ((levelMap[depth] == null) && (depth < targetDepth)) { levelData = {}; - allChildren = _.map(data, function(loc) { + allChildren = Object.keys(data).map(key => data[key]).map(function(loc) { return loc.children; }); for (i = j = 0, len = allChildren.length; j < len; i = ++j) { v = allChildren[i]; - _.extend(levelData, v); + Object.assign(levelData, v); } return Loc._query(depth + 1, targetDepth, levelData, levelMap, criteria); } @@ -215,7 +212,7 @@ export class Loc { return levelMap.indexOf(level); } } - return levelMap.indexOf(_.last(levels)); + return levelMap.indexOf(levels[levels.length-1]); } }