1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

CoffeeScript 0.5.6

This commit is contained in:
Jeremy Ashkenas 2010-03-23 00:18:50 -04:00
parent 94185e3f70
commit 590c069158
36 changed files with 744 additions and 457 deletions

View file

@ -1,6 +1,7 @@
<!DOCTYPE html> <html> <head> <title>underscore.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> underscore.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-1">#</a> </div> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-2">#</a> </div> <p><em>Underscore.coffee
(c) 2010 Jeremy Ashkenas, DocumentCloud Inc.</em>
Underscore is freely distributable under the terms of the <strong>MIT license</strong>.
<!DOCTYPE html> <html> <head> <title>underscore.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> underscore.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-1">#</a> </div> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-2">#</a> </div> <p><strong>Underscore.coffee
(c) 2010 Jeremy Ashkenas, DocumentCloud Inc.</strong>
Underscore is freely distributable under the terms of the
<a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a>.
Portions of Underscore are inspired by or borrowed from
<a href="http://prototypejs.org/api">Prototype.js</a>, Oliver Steele's
<a href="http://osteele.com">Functional</a>, and John Resig's
@ -12,7 +13,7 @@ For all details and documentation:
<span class="nv">unshift: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">unshift</span>
<span class="nv">toString: </span> <span class="nx">ObjProto</span><span class="p">.</span><span class="nx">toString</span>
<span class="nv">hasOwnProperty: </span> <span class="nx">ObjProto</span><span class="p">.</span><span class="nx">hasOwnProperty</span>
<span class="nv">propertyIsEnumerable: </span><span class="nx">ObjProto</span><span class="p">.</span><span class="nx">propertyIsEnumerable</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-10">#</a> </div> <p>All ECMA5 native implementations we hope to use are declared here.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">nativeForEach: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">forEach</span>
<span class="nv">propertyIsEnumerable: </span><span class="nx">ObjProto</span><span class="p">.</span><span class="nx">propertyIsEnumerable</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-10">#</a> </div> <p>All <strong>ECMA5</strong> native implementations we hope to use are declared here.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">nativeForEach: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">forEach</span>
<span class="nv">nativeMap: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">map</span>
<span class="nv">nativeReduce: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">reduce</span>
<span class="nv">nativeReduceRight: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">reduceRight</span>
@ -22,7 +23,7 @@ For all details and documentation:
<span class="nv">nativeIndexOf: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">indexOf</span>
<span class="nv">nativeLastIndexOf: </span> <span class="nx">ArrayProto</span><span class="p">.</span><span class="nx">lastIndexOf</span>
<span class="nv">nativeIsArray: </span> <span class="nb">Array</span><span class="p">.</span><span class="nx">isArray</span>
<span class="nv">nativeKeys: </span> <span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-11">#</a> </div> <p>Create a safe reference to the Underscore object for use below.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">_: </span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">wrapper</span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-12">#</a> </div> <p>Export the Underscore object for CommonJS.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="k">typeof</span><span class="p">(</span><span class="nx">exports</span><span class="p">)</span> <span class="o">!=</span> <span class="s1">&#39;undefined&#39;</span> <span class="k">then</span> <span class="nv">exports._: </span><span class="nx">_</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-13">#</a> </div> <p>Export Underscore to global scope.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">root._: </span><span class="nx">_</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-14">#</a> </div> <p>Current version.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">_.VERSION: </span><span class="s1">&#39;0.6.0&#39;</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-15">#</a> </div> <h2>Collection Functions</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-16">#</a> </div> <p>The cornerstone, an <strong>each</strong> implementation.
<span class="nv">nativeKeys: </span> <span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-11">#</a> </div> <p>Create a safe reference to the Underscore object for use below.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">_: </span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">wrapper</span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-12">#</a> </div> <p>Export the Underscore object for <strong>CommonJS</strong>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="k">typeof</span><span class="p">(</span><span class="nx">exports</span><span class="p">)</span> <span class="o">!=</span> <span class="s1">&#39;undefined&#39;</span> <span class="k">then</span> <span class="nv">exports._: </span><span class="nx">_</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-13">#</a> </div> <p>Export Underscore to global scope.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">root._: </span><span class="nx">_</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-14">#</a> </div> <p>Current version.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">_.VERSION: </span><span class="s1">&#39;0.6.0&#39;</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-15">#</a> </div> <h2>Collection Functions</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-16">#</a> </div> <p>The cornerstone, an <strong>each</strong> implementation.
Handles objects implementing <strong>forEach</strong>, arrays, and raw objects.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">_.each: </span><span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">iterator</span><span class="p">,</span> <span class="nx">context</span><span class="p">)</span> <span class="o">-&gt;</span>
<span class="k">try</span>
<span class="k">if</span> <span class="nx">nativeForEach</span> <span class="o">and</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">forEach</span> <span class="o">is</span> <span class="nx">nativeForEach</span>