Skip to content

rafaelrinaldi/truco

Repository files navigation

truco Build Status

Truncate strings.

Truco is a popular trick-taking card game originally from Valencia and Balearic Islands (Spain) and very popular in some countries like Brazil, Argentina, Paraguay and Italy.

Install

Via npm:

$ npm install truco --save

Via Bower:

$ bower install truco --save

Usage

var truco = require('truco');

truco('Lorem Ipsum', 5); // Lorem…
truco('Lorem Ipsum', 5, {ellipsis: '***'}); // Lorem***
truco('Lorem Ipsum', 5, {moonwalk: true}); // …Ipsum

API

truco(string, [limit], [options])

string

Required
Type: string

The string to be truncated.

limit

Type: number
Default: the total length of string

The position where the string should be truncated at.

options

Type: object

Custom options.

options.ellipsis

Type: string
Default:

The symbol that should be placed at the end/beginning of the truncated string.

options.moonwalk moonwalker

Type: boolean
Default: false

Wether or not to truncate string from the beginning to the end instead of the opposite.

License

MIT © Rafael Rinaldi

About

♠️ Truncate strings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published