jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.

regenerate

Generate JavaScript-compatible regular expressions based on a given set of Unicode symbols or code points.