Last active
November 11, 2024 02:34
-
-
Save UskeS/fcd6385d1f87b6a6b3f83d942167c6b4 to your computer and use it in GitHub Desktop.
[Automator Workflow] Exclude words from list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Use as workflow for Automator Service (JXA). | |
| * Plaese check it out my blog article: https://uske-s.hatenablog.com/entry/2024/11/11/113406 | |
| */ | |
| function run(input, parameters) { | |
| const myData = input[0].split("---\n"); | |
| const targetTexts = myData[0].split("\n"); | |
| const exceptWords = myData[1].split("\n"); | |
| const newTexts = targetTexts.filter( n => (!exceptWords.some(x => x === n)) ); | |
| return newTexts.join("\n"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment