Use _.deepContains

This commit is contained in:
Ben Ogle
2014-06-20 10:50:12 -07:00
parent 72b1821828
commit 593b5b4e36
3 changed files with 5 additions and 19 deletions

View File

@@ -174,11 +174,11 @@ GutterComponent = React.createClass
if previousDecorations?
for decoration in previousDecorations
node.classList.remove(decoration.class) if editor.decorationMatchesType(decoration, 'gutter') and not contains(decorations, decoration)
node.classList.remove(decoration.class) if editor.decorationMatchesType(decoration, 'gutter') and not _.deepContains(decorations, decoration)
if decorations?
for decoration in decorations
if editor.decorationMatchesType(decoration, 'gutter') and not contains(previousDecorations, decoration)
if editor.decorationMatchesType(decoration, 'gutter') and not _.deepContains(previousDecorations, decoration)
node.classList.add(decoration.class)
unless @screenRowsByLineNumberId[lineNumberId] is screenRow
@@ -211,10 +211,3 @@ GutterComponent = React.createClass
unless width is @measuredWidth
@measuredWidth = width
@props.onWidthChanged?(width)
# Created because underscore uses === not _.isEqual, which we need
contains = (array, target) ->
return false unless array?
for object in array
return true if _.isEqual(object, target)
false