×

Transform Text with JavaScript

iOS 15 +

Notes

Transforms the input text with the given JavaScript code. The input text is available in a global variable named $text. You are expected to return a string. The code must be synchronous. The code is excuted with JavaScriptCore (same as used in Safari), not JXA.

Syntax

transformTextWithJavaScript(text: <#String (Allows Variables)#>, javaScriptCode: <#String (Allows Variables)#>)

Example

transformTextWithJavaScript(text: "My really awesome text", javaScriptCode: "return `Appending to my text:` + text")