Code Explainers

Code explainers tagged #decorators

python
import random
import time
import logging
from functools import wraps

A retry decorator with exponential backoff

decorators retry exponential-backoff
Intermediate 6 steps
python
from functools import wraps
 
 
def memoize(func):

Building a memoize decorator in Python

decorators closures memoization
Intermediate 5 steps
typescript
import { IsEmail, IsEnum, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator';
import { Type } from 'class-transformer';
import { Body, Controller, Post } from '@nestjs/common';
 

How DTO validation works in NestJS

validation data-transfer-objects decorators
Intermediate 8 steps