Reputation: 113335
I'm playing with babel-cli
. I installed the ES2015 extension and it works well. For example, the following snippet:
let square = x => x * x;
...is converted into:
"use strict";
var square = function square(x) {
return x * x;
};
However I have trouble when using octal numbers. For example:
let mode = 0777;
throws me an error:
SyntaxError: index.js: Invalid number (1:11)
> 1 | let mode = 0777;
| ^
2 |
It looks like it doesn't like the numbers starting with 0
(octal numbers). How can I solve this?
In fact, such numbers appear not in my code but in one of the dependencies.
Is it a babel bug or a feature? What is the workaround/solution?
Upvotes: 3
Views: 918
Reputation: 2516
you are doing it incorrectly, it should be like let mode = 0o777;
, notice the o between 0 and 777
ES6 documentation here: Binary and Octal Literals
// try this in chrome
document.write(0o777);
Upvotes: 3