Skip to content

Alias names to ".true" and ".false". #288

Closed
@jamen

Description

@jamen

These are tokens, so in some usages they fail...

For instance with how I use AVA, I destructure the functions at the top. This way I don't have to prefix every operation with t. (which looks ugly in my opinion). So I do this:

test('test name', ({is, same, not}) => {
  // is(), same(), not()
});

But, whenever you when using functions with token-like names, it fails. For example, this destructuring fails getting .true:

test('test name', ({is, true, not}) => {
  // is(), true(), not()
});
SyntaxError: Unexpected token true
  at requireFromString (~/projects/rpv/node_modules/require-from-string/index.js:26:4)

Would be nice if there were some alias functions for any token-similar named functions for cases like this... .true() and .false()

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