当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript json_codecs.recordCodec函数代码示例

本文整理汇总了TypeScript中caesium-model/json_codecs.recordCodec函数的典型用法代码示例。如果您正苦于以下问题:TypeScript recordCodec函数的具体用法?TypeScript recordCodec怎么用?TypeScript recordCodec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了recordCodec函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: timeIntervalCodec

export function timeIntervalCodec(fmt: string): Codec<TimeInterval,JsonObject> {
    var _timeCodec = composeCodecs(timeCodec(fmt), _NULL_AS_WILDCARD);
    return recordCodec<TimeInterval>({
        start: _timeCodec,
        end: _timeCodec
    }, (args) => new TimeInterval(args))
}
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:7,代码来源:time_interval.ts

示例2: timeIntervalCodec

export const STAFF_AVAILABILITY_CODEC: Codec<StaffAvailability, JsonObject> = (() => {
    var intervalCodec = timeIntervalCodec('HH:mm');
    return recordCodec<StaffAvailability>({
        mon: intervalCodec,
        tue: intervalCodec,
        wed: intervalCodec,
        thu: intervalCodec,
        fri: intervalCodec
    }, (args) => new StaffAvailability(args));
})();
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:10,代码来源:availability.model.ts

示例3: constructor

export class EnergyAccount extends _ENERGY_ACCOUNT_RECORD {
    type: EnergyAccountType;
    retailer: EnergyRetailer;
    accountNumber: string;

    isResidential: boolean;
    isCorrectName: boolean;
    isCorrectAddress: boolean;

    constructor(args?: {
        type: EnergyAccountType,
        retailer?: EnergyRetailer,
        accountNumber?: string,
    }) {
        super(args);
    }

    get isValid(): boolean {
        return this.retailer !== 'NOT_DISCLOSED'
            && this.accountNumber !== '';
    }

}

export const ENERGY_ACCOUNT_CODEC = recordCodec<EnergyAccount>({
    type: ENERGY_ACCOUNT_TYPE_CODEC,
    retailer: ENERGY_RETAILER_CODEC,
    accountNumber: str,
}, (args: any) => new EnergyAccount(args));
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:29,代码来源:energy_account.model.ts

示例4: isExpired

    }

    get isExpired(): boolean {
        return moment(this.expires).isBefore(moment());
    }

    checkForAlertLabels():Iterable<any, AlertLabel|Iterable<any, any>> {
        return _TERM_LABELS
            .filter((label) => label.test(this));
    }
}

export const MEMBER_TERM_CODEC = recordCodec<MemberTerm>(
    {
        type: MEMBER_TERM_TYPE_CODEC,
        joined: dateTime,
        renewed: dateTime,
        expires: dateTime
    },
    (args) => new MemberTerm(args)
);

const _TERM_LABELS = List<AlertLabel>([
    {
        text: 'membership expired',
        severity: LabelSeverity.Warning,
        tooltip: 'Membership term has expired',
        test: (term: MemberTerm) => term.isExpired
    }
]);
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:30,代码来源:term.model.ts

示例5: constructor

});

export class EnergyAccountBill extends _BILL_RECORD {
    account: EnergyAccount;
    value: number;

    constructor(args?: {
        account?: EnergyAccount,
        value?: number,
    }) {
        super(args);
    }

    get isValid(): boolean {
        return this.account.isValid
            && this.value >= 0;

    }
}

export const ENERGY_ACCOUNT_BILL_CODEC = recordCodec<EnergyAccountBill>(
    {
        account: ENERGY_ACCOUNT_CODEC,
        value: num
    },
    (args: any) => new EnergyAccountBill(args)
);



开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:27,代码来源:bill.model.ts

示例6: Record

import {Iterable, List, Record} from 'immutable';

import {recordCodec} from 'caesium-model/json_codecs';
import {AlertLabel, CheckForAlertLabels} from "../../../utils/alert_label/alert_label";

import {ResidentialStability, RESIDENTIAL_STABILITY_CODEC} from './residential_stability.model';
import {ResidenceType, RESIDENCE_TYPE_CODEC} from './residence_type.model';

const _RESIDENTIAL_STATUS_RECORD = Record({
    stability: 'NOT_DISCLOSED',
    type: 'NOT_DISCLOSED'
});

export class ResidentialStatus extends _RESIDENTIAL_STATUS_RECORD implements CheckForAlertLabels {
    stability: ResidentialStability;
    type: ResidenceType;

    checkForAlertLabels(): Iterable.Indexed<AlertLabel|Iterable.Indexed<any>> {
        //TODO: Any labels emitted?
        return List<AlertLabel>();
    }
}

export const RESIDENTIAL_STATUS_CODEC = recordCodec<ResidentialStatus>({
    stability: RESIDENTIAL_STABILITY_CODEC,
    type: RESIDENCE_TYPE_CODEC
}, (args) => new ResidentialStatus(args));
开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:27,代码来源:residential_status.model.ts

示例7: checkForAlertLabels

    benefitType: BenefitType;
    benefitOtherDescription: string;
    proofOfLowIncome: ProofOfLowIncome;

    checkForAlertLabels():Iterable.Indexed<AlertLabel|Iterable.Indexed<any>> {
        return _INCOME_INFO_LABELS
            .filter((label) => label.test(this))
            .toIndexedSeq();
    }
}

export const INCOME_CODEC = recordCodec<Income>(
    {
        type: INCOME_TYPE_CODEC,
        benefitType: BENEFIT_TYPE_CODEC,
        benefitOtherDescriptions: str,
        proofOfLowIncome: PROOF_OF_LOW_INCOME_CODEC
    },
    (args) => new Income(args)
);

const _INCOME_INFO_LABELS = List<AlertLabel>([
    {
        text: 'No proof of low income',
        severity: LabelSeverity.Warning,
        tooltip: 'Request low income card on member contact',
        test: (income:Income) => (income.proofOfLowIncome === 'NO_PROOF')
    }
]);

开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:29,代码来源:income.model.ts

示例8: Record

import {Record} from 'immutable';
import {str, recordCodec} from "caesium-model/json_codecs";

const _ADDRESS_RECORD = Record({street: '', city: '', postcode: ''});

export class Address extends _ADDRESS_RECORD {
    street: string;
    city: string;
    postcode: string;
}

export const ADDRESS_CODEC = recordCodec<Address>({
    street: str,
    city: str,
    postcode: str
}, (args) => new Address(args));


开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:16,代码来源:address.model.ts

示例9: constructor

    isPBS: false,
});

export class ChemistPrescription extends _CHEMIST_PRESCRIPTION_RECORD {
    /**
     * The name of the medication, as printed on the description.
     */
    name: string;

    /**
     * Is the prescription a PBS prescription.
     */
    isPBS: boolean;

    /**
     * The cost of the medicine, including any PBS discounts.
     */
    value: number;


    constructor(args?: {isPBS: boolean}) {
        super(args);
    }
}

export const CHEMIST_PRESCRIPTION_CODEC = recordCodec<ChemistPrescription>({
    name: str,
    isPBS: bool
}, (args: any) => new ChemistPrescription(args));

开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:29,代码来源:prescription.model.ts

示例10: Record

import {Record} from 'immutable';

import {recordCodec} from 'caesium-model/json_codecs';

export const _REFERRAL_RECORD = Record({});

export class Referral extends _REFERRAL_RECORD {

}

export const REFERRAL_CODEC = recordCodec<Referral>({

    },
    (args: any) => new Referral(args)
);

开发者ID:ovangle,项目名称:TNC-admin-client,代码行数:15,代码来源:referral.model.ts


注:本文中的caesium-model/json_codecs.recordCodec函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。