UNPKG

@uiowa/uiowa-mfk-material

Version:

mfk, uiowa-mfk

68 lines (67 loc) 1.91 kB
import { FavoriteMfk } from './favorite-mfk'; import { IMfk } from './mfk.interface'; /** * Uiowa MFK Type * * class type contains 10 required MFK fields and 1 optional BFR field. * there are also several common methods ready to use. */ export declare class Mfk implements IMfk { FUND: string; ORG: string; DEPT: string; SUBDEPT: string; GRANTPGM: string; IACT: string; OACT: string; DACT: string; FN: string; CCTR: string; BRF: string; /** * Uiowa MFK. constructor takes a MFK string. * * Non-numeric characters will be stripped out automatically. * * Example usages: * ```typescript * let m1 = new Mfk(); * const m2 = new Mfk('010-11-1010-00000-00000000-6218-000-00000-00-1111'); * const m3 = new Mfk('0201210120100100000000621900000111123555'); * ``` */ constructor(mfkString?: string); /** * cast an object to type of MFK * * --> plain JSON object doesn't have type at run time. */ static cast(obj: any): Mfk; /** * Compare values of all 10 fields * * @param mfk An MFK */ equals(mfk: Mfk): boolean; /** * convert MFK to a 40 digit string. * @param separator (Optional) the separator between MFK parts. Default: "". * @returns MFK string */ to40String(separator?: string): string; /** * Get MFK format validation message. It checkes this MFK's first 10 fields are numeric strings or not. */ validateFormat(): string; /** * check if this MFK is in an array of Favorite MFKs. * * @param favoriteMfks an array of Favorite MFKs. * @returns boolean */ isIn(favoriteMfks: FavoriteMfk[]): boolean; /** * MFK module internal method. */ parseString(input: string): void; }