Repository: Rich-Harris/buble (js)

Issue:
Binary and octal number literals are not transpiled if base prefix is uppercase
Both `0B` and `0O' are [valid](https://tc39.github.io/ecma262/#sec-literals-numeric-literals) base prefixes. Example:
```js
0B01100 === 0O14
```

Pull request description:
Fix binary octal num literals
Fix #74, binary and octal number literals are now properly transpired regardless uppercase or downcase base prefix

Patch:
diff --git a/src/program/types/Literal.js b/src/program/types/Literal.js
index a2f5692..379f9a8 100644
--- a/src/program/types/Literal.js
+++ b/src/program/types/Literal.js
@@ -11,8 +11,7 @@ export default class Literal extends Node {
 
 	transpile(code, transforms) {
 		if (transforms.numericLiteral) {
-			const leading = this.raw.slice(0, 2);
-			if (leading === '0b' || leading === '0o') {
+			if (this.raw.match(/^0[bo]/i)) {
 				code.overwrite(this.start, this.end, String(this.value), {
 					storeName: true,
 					contentOnly: true


Test patch:
diff --git a/test/samples/binary-and-octal.js b/test/samples/binary-and-octal.js
index 8bcb48b..fc46e8c 100644
--- a/test/samples/binary-and-octal.js
+++ b/test/samples/binary-and-octal.js
@@ -3,11 +3,13 @@ module.exports = [
 		description: 'transpiles binary numbers',
 
 		input: `
-			var num = 0b111110111;
+			var num1 = 0b111110111;
+			var num2 = 0B111110111;
 			var str = '0b111110111';`,
 
 		output: `
-			var num = 503;
+			var num1 = 503;
+			var num2 = 503;
 			var str = '0b111110111';`
 	},
 
@@ -15,11 +17,13 @@ module.exports = [
 		description: 'transpiles octal numbers',
 
 		input: `
-			var num = 0o767;
+			var num1 = 0o767;
+			var num2 = 0O767;
 			var str = '0o767';`,
 
 		output: `
-			var num = 503;
+			var num1 = 503;
+			var num2 = 503;
 			var str = '0o767';`
 	},