Join to a string with one space between strings
Many times I need to joining strings in different projects.
For example, make a full name for users/customers with a prefix or without it. But not all fields customer filled. Then you joined string with space, many times we have an incorrect string with space inside, before, and after a sentence. It is not a big problem because simple function decided this problem. But it happened many times, and I decided to make this library for more comfortable implement this functionality to any projects.
For install function into your project, you need run command:
npm install --save @serslon/concat-string
or
yarn add @serslon/concat-string
You can use many ways for execute this function:
concatString(par1, par2, par3,...)
concatString([par1, par2, par3])
concatString([par1, par2, par3], par4)
.
const concatString = require('@serslon/concat-string');
...
const fullName = concatString(userProfile.prefix, userProfile.firstName, userProfile.lastName);
...
import concatString from '@serslon/concat-string';
...
const fullName = concatString(userProfile.prefix, userProfile.firstName, userProfile.lastName);
...