From 93181d8a544c28c50289e37f2c16a2efdc8d07c8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 28 Jan 2015 10:24:52 -0800 Subject: [PATCH] Array::find is undefined in Chrome 40 --- src/language-mode.coffee | 2 +- src/menu-manager.coffee | 2 +- src/pane-container.coffee | 4 ++-- src/view-registry.coffee | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/language-mode.coffee b/src/language-mode.coffee index e7c924a48..89373cc6e 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -32,7 +32,7 @@ class LanguageMode 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 commentStartString = commentStartEntry?.value commentEndString = commentEndEntry?.value diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 2c022cc32..35c012936 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -176,7 +176,7 @@ class MenuManager element?.classList.toString().split(' ') ? [] sortPackagesMenu: -> - packagesMenu = @template.find ({label}) -> MenuHelpers.normalizeLabel(label) is 'Packages' + packagesMenu = _.find @template, ({label}) -> MenuHelpers.normalizeLabel(label) is 'Packages' return unless packagesMenu?.submenu? packagesMenu.submenu.sort (item1, item2) -> diff --git a/src/pane-container.coffee b/src/pane-container.coffee index bcda87bbc..f36169e3b 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -48,7 +48,7 @@ class PaneContainer extends Model deserializeParams: (params) -> params.root = atom.deserializers.deserialize(params.root, container: this) 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 serializeParams: (params) -> @@ -147,7 +147,7 @@ class PaneContainer extends Model find @getPanes(), (pane) -> pane.itemForURI(uri)? paneForItem: (item) -> - @getPanes().find (pane) -> item in pane.getItems() + find @getPanes(), (pane) -> item in pane.getItems() saveAll: -> pane.saveItems() for pane in @getPanes() diff --git a/src/view-registry.coffee b/src/view-registry.coffee index 0eb2590cf..a9104af5f 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -1,3 +1,4 @@ +{find} = require 'underscore-plus' Grim = require 'grim' {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.") findProvider: (object) -> - @providers.find ({modelConstructor}) -> object instanceof modelConstructor + find @providers, ({modelConstructor}) -> object instanceof modelConstructor