summaryrefslogtreecommitdiff
path: root/lib/Evolving/evolving.js
blob: c7feda28180410120d3a4c5403bfd0a0fb090c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*

Copyright (c) 2015 Michele Bini


This library is free software: you can redistribute it and/or modify
it under the terms of the version 3 of the GNU General Public License
as published by the Free Software Foundation.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

var Evolving = (function() {
  function Evolving() {}

  Evolving.prototype.evolve = function(evolution) {
    var x, y;
    x = function() {};
    x.prototype = this;
    (y = new x).constructor = x;
    x.evolution = evolution;
    x.prototype = y;
    return evolution.call(y).constructor;
  };

  return Evolving;

})();

if (typeof exports !== "undefined" && exports !== null) {
  exports.Evolving = Evolving;
}