Commit 738d107

mo khan <mo@mokhan.ca>
2013-11-09 16:09:50
split out to separate files and use common js to load them in.
1 parent f0a21e1
src/enumerable.coffee
@@ -0,0 +1,25 @@
+module.exports = Enumerable =
+  any: (predicate) ->
+    result = false
+    @each (item) =>
+      result = predicate(item)
+      return if result
+    result
+
+  includes: (other_item) ->
+    result = false
+    @each (item) =>
+      result ||= (item == other_item || item.equals(other_item))
+    result
+
+  find_all: (predicate) ->
+    results = []
+    @each (item) =>
+      results.push(item) if predicate(item)
+    results
+
+  all: (specification) ->
+    @find_all (movie) -> 
+      specification.matches(movie)
+
+
src/module.coffee
@@ -0,0 +1,10 @@
+moduleKeywords = ['extended', 'included']
+
+module.exports = class Module
+  @include: (object) ->
+    for key, value of object when key not in moduleKeywords
+      @::[key] = value
+
+    object.included?.apply(@)
+    this
+
src/movie_library.coffee
@@ -1,38 +1,6 @@
 Studio = require('./studio')
-
-Enumerable =
-  any: (predicate) ->
-    result = false
-    @each (item) =>
-      result = predicate(item)
-      return if result
-    result
-
-  includes: (other_item) ->
-    result = false
-    @each (item) =>
-      result ||= (item == other_item || item.equals(other_item))
-    result
-
-  find_all: (predicate) ->
-    results = []
-    @each (item) =>
-      results.push(item) if predicate(item)
-    results
-
-  all: (specification) ->
-    @find_all (movie) -> 
-      specification.matches(movie)
-
-moduleKeywords = ['extended', 'included']
-
-class Module
-  @include: (object) ->
-    for key, value of object when key not in moduleKeywords
-      @::[key] = value
-
-    object.included?.apply(@)
-    this
+Module = require('./module')
+Enumerable = require('./enumerable')
 
 module.exports = class MovieLibrary extends Module
   @include Enumerable