import {containerless, inject, inlineView} from 'aurelia-framework'
import {EventAggregator} from 'aurelia-event-aggregator'

@containerless()
@inlineView(`
<template>
    <a href="javascript:;" class="menu__toggle" click.trigger="toggle()">
        <i class="fa fa-bars"></i>
        <content></content>
    </a>
</template>
`)
@inject(EventAggregator)
export class MenuToggle {

    _open = false

    constructor(events) {
        this.events = events

        this.setMenuStateFromCookie()
    }

    get open() {
        return this._open
    }

    set open(open) {
        this._open = open

        this.events.publish('menu:toggle-open', this._open)

        document.cookie = `menuopen=${this._open}`
    }

    toggle() {
        this.open = !this.open
    }

    setMenuStateFromCookie() {
        let cookie = document.cookie.replace(/(?:(?:^|.*;\s*)menuopen\s*\=\s*([^;]*).*$)|^.*$/, '$1');

        if (!cookie) return

        this.open = cookie
    }

}

@@ -896,17 +896,16 @@
 /, '$1')
-;
 %0A%0A      
@@ -910,54 +910,84 @@
     
-if
+this.open =
  (
-!
 cookie
-) return%0A%0A        this.open = cooki
+ && (cookie === true %7C%7C cookie === 'true')) ? true : fals
 e%0A  

Fix boolean check