(function(document, window, undefined) {
  window.formatDecimal = function(amt) {
    return amt.toLocaleString('en', {
      maximumFractionDigits: 2,
      minimumFractionDigits: 2
    });
  }

  window.market = function() {
    return {
      filter: decodeURIComponent(window.location.hash.split('#').pop()),
      text: 'Hello, LSC4-P',
      rows: [],
      fetchData() {
        fetch('/LSC4-P.json')
          .then(resp => {
            if (!resp.ok) {
              throw new Error('error fetching market data');
            }
            return resp.json();
          })
          .then(rows => {
            this.rows = rows;
            this.rows.forEach((r) => {
              // These are arbitrary thresholds I picked because it looks like
              // a lot of things get stocked in stacks of 10. We should
              // consider setting thresholds in the JSON and then using those
              // here instead of my magic numbers. -ST
              if (r.volume > 5) {
                r.stocked = true
                r.status = 'Stocked'
              } else if (r.volume > 0) {
                r.stockLow = true
                r.status = 'Low'
              } else {
                r.missing = true
                r.status = 'Missing'
              }
            })
          });
      },

      get filteredRows() {
        let q = this.filter.toLowerCase();
        if (!q) return this.rows;
        let tokens = q.split(/\s+/);
        return this.rows.filter((row) =>
          tokens.reduce((isMatch, token) => {
            return isMatch &&
              ((token === 'missing' && row.missing) ||
               (token === 'stocked' && row.stocked) ||
               (token === 'low' && row.stockLow) ||
               row.item.toLowerCase().includes(token) ||
               row.group.toLowerCase().includes(token))
          }, true));
      },

      updateLocationHash() {
        history.pushState(null, null, '#'+this.filter);
      }
    }
  }
})(document, window);

@@ -1558,25 +1558,133 @@
     
-return isMatch &&
+let negate = (token && token%5B0%5D === '-');%0A            if (negate) %7B token = token.substring(1); %7D%0A            let matched = (
 %0A   
@@ -1694,17 +1694,16 @@
         
-(
 (token =
@@ -1740,33 +1740,32 @@
 %7C%0A              
- 
 (token === 'stoc
@@ -1794,33 +1794,32 @@
 %7C%0A              
- 
 (token === 'low'
@@ -1835,25 +1835,24 @@
 tockLow) %7C%7C%0A
- 
             
@@ -1905,25 +1905,24 @@
             
- 
 row.group.to
@@ -1949,16 +1949,84 @@
 (token))
+;%0A            return isMatch && (negate !== matched);%0A              
 %0A       

Add negation operator to filtering (#24)