NuPIC port in JavaScript