HiBON.isArray

Check if the HiBON is an Array

class HiBON
const
bool
isArray
()

Return Value

Type: bool

true if all keys is indices and are consecutive

Examples

{
    auto hibon = new HiBON;
    assert(hibon.isArray);

    hibon["0"] = 1;
    assert(hibon.isArray);
    hibon["1"] = 2;
    assert(hibon.isArray);
    hibon["2"] = 3;
    assert(hibon.isArray);
    hibon["x"] = 3;
    assert(!hibon.isArray);
}
{
    auto hibon = new HiBON;
    hibon["1"] = 1;
    assert(!hibon.isArray);
    hibon["0"] = 2;
    assert(hibon.isArray);
    hibon["4"] = 3;
    assert(!hibon.isArray);
    hibon["3"] = 4;
    assert(!hibon.isArray);
    hibon["2"] = 7;
    assert(hibon.isArray);
    hibon["05"] = 2;
    assert(!hibon.isArray);
}