JSFiddle - React, Tailwind, and code Playground

by 3rror404

JavaScript

(function() {
  var objFilters = {
    year: null, // number
    surveyID: null, // number
    organisationDepartmentID: null, // number
    organisationLocationID: null, // number
    additional1Option: null, // string
    additional2Option: null, // string
    additional3Option: null, // string
    additional4Option: null, // string
    organisationUserContract: null, // string
    gender: null, // string
    ageFrom: null, // number
    ageTo: null, // number,
    timeInBusiness: null //number
  }

  Object.defineProperty(objFilters, 'year', {
    get: function() {
      return this._year;
    },
    set: function(val) {
      if (typeof val !== 'number') {
        throw 'Type must be number.';
      } else {
        this._year = val;
      }
    }
  });

  Object.defineProperty(objFilters, 'surveyID', {
    get: function() {
      return this._surveyID;
    },
    set: function(val) {
      if (typeof val !== 'number') {
        throw 'Type must be number.';
      } else {
        this._surveyID = val;
      }
    }
  });

  Object.defineProperty(objFilters, 'organisationDepartmentID', {
    get: function() {
      return this._organisationDepartmentID;
    },
    set: function(val) {
      if (typeof val !== 'number') {
        throw 'Type must be number.';
      } else {
        this._organisationDepartmentID = val;
      }
    }
  });

  Object.defineProperty(objFilters, 'organisationLocationID', {
    get: function() {
      return this._organisationLocationID;
    },
    set: function(val) {
      if (typeof val !== 'number') {
        throw 'Type must be number.';
      } else {
        this._organisationLocationID = val;
      }
    }
  });

  Object.defineProperty(objFilters, 'additional1Option', {
    get: function() {
      return this._additional1Option;
    },
    set: function(val) {
      if (typeof val !== 'string') {
        throw 'Type must be string.';
      } else {
        this._additional1Option = val;
      }
    }
  });

 ...