Skip to content

Instantly share code, notes, and snippets.

@chadaustin
Created October 15, 2015 18:55
Show Gist options
  • Select an option

  • Save chadaustin/7b93f533cdcfae54dae4 to your computer and use it in GitHub Desktop.

Select an option

Save chadaustin/7b93f533cdcfae54dae4 to your computer and use it in GitHub Desktop.
https://babeljs.io/repl/#?experimental=true&evaluate=true&loose=false&spec=false&code=import%20{%20Component%20}%20from%20%22react%22%3B%0A%0Aexport%20var%20Enhance%20%3D%20ComposedComponent%20%3D%3E%20class%20extends%20Component%20{%0A%20%20constructor%28%29%20{%0A%20%20%20%20super%28%29%3B%0A%20%20%20%20this.state%20%3D%20{%20data%3A%20null%20}%3B%0A%20%20}%0A%20%20componentDidMount%28%29%20{%0A%20%20%20%20this.setState%28{%20data%3A%20%27Hello%27%20}%29%3B%0A%20%20}%0A%20%20render%28%29%20{%0A%20%20%20%20return%20%3CComposedComponent%20{...this.props}%20data%3D{this.state.data}%20%2F%3E%3B%0A%20%20}%0A}%3B&%20typeof%20v.then%20=%3D%3D%20%22function%22%3B%0A}%0A%0Alet%20q%20%3D%20%28...args%29%20%3D%3E%20{%20return%20z%28...args%29%3B%20}%0A%0Alet%20f%20%3D%20%28%29%20%3D%3E%20e.push%28%27hi%27%29%3B%0A%0Aclass%20ExtendableError%20extends%20Error%20{%0A%20%20constructor%28message%29%20{%0A%20%20%20%20super%28%29%3B%0A%20%20%20%20this.message%20%3D%20message%3B%20%0A%20%20%20%20this.stack%20%3D%20%28new%20Error%28%29%29.stack%3B%0A%20%20%20%20this.name%20%3D%20this.constructor.name%3B%0A%20%20}%0A}%20%20%20%20%0A%0A%2F%2F%20now%20I%20can%20extend%0A%0Aclass%20MyError%20extends%20ExtendableError%20{%0A}%0A%0Afunction%20aoeu%28%29%20{%0A%20%20try%20{%0A%20%20%20%20throw%20new%20MyError%28%27boom%20boom%20dolla%201%27%29%3B%0A%20%20}%20catch%20%28e%29%20{%0A%20%20%20%20console.error%28e%29%3B%0A%20%20}%0A%20%20var%20myerror%20%3D%20new%20MyError%28%22ll%22%29%3B%0A%20%20console.log%28myerror.message%29%0A%20%20console.log%28myerror%20instanceof%20Error%29%3B%0A%20%20console.log%28myerror.name%29%0A%20%20console.log%28myerror.stack%29%0A}%0A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment