Category : typescript

I would like to understand what are the different parameters of a Typescript decorator. function myDecorator(target) { // do something with ‘target’ … } In the example above, I know that target represents the function/class the decorator is attached to, but what are the other parameters of a decorator, their meaning an order, I also ..

Read more

Can you help me how to write a regular expression for the below format? "2020-02-07 15:45:25.763437 UTC+0000" my rex should accept the below format also: "2020-02-07 15:45:25" I found how to find the "2020-02-07 15:45:25" but I don’t know how I can make the second part optional? can you help me to figure it out, ..

Read more

I have a class that has two methods for generating and decoding jsonwebtokens. This is what the class looks like. interface IVerified { id: string email?: string data?: any } export default class TokenProvider implements ITokenProvider { public async generateToken({ id, email }: ITokenDetails): Promise<string> { return sign({ id, email }, CONFIG.JWT.secret, { subject: id, ..

Read more