šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.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
Version published
Weekly downloads
1.3K
3.9%
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

atom

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