Crates.io | is-thirteen |
lib.rs | is-thirteen |
version | 0.13.0 |
source | src |
created_at | 2021-07-31 19:49:34.380557 |
updated_at | 2021-08-12 18:40:22.28686 |
description | Did you consider the fact that "Jodie Whittaker" represents the number 13 in some cultures? No you didn't. That's why you need this crate. |
homepage | |
repository | https://github.com/MakotoE/is-thirteen |
max_upload_size | |
id | 429801 |
size | 44,138 |
"Sometimes it is too difficult to figure out if a variable equals 13 or not. That's why we need is-thirteen
."
— Literally no one
This very useful crate is a production-ready* solution for all of your 13-comparison needs.
* I like asterisks.
This is a port of is-thirteen and is tested with all tests from the original library. A RIIR blog about how our servers improved by x10-100 will be posted to Medium shortly.
The syntax of this library is quite different from that of the original library. This table shows how your messy JS code can be cleaned up with the Rust version.
Original version | Rust version |
---|---|
is(x).thirteen() |
x.thirteen() |
is(x).roughly.thirteen() |
Roughly(x).thirteen() |
is(() => x).returning.thirteen() |
Returns(|| x).thirteen() |
is(x).not.thirteen() |
!x.thirteen() // How lazy do you have to be if you need a library to negate a Boolean? |
is(x).divisible.by.thirteen() |
DivisibleBy(x).thirteen() |
is(x).square.of.thirteen() |
(x * x).thirteen() |
is(x).greater.than.thirteen() |
GreaterThan(x).thirteen() |
is(x).less.than.thirteen() |
LessThan(x).thirteen() |
is(x).within(1).of.thirteen() |
Within::new(x, 1.0).thirteen() |
is(x).yearOfBirth() |
(chrono::Utc::today().year() - x).thirteen() |
is(x).plus(2).thirteen() |
(x + 2).thirteen() |
is(x).minus(2).thirteen() |
(x - 2).thirteen() |
is(x).times(2).thirteen() |
(x * 2).thirteen() |
is(x).dividedby(2).thirteen() |
(x / 2).thirteen() |
is(x).canSpell.thirteen() |
CanSpell(x).thirteen() |
is(x).anagramOf.thirteen() |
AnagramOf(x).thirteen() |
is(x).backwards.thirteen() |
Backwards(x).thirteen() |
is(x).atomicNumber.thirteen() |
AtomicNumber(x).thirteen() |
is(x).base(16).thirteen() |
i64::from_str_radix(x, 16).thirteen() |