Compare commits
1 Commits
AUT-157-AU
...
replace-wi
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f4a2e1a84b |
@@ -8,6 +8,7 @@ import htmlToMarkdown from './transformers/html-to-markdown.js';
|
|||||||
import lowercase from './transformers/lowercase.js';
|
import lowercase from './transformers/lowercase.js';
|
||||||
import markdownToHtml from './transformers/markdown-to-html.js';
|
import markdownToHtml from './transformers/markdown-to-html.js';
|
||||||
import pluralize from './transformers/pluralize.js';
|
import pluralize from './transformers/pluralize.js';
|
||||||
|
import replaceWithRegEx from './transformers/replace-with-regex.js';
|
||||||
import replace from './transformers/replace.js';
|
import replace from './transformers/replace.js';
|
||||||
import stringToBase64 from './transformers/string-to-base64.js';
|
import stringToBase64 from './transformers/string-to-base64.js';
|
||||||
import trimWhitespace from './transformers/trim-whitespace.js';
|
import trimWhitespace from './transformers/trim-whitespace.js';
|
||||||
@@ -22,6 +23,7 @@ const transformers = {
|
|||||||
lowercase,
|
lowercase,
|
||||||
markdownToHtml,
|
markdownToHtml,
|
||||||
pluralize,
|
pluralize,
|
||||||
|
replaceWithRegEx,
|
||||||
replace,
|
replace,
|
||||||
stringToBase64,
|
stringToBase64,
|
||||||
trimWhitespace,
|
trimWhitespace,
|
||||||
@@ -49,6 +51,7 @@ export default defineAction({
|
|||||||
{ label: 'Extract Number', value: 'extractNumber' },
|
{ label: 'Extract Number', value: 'extractNumber' },
|
||||||
{ label: 'Lowercase', value: 'lowercase' },
|
{ label: 'Lowercase', value: 'lowercase' },
|
||||||
{ label: 'Pluralize', value: 'pluralize' },
|
{ label: 'Pluralize', value: 'pluralize' },
|
||||||
|
{ label: 'Replace with RegEx', value: 'replaceWithRegEx' },
|
||||||
{ label: 'Replace', value: 'replace' },
|
{ label: 'Replace', value: 'replace' },
|
||||||
{ label: 'String to Base64', value: 'stringToBase64' },
|
{ label: 'String to Base64', value: 'stringToBase64' },
|
||||||
{ label: 'Trim Whitespace', value: 'trimWhitespace' },
|
{ label: 'Trim Whitespace', value: 'trimWhitespace' },
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
const replaceWithRegEx = ($) => {
|
||||||
|
const input = $.step.parameters.input;
|
||||||
|
|
||||||
|
const find = new RegExp($.step.parameters.find);
|
||||||
|
const replace = $.step.parameters.replace;
|
||||||
|
|
||||||
|
return input.replace(find, replace);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default replaceWithRegEx;
|
@@ -6,6 +6,7 @@ import htmlToMarkdown from './text/html-to-markdown.js';
|
|||||||
import lowercase from './text/lowercase.js';
|
import lowercase from './text/lowercase.js';
|
||||||
import markdownToHtml from './text/markdown-to-html.js';
|
import markdownToHtml from './text/markdown-to-html.js';
|
||||||
import pluralize from './text/pluralize.js';
|
import pluralize from './text/pluralize.js';
|
||||||
|
import replaceWithRegEx from './text/replace-with-regex.js';
|
||||||
import replace from './text/replace.js';
|
import replace from './text/replace.js';
|
||||||
import stringToBase64 from './text/string-to-base64.js';
|
import stringToBase64 from './text/string-to-base64.js';
|
||||||
import trimWhitespace from './text/trim-whitespace.js';
|
import trimWhitespace from './text/trim-whitespace.js';
|
||||||
@@ -25,6 +26,7 @@ const options = {
|
|||||||
lowercase,
|
lowercase,
|
||||||
markdownToHtml,
|
markdownToHtml,
|
||||||
pluralize,
|
pluralize,
|
||||||
|
replaceWithRegEx,
|
||||||
replace,
|
replace,
|
||||||
stringToBase64,
|
stringToBase64,
|
||||||
trimWhitespace,
|
trimWhitespace,
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
const replaceWithRegEx = [
|
||||||
|
{
|
||||||
|
label: 'Input',
|
||||||
|
key: 'input',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description:
|
||||||
|
'Text that you want to search for and replace values with regex.',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Find',
|
||||||
|
key: 'find',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: 'RegEx that will be searched for.',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Replace',
|
||||||
|
key: 'replace',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: 'Text that will replace the found regex.',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default replaceWithRegEx;
|
Reference in New Issue
Block a user