Truncate the unsecured form string, cutting the independent string of required position.
Install
Install all functions of strman
yarn add strman
or just the truncate function
yarn add strman.truncate
Usage
import { truncate } from 'strman'
// OR
import truncate from 'strman.truncate'
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
String | Value will be truncated unsecurely. |
||
length |
Number | Size of the returned string. |
||
_append |
String |
<optional> |
'' | Value that will be added to the end of the return string. |
- Source:
Returns:
String truncated unsafely.
- Type
- String
Example
const title = 'A Javascript string manipulation library.'
truncate(title, 16, '...')
// => 'A Javascript ...'