# Function assertPredicate

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

#### 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"");

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

- #### Parameters

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

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

  - - (obj): any

    - #### Parameters

      - obj: any

      #### Returns any

  - Defined in shared/common.js:349