项目作者: kontentino

项目描述 :
Helper function whose input is an array and output is a semantic string with joined items of the input array.
高级语言: JavaScript
项目地址: git://github.com/kontentino/array-semantic-join.git
创建时间: 2019-11-13T08:32:49Z
项目社区:https://github.com/kontentino/array-semantic-join

开源协议:MIT License

下载


Kontentino - Making social media a piece of cake

array-semantic-join by Kontentino


@kontentino/array-semantic-join"">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

  1. import arraySemanticJoin from 'array-semantic-join';
  2. ...
  3. const userNames = ['John', 'Jane', 'Patrick'];
  4. ...
  5. <span>
  6. {arraySemanticJoin(userNames)} // output: "John, Jane and Patrick"
  7. </span>
  8. <span>
  9. {arraySemanticJoin(userNames, { word: 'a' } )} // output: "John, Jane a Patrick"
  10. </span>
  11. <span>
  12. {arraySemanticJoin(userNames, { word: 'und' } )} // output: "John, Jane und Patrick"
  13. </span>
  14. ...

Docs

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