0.1.0 • Published 4 years ago

camelcut v0.1.0

Weekly downloads
3
License
Unlicense
Repository
github
Last release
4 years ago

VersionBuild Status codecov

license JavaScript Style Guide


camelcut

Documentation

Cuts camel-cased strings somewhat shorter.

Take a camel case string and make a straight abbreviation.


Installation

Run npm install camelcut

Usage

Import:

import camelcut from 'camelcut'

Require:

const camelcut = require('camelcut')

Parameters

This module exports a single function with the ordered parameters

ArgumentTypeRequiredDescription
strstringYesThe source string
targetnumber = 7NoThe target output length
camelsnumber = 3NoThe number of camel-case substrings to include in the output.

Returns

Returns null if the parameters are not of the required types.
Returns empty string '' if str is empty string.

Examples

camelcut('SomeTextWrittenTogether', 7, 3) // 'SomTexW'  
camelcut('SomeTextWrittenTogether', 7, 4) // 'SoTeWrT'  
camelcut('Bright Ditch, Show Bulb Shining Loudly', 12, 6) // 'BrDiShBuShLo'  
camelcut('Bright Ditch?Show Bulb0Shining /Loudly', 12, 6) // 'BrDiShBuShLo'  

Testing

npm test

0.1.0

4 years ago