From df4f25a02c0c74ab62448c7ac845456b8e03c24f Mon Sep 17 00:00:00 2001 From: J Guthrie Date: Mon, 21 Jan 2019 21:28:45 +0000 Subject: [PATCH] Use lodash _includes instead of standard javascript version --- modules/operations/straighten.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/operations/straighten.js b/modules/operations/straighten.js index 112746445..73525af27 100644 --- a/modules/operations/straighten.js +++ b/modules/operations/straighten.js @@ -1,5 +1,6 @@ import _uniq from 'lodash-es/uniq'; import _difference from 'lodash-es/difference'; +import _includes from 'lodash-es/includes'; import { t } from '../util/locale'; import { actionStraighten } from '../actions/index'; @@ -41,15 +42,15 @@ export function operationStraighten(selectedIDs, context) { endNodes.push(entity.nodes[entity.nodes.length-1]); } - if (_uniq(nodes).length <= 2 || ![0,2].includes(selectedNodes.length)) return false; + if (_uniq(nodes).length <= 2 || !_includes([0,2], selectedNodes.length)) return false; // Ensure all ways are connected (i.e. only one unique start point and one unique end point) if (_difference(startNodes, endNodes).length !== 1 || _difference(endNodes, startNodes).length !== 1) return false; // Ensure both selected nodes lie on the selected path - if (selectedNodes.length && (!nodes.includes(selectedNodes[0]) || - !nodes.includes(selectedNodes[1]))) return false; + if (selectedNodes.length && (!_includes(nodes, selectedNodes[0]) || + !_includes(nodes, selectedNodes[1]))) return false; return true; };