Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abbreviate

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abbreviate

abbreviate strings in style of R: Abbreviate

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
970
increased by0.21%
Maintainers
1
Weekly downloads
 
Created
Source

abbreviate

abbreviate strings in style of R: Abbreviate

Install

npm install --save abbreviate

Usage

abbreviate = require('abbreviate')

// abbreviate(string, opts)
// opts:
// length (default 3)
// keepSeparators (default false) - keeps all separators between words
// strict (default true) - if false, overwrites length to include all words
abbr = abbreviate('Some Important String', {length: 8})
// abbr: 'SmImpStr'
// which chars will be included for varying length?
// [S,o ,m,e ,  ,I,m,p,o ,r,t ,a ,n ,t ,  ,S,t,r,i ,n ,g ]
// [1,16,6,17,20,2,7,8,18,9,10,19,11,12,21,3,4,5,13,14,15]

What it does

In this order:

  • trims the string
  • removes word separators (/\s\-_,/) (unless keepSeparators is true)
  • removes lowercase vocals
  • removes lowercase consonants
  • removes uppercase vocals
  • removes uppercase consonants and numbers
  • removes word beginnings (looks for digraphs, trigraphs and blends)

License

Copyright (c) 2015 Paul Pflugradt Licensed under the MIT license.

Keywords

FAQs

Package last updated on 28 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc