2.0.1 • Published 3 years ago

array-semantic-join v2.0.1

Weekly downloads
271
License
MIT
Repository
github
Last release
3 years ago

Kontentino - Making social media a piece of cake

array-semantic-join by Kontentino

npm.io npm NPM

Helper function whose input is an array and output is a semantic string with joined items of the input array.

Installation

$ npm install array-semantic-join or $ yarn add array-semantic-join

Usage

import arraySemanticJoin from 'array-semantic-join';

...
    const userNames = ['John', 'Jane', 'Patrick'];

    ...
    <span>
        {arraySemanticJoin(userNames)} // output: "John, Jane and Patrick"
    </span>

    <span>
        {arraySemanticJoin(userNames, { word: 'a' } )} // output: "John, Jane a Patrick"
    </span>

    <span>
        {arraySemanticJoin(userNames, { word: 'und' } )} // output: "John, Jane und Patrick"
    </span>
...

Docs

Function
arraySemanticJoin(inputArray: Array, options?: { word: String }): String