// Helpers.js
export default class Helpers {
static isDefined(obj) {
return typeof obj !== 'undefined';
}
}
export class Storage extends Helpers {
constructor(isDefined) {
super(isDefined);
}
static setStorageItem(key, value) {
if (this.isDefined(Storage)) {
if (window.localStorage) {
const storage = window.localStorage;
storage.setItem(key, value);
}
}
}
}
// Body.js
import Helpers, { Storage } from '../helpers';
class Car {
constructor() {
this.wheels = 4
}
}
class Fiesta extends Car {
constructor() {
super()
this.brand = 'Ford'
}
}
const myCar = new Fiesta()
'brand' in myCar //true
'wheels' in myCar //true