Now in TypeScript!
stringstonumbers is a very simple npm package that converts any string input into a number and back. It was created to be used with the scratch-api module for transferring data over scratch cloud servers.
npm install stringstonumbers
const strToNum = require("stringstonumbers");<script
type="application/javascript"
src="https://cdn.jsdelivr.net/npm/stringstonumbers@5/dist/browser.js"
></script>strToNum.encode("Hello World!");
// returns "07303737409122404337296200"strToNum.decode("07303737409122404337296200");
// returns "Hello World!"