-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from slash-create/feat/discordjs-docs-query
Add discord.js to providers
- Loading branch information
Showing
14 changed files
with
426 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Option 1 | ||
* | ||
* Calling 'branch', 'tag' or 'latest' will update the target key with the argument provided. | ||
* If the target key already exists, it will be overwritten. | ||
* If the proxy call follows with 'hours', 'minutes' or 'seconds', the value with be multiplied with the appropriate time unit. | ||
* If the proxy call follows with 'build', it returns the object inside the proxy - ending the chain. | ||
* | ||
* @example | ||
* expires() | ||
* .branch(3).hours() | ||
* .tag(30).minutes() | ||
* .latest(2).minutes() | ||
* .build() | ||
*/ | ||
function expires() { | ||
let key: string; | ||
|
||
const context = { branch: 0, tag: 0, latest: 0 }; | ||
|
||
const handler: ProxyHandler<typeof context> = { | ||
get(target, prop) { | ||
if (prop === "branch" || prop === "tag" || prop === "latest") { | ||
key = prop; | ||
return new Proxy(this, handler); | ||
} | ||
|
||
if (prop === "hours") { | ||
context[key] *= 60; | ||
} | ||
|
||
if (prop === "minutes") { | ||
context[key] *= 60; | ||
} | ||
|
||
if (prop === "seconds") { | ||
context[key] *= 60; | ||
} | ||
}, | ||
apply(target, thisArg, argArray) { | ||
if (key === "build") { | ||
return Object.freeze({ ...context }); | ||
} | ||
|
||
return this; | ||
}, | ||
}; | ||
|
||
return new Proxy(context, handler); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.