Skip to content

Commit

Permalink
Changing how Base is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Oct 24, 2019
1 parent a7e8bfa commit f438e52
Showing 1 changed file with 144 additions and 14 deletions.
158 changes: 144 additions & 14 deletions lib/base.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,151 @@
"use strict";

const {METHODS} = require("http");
class Base {
constructor () {
this.router = {
use: () => void 0
};
}

function Base () {
this.router = {
use: () => void 0
};
}
acl (...args) {
this.router.use(...args, "ACL");
}

bind (...args) {
this.router.use(...args, "BIND");
}

checkout (...args) {
this.router.use(...args, "CHECKOUT");
}

connect (...args) {
this.router.use(...args, "CONNECT");
}

copy (...args) {
this.router.use(...args, "COPY");
}

del (...args) {
this.router.use(...args, "DELETE");
}

delete (...args) {
this.router.use(...args, "DELETE");
}

get (...args) {
this.router.use(...args, "GET");
}

head (...args) {
this.router.use(...args, "HEAD");
}

link (...args) {
this.router.use(...args, "LINK");
}

lock (...args) {
this.router.use(...args, "LOCK");
}

"m-search" (...args) {
this.router.use(...args, "M-SEARCH");
}

merge (...args) {
this.router.use(...args, "MERGE");
}

mkactivity (...args) {
this.router.use(...args, "MKACTIVITY");
}

mkcalendar (...args) {
this.router.use(...args, "MKCALENDAR");
}

mkcol (...args) {
this.router.use(...args, "MKCOL");
}

move (...args) {
this.router.use(...args, "MOVE");
}

Base.prototype.del = function (...args) {
this.router.use(...args, "DELETE");
};
notify (...args) {
this.router.use(...args, "NOTIFY");
}

METHODS.forEach(i => {
Base.prototype[i.toLowerCase()] = function (...args) {
this.router.use(...args, i);
};
});
options (...args) {
this.router.use(...args, "OPTIONS");
}

patch (...args) {
this.router.use(...args, "PATCH");
}

post (...args) {
this.router.use(...args, "POST");
}

propfind (...args) {
this.router.use(...args, "PROPFIND");
}

proppatch (...args) {
this.router.use(...args, "PROPPATCH");
}

purge (...args) {
this.router.use(...args, "PURGE");
}

put (...args) {
this.router.use(...args, "PUT");
}

rebind (...args) {
this.router.use(...args, "REBIND");
}

report (...args) {
this.router.use(...args, "REPORT");
}

search (...args) {
this.router.use(...args, "SEARCH");
}

source (...args) {
this.router.use(...args, "SOURCE");
}

subscribe (...args) {
this.router.use(...args, "SUBSCRIBE");
}

trace (...args) {
this.router.use(...args, "TRACE");
}

unbind (...args) {
this.router.use(...args, "UNBIND");
}

unlink (...args) {
this.router.use(...args, "UNLINK");
}

unlock (...args) {
this.router.use(...args, "UNLOCK");
}

unsubscribe (...args) {
this.router.use(...args, "UNSUBSCRIBE");
}
}

module.exports = Base;

0 comments on commit f438e52

Please sign in to comment.