Global

Methods

addUser(user)

Adds a new user to the list of users stored in the JSON file.
Parameters:
Name Type Description
user Object The user object to add.
Properties
Name Type Attributes Description
email string The email of the user.
password string The password of the user.
name string <optional>
The optional name of the user.
Source:

getAllUsers() → {Array.<Object>}

Retrieves all users from the JSON file.
Source:
Returns:
- An array of all users.
Type
Array.<Object>

getUserByEmail(email) → {Object|null}

Retrieves a user by their email address.
Parameters:
Name Type Description
email string The email of the user to retrieve.
Source:
Returns:
- The user object if found, otherwise null.
Type
Object | null

login(email, password) → {Object|boolean}

Attempts to log in a user by matching the email and password.
Parameters:
Name Type Description
email string The email of the user trying to log in.
password string The password of the user trying to log in.
Source:
Returns:
- The user object if login is successful, otherwise false.
Type
Object | boolean

saveUsers(users)

Saves an array of user objects to the JSON file.
Parameters:
Name Type Description
users Array.<Object> The array of user objects to save.
Source: