Skip to content

Instantly share code, notes, and snippets.

@UskeS
Last active November 11, 2024 02:34
Show Gist options
  • Select an option

  • Save UskeS/fcd6385d1f87b6a6b3f83d942167c6b4 to your computer and use it in GitHub Desktop.

Select an option

Save UskeS/fcd6385d1f87b6a6b3f83d942167c6b4 to your computer and use it in GitHub Desktop.
[Automator Workflow] Exclude words from list.
/**
* 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