# All files / src/tokenizer token.js

100% Statements 10/10
100% Branches 2/2
100% Functions 2/2
100% Lines 10/10

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    27x

    220289x
    801495x
    801495x

    220289x
    220289x
    220289x
    220289x
    220289x

    27x
     // @flow
    const wrap = (
      predicate: string => any,
      type: string,
      supported?: Array<string>
    ) => {
      const wrapper = (value: string) => {
        const result = predicate(value);
        return typeof result === 'function'
          ? wrap(result, type, supported)
          : result;
      };
      wrapper.type = type;
      wrapper.supported = supported;
      wrapper.strict = !!supported;
      wrapper.leaf = predicate.leaf;
      return wrapper;
    };

    module.exports = wrap;