text: /* eslint-disable  func-names */
  /* eslint-disable  no-console */
  
  const Alexa = require('ask-sdk-core');
  
  const cookbook = {
      getRandomThing(arrayOfItems) {
      // can take an array, or a dictionary
      if (Array.isArray(arrayOfItems)) {
        // the argument is an array []
        let i = 0;
        i = Math.floor(Math.random() * arrayOfItems.length);
        return (arrayOfItems[i]);
      }
  
      if (typeof arrayOfItems === 'object') {
        // argument is object, treat as dictionary
        const result = {};
        const key = this.getRandomItem(Object.keys(arrayOfItems));
        result[key] = arrayOfItems[key];
        return result;
      }
      // not an array or object, so just return the input
      return arrayOfItems;
    }
  };
  
  //=========================================================================================================================================
  //TODO: The items below this comment need your attention.
  //=========================================================================================================================================
  
  const SKILL_NAME = 'Object Tracker';
  const GET_FACT_MESSAGE = 'Here\'s your object: ';
  const HELP_MESSAGE = 'You can say something like I am putting secondary house keys in the garage, or, you can say exit... What can I help you with?';
  const HELP_REPROMPT = 'What can I help you with?';
  const FALLBACK_MESSAGE = 'The Object Tracker skill can\'t help you with that.  It can help you remember or discover things that you put if you say where is my helmet, where are car keys, where have I kept my property documents etc. What can I help you with?';
  const FALLBACK_REPROMPT = 'What can I help you with?';
  const STOP_MESSAGE = 'Goodbye!';
  
  const data = [
    'You have kept your car keys in garage cupboard',
    'Alternate copy of your property document is with your friend Ashish',
    'Your wifi paaaword is written in your notebbok'
  ];
  
  //=========================================================================================================================================
  //Editing anything below this line might break your skill.
  //=========================================================================================================================================
  
  const GetNewFactHandler = {
    canHandle(handlerInput) {
      const request = handlerInput.requestEnvelope.request;
      return request.type === 'LaunchRequest'
        || (request.type === 'IntentRequest'
          && request.intent.name === 'GetThingIntent');
    },
    handle(handlerInput) {
      const randomFact = cookbook.getRandomThing(data);
      const speechOutput = GET_FACT_MESSAGE + randomFact;
  
      return handlerInput.responseBuilder
        .speak(speechOutput)
        .withSimpleCard(SKILL_NAME, randomFact)
        .getResponse();
    },
  };
  
  const HelpHandler = {
    canHandle(handlerInput) {
      const request = handlerInput.requestEnvelope.request;
      return request.type === 'IntentRequest'
        && request.intent.name === 'AMAZON.HelpIntent';
    },
    handle(handlerInput) {
      return handlerInput.responseBuilder
        .speak(HELP_MESSAGE)
        .reprompt(HELP_REPROMPT)
        .getResponse();
    },
  };
  
  const FallbackHandler = {
    // 2018-May-01: AMAZON.FallackIntent is only currently available in en-US locale.
    //              This handler will not be triggered except in that locale, so it can be
    //              safely deployed for any locale.
    canHandle(handlerInput) {
      const request = handlerInput.requestEnvelope.request;
      return request.type === 'IntentRequest'
        && request.intent.name === 'AMAZON.FallbackIntent';
    },
    handle(handlerInput) {
      return handlerInput.responseBuilder
        .speak(FALLBACK_MESSAGE)
        .reprompt(FALLBACK_REPROMPT)
        .getResponse();
    },
  };
  
  const ExitHandler = {
    canHandle(handlerInput) {
      const request = handlerInput.requestEnvelope.request;
      return request.type === 'IntentRequest'
        && (request.intent.name === 'AMAZON.CancelIntent'
          || request.intent.name === 'AMAZON.StopIntent');
    },
    handle(handlerInput) {
      return handlerInput.responseBuilder
        .speak(STOP_MESSAGE)
        .getResponse();
    },
  };
  
  const SessionEndedRequestHandler = {
    canHandle(handlerInput) {
      const request = handlerInput.requestEnvelope.request;
      return request.type === 'SessionEndedRequest';
    },
    handle(handlerInput) {
      console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`);
  
      return handlerInput.responseBuilder.getResponse();
    },
  };
  
  const ErrorHandler = {
    canHandle() {
      return true;
    },
    handle(handlerInput, error) {
      console.log(`Error handled: ${error.message}`);
  
      return handlerInput.responseBuilder
        .speak('Sorry, an error occurred. I cant track your things. Please try again.')
        .reprompt('Sorry, an error occurred. I cant track your things. Please try again.')
        .getResponse();
    },
  };
  
  const skillBuilder = Alexa.SkillBuilders.custom();
  
  exports.handler = skillBuilder
    .addRequestHandlers(
      GetNewFactHandler,
      HelpHandler,
      ExitHandler,
      FallbackHandler,
      SessionEndedRequestHandler
    )
    .addErrorHandlers(ErrorHandler)
    .lambda();
  