Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gender transformer
Browse files Browse the repository at this point in the history
evisdrenova committed Nov 13, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent be0291c commit 167c5a8
Showing 5 changed files with 94 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/docs/transformers/system/full-name.mdx
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ Depending on your validations, you may want to configure the output full name. T
{
data: [
'PreserveLength',
'Preserve Length will ensure that the output full name is the same length as the input full name by preserving the length of the first and last names. The preserveLength config only preserves names up to 12 characters long.',
'Preserve Length will ensure that the output full name is the same length as the input full name by preserving the length of the first and last names. The preserveLength config only preserves first and/or last names up to 12 characters long. So the max full name length is 25 characters.',
'false',
'John',
'Bill',
84 changes: 84 additions & 0 deletions docs/docs/transformers/system/gender.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: Gender
id: gender
hide_title: true
slug: /transformers/system/gender
---

import { TransformerPageHeader } from '@site/src/CustomComponents/TransformerPageHeader.tsx';

import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="Gender"
type="string"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/gender.go"
/>

## Definition

The gender transformer randomly selects a gender value from a predefined list of genders. Here is the list:

<DocsTable
headers={['Gender', 'Abbreviation']}
rowData={[
{
data: ['male', 'm'],
},
{
data: ['female', 'f'],
},
{
data: ['nonbinary', 'n'],
},
{
data: ['undefined', 'u'],
},
]}
/>

By default, the gender transformer does not abbreviate the gender. If you'd like to return an abbreviated gender, pass in the `abbreviate` config.

## Configurations

Depending on your validations, you may want to configure the output gender. The gender transformer has the following configurations:

<DocsTable
headers={[
'Name',
'Description',
'Default',
'Example Input',
'Example Output',
]}
rowData={[
{
data: [
'Abbreviate',
'Abbreviate will abbreviate the output gender so that it is only one character. ',
'false',
'N/A',
'u',
],
},
]}
/>

## Examples

There are several ways you can mix-and-match configurations to get different full name formats. Here are some possible combinations:

<DocsTable
headers={['Abbreviate', 'Example Input', 'Example Output']}
rowData={[
{
data: ['false', 'N/A', 'male'],
},
{
data: ['true', 'N/A', 'f'],
},
{
data: ['false', 'female', 'nonbinary'],
},
]}
/>
5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
@@ -161,6 +161,11 @@ const sidebars = {
id: 'transformers/system/full-name',
label: 'Full Name',
},
{
type: 'doc',
id: 'transformers/system/gender',
label: 'Gender',
},
{
type: 'doc',
id: 'transformers/system/ssn',
2 changes: 1 addition & 1 deletion docs/src/CustomComponents/TransformerPageHeader.tsx
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export const TransformerPageHeader = (props: Props) => {
href={apiRef}
className="no-underline text-gray-900 flex items-center hover:text-gray-900"
>
<Badge>Code reference</Badge>
<Badge>code reference</Badge>
</Link>
</div>
);
4 changes: 3 additions & 1 deletion docs/src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import {
AiOutlinePhone,
} from 'react-icons/ai';
import { BiLogoPostgresql, BiSolidCity } from 'react-icons/bi';
import { BsFunnel, BsShieldCheck } from 'react-icons/bs';
import { BsFunnel, BsGenderAmbiguous, BsShieldCheck } from 'react-icons/bs';
import {
FaAws,
FaDocker,
@@ -138,6 +138,8 @@ export const RenderIcon = (name) => {
return <RxAvatar />;
case 'Full Address':
return <FaRegAddressBook />;
case 'Gender':
return <BsGenderAmbiguous />;
default:
return <LayersIcon />;
}

0 comments on commit 167c5a8

Please sign in to comment.