import anthro_zscores from './z-score'; function weight_adjust(weight: number, clothing_weight: number, clothing?: 'y'): number { if (clothing && clothing == 'y') { return weight - (clothing_weight / 1000) } return weight } type ena_zscores = { sex: string | 1 | 2, age?: number, is_age_in_month?: boolean, weight?: number, lenhei?: number, measure?: string, headc?: number, armc?: number, triskin?: number, subskin?: number, oedema?: string, clothing?: 'y', clothing_weight?: number, //assumed average clothing weight in grams }; export default function ena_zscores({ sex, age, is_age_in_month = false, weight, lenhei, measure, headc, armc, triskin, subskin, oedema = 'n', clothing, clothing_weight = 40 }: ena_zscores): ReturnType { const cweight = weight ? weight_adjust(weight, clothing_weight, clothing) : undefined return anthro_zscores({sex,age,is_age_in_month,weight: cweight,lenhei,measure,headc, armc, triskin, subskin, oedema}) }