teljari 1.0.0

Print arrays with commas and conjunctions for human consumption.
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 6.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.03 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • stscoundrel/teljari-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • stscoundrel

Teljari

Print arrays with commas and conjunctions for human consumption.

join(',') might bring you far when printing contents for humans. Yet you often want the last entry not be preceded by comma, but by the word 'and' or maybe 'or'. Teljari does this for you.

Rust version of original JS/TS lib.

Install

Add this to your Cargo.toml:

[dependencies]
teljari = "1.0.0"

Usage

use teljari::join_with_conj;

let list: Vec<&str> = vec!("Me", "Myself", "I");
let conj: &str = "and";
let result = join_with_conj(&list, &conj);


println!!("{}", result); // Me, Myself and I

What's in the name?

"Teljari" comes from Old Norse verb for "telja" (to count, tell, tally). It has same origins as English verb "tell". Verb + ari structure, which makes it a noun, "someone who tells". Teljari tells what's in your array as a human would want to hear it.