Skip to content

30th March 2022

Computer Science

Programming

basics

  • Reorganization: Renamed file.
  • New: Recursively log object.

    If you console.log() an object, only the first levels of it will be shown. To recursively log the whole object, use:

    console.dir(yourObject, { depth: null });
    
  • New: Map a dictionary to a dictionary.

    Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, v["someKey"]]));
    
  • New: Enum.

    There is no Enum in JavaScript but you can use:

    Object.freeze({ Apple: 0, Banana: 1, Cherry: 2});
    

pydantic

  • New: Logging.

    To add custom log messages to the uvicorn output, the dirty way, get the logger called uvicorn:

    logger = logging.getLogger("uvicorn")