Function bodies 124 total
Administrator class · typescript · L3-L9 (7 LOC)src/Web/vue-app/src/types/entities/administrator.ts
export class Administrator implements IPerson {
id?: string
firstName?: string
lastName?: string
fullName?: string
email?: string
}Book class · typescript · L3-L9 (7 LOC)src/Web/vue-app/src/types/entities/book.ts
export class Book extends Product {
isbn?: string;
author?: string;
editor?: string;
yearOfPublication?: number;
numberOfPages?: number;
}Equipe class · typescript · L7-L11 (5 LOC)src/Web/vue-app/src/types/entities/equipe.ts
export class Equipe implements IEquipes {
Id: string = "";
nameFr?: string;
nameEn?: string;
}Member class · typescript · L3-L19 (17 LOC)src/Web/vue-app/src/types/entities/member.ts
export class Member implements IPerson {
id?: string
created?: string
active?: boolean
firstName?: string
lastName?: string
fullName?: string
email?: string
phoneNumber?: string
phoneExtension?: number
apartment?: number
street?: string
city?: string
zipCode?: string
userId?: string
roles?: string[]
}Module class · typescript · L9-L15 (7 LOC)src/Web/vue-app/src/types/entities/modules.ts
export class Module implements IModules {
Id: string = '';
name?: string;
content?: string;
cardImage?: File;
subject?: string;
}Product class · typescript · L13-L24 (12 LOC)src/Web/vue-app/src/types/entities/product.ts
export class Product implements IProduct {
id?: string;
nameFr?: string
nameEn?: string
descriptionFr?: string
descriptionEn?: string
price?: number
cardImage?: File
savedCardImage?: string
membersOnly?: boolean
}User class · typescript · L3-L10 (8 LOC)src/Web/vue-app/src/types/entities/user.ts
export class User {
id?: string
fullName?: string
email?: string
phoneNumber?: string
phoneExtension?: number
roles: Role[] = []
}Source: Repobility analyzer · https://repobility.com
Guid class · typescript · L1-L37 (37 LOC)src/Web/vue-app/src/types/guid.ts
export class Guid {
public static newGuid(): Guid {
return new Guid(
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
const v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
})
);
}
public static get empty(): string {
return "00000000-0000-0000-0000-000000000000";
}
public get empty(): string {
return Guid.empty;
}
public static isValid(str: string): boolean {
const validRegex =
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
return validRegex.test(str);
}
private value: string = this.empty;
constructor(value?: string) {
if (value) {
if (Guid.isValid(value)) {
this.value = value;
}
}
}
public toString() {
return this.value;
}
public toJSON(): string {
return this.value;
}
}newGuid method · typescript · L2-L10 (9 LOC)src/Web/vue-app/src/types/guid.ts
public static newGuid(): Guid {
return new Guid(
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
const v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
})
);
}isValid method · typescript · L17-L21 (5 LOC)src/Web/vue-app/src/types/guid.ts
public static isValid(str: string): boolean {
const validRegex =
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
return validRegex.test(str);
}constructor method · typescript · L23-L29 (7 LOC)src/Web/vue-app/src/types/guid.ts
constructor(value?: string) {
if (value) {
if (Guid.isValid(value)) {
this.value = value;
}
}
}toString method · typescript · L30-L32 (3 LOC)src/Web/vue-app/src/types/guid.ts
public toString() {
return this.value;
}toJSON method · typescript · L34-L36 (3 LOC)src/Web/vue-app/src/types/guid.ts
public toJSON(): string {
return this.value;
}SucceededOrNotResponse class · typescript · L5-L27 (23 LOC)src/Web/vue-app/src/types/responses/succeededOrNotResponse.ts
export class SucceededOrNotResponse {
errors: Error[] = [];
succeeded: boolean;
constructor(succeeded: boolean, errors?: Error[]) {
this.succeeded = succeeded
if (errors)
this.errors = errors
}
getErrorMessages(translationLocation: string, fallbackKey?: string): string[] {
const errorMessages: string[] = [];
this.errors.forEach(error => {
const errorKey = error.errorType.makeFirstLetterLowercase()
const errorMessage = i18n.t(`${translationLocation}.${errorKey}`)
if (fallbackKey)
errorMessages.push(errorMessage ? errorMessage : i18n.t(fallbackKey))
else
errorMessages.push(errorMessage ? errorMessage : i18n.t('validation.errorOccured'))
})
return errorMessages
}
}constructor method · typescript · L9-L13 (5 LOC)src/Web/vue-app/src/types/responses/succeededOrNotResponse.ts
constructor(succeeded: boolean, errors?: Error[]) {
this.succeeded = succeeded
if (errors)
this.errors = errors
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
TranslatableString class · typescript · L3-L17 (15 LOC)src/Web/vue-app/src/types/translatableString.ts
export class TranslatableString {
fr?: string
en?: string
constructor(fr?: string, en?: string) {
this.fr = fr
this.en = en
}
get getValueForLocale() {
if (i18n.getLocale() === "fr")
return this.fr ?? "";
return this.en ?? "";
}
}constructor method · typescript · L7-L10 (4 LOC)src/Web/vue-app/src/types/translatableString.ts
constructor(fr?: string, en?: string) {
this.fr = fr
this.en = en
}validate function · typescript · L8-L19 (12 LOC)src/Web/vue-app/src/validation/index.ts
export function validate(value: string, rules: Rule[]): Status {
for (const rule of rules) {
const result = rule(value);
if (!result.valid) {
return result;
}
}
return {
valid: true,
};
}validateBoolean function · typescript · L21-L32 (12 LOC)src/Web/vue-app/src/validation/index.ts
export function validateBoolean(value: boolean, rules: RuleBoolean[]): Status {
for (const rule of rules) {
const result = rule(value);
if (!result.valid) {
return result;
}
}
return {
valid: true,
};
}validateArray function · typescript · L34-L45 (12 LOC)src/Web/vue-app/src/validation/index.ts
export function validateArray(value: any[], rules: RuleArray[]): Status {
for (const rule of rules) {
const result = rule(value);
if (!result.valid) {
return result;
}
}
return {
valid: true,
};
}minDate function · typescript · L22-L33 (12 LOC)src/Web/vue-app/src/validation/rules.ts
export function minDate(min: string): Rule {
return function (value: string): Status {
const result = value > min;
return {
valid: result,
message: result
? undefined
: i18n.t('validation.min').replace("{min}", min.toString())
};
};
}min function · typescript · L35-L46 (12 LOC)src/Web/vue-app/src/validation/rules.ts
export function min(min: number): Rule {
return function (value: string): Status {
const result = Boolean(parseInt(value) >= min);
return {
valid: result,
message: result
? undefined
: i18n.t('validation.min').replace("{min}", min.toString()),
};
};
}max function · typescript · L48-L59 (12 LOC)src/Web/vue-app/src/validation/rules.ts
export function max(max: number): Rule {
return function (value: string): Status {
const result = Boolean(parseInt(value) <= max);
return {
valid: result,
message: result
? undefined
: i18n.t('validation.max').toString().replace("{max}", max.toString()),
};
};
}Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
removeCrossorigin function · typescript · L7-L14 (8 LOC)src/Web/vue-app/vite.config.ts
function removeCrossorigin() {
return {
name: 'remove-crossorigin',
transformIndexHtml(html: string) {
return html.replace(/ crossorigin/g, '')
}
}
}‹ prevpage 3 / 3