Module ddash.utils.truthy

Truthy values: so not any of false, null, 0, "", none, and NaN.

Example

assert( isTruthy(true));
assert( isTruthy(1));
assert(!isTruthy(0));
assert( isTruthy((new int(3))));
assert(!isTruthy(((int[]).init)));
assert( isTruthy([1]));
assert(!isTruthy(double.nan));
assert(!isTruthy(0.0));
assert( isTruthy(1.0));

class C {}
C c;
assert(!isTruthy(c));
c = new C;
assert( isTruthy(c));

struct S {}
const S s;
assert(!__traits(compiles, isTruthy(s)));

Functions

NameDescription
isTruthy(value) Returns true if value is "truthy", i.e. not any of false, null, 0, "", none, NaN, or empty.

Aliases

NameTypeDescription
isFalsey Returns true if value is "falsey", i.e. false, null, 0, "", none, NaN, or empty.