rewrite for npm