Function splitName

  • Name

    splitName

    Description

    Splits a full name into firstName and lastName

    Returns

    Object with firstName and lastName

    Example

    splitName('Mary Jane Smith') // { firstName: 'Mary Jane', lastName: 'Smith' }
    splitName('Alice') // { firstName: 'Alice', lastName: '' }
    splitName('John Doe') // { firstName: 'John', lastName: 'Doe' }
    splitName('') // { firstName: '', lastName: '' }

    Parameters

    • fullName: string

    Returns {
        firstName: string;
        lastName: string;
    }

    • firstName: string
    • lastName: string

Generated using TypeDoc