js-contracts
Version:
C# inspired Code Contracts
34 lines (33 loc) • 1.6 kB
TypeScript
import Contract from './contract';
import { ContractCondition, ContractPredicate, ContractSettings } from './types';
export default class ContractInternal {
static _cache: {};
private static defaultSettings;
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>(condition: boolean, message?: string): boolean;
static _assert(condition: boolean, message?: string): boolean;
static _exists<T>(collection: T[], predicate: ContractPredicate<T>, message?: string): boolean;
static _forAll<T>(collection: T[], predicate: ContractPredicate<T>, message?: string): boolean;
static _requires(condition: boolean, message?: string): boolean;
static _executeError(message?: string): void;
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;
}