# Variable assertPredicate`Const`

assertPredicate: (predicateOrMap: any, errMsg?: string) => (obj: any) => any = assertFn

Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.

#### Type declaration

- - (predicateOrMap: any, errMsg?: string): (obj: any) => any

  - #### Parameters

    - predicateOrMap: any
    - errMsg: string = "assert failure"

    #### Returns (obj: any) => any

#### Example

    let isNumber = (obj) => typeof(obj) === 'number';
    let allNumbers = [ 1, 2, 3, 4, 5 ];
    allNumbers.filter(assertPredicate(isNumber)); //OK

    let oneString = [ 1, 2, 3, 4, "5" ];
    oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers"");

- Defined in src/shared/common.js:339