truco
v1.3.1
Published
Truncate strings.
Downloads
13
Maintainers
Readme
truco
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
Type: boolean
Default: false
Wether or not to truncate string from the beginning to the end instead of the opposite.
License
MIT © Rafael Rinaldi