Pure JavaScript sparse vector implementation