Take a camel case string and make a straight abbreviation.
Run npm install camelcut
import camelcut from 'camelcut'
const camelcut = require('camelcut')
This module exports a single function with the ordered parameters
Argument | Type | Required | Description |
---|---|---|---|
str |
string |
Yes | The source string |
target |
number = 7 |
No | The target output length |
camels |
number = 3 |
No | The number of camel-case substrings to include in the output. |
Returns null if the parameters are not of the required types.
Returns empty string ''
if str
is empty string.
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'
npm test