Skip to content

TypeError: Cannot read property 'trim' of undefined > at isEmpty #17

@MatthieuTnsc

Description

@MatthieuTnsc

Hi, I am following the YouTube tutorial (amazing job 👍)

I am at the stage of building the signup and login validation functions.
When I POST a signup request with an empty value I've got an TypeError due to the trim function used in the 'isEmtpy' helper.

Any idea how to fix it?

Thanks

>  TypeError: Cannot read property 'trim' of undefined
>      at isEmpty (/Users/***/***/***/***/functions/index.js:69:14)
>      at /Users/***/***/***/***/functions/index.js:93:7
const isEmpty = (string) => {
  if (string.trim() === '') return true;
  else return false;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions