loading...
Cover image for is thirteen

is thirteen

delta456 profile image Swastik Baranwal ・1 min read

is thirteen

Check if a number is equal to 13.

GitHub logo Delta456 / is-thirteen

Check if a number is equal to 13.

is thirteen

Check if a number is equal to 13. Inspired from this Go Module.

Installation

  • Manually:

    • git clone https://github.com/Delta456/is-thirteen is_thirteen
  • Via VPM

    • v install is_thirteen
  • Via Vpkg

    • vpkg install is_thirteen

Usage

import is_thirteen
fn main() {
    is_thirteen.number(13).thirteen()               // true
    is_thirteen.number(12.8).roughly.thirteen()     // true
    is_thirteen.number(6).within(10).of.thirteen()  // true
    // Check your math skillz
    is_thirteen.number(4).plus(5).thirteen()     // false
    is_thirteen.number(12).plus(1).thirteen()    // true
    is_thirteen.number(4).minus(12).thirteen()   // false
    is_thirteen.number(14).minus(1).thirteen()   // true
    is_thirteen.number(1).times(8).thirteen()    // false
    is_thirteen.number(26).divides(2).thirteen

Why

As corona epidemic is going on in the world and I was bored and wanted to make a new project but I wanted it to be short and funny so I though of porting this JS module to V.

Recently, I saw a port of the JS module to Golang here.

This Go port adds more checks if string is equal to 13 in all aspects as listed here. So my port uses both of the functionality combined.

Installation

  • Manually:

    • git clone https://github.com/Delta456/is-thirteen is_thirteen
  • Via VPM

    • v install is_thirteen
  • Via Vpkg

    • vpkg install is_thirteen

Usage

import is_thirteen

fn main() {
    is_thirteen.number(13).thirteen()               // true
    is_thirteen.number(12.8).roughly.thirteen()     // true
    is_thirteen.number(6).within(10).of.thirteen()  // true

    // Check your math skillz
    is_thirteen.number(4).plus(5).thirteen()     // false
    is_thirteen.number(12).plus(1).thirteen()    // true
    is_thirteen.number(4).minus(12).thirteen()   // false
    is_thirteen.number(14).minus(1).thirteen()   // true
    is_thirteen.number(1).times(8).thirteen()    // false
    is_thirteen.number(26).divides(2).thirteen() // true

    // Check your spelling and chemistry skillz
    is_thirteen.str("tHirTeEn").thirteen()  // true
    is_thirteen.str("neetriht").backwards.thirteen()  // true
    is_thirteen.str("aLumInUm").atomic_number.thirteen() // true
}

Acknowledgments

I thank the authors who wrote this module respectively in Go and JS from which I understood the code and ported from!

License

Licensed under MIT.

Discussion

markdown guide