Class: User

User

The User class wraps an user.

Cannot directly be instantiated

Constructor

new User(user, opts)

Creates a User.

Parameters:
Name Type Description
user object

The initial user object. This User object will be extended with user properties.

opts object

The configuration options.

Properties
Name Type Description
users string

The Users object linked to this user.

Source:

Methods

get(propertyName) → {User}

Gets a user property.

Parameters:
Name Type Description
propertyName string

The property name, such as 'fistName', 'email', ...

Source:
Returns:
Type
User

save(optsopt) → {Promise}

Saves the user. It updates only the 'dirty properties' set through the User#set method.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A promise object resolved with the updated user.

Type
Promise

set(properties) → {User}

Sets user properties.

Parameters:
Name Type Description
properties object

The properties to set.

Source:
Returns:
Type
User
Example
user.set({
  firstName: 'new first name',
  company: 'new company',
});