Created
February 1, 2017 10:22
-
-
Save dmorosinotto/055dd6abb31f938894c6dd2e580cb545 to your computer and use it in GitHub Desktop.
Detect ES6 support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ES6detect - inspired by https://github.com/bevacqua/sixflix - Algorithm by Netflix | |
var detection = 'class ಠ_ಠ extends Array{constructor(j=`a`,...c){const q=(({u: e})=>{return {[`${c}`]:Symbol(j)};})({});super(j,q,...c)}}new Promise(f=>{const a=function*(){return "\u{20BB7}".match(/./u)[0].length===2||!0};for (let z of a()){const [x,y,w,k]=[new Set(),new WeakSet(),new Map(), new WeakMap()];break}f(new Proxy({},{get:(h,i) =>i in h ?h[i]:"j".repeat(0o2)}))}).then(t => new ಠ_ಠ(t.d))' | |
var result | |
module.exports = function () { | |
if (result === void 0) { | |
try { | |
eval(detection) | |
result = true | |
} catch (e) { | |
result = false | |
} | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment