# All files / src/tokenizer/identifier index.js

100% Statements 13/13
100% Branches 10/10
100% Functions 3/3
100% Lines 13/13

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

    27x

    154419x

    27x
    114999x

    27x
    39420x

    27x

     // @flow
    import token from '../token';
    import punctuator from '../punctuator';
    import constant from '../constant';
    import string from '../string';
    import Syntax from '../../Syntax';
    import { eol } from '../../utils/stream';

    const isValidIdentifier = char => {
      // Don't allow these
      return !string(char) && !punctuator(char) && !eol(char) && char !== ' ';
    };

    const supportAny = char => {
      return isValidIdentifier(char) ? supportAny : null;
    };

    const parse = char => {
      return isValidIdentifier(char) && !constant(char) ? supportAny : null;
    };
    const tokenParser = token(parse, Syntax.Identifier);
    export default tokenParser;