3

I'm seeing the below function as an example of the babel plugin. What is the pre: doing in this function? I've tried with and without it and the result is the same.

function warn (message) {
  pre: typeof message === 'string';
  return 'Warning!\n' + message;
}

edit: Babel plugin

2
  • I think it depends on how the babel plugin works. Do you have a link to it? Looks like it could be some kind of type checking. Commented Dec 9, 2015 at 22:33
  • @CoryDanielson Yep good call, added to the question. Commented Dec 9, 2015 at 22:53

1 Answer 1

7

It is a label (a type of GOTO primerily used to manipulate loops (e.g. with continue) when dealing with nested loops).

In that particular case, it is not doing anything practical since there is no loop and nothing references it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.