golevelup / nestjs

A collection of badass modules and utilities to help you level up your NestJS applications 🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filtering when meta is Nullish

HmFlashy opened this issue · comments

I try to get the methods of all my handlers thanks to the metadata key METHOD_METADATA but since the methods GET = 0 in the RequestMethod enum

export declare enum RequestMethod {
    GET = 0,
    POST = 1,
    PUT = 2,
    DELETE = 3,
    PATCH = 4,
    ALL = 5,
    OPTIONS = 6,
    HEAD = 7
}

these methods are filtered

.filter((x) => !!x.meta);

It would be better to do something like this

.filter((x) => !isNull(x.meta)); // from lodash 

Looks good to me. Feel free to open a PR