Skip to content

Main content

Concatenate Two Strings Source Code

Browse the implementation files for Concatenate Two Strings.
tool.ts typescript
// Tool: Concatenate Two Strings

import { concatenateTwoStrings as concatenatePortableStrings } from '@tool.io/tools/text/concatenate-two-strings';

export const concatenateTwoStrings = (
  firstInput: unknown,
  secondInput: unknown,
): string => {
  if (typeof firstInput !== 'string' || typeof secondInput !== 'string') {
    return '';
  }

  return concatenatePortableStrings(firstInput, secondInput);
};

export const Tool: TypeTool = {
  name: 'Concatenate Two Strings',
  slug: 'text/concatenate-two-strings',
  intro: 'Join two strings without adding a separator.',
  tool: concatenateTwoStrings,
  i: [
    {
      example: 'tool',
      label: 'First String',
      placeholder: 'Enter the first string',
      type: 'text',
    },
    {
      example: '.io',
      label: 'Second String',
      placeholder: 'Enter the second string',
      type: 'text',
    },
  ],
  o: [
    {
      example: 'tool.io',
      label: 'Combined String',
      placeholder: 'Combined string will appear here...',
      type: 'text',
    },
  ],
};

export default Tool;

Description

Browse the implementation files for Concatenate Two Strings.

References

  1. Tool.io on GitHub
  2. Tool.io TypeScript tools library

Similar or alternative tools