{"ScriptPreparationCode":"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\u0022function\u0022\u0026\u0026require;if(!u\u0026\u0026a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\u0022Cannot find module \u0027\u0022\u002Bo\u002B\u0022\u0027\u0022);throw f.code=\u0022MODULE_NOT_FOUND\u0022,f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\u0022function\u0022\u0026\u0026require;for(var o=0;o\u003Cr.length;o\u002B\u002B)s(r[o]);return s})({1:[function(require,module,exports){\r\n\u0022use strict\u0022;\r\n\r\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i \u003C props.length; i\u002B\u002B) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\u0022value\u0022 in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\r\n\r\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\u0022this hasn\u0027t been initialised - super() hasn\u0027t been called\u0022); } return call \u0026\u0026 (typeof call === \u0022object\u0022 || typeof call === \u0022function\u0022) ? call : self; }\r\n\r\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \u0022function\u0022 \u0026\u0026 superClass !== null) { throw new TypeError(\u0022Super expression must either be null or a function, not \u0022 \u002B typeof superClass); } subClass.prototype = Object.create(superClass \u0026\u0026 superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\r\n\r\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\u0022Cannot call a class as a function\u0022); } }\r\n\r\nvar barker = function barker(state) {\r\n return {\r\n bark: function bark() {\r\n return console.log(\u0022woof, I am \u0022 \u002B state.name);\r\n }\r\n };\r\n};\r\n\r\nvar driver = function driver(state) {\r\n return {\r\n drive: function drive() {\r\n return state.position = state.position \u002B state.speed;\r\n }\r\n };\r\n};\r\n\r\nvar robotDog = function robotDog(name) {\r\n var state = {\r\n name: name,\r\n speed: 100,\r\n position: 0\r\n };\r\n return Object.assign({}, barker(state), driver(state));\r\n};\r\n\r\nvar Driver = function () {\r\n function Driver() {\r\n _classCallCheck(this, Driver);\r\n }\r\n\r\n _createClass(Driver, [{\r\n key: \u0022drive\u0022,\r\n value: function drive() {\r\n console.log(\u0022I am driving\u0022);\r\n }\r\n }]);\r\n\r\n return Driver;\r\n}();\r\n\r\nvar Barker = function (_Driver) {\r\n _inherits(Barker, _Driver);\r\n\r\n function Barker(name) {\r\n _classCallCheck(this, Barker);\r\n\r\n var _this = _possibleConstructorReturn(this, (Barker.__proto__ || Object.getPrototypeOf(Barker)).call(this));\r\n\r\n _this.name = name;\r\n return _this;\r\n }\r\n\r\n _createClass(Barker, [{\r\n key: \u0022bark\u0022,\r\n value: function bark() {\r\n console.log(\u0022woof, I am \u0022 \u002B this.name);\r\n }\r\n }]);\r\n\r\n return Barker;\r\n}(Driver);\r\n\r\nwindow.robotDog = robotDog;\r\nwindow.Barker = Barker;\r\n},{}]},{},[1])","TestCases":[{"Name":"Instantiation","Code":"var red = new Barker(\u0022red\u0022);","IsDeferred":false},{"Name":"Composition","Code":"var yellow = robotDog(\u0022yellow\u0022);","IsDeferred":false}]}