Neosync Javascript Transformer Functions
Learn about Neosync's Javascript transformer and generator functions, which provide a wide range of capabilities for data transformation and generation within the Javascript Transformer and Generator. Explore detailed descriptions and examples to effectively utilize these functions in your jobs.
Transformers
Neosync's transformer functions allow you to manipulate and transform data values with ease.
These functions are designed to provide powerful and flexible data transformation capabilities within your jobs.
Each transformer function accepts a value and a configuration object as arguments.
The source column value is accessible via the value
keyword, while additional columns can be referenced using input.{column_name}
.
transformCharacterScramble
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
userProvidedRegex | string | false | A custom regular expression. This regex is used to manipulate input data during the transformation process. | |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformCharacterScramble(value, {
userProvidedRegex: "",
seed: 1,
});
transformE164PhoneNumber
Transforms an existing E164 formatted phone number.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
maxLength | int64 | 15 | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformE164PhoneNumber(value, {
preserveLength: false,
maxLength: 15,
seed: 1,
});
transformEmail
Anonymizes and transforms an existing email address.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
preserveLength | bool | false | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
preserveDomain | bool | false | false | A boolean indicating whether the domain part of the email should be preserved. |
excludedDomains | any | [] | false | A list of domains that should be excluded from the transformation |
maxLength | int64 | 100 | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
seed | int64 | false | An optional seed value used for generating deterministic transformations. | |
emailType | string | 'uuidv4' | false | Specifies the type of email to transform, with options including uuidv4 , fullname , or any . |
invalidEmailAction | string | 'reject' | false | Specifies the action to take when an invalid email is encountered, with options including reject , passthrough , null , or generate . |
Example
const newValue = neosync.transformEmail(value, {
preserveLength: false,
preserveDomain: false,
excludedDomains: [],
maxLength: 100,
seed: 1,
emailType: 'uuidv4',
invalidEmailAction: 'reject',
});
transformFirstName
Transforms an existing first name
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
seed | int64 | false | An optional seed value used for generating deterministic transformations. |
Example
const newValue = neosync.transformFirstName(value, {
maxLength: 100,
preserveLength: false,
seed: 1,
});
transformFloat64
Anonymizes and transforms an existing float value.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
randomizationRangeMin | float64 | 1 | false | Specifies the minimum value for the range of the float. |
randomizationRangeMax | float64 | 10000 | false | Specifies the maximum value for the randomization range of the float. |
precision | int64 | false | An optional parameter that defines the number of significant digits for the float. | |
scale | int64 | false | An optional parameter that defines the number of decimal places for the float. | |
seed | int64 | false | An optional seed value used for generating deterministic transformations. |
Example
const newValue = neosync.transformFloat64(value, {
randomizationRangeMin: 1,
randomizationRangeMax: 10000,
precision: 1,
scale: 1,
seed: 1,
});
transformFullName
Transforms an existing full name.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
seed | int64 | false | An optional seed value used for generating deterministic transformations. |
Example
const newValue = neosync.transformFullName(value, {
maxLength: 100,
preserveLength: false,
seed: 1,
});
transformInt64
Anonymizes and transforms an existing int64 value.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
randomizationRangeMin | int64 | 1 | false | Specifies the minimum value for the range of the int. |
randomizationRangeMax | int64 | 10000 | false | Specifies the maximum value for the range of the int. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformInt64(value, {
randomizationRangeMin: 1,
randomizationRangeMax: 10000,
seed: 1,
});
transformInt64PhoneNumber
Anonymizes and transforms an existing int64 phone number.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformInt64PhoneNumber(value, {
preserveLength: false,
seed: 1,
});
transformLastName
Anonymizes and transforms an existing last name.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
seed | int64 | false | An optional seed value used for generating deterministic transformations. |
Example
const newValue = neosync.transformLastName(value, {
maxLength: 100,
preserveLength: false,
seed: 1,
});
transformString
Anonymizes and transforms an existing string value.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
minLength | int64 | 1 | false | Specifies the minimum length of the transformed value. |
maxLength | int64 | 100 | false | Specifies the maximum length of the transformed value. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformString(value, {
preserveLength: false,
minLength: 1,
maxLength: 100,
seed: 1,
});
transformStringPhoneNumber
Anonymizes and transforms an existing phone number that is typed as a string.
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
preserveLength | bool | false | false | Whether the original length of the input data should be preserved during transformation. If set to true, the transformation logic will ensure that the output data has the same length as the input data. |
maxLength | int64 | 100 | false | Specifies the maximum length for the transformed data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.transformStringPhoneNumber(value, {
preserveLength: false,
maxLength: 100,
seed: 1,
});
transformUuid
Transforms an existing UUID to a UUID v5
Parameters
Value
Type: Any
Description: Value that will be transformed
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used for generating deterministic transformations. |
Example
const newValue = neosync.transformUuid(value, {
seed: 1,
});
Generators
Neosync's generator functions enable the creation of various data values, facilitating the generation of realistic and diverse data for testing and development purposes. These functions are designed to provide robust and versatile data generation capabilities within your jobs. Each generator function accepts a configuration object as an argument.
generateBool
Generates a random boolean value.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateBool({
seed: 1,
});
generateBusinessName
Generates a random business name between 2 and 35 characters long.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateBusinessName({
maxLength: 100,
seed: 1,
});
generateCardNumber
Generates a 16 digit card number that is valid by Luhn valid by default.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
validLuhn | bool | false | false | A boolean indicating whether the generated value should pass the Luhn algorithm check. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateCardNumber({
validLuhn: false,
seed: 1,
});
generateCategorical
Randomly selects a value from a defined set of categorical values.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
categories | string | "ultimo,proximo,semper" | false | A list of comma-separated string values to randomly select from. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateCategorical({
categories: "ultimo,proximo,semper",
seed: 1,
});
generateCity
Randomly selects a city from a list of predefined US cities.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateCity({
maxLength: 100,
seed: 1,
});
generateCountry
Randomly selects a country and by default, returns it as a 2-letter country code.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
generateFullName | bool | false | false | If true returns the full country name instead of the two character country code. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateCountry({
generateFullName: false,
seed: 1,
});
generateEmail
Generates a new randomized email address.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100000 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
emailType | string | 'uuidv4' | false | Specifies the type of email type to generate, with options including uuidv4 , fullname , or any . |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateEmail({
maxLength: 100000,
emailType: 'uuidv4',
seed: 1,
});
generateFirstName
Generates a random first name between 2 and 12 characters long.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateFirstName({
maxLength: 100,
seed: 1,
});
generateFloat64
Generates a random floating point number with a max precision of 17. Go float64 adheres to the IEEE 754 standard for double-precision floating-point numbers.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
randomizeSign | bool | false | false | A boolean indicating whether the sign of the float should be randomized. |
min | float64 | 1 | false | Specifies the minimum value for the generated float. |
max | float64 | 10000 | false | Specifies the maximum value for the generated float |
precision | int64 | false | An optional parameter that defines the number of significant digits for the generated float. | |
scale | int64 | false | An optional parameter that defines the number of decimal places for the generated float. | |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateFloat64({
randomizeSign: false,
min: 1,
max: 10000,
precision: 1,
scale: 1,
seed: 1,
});
generateFullAddress
Generates a randomly selected real full address that exists in the United States.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateFullAddress({
maxLength: 100,
seed: 1,
});
generateFullName
Generates a new full name consisting of a first and last name.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateFullName({
maxLength: 100,
seed: 1,
});
generateGender
Randomly generates one of the following genders: female (f), male (m), undefined (u), nonbinary (n).
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
abbreviate | bool | false | false | Shortens length of generated value to 1. |
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateGender({
abbreviate: false,
maxLength: 100,
seed: 1,
});
generateInt64
Generates a random int64 value with a default length of 4.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
randomizeSign | bool | false | false | A boolean indicating whether the sign of the float should be randomized. |
min | int64 | 1 | false | Specifies the minimum value for the generated int. |
max | int64 | 10000 | false | Specifies the maximum value for the generated int. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateInt64({
randomizeSign: false,
min: 1,
max: 10000,
seed: 1,
});
generateInt64PhoneNumber
Generates a new int64 phone number with a default length of 10.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateInt64PhoneNumber({
seed: 1,
});
generateInternationalPhoneNumber
Generates a new random international phone number including the + sign and no hyphens.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
min | int64 | 9 | false | Specifies the minimum value for the generated phone number. |
max | int64 | 15 | false | Specifies the maximum value for the generated phone number. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateInternationalPhoneNumber({
min: 9,
max: 15,
seed: 1,
});
generateIpAddress
Generates IPv4 or IPv6 addresses with support for different network classes.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100000 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
ipType | string | string(IpV4_Public) | false | IP type to generate. |
seed | int64 | false | Optional seed for deterministic generation |
Example
const newValue = neosync.generateIpAddress({
maxLength: 100000,
ipType: string(IpV4_Public),
seed: 1,
});
generateLastName
Generates a random last name.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateLastName({
maxLength: 100,
seed: 1,
});
generateRandomString
Generates a random string of alphanumeric characters..
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
min | int64 | 1 | false | Specifies the minimum length for the generated string. |
max | int64 | 100 | false | Specifies the maximum length for the generated string. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateRandomString({
min: 1,
max: 100,
seed: 1,
});
generateSHA256Hash
Generates a random SHA256 hash and returns it as a string.
Parameters
Config
Field | Type | Default | Required | Description |
---|
Example
const newValue = neosync.generateSHA256Hash({});
generateSSN
Generates a random social security numbers including the hyphens in the format xxx-xx-xxxx.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateSSN({
seed: 1,
});
generateState
Randomly selects a US state and by default, returns it as a 2-letter state code.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
generateFullName | bool | false | false | If true returns the full state name instead of the two character state code. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateState({
generateFullName: false,
seed: 1,
});
generateStreetAddress
Randomly generates a street address.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateStreetAddress({
maxLength: 100,
seed: 1,
});
generateStringPhoneNumber
Generates a random 10 digit phone number and returns it as a string with no hyphens.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
min | int64 | 9 | false | Specifies the minimum length for the generated phone number. |
max | int64 | 15 | false | Specifies the maximum length for the generated phone number. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateStringPhoneNumber({
min: 9,
max: 15,
seed: 1,
});
generateUnixTimestamp
Randomly generates a Unix timestamp that is in the past.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateUnixTimestamp({
seed: 1,
});
generateUsername
Randomly generates a username
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters. |
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateUsername({
maxLength: 100,
seed: 1,
});
generateUTCTimestamp
Randomly generates a UTC timestamp.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateUTCTimestamp({
seed: 1,
});
generateUUID
Generates a new UUIDv4 id.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
includeHyphens | bool | true | false | Determines whether the generated UUID should include hyphens. If set to true, the UUID will be formatted with hyphens (e.g., d853d251-e135-4fe4-a4eb-0aea6bfaf645). If set to false, the hyphens will be omitted (e.g., d853d251e1354fe4a4eb0aea6bfaf645). |
Example
const newValue = neosync.generateUUID({
includeHyphens: true,
});
generateZipcode
Generates a randomly selected US zipcode.
Parameters
Config
Field | Type | Default | Required | Description |
---|---|---|---|---|
seed | int64 | false | An optional seed value used to generate deterministic outputs. |
Example
const newValue = neosync.generateZipcode({
seed: 1,
});