Skip to content

Commit

Permalink
Pending changes exported from your codespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayandevs committed Oct 27, 2024
1 parent 9338fe1 commit 7beb0d8
Show file tree
Hide file tree
Showing 3 changed files with 375 additions and 21 deletions.
33 changes: 33 additions & 0 deletions lib/Parser/index.components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import parser from "qs";

/**
* ID - The main identifier, this is required. Prefix = I:
* [I]=member*
*
* SUBID - This is not required: Prefix = S:
* *[S]=0* - No SUBID ; *[S]=whois WITH SUBID
*
* ARGS - This is not required: Prefix = A:
* *A[username]=0sapphy&A[command]=whois
*
* How id arguments string should be formatted:
*
* @example
* new Builder()
* .setCustomId("[I]=member&[S]=whois&A[userId]=1234") // With ID, SUBID & ARGS
* .setCustomId("[I]=member&[S]=whois") // With ID & SUBID
* .setCustomId("[I]=member&A[username]=0sapphy&A[command]=whois") // With ID & MULTI-ARGS
*/
export function Parse(id: string) {
return parser.parse(id) as { I: string; S?: string; A?: object }
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function CompileArguments(A: any) {
const args = {};
for (const ARG of Object.keys(A)) {
Object.assign(args, { [ARG]: A[ARG] })
}

return args;
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@
"mongoose": "^8.7.2",
"neet-canvas.js": "^0.0.2",
"prompts": "^2.4.2",
"qs": "^6.13.0",
"signale": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@favware/cliff-jumper": "^4.1.0",
"@types/prompts": "^2.4.9",
"@types/qs": "^6.9.16",
"@types/signale": "^1.4.7",
"eslint": "^8.57.1",
"eslint": "^9.13.0",
"globals": "^15.10.0",
"prettier": "^3.3.3",
"prettier-eslint": "^16.3.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.8.0"
},

"signale": {
"displayScope": true,
"displayBadge": true,
Expand Down
Loading

0 comments on commit 7beb0d8

Please sign in to comment.