refactor(backend): Functions
This commit is contained in:
parent
5ec62554e3
commit
65c1a5e6b6
57 changed files with 172 additions and 117 deletions
|
@ -6,7 +6,11 @@
|
|||
* @param regex
|
||||
* @param replacementFn
|
||||
*/
|
||||
export async function replaceAsync(str: string, regex: RegExp, replacementFn: (match: string, ...args: string[]) => Promise<string>) {
|
||||
export async function replaceAsync(
|
||||
str: string,
|
||||
regex: RegExp,
|
||||
replacementFn: (match: string, ...args: string[]) => Promise<string>
|
||||
): Promise<string> {
|
||||
const promises: Promise<string>[] = [];
|
||||
|
||||
// First run through matches: add all Promises resulting from the replacement function
|
||||
|
|
|
@ -9,7 +9,7 @@ export function isValidHttpUrl(url: string): boolean {
|
|||
}
|
||||
}
|
||||
|
||||
export function getUrlStringForLearningObject(learningObjectId: LearningObjectIdentifier) {
|
||||
export function getUrlStringForLearningObject(learningObjectId: LearningObjectIdentifier): string {
|
||||
let url = `/learningObject/${learningObjectId.hruid}/html?language=${learningObjectId.language}`;
|
||||
if (learningObjectId.version) {
|
||||
url += `&version=${learningObjectId.version}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue