This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import fs from 'fs' | |
| var output = fs.readFileSystem('example.txt', 'utf8') | |
| .trim() | |
| .split('\n') | |
| .map(line => line.split('\t')) | |
| .reduce((customers, line) => { | |
| customers[line[0]] = customers[line[0]] || [] | |
| customers[line[0]].push({ | |
| name: line[1], | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function once(fn, context) { | |
| var result; | |
| return function() { | |
| if(fn) { | |
| result = fn.apply(context || this, arguments); | |
| fn = null; | |
| } | |
| return result; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function debounce(func, wait, immediate) { | |
| var timeout; | |
| return function() { | |
| var context = this, args = arguments; | |
| var later = function() { | |
| timeout = null; | |
| if (!immediate) func.apply(context, args); | |
| }; | |
| var callNow = immediate && !timeout; | |
| clearTimeout(timeout); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var items = ['one', 'two', 'three', 'four']; | |
| items.splice(items.length / 2, 0, 'hello'); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var Subject = function() { | |
| this.observers = []; | |
| return { | |
| subscribeObserver: function(observer) { | |
| this.observers.push(observer); | |
| }, | |
| unsubscribeObserver: function(observer) { | |
| var index = this.observers.indexOf(observer); | |
| if(index > -1) { | 
NewerOlder