Browse Source

Level 4: arrays, objects, iteration

Frederic G. MARAND 6 years ago
parent
commit
ddf9cf3e63

+ 134 - 65
.idea/workspace.xml

@@ -2,11 +2,26 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="a9e80a2a-c5a3-4f61-9674-b81f51dbb223" name="Default" comment="">
-      <change beforePath="" afterPath="$PROJECT_DIR$/.idea/runConfigurations/PHP_Server.xml" />
-      <change beforePath="" afterPath="$PROJECT_DIR$/src/conditions.coffee" />
-      <change beforePath="" afterPath="$PROJECT_DIR$/src/operators.coffee" />
+      <change beforePath="" afterPath="$PROJECT_DIR$/src/4-01-arrays.coffee" />
+      <change beforePath="" afterPath="$PROJECT_DIR$/src/4-02-ranges.coffee" />
+      <change beforePath="" afterPath="$PROJECT_DIR$/src/4-03-splats.coffee" />
+      <change beforePath="" afterPath="$PROJECT_DIR$/src/4-04-objects.coffee" />
+      <change beforePath="" afterPath="$PROJECT_DIR$/src/5-01-jquery.coffee" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
       <change beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" />
+      <change beforePath="$PROJECT_DIR$/lib/conditions.js" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/conditions.js.map" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/hello.js" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/hello.js.map" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/jquery.js" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/jquery.js.map" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/operators.js" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/lib/operators.js.map" afterPath="" />
+      <change beforePath="$PROJECT_DIR$/package.json" afterPath="$PROJECT_DIR$/package.json" />
+      <change beforePath="$PROJECT_DIR$/src/conditions.coffee" afterPath="$PROJECT_DIR$/src/3-01-conditions.coffee" />
+      <change beforePath="$PROJECT_DIR$/src/hello.coffee" afterPath="$PROJECT_DIR$/src/1-01-hello.coffee" />
+      <change beforePath="$PROJECT_DIR$/src/jquery.coffee" afterPath="$PROJECT_DIR$/src/2-01-jquery.coffee" />
+      <change beforePath="$PROJECT_DIR$/src/operators.coffee" afterPath="$PROJECT_DIR$/src/3-02-operators.coffee" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="TRACKING_ENABLED" value="true" />
@@ -16,18 +31,7 @@
     <option name="LAST_RESOLUTION" value="IGNORE" />
   </component>
   <component name="FileEditorManager">
-    <leaf>
-      <file leaf-file-name="index.html" pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/index.html">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="150">
-              <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
   </component>
   <component name="FileTemplateManagerImpl">
     <option name="RECENT_TEMPLATES">
@@ -42,13 +46,22 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/package.json" />
         <option value="$PROJECT_DIR$/hello.coffee" />
         <option value="$PROJECT_DIR$/src/hello.coffee" />
         <option value="$PROJECT_DIR$/src/jquery.coffee" />
-        <option value="$PROJECT_DIR$/index.html" />
         <option value="$PROJECT_DIR$/src/conditions.coffee" />
         <option value="$PROJECT_DIR$/src/operators.coffee" />
+        <option value="$PROJECT_DIR$/src/ranges.coffee" />
+        <option value="$PROJECT_DIR$/src/arrays.coffee" />
+        <option value="$PROJECT_DIR$/lib/splats.js" />
+        <option value="$PROJECT_DIR$/src/splats.coffee" />
+        <option value="$PROJECT_DIR$/package.json" />
+        <option value="$PROJECT_DIR$/src/4-03-splats.coffee" />
+        <option value="$PROJECT_DIR$/index.html" />
+        <option value="$PROJECT_DIR$/lib/4-04-objects.js" />
+        <option value="$PROJECT_DIR$/src/4-04-objects.coffee" />
+        <option value="$PROJECT_DIR$/lib/5-01-jquery.js" />
+        <option value="$PROJECT_DIR$/src/5-01-jquery.coffee" />
       </list>
     </option>
   </component>
@@ -104,7 +117,7 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="Scratches" />
+      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
@@ -121,13 +134,7 @@
               <item name="coffee-codeschool" type="b2602c69:ProjectViewProjectNode" />
               <item name="coffee-codeschool" type="2a2b976b:PhpTreeStructureProvider$1" />
               <item name="lib" type="2a2b976b:PhpTreeStructureProvider$1" />
-              <item name="conditions.js" type="620a8d5e:NestingTreeNode" />
-            </path>
-            <path>
-              <item name="coffee-codeschool" type="b2602c69:ProjectViewProjectNode" />
-              <item name="coffee-codeschool" type="2a2b976b:PhpTreeStructureProvider$1" />
-              <item name="lib" type="2a2b976b:PhpTreeStructureProvider$1" />
-              <item name="operators.js" type="620a8d5e:NestingTreeNode" />
+              <item name="5-01-jquery.js" type="620a8d5e:NestingTreeNode" />
             </path>
             <path>
               <item name="coffee-codeschool" type="b2602c69:ProjectViewProjectNode" />
@@ -138,7 +145,7 @@
           <select />
         </subPane>
       </pane>
-      <pane id="Scope" />
+      <pane id="Scratches" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -171,10 +178,30 @@
       </list>
     </option>
   </component>
-  <component name="RunManager" selected="Node.js.Coffee watch">
-    <list size="2">
+  <component name="RunManager" selected="npm.NPM Watch">
+    <configuration name="NPM Clean" type="js.build_tools.npm" factoryName="npm">
+      <package-json value="$PROJECT_DIR$/package.json" />
+      <command value="run" />
+      <scripts>
+        <script value="clean" />
+      </scripts>
+      <node-interpreter value="project" />
+      <envs />
+    </configuration>
+    <configuration name="NPM Watch" type="js.build_tools.npm" factoryName="npm">
+      <package-json value="$PROJECT_DIR$/package.json" />
+      <command value="run" />
+      <scripts>
+        <script value="watch" />
+      </scripts>
+      <node-interpreter value="project" />
+      <envs />
+    </configuration>
+    <list size="4">
       <item index="0" class="java.lang.String" itemvalue="Node.js.Coffee watch" />
-      <item index="1" class="java.lang.String" itemvalue="PHP Built-in Web Server.PHP Server" />
+      <item index="1" class="java.lang.String" itemvalue="npm.NPM Clean" />
+      <item index="2" class="java.lang.String" itemvalue="npm.NPM Watch" />
+      <item index="3" class="java.lang.String" itemvalue="PHP Built-in Web Server.PHP Server" />
     </list>
   </component>
   <component name="ShelveChangesManager" show_recycled="false">
@@ -190,29 +217,29 @@
       <workItem from="1519329235294" duration="254000" />
       <workItem from="1519329561859" duration="14000" />
       <workItem from="1519329585238" duration="4143000" />
-      <workItem from="1519580966069" duration="1963000" />
+      <workItem from="1519580966069" duration="8752000" />
+      <workItem from="1519625833056" duration="1738000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="6374000" />
+    <option name="totallyTimeSpent" value="14901000" />
   </component>
   <component name="ToolWindowManager">
-    <frame x="0" y="23" width="1440" height="877" extended-state="6" />
-    <editor active="true" />
+    <frame x="0" y="23" width="1440" height="877" extended-state="0" />
     <layout>
-      <window_info id="Project" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1702432" sideWeight="0.5" order="5" side_tool="false" content_ui="combo" />
+      <window_info id="Project" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17238913" sideWeight="0.5" order="5" side_tool="false" content_ui="combo" />
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
       <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
       <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19053708" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1892583" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16380544" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32992327" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32225063" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@@ -234,83 +261,125 @@
     <watches-manager />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/package.json">
+    <entry file="file://$PROJECT_DIR$/src/4-04-objects.coffee">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="60">
-          <caret line="4" column="46" lean-forward="false" selection-start-line="4" selection-start-column="46" selection-end-line="4" selection-end-column="46" />
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/4-04-objects.js">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1230">
+          <caret line="82" column="0" lean-forward="true" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
+          <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/hello.js" />
     <entry file="file://$PROJECT_DIR$/hello.coffee" />
-    <entry file="file://$PROJECT_DIR$/src/hello.coffee">
+    <entry file="file://$PROJECT_DIR$/src/1-01-hello.coffee">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="195">
           <caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
-          <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/hello.js">
+    <entry file="file://$PROJECT_DIR$/lib/hello.js" />
+    <entry file="file://$PROJECT_DIR$/lib/jquery.js" />
+    <entry file="file://$PROJECT_DIR$/src/3-01-conditions.coffee">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="210">
+          <caret line="14" column="0" lean-forward="false" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/conditions.js" />
+    <entry file="file://$PROJECT_DIR$/src/3-02-operators.coffee">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="268">
+          <caret line="34" column="22" lean-forward="true" selection-start-line="34" selection-start-column="22" selection-end-line="34" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/operators.js" />
+    <entry file="file://$PROJECT_DIR$/src/4-02-ranges.coffee">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="270">
           <caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
-          <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/jquery.coffee">
+    <entry file="file://$PROJECT_DIR$/lib/ranges.js" />
+    <entry file="file://$PROJECT_DIR$/lib/arrays.js" />
+    <entry file="file://$PROJECT_DIR$/lib/splats.js" />
+    <entry file="file://$PROJECT_DIR$/src/4-01-arrays.coffee">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="300">
-          <caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
+        <state relative-caret-position="375">
+          <caret line="25" column="0" lean-forward="true" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/jquery.js">
+    <entry file="file://$PROJECT_DIR$/package.json">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="435">
-          <caret line="29" column="0" lean-forward="true" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
+        <state relative-caret-position="165">
+          <caret line="11" column="0" lean-forward="true" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/conditions.coffee">
+    <entry file="file://$PROJECT_DIR$/src/4-03-splats.coffee">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="210">
-          <caret line="14" column="0" lean-forward="false" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
+        <state relative-caret-position="150">
+          <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/index.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="150">
+          <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/4-04-objects.coffee">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="135">
+          <caret line="9" column="8" lean-forward="true" selection-start-line="9" selection-start-column="8" selection-end-line="9" selection-end-column="8" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/conditions.js">
+    <entry file="file://$PROJECT_DIR$/lib/4-04-objects.js">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="390">
-          <caret line="26" column="0" lean-forward="true" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
+        <state relative-caret-position="479">
+          <caret line="82" column="0" lean-forward="false" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/operators.coffee">
+    <entry file="file://$PROJECT_DIR$/src/2-01-jquery.coffee">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="268">
-          <caret line="34" column="22" lean-forward="true" selection-start-line="34" selection-start-column="22" selection-end-line="34" selection-end-column="22" />
+        <state relative-caret-position="15">
+          <caret line="1" column="0" lean-forward="true" selection-start-line="0" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/operators.js">
+    <entry file="file://$PROJECT_DIR$/src/5-01-jquery.coffee">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="358">
-          <caret line="82" column="45" lean-forward="false" selection-start-line="82" selection-start-column="45" selection-end-line="82" selection-end-column="45" />
+        <state relative-caret-position="435">
+          <caret line="29" column="0" lean-forward="true" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/index.html">
+    <entry file="file://$PROJECT_DIR$/lib/5-01-jquery.js">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="150">
-          <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
+        <state relative-caret-position="239">
+          <caret line="20" column="2" lean-forward="false" selection-start-line="20" selection-start-column="2" selection-end-line="20" selection-end-column="2" />
           <folding />
         </state>
       </provider>

+ 1 - 1
index.html

@@ -5,6 +5,6 @@
     <title>CoffeeScript playground</title>
   </head>
   <body>
-    <script src="lib/conditions.js"></script>
+    <script src="lib/3-01-conditions.js"></script>
   </body>
 </html>

+ 1 - 1
lib/hello.js → lib/1-01-hello.js

@@ -15,4 +15,4 @@ alert(coffee("Chocolate ?"));
 //`Best practice: parentheses always except at the outermost level.
 alert(coffee("Tea, maybe ?"));
 
-//# sourceMappingURL=hello.js.map
+//# sourceMappingURL=1-01-hello.js.map

+ 2 - 2
lib/hello.js.map → lib/1-01-hello.js.map

@@ -1,9 +1,9 @@
 {
   "version": 3,
-  "file": "hello.js",
+  "file": "1-01-hello.js",
   "sourceRoot": "..",
   "sources": [
-    "src/hello.coffee"
+    "src/1-01-hello.coffee"
   ],
   "names": [],
   "mappings": "AAAA,IAAA,MAAA,EAAA;;AAAA,OAAA,GAAU;;AAEV,MAAA,GAAS,QAAA,CAAC,MAAM,OAAP,CAAA;AACP,MAAA;EAAA,MAAA,GAAS,OAAA,CAAQ,GAAR;SACT,CAAA,eAAA,CAAA,CAAkB,MAAlB,CAAA;AAFO;;AAKT,KAAA,CAAM,MAAA,CAAA,CAAN,EAPA;;AAQA,KAAA,CAAM,MAAA,CAAO,aAAP,CAAN,EARA;;;AAWA,KAAA,CAAM,MAAA,CAAO,cAAP,CAAN",

+ 1 - 1
lib/jquery.js → lib/2-01-jquery.js

@@ -26,4 +26,4 @@ showNumberOfFlights = function(e) {
   return $('#tabs span.tooltip').show();
 };
 
-//# sourceMappingURL=jquery.js.map
+//# sourceMappingURL=2-01-jquery.js.map

File diff suppressed because it is too large
+ 2 - 2
lib/2-01-jquery.js.map


+ 1 - 1
lib/conditions.js → lib/3-01-conditions.js

@@ -23,4 +23,4 @@ console.log((ref = age < 15) != null ? ref : {
   "Minor": "Elder"
 });
 
-//# sourceMappingURL=conditions.js.map
+//# sourceMappingURL=3-01-conditions.js.map

+ 2 - 2
lib/conditions.js.map → lib/3-01-conditions.js.map

@@ -1,9 +1,9 @@
 {
   "version": 3,
-  "file": "conditions.js",
+  "file": "3-01-conditions.js",
   "sourceRoot": "..",
   "sources": [
-    "src/conditions.coffee"
+    "src/3-01-conditions.coffee"
   ],
   "names": [],
   "mappings": "AAAA,IAAA,GAAA,EAAA;;AAAA,GAAA,GAAM,MAAA,CAAO,kBAAP,EAA2B,CAA3B;;AAEN,IAAG,GAAA,IAAO,EAAV;EACE,KAAA,CAAM,OAAN,EADF;CAAA,MAAA;EAGE,KAAA,CAAM,UAAN,EAHF;;;AAKA,IAAoB,GAAA,GAAM,EAA1B;EAAA,KAAA,CAAM,UAAN,EAAA;;;AAEA,IAAG,GAAA,GAAM,EAAT;EAAiB,KAAA,CAAM,WAAN,EAAjB;CAAA,MAAA;EAAwC,KAAA,CAAM,QAAN,EAAxC;CATA;;;AAYA,OAAO,CAAC,GAAR,kCAA0B;EAAA,OAAA,EAAU;AAAV,CAA1B",

+ 1 - 1
lib/operators.js → lib/3-02-operators.js

@@ -88,4 +88,4 @@ if (typeof vehicle.start_engine === "function") {
   }
 }
 
-//# sourceMappingURL=operators.js.map
+//# sourceMappingURL=3-02-operators.js.map

File diff suppressed because it is too large
+ 2 - 2
lib/3-02-operators.js.map


+ 71 - 0
lib/4-01-arrays.js

@@ -0,0 +1,71 @@
+var geoLocate, i, index, j, len, len1, loc, location, storeLocations1, storeLocations2, storeLocations3;
+
+storeLocations1 = ['Orlando', 'Winter Park', 'Sanford'];
+
+// Beware, this doesn't compile correctly:
+// storeLocations.forEach(location, index) ->
+// It uses it as a forEach(location, index) call with a () => {} callback
+
+// So be sure to add the space.
+storeLocations1.forEach(function(location, index) {
+  return console.log(`Location ${index}: ${location}`);
+});
+
+// Or use something more idiomatic:
+for (index = i = 0, len = storeLocations1.length; i < len; index = ++i) {
+  location = storeLocations1[index];
+  console.log(`Location ${index}: ${location}`);
+}
+
+for (index = j = 0, len1 = storeLocations1.length; j < len1; index = ++j) {
+  location = storeLocations1[index];
+  // List comprehensions
+  console.log(`Location ${index}: ${location}`);
+}
+
+// In this case, the parentheses are essential
+storeLocations2 = (function() {
+  var k, len2, results;
+  results = [];
+  for (k = 0, len2 = storeLocations1.length; k < len2; k++) {
+    loc = storeLocations1[k];
+    results.push(`${loc}, FL`);
+  }
+  return results;
+})();
+
+// Without them, the whole "storeLocations = ..." part is run for each loc.
+console.log(storeLocations2);
+
+geoLocate = function(loc) {
+  return `${loc}, USA`;
+};
+
+// Applying a filter to a list comprehension
+console.log((function() {
+  var k, len2, results;
+  results = [];
+  for (k = 0, len2 = storeLocations1.length; k < len2; k++) {
+    loc = storeLocations1[k];
+    if (loc !== 'Sanford') {
+      results.push(geoLocate(loc));
+    }
+  }
+  return results;
+})());
+
+storeLocations3 = (function() {
+  var k, len2, results;
+  results = [];
+  for (k = 0, len2 = storeLocations1.length; k < len2; k++) {
+    loc = storeLocations1[k];
+    if (loc !== 'Sanford') {
+      results.push(loc);
+    }
+  }
+  return results;
+})();
+
+console.log(storeLocations3);
+
+//# sourceMappingURL=4-01-arrays.js.map

File diff suppressed because it is too large
+ 8 - 0
lib/4-01-arrays.js.map


+ 41 - 0
lib/4-02-ranges.js

@@ -0,0 +1,41 @@
+var bot, end, range1, range2, range3, start, top;
+
+bot = 3;
+
+top = 0;
+
+// With right limit
+range1 = (function() {
+  var results = [];
+  for (var i = bot; bot <= top ? i <= top : i >= top; bot <= top ? i++ : i--){ results.push(i); }
+  return results;
+}).apply(this);
+
+// Without right limit
+range2 = (function() {
+  var results = [];
+  for (var i = bot; bot <= top ? i < top : i > top; bot <= top ? i++ : i--){ results.push(i); }
+  return results;
+}).apply(this);
+
+console.log(range1, range2);
+
+// Referencing ranges
+start = 5;
+
+end = 10;
+
+range3 = (function() {
+  var results = [];
+  for (var i = start; start <= end ? i <= end : i >= end; start <= end ? i++ : i--){ results.push(i); }
+  return results;
+}).apply(this);
+
+console.log(range3.slice(1, 4));
+
+console.log(range3.slice(1, +range3.length + 1 || 9e9));
+
+// Negative indexes
+console.log(range3.slice(1, -1));
+
+//# sourceMappingURL=4-02-ranges.js.map

+ 13 - 0
lib/4-02-ranges.js.map

@@ -0,0 +1,13 @@
+{
+  "version": 3,
+  "file": "4-02-ranges.js",
+  "sourceRoot": "..",
+  "sources": [
+    "src/4-02-ranges.coffee"
+  ],
+  "names": [],
+  "mappings": "AAAA,IAAA,GAAA,EAAA,GAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA;;AAAA,GAAA,GAAM;;AACN,GAAA,GAAM,EADN;;;AAIA,MAAA,GAAS;;;;eAJT;;;AAMA,MAAA,GAAS;;;;;;AAET,OAAO,CAAC,GAAR,CAAY,MAAZ,EAAoB,MAApB,EARA;;;AAWA,KAAA,GAAQ;;AACR,GAAA,GAAM;;AACN,MAAA,GAAS;;;;;;AACT,OAAO,CAAC,GAAR,CAAY,MAAO,YAAnB;;AACA,OAAO,CAAC,GAAR,CAAY,MAAO,oCAAnB,EAfA;;;AAiBA,OAAO,CAAC,GAAR,CAAY,MAAO,aAAnB",
+  "sourcesContent": [
+    "bot = 3\ntop = 0\n\n# With right limit\nrange1 = [bot..top]\n# Without right limit\nrange2 = [bot...top]\n\nconsole.log range1, range2\n\n# Referencing ranges\nstart = 5\nend = 10\nrange3 = [start..end]\nconsole.log range3[1..3]\nconsole.log range3[1..range3.length]\n# Negative indexes\nconsole.log range3[1..-2]\n"
+  ]
+}

+ 17 - 0
lib/4-03-splats.js

@@ -0,0 +1,17 @@
+var coffee, params, searchLocations;
+
+coffee = 'Starducks';
+
+searchLocations = function(brand, ...cities) {
+  return `Looking for ${brand} in ${cities.join(', ')}`;
+};
+
+console.log(searchLocations(coffee, 'Orlando'));
+
+console.log(searchLocations(coffee, 'Orlando', 'Miami', 'Winter Park'));
+
+params = ['Orlando', 'Miami', 'Winter Park'];
+
+console.log(searchLocations(coffee, ...params));
+
+//# sourceMappingURL=4-03-splats.js.map

+ 13 - 0
lib/4-03-splats.js.map

@@ -0,0 +1,13 @@
+{
+  "version": 3,
+  "file": "4-03-splats.js",
+  "sourceRoot": "..",
+  "sources": [
+    "src/4-03-splats.coffee"
+  ],
+  "names": [],
+  "mappings": "AAAA,IAAA,MAAA,EAAA,MAAA,EAAA;;AAAA,MAAA,GAAS;;AAET,eAAA,GAAkB,QAAA,CAAC,KAAD,EAAA,GAAQ,MAAR,CAAA;SAChB,CAAA,YAAA,CAAA,CAAe,KAAf,CAAqB,IAArB,CAAA,CAA2B,MAAM,CAAC,IAAP,CAAY,IAAZ,CAA3B,CAAA;AADgB;;AAGlB,OAAO,CAAC,GAAR,CAAY,eAAA,CAAgB,MAAhB,EAAwB,SAAxB,CAAZ;;AACA,OAAO,CAAC,GAAR,CAAY,eAAA,CAAgB,MAAhB,EAAwB,SAAxB,EAAmC,OAAnC,EAA4C,aAA5C,CAAZ;;AAEA,MAAA,GAAS,CAAC,SAAD,EAAY,OAAZ,EAAqB,aAArB;;AACT,OAAO,CAAC,GAAR,CAAY,eAAA,CAAgB,MAAhB,EAAwB,GAAA,MAAxB,CAAZ",
+  "sourcesContent": [
+    "coffee = 'Starducks'\n\nsearchLocations = (brand, cities...) ->\n  \"Looking for #{brand} in #{cities.join(', ')}\"\n\nconsole.log searchLocations coffee, 'Orlando'\nconsole.log searchLocations coffee, 'Orlando', 'Miami', 'Winter Park'\n\nparams = ['Orlando', 'Miami', 'Winter Park']\nconsole.log searchLocations(coffee, params...)\n"
+  ]
+}

+ 83 - 0
lib/4-04-objects.js

@@ -0,0 +1,83 @@
+var attrs, coffee, coffees, to_print;
+
+coffee = {
+  name: 'French',
+  strength: 1
+};
+
+console.log(coffee);
+
+// Spaced-out writing
+coffee = {
+  name: 'French',
+  strength: 1
+};
+
+console.log(coffee);
+
+coffee = {
+  name: 'French',
+  strength: 1,
+  brew: function() {
+    return console.log(`Brewing ${this.name}`);
+  },
+  pour: function(amount = 1) {
+    if (amount === 1) {
+      return "Poured a single cup";
+    } else {
+      return `Poured ${amount} cups`;
+    }
+  }
+};
+
+coffee.brew();
+
+console.log(coffee.pour());
+
+console.log(coffee.pour(2));
+
+coffees = {
+  french: {
+    strength: 1,
+    in_stock: 20
+  },
+  italian: {
+    strength: 2,
+    in_stock: 12
+  },
+  decaf: {
+    strength: 0,
+    in_stock: 0
+  }
+};
+
+console.log(coffees);
+
+for (coffee in coffees) {
+  attrs = coffees[coffee];
+  // For key, value of object. Notice how the "for" applies to everything to its
+  // left, including the console.log.
+  console.log(`${coffee} has ${attrs.in_stock}`);
+}
+
+// It compiles exactly like this:
+for (coffee in coffees) {
+  attrs = coffees[coffee];
+  console.log(`${coffee} has ${attrs.in_stock}`);
+}
+
+to_print = (function() {
+  var results;
+  results = [];
+  for (coffee in coffees) {
+    attrs = coffees[coffee];
+    if (attrs.in_stock > 0) {
+      results.push(`${coffee} has ${attrs.in_stock}`);
+    }
+  }
+  return results;
+})();
+
+console.log(to_print.join(", "));
+
+//# sourceMappingURL=4-04-objects.js.map

File diff suppressed because it is too large
+ 8 - 0
lib/4-04-objects.js.map


File diff suppressed because it is too large
+ 8 - 0
lib/5-01-jquery.js.map


+ 5 - 1
package.json

@@ -3,5 +3,9 @@
   "version": "1.0.0",
   "main": "index.js",
   "author": "Greg Pollack <greg@codeschool.com>",
-  "license": "MIT"
+  "license": "MIT",
+  "scripts": {
+    "clean": "rm -fr lib/*",
+    "watch": "coffee --no-header --bare -m -w -o lib -c src"
+  }
 }

+ 0 - 0
src/hello.coffee → src/1-01-hello.coffee


+ 0 - 0
src/jquery.coffee → src/2-01-jquery.coffee


+ 0 - 0
src/conditions.coffee → src/3-01-conditions.coffee


+ 0 - 0
src/operators.coffee → src/3-02-operators.coffee


+ 34 - 0
src/4-01-arrays.coffee

@@ -0,0 +1,34 @@
+storeLocations1 = [
+  'Orlando'
+  'Winter Park'
+  'Sanford'
+]
+
+# Beware, this doesn't compile correctly:
+# storeLocations.forEach(location, index) ->
+# It uses it as a forEach(location, index) call with a () => {} callback
+
+# So be sure to add the space.
+storeLocations1.forEach (location, index) ->
+  console.log "Location #{index}: #{location}"
+
+# Or use something more idiomatic:
+for location, index in storeLocations1
+  console.log "Location #{index}: #{location}"
+
+# List comprehensions
+console.log "Location #{index}: #{location}" for location, index in storeLocations1
+
+# In this case, the parentheses are essential
+storeLocations2 = ("#{loc}, FL" for loc in storeLocations1)
+# Without them, the whole "storeLocations = ..." part is run for each loc.
+console.log storeLocations2
+
+geoLocate = (loc) ->
+  return "#{loc}, USA"
+
+# Applying a filter to a list comprehension
+console.log (geoLocate(loc) for loc in storeLocations1 when loc isnt 'Sanford')
+
+storeLocations3 = (loc for loc in storeLocations1 when loc isnt 'Sanford')
+console.log(storeLocations3)

+ 18 - 0
src/4-02-ranges.coffee

@@ -0,0 +1,18 @@
+bot = 3
+top = 0
+
+# With right limit
+range1 = [bot..top]
+# Without right limit
+range2 = [bot...top]
+
+console.log range1, range2
+
+# Referencing ranges
+start = 5
+end = 10
+range3 = [start..end]
+console.log range3[1..3]
+console.log range3[1..range3.length]
+# Negative indexes
+console.log range3[1..-2]

+ 10 - 0
src/4-03-splats.coffee

@@ -0,0 +1,10 @@
+coffee = 'Starducks'
+
+searchLocations = (brand, cities...) ->
+  "Looking for #{brand} in #{cities.join(', ')}"
+
+console.log searchLocations coffee, 'Orlando'
+console.log searchLocations coffee, 'Orlando', 'Miami', 'Winter Park'
+
+params = ['Orlando', 'Miami', 'Winter Park']
+console.log searchLocations(coffee, params...)

+ 44 - 0
src/4-04-objects.coffee

@@ -0,0 +1,44 @@
+coffee = name: 'French', strength: 1
+console.log coffee
+
+# Spaced-out writing
+coffee =
+  name: 'French'
+  strength: 1
+console.log coffee
+
+coffee =
+  name: 'French'
+  strength: 1
+  brew: -> console.log "Brewing #{@name}"
+  pour: (amount =  1) ->
+    if amount is 1
+      "Poured a single cup"
+    else
+      "Poured #{amount} cups"
+coffee.brew()
+console.log coffee.pour()
+console.log coffee.pour(2)
+
+coffees =
+  french:
+    strength: 1
+    in_stock: 20
+  italian:
+    strength: 2
+    in_stock: 12
+  decaf:
+    strength: 0
+    in_stock: 0
+console.log coffees
+
+# For key, value of object. Notice how the "for" applies to everything to its
+# left, including the console.log.
+console.log "#{coffee} has #{attrs.in_stock}" for coffee, attrs of coffees
+# It compiles exactly like this:
+for coffee, attrs of coffees
+  console.log "#{coffee} has #{attrs.in_stock}"
+
+to_print = for coffee, attrs of coffees when attrs.in_stock > 0
+  "#{coffee} has #{attrs.in_stock}"
+console.log to_print.join(", ")

Some files were not shown because too many files changed in this diff