You can just use args[0]->IntegerValue(). If you really need a Number instance, use args[0]->ToNumber() not casting.