Array::find is undefined in Chrome 40

This commit is contained in:
Cheng Zhao 2015-01-28 10:24:52 -08:00
parent 661f1f822a
commit 93181d8a54
4 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class LanguageMode
return unless commentStartEntry? return unless commentStartEntry?
commentEndEntry = atom.config.getAll('editor.commentEnd', {scope}).find (entry) -> commentEndEntry = _.find atom.config.getAll('editor.commentEnd', {scope}), (entry) ->
entry.scopeSelector is commentStartEntry.scopeSelector entry.scopeSelector is commentStartEntry.scopeSelector
commentStartString = commentStartEntry?.value commentStartString = commentStartEntry?.value
commentEndString = commentEndEntry?.value commentEndString = commentEndEntry?.value

View File

@ -176,7 +176,7 @@ class MenuManager
element?.classList.toString().split(' ') ? [] element?.classList.toString().split(' ') ? []
sortPackagesMenu: -> sortPackagesMenu: ->
packagesMenu = @template.find ({label}) -> MenuHelpers.normalizeLabel(label) is 'Packages' packagesMenu = _.find @template, ({label}) -> MenuHelpers.normalizeLabel(label) is 'Packages'
return unless packagesMenu?.submenu? return unless packagesMenu?.submenu?
packagesMenu.submenu.sort (item1, item2) -> packagesMenu.submenu.sort (item1, item2) ->

View File

@ -48,7 +48,7 @@ class PaneContainer extends Model
deserializeParams: (params) -> deserializeParams: (params) ->
params.root = atom.deserializers.deserialize(params.root, container: this) params.root = atom.deserializers.deserialize(params.root, container: this)
params.destroyEmptyPanes = atom.config.get('core.destroyEmptyPanes') params.destroyEmptyPanes = atom.config.get('core.destroyEmptyPanes')
params.activePane = params.root.getPanes().find (pane) -> pane.id is params.activePaneId params.activePane = find params.root.getPanes(), (pane) -> pane.id is params.activePaneId
params params
serializeParams: (params) -> serializeParams: (params) ->
@ -147,7 +147,7 @@ class PaneContainer extends Model
find @getPanes(), (pane) -> pane.itemForURI(uri)? find @getPanes(), (pane) -> pane.itemForURI(uri)?
paneForItem: (item) -> paneForItem: (item) ->
@getPanes().find (pane) -> item in pane.getItems() find @getPanes(), (pane) -> item in pane.getItems()
saveAll: -> saveAll: ->
pane.saveItems() for pane in @getPanes() pane.saveItems() for pane in @getPanes()

View File

@ -1,3 +1,4 @@
{find} = require 'underscore-plus'
Grim = require 'grim' Grim = require 'grim'
{Disposable} = require 'event-kit' {Disposable} = require 'event-kit'
@ -148,4 +149,4 @@ class ViewRegistry
throw new Error("Can't create a view for #{object.constructor.name} instance. Please register a view provider.") throw new Error("Can't create a view for #{object.constructor.name} instance. Please register a view provider.")
findProvider: (object) -> findProvider: (object) ->
@providers.find ({modelConstructor}) -> object instanceof modelConstructor find @providers, ({modelConstructor}) -> object instanceof modelConstructor