js-contracts
Version:
C# inspired Code Contracts
33 lines (32 loc) • 1.63 kB
TypeScript
import Contract from './contract';
import { ContractCondition, ContractPredicate, ContractSettings } from './types';
export default class ContractInternal {
private static _cache;
private static _settings;
static get shouldSkipContractChecks(): boolean;
static _setSettings(settings: ContractSettings): void;
static initContextParameters(contractInstance: Contract, condition: ContractCondition, target: Object, key: string | symbol): {
hasOldValueParameter: boolean;
populateCache: (...args: any[]) => void;
populateResultCache: (result: any) => void;
destroyCache: () => void;
bindOldValue: () => void;
bindOldValueByPath: (context: any) => void;
bindFunctionResult: () => void;
};
static _ensures<T extends Error>(condition: boolean, message?: string): boolean;
static _assert<T extends Error>(condition: boolean, message?: string): boolean;
static _exists<T, E extends Error>(collection: T[], predicate: ContractPredicate<T>, message?: string): boolean;
static _forAll<T, E extends Error>(collection: T[], predicate: ContractPredicate<T>, message?: string): boolean;
static _requires<T extends Error>(condition: boolean, message?: string): boolean;
private static executeError;
private static getParameters;
private static hasOldValueParameter;
private static hasResultParameter;
private static _oldValue;
private static getOldValueParameter;
private static populateCache;
private static populateFunctionResultCache;
private static destroyClassCache;
private static _contractResult;
}