'use strict';

function eva (id) {
    var TheTextBox, source;

    function erra (e) {
        console.log("Error in WaveJS: ", e);
        var msg = ['tspan', ['tspan', {class:'error h5'}, 'Error: '], e.message];
        msg.textWidth = 1000;  // set dummy width because we cannot measure tspans
        return { signal: [{ name: msg }]};
    }

    TheTextBox = document.getElementById(id);

    /* eslint-disable no-eval */
    if (TheTextBox.type && TheTextBox.type === 'textarea') {
        try { source = eval('(' + TheTextBox.value + ')'); } catch (e) { return erra(e); }
    } else {
        try { source = eval('(' + TheTextBox.innerHTML + ')'); } catch (e) { return erra(e); }
    }
    /* eslint-enable  no-eval */

    if (Object.prototype.toString.call(source) !== '[object Object]') {
        return erra({ message: '[Semantic]: The root has to be an Object: "{signal:[...]}"'});
    }
    if (source.signal) {
        if (Object.prototype.toString.call(source.signal) !== '[object Array]') {
            return erra({ message: '[Semantic]: "signal" object has to be an Array "signal:[]"'});
        }
    } else if (source.assign) {
        if (Object.prototype.toString.call(source.assign) !== '[object Array]') {
            return erra({ message: '[Semantic]: "assign" object hasto be an Array "assign:[]"'});
        }
    } else if (source.reg) {
        // test register
    } else {
        return erra({ message: '[Semantic]: "signal:[...]" or "assign:[...]" property is missing inside the root Object'});
    }
    return source;
}

module.exports = eva;

/* eslint-env browser */

@@ -101,17 +101,17 @@
 ole.log(
-%22
+'
 Error in
@@ -119,17 +119,17 @@
 WaveJS: 
-%22
+'
 , e);%0A  
@@ -1595,12 +1595,39 @@
  browser */%0A
+/* eslint no-console: 0 */%0A

fix lint issues