purespectrum-lib
Version:
shared code between front and backend projects
55 lines (54 loc) • 1.97 kB
TypeScript
import { Child } from '../child/child';
/**
* Extension class mapper for new child age gender qualification.
* A instance of this class represent a group of child, its age range, genders and
* the new condition code that represents them.
* This class use an Child array to determine children group age, gender and age.
*/
export declare class Children {
private _children;
private _unit;
private _ageUnit;
/**
* Create a new Child group from an array of Child
*/
constructor(_children: Child[], _unit?: number);
/**
* Create a new Child group from criterias
* @param {boolean} isBaby - true for baby ages, meaning months from 1 to 11.
* false for child ages, meaning years from 1 to 17.
* @param {ChildGenderEnum | string | boolean} genderOrIsBoy - child gender: boy, girl or both
* If boolean: true for boy or false for girl.
* If string: values from ChildGenderEnum.
* @param {number} ageFrom - "from" value of age range
* @param {number} ageTo - "to" value of age range
* @returns a new Children instance
*/
static create(isBaby: boolean, genderOrIsBoy: ChildGenderEnum | string | boolean, ageFrom: number, ageTo: number): Children;
toEachChild(): Child[];
private static _mapMonthConditionCodes;
private static _mapYearConditionCodes;
private static _createChild;
/**
* Validate ageFrom from if it come with 0 we need to consider it as 1
* @param {number} ageFrom - "ageFrom" value
*/
private static _validateAgeFrom;
private static _parseGender;
private _filterChildrenAges;
private _mapChildrenAges;
get gender(): ChildGenderEnum;
get ageUnit(): number;
get age(): AgeRangeChildren;
get noChildren(): boolean;
get description(): string;
}
export declare enum ChildGenderEnum {
boy = "111",
girl = "112",
both = "both"
}
export interface AgeRangeChildren {
from: number;
to: number;
}