feat(formatter): add number action with math operation transformer (#1264)
* feat(formatter): Add number action with math operation transformer * chore: Use different folders for list transform options of formatter
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
import capitalize from './options/capitalize';
|
||||
import extractEmailAddress from './options/extract-email-address';
|
||||
import extractNumber from './options/extract-number';
|
||||
import htmlToMarkdown from './options/html-to-markdown';
|
||||
import lowercase from './options/lowercase';
|
||||
import markdownToHtml from './options/markdown-to-html';
|
||||
import pluralize from './options/pluralize';
|
||||
import replace from './options/replace';
|
||||
import trimWhitespace from './options/trim-whitespace';
|
||||
import useDefaultValue from './options/use-default-value';
|
||||
import capitalize from './text/capitalize';
|
||||
import extractEmailAddress from './text/extract-email-address';
|
||||
import extractNumber from './text/extract-number';
|
||||
import htmlToMarkdown from './text/html-to-markdown';
|
||||
import lowercase from './text/lowercase';
|
||||
import markdownToHtml from './text/markdown-to-html';
|
||||
import pluralize from './text/pluralize';
|
||||
import replace from './text/replace';
|
||||
import trimWhitespace from './text/trim-whitespace';
|
||||
import useDefaultValue from './text/use-default-value';
|
||||
import performMathOperation from './numbers/perform-math-operation';
|
||||
|
||||
const options: IJSONObject = {
|
||||
capitalize,
|
||||
@@ -21,6 +22,7 @@ const options: IJSONObject = {
|
||||
replace,
|
||||
trimWhitespace,
|
||||
useDefaultValue,
|
||||
performMathOperation,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@@ -0,0 +1,36 @@
|
||||
const performMathOperation = [
|
||||
{
|
||||
label: 'Math Operation',
|
||||
key: 'mathOperation',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
description: 'The math operation to perform.',
|
||||
variables: true,
|
||||
options: [
|
||||
{ label: 'Add', value: 'add' },
|
||||
{ label: 'Divide', value: 'divide' },
|
||||
{ label: 'Make Negative', value: 'makeNegative' },
|
||||
{ label: 'Multiply', value: 'multiply' },
|
||||
{ label: 'Subtract', value: 'subtract' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Values',
|
||||
key: 'values',
|
||||
type: 'dynamic' as const,
|
||||
required: false,
|
||||
description: 'Add or remove numbers as needed.',
|
||||
fields: [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'The number to perform the math operation on.',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default performMathOperation;
|
Reference in New Issue
Block a user