Skip to content

Restrict allowed variable symbols & reserved words #20

Description

@justsml

For all variable/token names:

  • Prevent any special symbols or operators in names.
    • Opt 1: Filtering ~``!@#$%^&*()-_=+{}|[]\;:'<>?,./ - exclusionary approach can allow strange edge cases and must account for the endless strangeness of Unicode special symbols.
    • Opt 2: Must match ^[a-zA-Z0-9\.\-_]+$ - restricted can limit use cases, but much safer.
  • Exclude all builtin JS functions & internal operation names.
    • parseInt, parseFloat, (there's an NPM package with arrays of this...)
    • Get a dynamic list of prefixOps and infixOps. (need to export from the expression-language/index.)
  • No lone or dotted numbers (avoids some array/index collisions & weirdness.)
    • 42 = 'Antwerd'
    • 42.24 = 'Antwerd'
    • words[42] = 'Antwerd'
  • Throw error on dangerous Object.prototype.... methods.
    • valueOf, toString, toJSON, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions