My First YouTube Short - Detecting data types in JS is hard!
Schemetastic (Rodrigo)

Schemetastic (Rodrigo) @schemetastic

About: I started with JS about 10 years ago and I fell in love with it (even though it can be weird 😅). I had step backs in my career that ended up being good. Currently I'm a passionate front-end developer.

Joined:
Sep 21, 2022

My First YouTube Short - Detecting data types in JS is hard!

Publish Date: Feb 27 '24
3 4

Recently I'd been promoting a small project of mine called TypeLib JS. I also decided that I want to create video content... so I thought this was a good starting point.

I'm sharing this with you, if you can provide me any feedback that would help me to improve I would appreciate that.

Without furthermore, here is the video

The project page: typelib.schemetastic.com

I will be posting educative videos about front-end (mostly) design and I will share freebies too. If you don't want to miss that out you can help me: liking, sharing and subscribing!


Big shout out to sensa for providing a ton of emojis for free: sensa emoji

Comments 4 total

  • Mykezero
    MykezeroFeb 27, 2024

    Looks like a fantastic tool to guard against changing data in APIs. For someone who wants to stick to using JS for the flexibility but wants the type guarantees, this seems like a wonderful library. Thanks for sharing! ^^

    • Schemetastic (Rodrigo)
      Schemetastic (Rodrigo)Feb 27, 2024

      Hey, thanks!

      Yeah, that is one of the main purposes of the library, actually one of the main features is that it can make debugging easier. For example:

      import {typeErrorIf} from "typelib-js";
      
      function generateFile(file){
          typeErrorIf(file).isNot("blob").throwIt(); //alternatively you can catchIt() and store it in a variable
          console.log("File type is valid");
      }
      
      /* This would generate a TypeError because the function is
      expecting a blob, not a string*/
      generateFile("My file content");
      
      Enter fullscreen mode Exit fullscreen mode

      *You can test this if you go the page project, open your browser console and paste this code snippet (except for the import statement). You can also try to pass a blob to test it (new Blob(["My file content"])).

      I think on Thursday I'll publish a post giving further details about this feature. Thanks for your feedback! 😉

      • Mykezero
        MykezeroFeb 28, 2024

        Very cool, ran it through the console, throws the error, then I can handle it any way I want. Definitely let me know when the post is available!

Add comment