All Projects → shinnn → array-to-sentence

shinnn / array-to-sentence

Licence: ISC License
Join all elements of an array and create a human-readable string

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to array-to-sentence

arraync
Async Array methods polyfills
Stars: ✭ 16 (-50%)
Mutual labels:  array
array-validation
Validation utilities for array structure
Stars: ✭ 14 (-56.25%)
Mutual labels:  array
pixiedust-facebook-analysis
A Jupyter notebook that uses the Watson Visual Recognition and Natural Language Understanding services to enrich Facebook Analytics and uses Cognos Dashboard Embedded to explore and visualize the results in Watson Studio
Stars: ✭ 42 (+31.25%)
Mutual labels:  natural-language
ra-ra
A C++20 array / expression template library with some J/APL features
Stars: ✭ 22 (-31.25%)
Mutual labels:  array
SNAP
Easy data format saving and loading for GameMaker Studio 2.3.2
Stars: ✭ 49 (+53.13%)
Mutual labels:  array
array-api-comparison
Data and tooling to compare the API surfaces of various array libraries.
Stars: ✭ 46 (+43.75%)
Mutual labels:  array
rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (+112.5%)
Mutual labels:  array
ienumerable
Deep immutable, Lightweight Enumerable with superpowers
Stars: ✭ 63 (+96.88%)
Mutual labels:  array
alvito
Alvito - An Algorithm Visualization Tool for Python
Stars: ✭ 52 (+62.5%)
Mutual labels:  array
array-access
PHP multi array access
Stars: ✭ 23 (-28.12%)
Mutual labels:  array
book-sentences
A collection of sentences from different books.
Stars: ✭ 43 (+34.38%)
Mutual labels:  sentence
array-diff-multidimensional
Compare the difference between two multidimensional arrays in PHP
Stars: ✭ 60 (+87.5%)
Mutual labels:  array
Algorithms
✨ a bunch of algorithms in a bunch of languages ✨
Stars: ✭ 55 (+71.88%)
Mutual labels:  array
MCUCapture
Utility for plotting array data from MCU RAM
Stars: ✭ 22 (-31.25%)
Mutual labels:  array
lancaster-stemmer
Lancaster stemming algorithm
Stars: ✭ 22 (-31.25%)
Mutual labels:  natural-language
nli-go
Natural Language Interface in GO, a semantic parser and execution engine.
Stars: ✭ 20 (-37.5%)
Mutual labels:  natural-language
php-traits
A collection of (more or less) useful traits for PHP7.2+
Stars: ✭ 17 (-46.87%)
Mutual labels:  array
retext-profanities
plugin to check for profane and vulgar wording
Stars: ✭ 34 (+6.25%)
Mutual labels:  natural-language
array-mixer
Powerful, super tiny and easy to use lib to reorder your javascript arrays.
Stars: ✭ 32 (+0%)
Mutual labels:  array
rrbit-js
No description or website provided.
Stars: ✭ 11 (-65.62%)
Mutual labels:  array

array-to-sentence

npm version Build Status Coverage Status

Join all elements of an array and create a human-readable string

arrayToSentence(['foo', 'bar', 'baz', 'qux']); //=> 'foo, bar, baz and qux'

Installation

Use npm.

npm install array-to-sentence

API

import arrayToSentence from 'array-to-sentence';

arrayToSentence(array [, options])

array: Array<any>
options: Object
Return: string

It joins all elements of an array, and returns a string in the form A, B, ... and X.

arrayToSentence(['one', 'two', 3]); //=> 'one, two and 3'
arrayToSentence(['one', 'two']); //=> 'one and two'
arrayToSentence(['one']); //=> 'one'

arrayToSentence([]); //=> ''

options.separator

Type: string
Default: ', '

Set the separator string of each word.

options.lastSeparator

Type: string
Default: ' and '

Set the separator string before the last word.

arrayToSentence(['A', 'B', 'C'], {
  separator: '-',
  lastSeparator: '-'
}); //=> 'A-B-C'

arrayToSentence(['Earth', 'Wind', 'Fire'], {
  lastSeparator: ' & '
}); //=> 'Earth, Wind & Fire'

License

ISC License © 2018 Shinnosuke Watanabe

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].