UNPKG

@singleton-i18n/angular-client

Version:

Singleton client code for Angular 10.

57 lines (56 loc) 1.85 kB
/** * Enum for Type values for Stringable Object * type ObjectType = 'stringableList' | 'otherType' ; * @readonly */ export declare enum ObjectType { stringableList = 1, otherType = 2 } /** * Interface for classes that represent a stringable Object. * Providing two abastract methods here in interface is inntended for any Objects implementation, * so that the objects can be stringable */ export interface Stringable { check(): boolean; toString(): string; } /** * listObject is one object type which vip first supports for converting object to string * in future, if have more objects have requirements for converting into string, they have to * implement Stringable interface just like this listObject class. */ export declare class listObject implements Stringable { obj: Object; constructor(obj: Object); listItems: { [index: number]: string; }; separatorType: string; type: ObjectType; check(): boolean; toString(): string; } /** * This is default object type which can't be converted into string, so directly print error with object structure in browser console */ export declare class defaultObject implements Stringable { obj: Object; constructor(obj: Object); check(): boolean; toString(): string; } /** * Using factory model here is in order to make the functionality flexiable and scalable, * if have other objects require converting into string, only add corresponding condition judgement along with * Object type class which implements Stringable interface * @param obj */ export declare function factory(obj: Object): listObject | defaultObject; /** * mainly handle source args Array, and make sure each parameter in Array converting into string * @param [args] * @returns */ export declare function filterArgs(args?: any[] | {}): {} | any[];