<!DOCTYPE html>
<html>

  <head>
    <script data-require="typescript@*" data-semver="2.2.2" src="https://cdnjs.cloudflare.com/ajax/libs/typescript/2.2.2/typescript.min.js"></script>
    <script data-require="underscore.js@*" data-semver="1.8.3" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body>
    <h1>Hello Plunker!</h1>
    
    <script>
      modifyArray();
      //new ArraySorter().modifyArray();
    </script>
  </body>

</html>
/* Styles go here */


//Not working yet.
let array = [1, 2, 3, 4];

class ArraySorter {
  constructor(){}
  
  aFunc(array){
    console.log(array);
    if(array.length > 3) return [0,1,2,3,4];
    return array;
  }
  
  otherFunction(array){
    if(array) array.push(20);
    return array;
  }
  
  modifyArray(){
    _.mixin({aFunction: aFunc, otherChainFunc: otherFunction});
    
    let someVal = _.chain(array)
                  .aFunction()
                  .otherChainFunc()
                  .value();
                  
    console.log("typscript");
    console.log(someVal);
  }
}
var array = [1, 2, 3, 4];


function aFunc(array){
  if(array.length > 3) return [0,1,2,3,4];
  return array;
}

function otherFunction(array){
  if(array) array.push(20);
  return array;
}

function modifyArray(){
  _.mixin({aFunction: aFunc, otherChainFunc: otherFunction});
  
  var someVal = _.chain(array)
                .aFunction()
                .otherChainFunc()
                .value();
                
                
  console.log(someVal);
}