Last active
          August 29, 2015 14:05 
        
      - 
      
- 
        Save ourmaninamsterdam/80fdb88e16a324c0c598 to your computer and use it in GitHub Desktop. 
    Method chaining with arguments - demonstrating a simple conversion pipeline utility
  
        
  
    
      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 Editor = function(){}; | |
| Editor.prototype.convert = {}; | |
| Editor.prototype.convert.from = function(type) { | |
| this.fromType = type; | |
| return this; | |
| }; | |
| Editor.prototype.convert.to = function(type) { | |
| this.toType = type; | |
| this.parse(this.fromType, this.toType); | |
| return this; | |
| }; | |
| Editor.prototype.convert.parse = function(from, to) { | |
| // Do some parsing | |
| return this; | |
| }; | |
| var editor = new Editor(); | |
| editor.convert.from('html').to('markdown'); | 
      
      
  Author
  
  
        
      
            ourmaninamsterdam
  
      
      
      commented 
        Dec 17, 2014 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment