/react-delimiter

Array Delimiter(Deliminate last number or string with "and" or "or")

Primary LanguageJavaScriptMIT LicenseMIT

react-delimiter

npm npm npm npm

Array Delimiter(Deliminate last number or string with "and" or "or")

Demo

Click Here

Installation

  1. Install React Delimiter as a dependency
# NPM
$ npm install react-delimiter
  1. Import the react-delimiter module
// ES6
import { delimiter } from "react-delimiter";

Example

import { delimiter } from 'react-delimiter';

render() {
    <h4>{delimiter([1, 2, 3], "and")}</h4>
  }

Parameters

{
    array=[1,2,3],
    string= "and" or "or"
}
Input Output
delimiter([1, 2, 3], "and") 1, 2 and 3
delimiter([1, 2, 3], "or") 1, 2 or 3
delimiter([1, 2], "or") 1 or 2
delimiter([1, 2], "and") 1 and 2
delimiter([1], "or") 1
delimiter([1], "and") 1

Parameters Details

  • array - Array of Numbers or Strings
  • String - String (Deliminate number or string by this string)