Skip to content

Use of if(typeof value !== 'undefined')? #236

@Fdawgs

Description

@Fdawgs

Noticed this in a few places in this repo:

https://github.com/fastify/fastify-helmet/blob/b0aacaee932e1629a6233c97424d739735b3293c/index.js#L25C31-L25C31

Never seen this before, does this have a performance benefit over the following?:

  • if(value)
  • if(value !== undefined)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions