Skip to content

Wiki page should tell about processors can be return with Promise. #4

Open
@nakorndev

Description

@nakorndev

Sorry for my English. But the document is lack about using asynchronous programming.

So, I was tried with below code

processors: {
    async password (value) {
        const hashed = await bcrypt.hashSync(value, Number(process.env.SALT_ROUND))
        return hashed
    }
}

In database will not set any data as hashed resolve on await statement. But instead it's work with return promise then processors will resolve itself.

processors: {
    password (value) {
        return bcrypt.hashSync(value, Number(process.env.SALT_ROUND))
    }
}

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions