Skip to content

Instantly share code, notes, and snippets.

@dmorosinotto
Created February 1, 2017 10:22
Show Gist options
  • Save dmorosinotto/055dd6abb31f938894c6dd2e580cb545 to your computer and use it in GitHub Desktop.
Save dmorosinotto/055dd6abb31f938894c6dd2e580cb545 to your computer and use it in GitHub Desktop.
Detect ES6 support
//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