godprotocol
Version:
A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.
45 lines (37 loc) • 906 B
JavaScript
class Repository {
constructor(type) {
this.type = type;
}
objectify = () => {
let obj = { type: this.type };
if (this.type === "fs") {
obj.name = this.name;
obj.remote = this.remote;
obj.__dirname = this.__dirname;
obj._id = `${this.__dirname}/${this.name}`;
} else if (this.type === "github") {
obj.key = this.auth_token;
obj.username = this.owner;
obj.repo = this.repo;
obj._id = `${this.owner}/${this.repo}`;
obj.branch = this.branch;
}
return obj;
};
get_id = () => {
if (this._id) return this._id;
switch (this.type) {
case "fs":
this._id = `${this.__dirname}/${this.name}`;
break;
case "github":
this._id = `${this.owner}/${this.repo}`;
break;
}
return this._id;
};
match = async () => {
return false;
};
}
export default Repository;