Hacker News new | ask | show | jobs
Show HN: TxtFiddle – JavaScript playground for text manipulation tasks (txtfiddle.com)
18 points by awulf 1910 days ago
4 comments

I have been just clicking on the "New" menu. It was not clear to me that I should mouse over and wait. There are many interesting transformations such as "Generate SQL INSERT INTO statement from CSV" or "Generate ASCII table from CSV/TSV". They could be more prominent. How about moving them from "New" into "Library" section?
Thank you for the input. I have now added a separate "Templates" menu item.
nice. very similar to CyberChef[1] except it allows custom JS code.

1. https://gchq.github.io/CyberChef/

so this is basically eval('var input = inputElement.innerText;' + jsElement.innerText)
Basically, yes. In practice, there's a bit more to it. The user code is wrapped into an "async function(input)" (so you can use async/await) and run inside a worker inside a sandboxed iframe (for security reasons and for being able to stop the execution). There's also some additional code for catching errors and parsing the error stack.
why not just use jsfiddle?
The main reason is ease of use. Of course, you can use JSFiddle to create an HTML page with a textarea field and a button that triggers your code and outputs the result to the console or somewhere else. But that's a lot of overhead for a simple text editing task.

TxtFiddle is specifically built for text manipulation tasks and reduces the amount of code you have to write to a minimum. There's also a (growing) list of templates that you can choose from (see the "New" menu). Another differentiating feature is the ability to abort a running script (i.e., in the case of an accidental infinite loop).