JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 119146
  • Score
    100M100P100Q173883F
  • License MIT

Truncate text and keep urls safe

Package Exports

  • truncate

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (truncate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Truncate Build Status Downloads

Truncate text and keeps urls safe.

NPM

Install the module with: npm install truncate

Usage

// Browser
String.truncate("1234 http://google.com hey :)", 2) === "12..."
// NodeJS
> truncate = require('truncate');
> truncate("1234 http://google.com hey :)", 4);
"1234..."
> truncate("1234 http://google.com hey :)", 4, {ellipsis:null}); // or ellipsis:''
"1234"
> truncate("1234 http://google.com hey :)", 6);
"1234 http://google.com..."
> truncate("1234 http://google.com hey :)", 100);
"1234 http://google.com hey :)"

Changelog

Donate Bitcoins

License

Copyright (c) 2014 Francois-Guillaume Ribreau Licensed under the MIT license.