DEV Community

Cover image for is thirteen
Swastik Baranwal
Swastik Baranwal

Posted on

6

is thirteen

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

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
Enter fullscreen mode Exit fullscreen mode

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
}
Enter fullscreen mode Exit fullscreen mode

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.

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more