diff --git a/include/ircd/js/vector.h b/include/ircd/js/vector.h index 5a8d01e5e..b1c27cc79 100644 --- a/include/ircd/js/vector.h +++ b/include/ircd/js/vector.h @@ -101,6 +101,18 @@ struct vector infallibleAppend(value(t)); } + vector(const object &obj) + :JS::AutoVectorRooter{*cx} + { + if(!is_array(obj)) + throw internal_error("Object is not an array"); + + const auto len(obj.size()); + reserve(obj.size()); + for(size_t i(0); i < len; ++i) + infallibleAppend(get(obj, i)); + } + vector(const size_t &size) :JS::AutoVectorRooter{*cx} {