import $$observable from 'symbol-observable'
import flyd from 'flyd'

const noop = () => {}

const config = {
  fromESObservable: observable => {
    const stream = flyd.stream()
    const {unsubscribe} = observable.subscribe({
      next: value => stream(value),
      error: error => stream({error}),
      complete: () => stream.end(true)
    })

    flyd.on(unsubscribe, stream.end)
    return stream
  },

  toESObservable: stream => ({
    subscribe: observer => {
      const sub = flyd.on(observer.next || noop, stream)
      flyd.on(_ => observer.complete(), sub.end)
      return {
        unsubscribe: () => sub.end(true)
      }
    },
    [$$observable]() {
      return this
    }
  })
}

export default config

@@ -183,16 +183,17 @@
  const %7B
+ 
 unsubscr
@@ -195,16 +195,17 @@
 ubscribe
+ 
 %7D = obse
@@ -289,21 +289,23 @@
 stream(%7B
+ 
 error
+ 
 %7D),%0A    

Fix lint errors