Nine Parsecs from Milwaukee

    TypeScript icon, indicating that this package has built-in type declarations

    0.4.1 • Public • Published

    Actions Status Actions Status Actions Status Test Coverage Maintainability Packages npm version


    Just a project with some type guard functions to identify the type of an object not vanilla covered and some dummy functions for better readability and to use as some common callbacks

    How to install

    npm i is-this-a-pigeon

    How to Use it

    Just call the function you want, like this simple type guard:

    function iterateIfYouCan(maybeAnIterable: unknown) {
      if (isIterable(maybeAnIterable)) {
        for (const item of maybeAnIterable) {

    There you go. Inside the if, even maybeAnIterable not being typed as an iterable, you can safely iterate over it and TypeScript will not scream at you. This is a simple type guard for iterable. There is plenty of others type guards in this library, you may check it out.

    We also have some dummy functions for use in simple callbacks for better readability. Examples:

     // identity returns the received argument. This filter will return an array excluding all the falsy elements
    [0, 1, false, 'a', null, NaN, true].filter(identity);
     // greaterThan returns a functions that evaluates to true only when the argument is greater than the informed value
    [1, 2, 3, 4, 5, 6].filter(greaterThan(3));
    // Filters all values where property "a" is greater than 3. Directly passing as a parameter of filter or something similar, you have a strongly typed property key!
    // Thanks to TypeScript contextual typing
    [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }, { a: 6 }].filter(compareProp('a', greaterThan(3)));
    // Filters all values where property "a" is truthy
    [{ a: 0 }, { a: 1 }, { a: false }, { a: 'a' }, { a: null }, { a: NaN }, { a: true }].filter(prop('a'));

    But why though?

    The kind of function I made here is a repeating code for many projects I work with. So, I just wanted to group it in a single package with the best typing possible


    Licensed under MIT.


    npm i is-this-a-pigeon

    DownloadsWeekly Downloads






    Unpacked Size

    19.6 kB

    Total Files


    Last publish


    • pedrosodre
    • danielcarvalho
    • gustavobeavis
    • paulododt
    • fgabrielsilva
    • danielgaleni
    • farenheith
    • jeocoutinho