chicken-sloths / bangazon-api-sprint1

API for a mock Amazon + Etsy platform providing developers access to the company's employee & product data
0 stars 0 forks source link

Fix escapeSingleQuote trying to escape undefined value #82

Closed TimAConner closed 6 years ago

TimAConner commented 6 years ago

Description

Change escapeSingleQuotes to check if value being passed into it is a string or not. If it is, escape. If not, don't escape string.

Problem to Solve

Check if value trying to be escape is a string or not. If it is a string, escape it, if not, don't escape it. Before it was trying to run a .replace method on an undefined object.

Proposed Changes

Check if value to be escaped is a string or not.

Expected Behavior

No errors should be thrown when running npm run db:generate

Steps to Test Solution

  1. Run npm run db:generate
  2. There should be no errors. The output should be:
    > bangazon-api-sprint1@1.0.0 db:generate C:\Users\Tim\workspace\group-projects\bangazon-api-sprint1
    > node db/build-db.js