Skip to content

findOrCreateLabel unnecessary check #1

@thankevan

Description

@thankevan

labelCache[name] = GmailApp.getUserLabelByName(name) || GmailApp.createLabel(name);

I was just writing an appscript (I found yours when searching to see if there was already a similar solution). In my testing GmailApp.createLabel(name) does the "get or create" step inherently. labelCache[name] = GmailApp.getUserLabelByName(name) || GmailApp.createLabel(name); is unnecessary.

I'd love to know if my understanding is incorrect if I missed something and need to fix my script.

I like the caching though.

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