Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createMixins() {
- function computerQualityMixin(classToExtend) {
- function attach() {
- this.getQuality = function () {
- return (this.processorSpeed_Ghz + this.ram_Gb + this.hardDiskSpace_Tb) / 3;
- };
- this.isFast = function () {
- return this.processorSpeed_Ghz > (this.ram_Gb / 4);
- };
- this.isRoomy = function () {
- return this.hardDiskSpace_Tb > Math.floor(this.ram_Gb * this.processorSpeed_Ghz);
- };
- }
- attach.call(classToExtend.prototype);
- }
- function styleMixin(classToExtend) {
- function attach() {
- this.isFullSet = function () {
- return this._keyboard.manufacturer === this._monitor.manufacturer;
- };
- this.isClassy = function () {
- let batteryLifeCondition = this._battery.expectedLife >= 3;
- let colorCondition = ["Silver", "Black"].includes(this.color);
- let weightConition = this.weight < 3;
- return batteryLifeCondition && colorCondition && weightConition;
- }
- }
- attach.call(classToExtend.prototype);
- }
- return{
- computerQualityMixin,
- styleMixin
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement