Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lower case titles in comparison

  • Loading branch information...
commit 0bd08477b7dc7f33cc70d25a7dc9881a183927e3 1 parent 7c7714e
@linus authored
Showing with 3 additions and 3 deletions.
  1. +1 −1  docs/discogs.html
  2. +1 −1  lib/discogs.js
  3. +1 −1  src/discogs.coffee
View
2  docs/discogs.html
@@ -56,7 +56,7 @@
<span class="nv">masters = </span><span class="p">(</span><span class="nx">result</span> <span class="k">for</span> <span class="nx">result</span> <span class="k">in</span> <span class="nx">results</span> <span class="k">when</span> <span class="nx">result</span><span class="p">.</span><span class="nx">type</span> <span class="o">is</span> <span class="s2">&quot;master&quot;</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Did we find masters already?</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">results = </span><span class="nx">masters</span> <span class="k">if</span> <span class="nx">masters</span><span class="p">.</span><span class="nx">length</span>
- <span class="nv">matches = </span><span class="p">(</span><span class="nx">result</span> <span class="k">for</span> <span class="nx">result</span> <span class="k">in</span> <span class="nx">results</span> <span class="k">when</span> <span class="nx">result</span><span class="p">.</span><span class="nx">title</span> <span class="o">is</span> <span class="nx">query</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Take only the best results</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">results = </span><span class="nx">matches</span> <span class="k">if</span> <span class="nx">matches</span><span class="p">.</span><span class="nx">length</span>
+ <span class="nv">matches = </span><span class="p">(</span><span class="nx">result</span> <span class="k">for</span> <span class="nx">result</span> <span class="k">in</span> <span class="nx">results</span> <span class="k">when</span> <span class="nx">result</span><span class="p">.</span><span class="nx">title</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">()</span> <span class="o">is</span> <span class="nx">query</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">())</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Take only the best results</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">results = </span><span class="nx">matches</span> <span class="k">if</span> <span class="nx">matches</span><span class="p">.</span><span class="nx">length</span>
<span class="nv">release = </span><span class="nx">results</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="nv">id = </span><span class="nx">release</span><span class="p">.</span><span class="nx">uri</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">).</span><span class="nx">pop</span><span class="p">()</span>
View
2  lib/discogs.js
@@ -111,7 +111,7 @@
_results = [];
for (_i = 0, _len = results.length; _i < _len; _i++) {
result = results[_i];
- if (result.title === query) {
+ if (result.title.toLowerCase() === query.toLowerCase()) {
_results.push(result);
}
}
View
2  src/discogs.coffee
@@ -89,7 +89,7 @@ exports = module.exports = (format) ->
# Did we find masters already?
results = masters if masters.length
- matches = (result for result in results when result.title is query)
+ matches = (result for result in results when result.title.toLowerCase() is query.toLowerCase())
# Take only the best results
results = matches if matches.length
Please sign in to comment.
Something went wrong with that request. Please try again.