feat(formatter): add pluralize transformer for text action (#1260)
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
"passport": "^0.6.0",
|
||||
"pg": "^8.7.1",
|
||||
"php-serialize": "^4.0.2",
|
||||
"pluralize": "^8.0.0",
|
||||
"showdown": "^2.1.0",
|
||||
"stripe": "^11.13.0",
|
||||
"winston": "^3.7.1",
|
||||
@@ -126,6 +127,7 @@
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/pg": "^8.6.1",
|
||||
"@types/pino": "^7.0.5",
|
||||
"@types/pluralize": "^0.0.30",
|
||||
"@types/showdown": "^2.0.1",
|
||||
"ava": "^3.15.0",
|
||||
"nodemon": "^2.0.13",
|
||||
|
@@ -6,6 +6,7 @@ import useDefaultValue from './transformers/use-default-value';
|
||||
import extractEmailAddress from './transformers/extract-email-address';
|
||||
import extractNumber from './transformers/extract-number';
|
||||
import lowercase from './transformers/lowercase';
|
||||
import pluralize from './transformers/pluralize';
|
||||
|
||||
const transformers = {
|
||||
capitalize,
|
||||
@@ -15,6 +16,7 @@ const transformers = {
|
||||
extractEmailAddress,
|
||||
extractNumber,
|
||||
lowercase,
|
||||
pluralize,
|
||||
};
|
||||
|
||||
export default defineAction({
|
||||
@@ -38,6 +40,7 @@ export default defineAction({
|
||||
{ label: 'Extract Email Address', value: 'extractEmailAddress' },
|
||||
{ label: 'Extract Number', value: 'extractNumber' },
|
||||
{ label: 'Lowercase', value: 'lowercase' },
|
||||
{ label: 'Pluralize', value: 'pluralize' },
|
||||
],
|
||||
additionalFields: {
|
||||
type: 'query',
|
||||
|
@@ -0,0 +1,9 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import pluralizeLibrary from 'pluralize';
|
||||
|
||||
const pluralize = ($: IGlobalVariable) => {
|
||||
const input = $.step.parameters.input as string;
|
||||
return pluralizeLibrary(input);
|
||||
};
|
||||
|
||||
export default pluralize;
|
@@ -6,6 +6,7 @@ import useDefaultValue from './options/use-default-value';
|
||||
import extractEmailAddress from './options/extract-email-address';
|
||||
import extractNumber from './options/extract-number';
|
||||
import lowercase from './options/lowercase';
|
||||
import pluralize from './options/pluralize';
|
||||
|
||||
const options: IJSONObject = {
|
||||
capitalize,
|
||||
@@ -15,6 +16,7 @@ const options: IJSONObject = {
|
||||
extractEmailAddress,
|
||||
extractNumber,
|
||||
lowercase,
|
||||
pluralize,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@@ -0,0 +1,12 @@
|
||||
const pluralize = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'Text that will be pluralized.',
|
||||
variables: true,
|
||||
},
|
||||
];
|
||||
|
||||
export default pluralize;
|
Reference in New Issue
Block a user