factorize js