Add full subdoc support to Javascript client

Should these asserts be in the constructor?