DEV Community

Cover image for is-thirteen in Go
Stanley Nguyen
Stanley Nguyen

Posted on • Edited on

5 2

is-thirteen in Go

As COVID-19 lockdown is still going on, Labor Day is another indoor day just like how it has been for the last month. I'm surprised I even remember what day it is. To make myself feel less useless and bored, I decided to write a useless (?) Go module port called is-thirteen from its original JS version . With its extensive API, you can:

Check whether a number is 13

...
    is.Number(13).Thirteen()               // true
    is.Number(12.8).Roughly.Thirteen()     // true
    is.Number(6).Within(10).Of.Thirteen()  // true
    is.Number(2007).YearOfBirth.Thirteen() // true

    // check your math skillz
    is.Number(4).Plus(5).Thirteen()     // false
    is.Number(12).Plus(1).Thirteen()    // true
    is.Number(4).Minus(12).Thirteen()   // false
    is.Number(14).Minus(1).Thirteen()   // true
    is.Number(1).Times(8).Thirteen()    // false
    is.Number(26).Divides(2).Thirteen() // true
...

or

Check whether a string is 13

...
    // check your spelling and chemistry skillz
    is.String("tHirTeEn").Thirteen()              // true
    is.String("nethtire").AnagramOf.Thirteen()    // true
    is.String("neetriht").Backwards.Thirteen()    // true
    is.String("aLumInUm").AtomicNumber.Thirteen() // true
...

is-thirteen is stable with 98% test coverage. Check it out over on Github!

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️