basic implementation of struct and lib for js