Skip to content

Method chaining when using update #100

@ADTC

Description

@ADTC

Is your feature request related to a problem? Please describe.
Method chaining can help simplify code.

Describe the solution you'd like
I have a code block like this:

const hash256 = (str) => {
    const shaObj = new jsSHA('SHA-256', 'TEXT');
    shaObj.update(str);
    return shaObj.getHash('HEX');
}

I thought I could simplify it like this:

const hash256 = (str) => new jsSHA('SHA-256', 'TEXT').update(str).getHash('HEX');

But it won't be possible since update returns void and not this.

Perhaps it could return this so that chaining becomes possible.

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