feat(formatter): Add replace transformer to text action
This commit is contained in:
@@ -8,6 +8,7 @@ import extractNumber from './transformers/extract-number';
|
||||
import lowercase from './transformers/lowercase';
|
||||
import pluralize from './transformers/pluralize';
|
||||
import trimWhitespace from './transformers/trim-whitespace';
|
||||
import replace from './transformers/replace';
|
||||
|
||||
const transformers = {
|
||||
capitalize,
|
||||
@@ -19,6 +20,7 @@ const transformers = {
|
||||
lowercase,
|
||||
pluralize,
|
||||
trimWhitespace,
|
||||
replace,
|
||||
};
|
||||
|
||||
export default defineAction({
|
||||
@@ -44,6 +46,7 @@ export default defineAction({
|
||||
{ label: 'Lowercase', value: 'lowercase' },
|
||||
{ label: 'Pluralize', value: 'pluralize' },
|
||||
{ label: 'Trim Whitespace', value: 'trimWhitespace' },
|
||||
{ label: 'Replace', value: 'replace' },
|
||||
],
|
||||
additionalFields: {
|
||||
type: 'query',
|
||||
|
@@ -0,0 +1,12 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const replace = ($: IGlobalVariable) => {
|
||||
const input = $.step.parameters.input as string;
|
||||
|
||||
const find = $.step.parameters.find as string;
|
||||
const replace = $.step.parameters.replace as string;
|
||||
|
||||
return input.replaceAll(find, replace);
|
||||
};
|
||||
|
||||
export default replace;
|
Reference in New Issue
Block a user