From 0bb0863b6109b74eb7cac73df9a618de65f11b3e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Feb 2013 09:06:35 -0800 Subject: [PATCH] Use _.indexOf instead of _.contains _.indexOf supports a isSorted flag which can be used since the extension arrays are pre-sorted. --- src/stdlib/fs.coffee | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/stdlib/fs.coffee b/src/stdlib/fs.coffee index fcf8904a9..d553d6361 100644 --- a/src/stdlib/fs.coffee +++ b/src/stdlib/fs.coffee @@ -152,35 +152,33 @@ module.exports = undefined isCompressedExtension: (ext) -> - _.contains([ + _.indexOf([ '.gz' '.jar' '.tar' '.zip' - ], ext) + ], ext, true) >= 0 isImageExtension: (ext) -> - _.contains([ + _.indexOf([ '.gif' '.jpeg' '.jpg' '.png' '.tiff' - ], ext) + ], ext, true) >= 0 isPdfExtension: (ext) -> - _.contains([ - '.pdf' - ], ext) + ext is '.pdf' isMarkdownExtension: (ext) -> - _.contains([ + _.indexOf([ '.markdown' '.md' '.mkd' '.mkdown' '.ron' - ], ext) + ], ext, true) >= 0 readObject: (path) -> contents = @read(path)