Skip to content

Commit

Permalink
Nits
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezp committed Jun 28, 2022
1 parent 15e4daa commit ddfa40e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/managers/FileFetchManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { IFunctionSignature } from "../models/FunctionSignature";
import { createRegex, remoteFetchFile, parseFunctionSig } from "../support/utils";

export class FileFetchManager {
static async getStubs() {
static async getStubs(): Promise<string[]> {
const stubFile = await remoteFetchFile(PATHS.ONESIGNAL_STUBS);
const regex = /FUNCTION_LIST_WITH_PROMISE_TO_STUB = \[([a-zA-Z\s,\"_]*)\]/;
return stubFile.match(regex)[1].split("\n \"").join("").split("\",").join(',').split("\"\n ").join("").split(",");
const match = stubFile.match(regex)[1]
// removes unwanted characters and returns simple array of functions
return match.split("\n \"").join("").split("\",").join(',').split("\"\n ").join("").split(",");
}

static async getFunctions(): Promise<IFunctionSignature[]> {
Expand Down
2 changes: 1 addition & 1 deletion src/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IFunctionSignature } from '../models/FunctionSignature';

export async function remoteFetchFile(path: string): Promise<string> {
return await new Promise(resolve => {
curl.request({ url: GITHUB_URL+path }, function (err, stdout) {
curl.request({ url: GITHUB_URL+path }, (err, stdout) => {
resolve(stdout);
});
})
Expand Down

0 comments on commit ddfa40e

Please sign in to comment.