Skip to content

Parsing fails when binding expression contains ES6 property shorthand immediately before closing brace #421

Description

@jasonmobley

@tko/utils.parser fails to parse an object literal whose last property is written in ES6 shorthand form (a bare identifier, e.g. { a } instead of { a: a }) when that identifier is immediately followed by the closing } with no other characters in between, including whitespace.

parse("x:{a}")     // Should work, but throws: Expected ',' but got ''
parse("x:{a,}")    // OK  (trailing comma "protects" it)
parse("x:{a }")    // OK  (extra space "protects" it)
parse("x:{a:1}")   // OK  (explicit key:value form is not affected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions