CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-uppercamelcase

Convert a dash/dot/underscore/space separated string to UpperCamelCase

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

UpperCamelCase

UpperCamelCase is a lightweight JavaScript utility for converting dash, dot, underscore, or space separated strings to UpperCamelCase format. It transforms strings like 'foo-bar' into 'FooBar' by building upon the popular camelcase library and capitalizing the first letter.

Package Information

  • Package Name: uppercamelcase
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install uppercamelcase

Core Imports

const upperCamelCase = require('uppercamelcase');

Basic Usage

const upperCamelCase = require('uppercamelcase');

// Convert dash-separated strings
upperCamelCase('foo-bar');
//=> 'FooBar'

// Convert underscore-separated strings  
upperCamelCase('foo_bar');
//=> 'FooBar'

// Convert dot-separated strings
upperCamelCase('foo.bar');
//=> 'FooBar'

// Convert space-separated strings
upperCamelCase('foo bar');
//=> 'FooBar'

// Handle multiple arguments
upperCamelCase('foo', 'bar', 'baz');
//=> 'FooBarBaz'

Capabilities

String Conversion

Converts strings with various separators to UpperCamelCase format.

/**
 * Convert strings to UpperCamelCase format
 * @param {...string} arguments - Variable number of strings to convert
 * @returns {string} The converted UpperCamelCase string
 */
function upperCamelCase(...arguments): string;

Parameters:

  • ...arguments (string): Variable number of string arguments
    • Each string may contain dash (-), dot (.), underscore (_), or space ( ) separators
    • Multiple consecutive separators are handled gracefully
    • Leading and trailing separators are processed correctly
    • Empty strings and separator-only strings are supported

Returns:

  • string: The input string(s) converted to UpperCamelCase format
    • First character is always uppercase
    • Each word boundary (after separators) is capitalized
    • Separators are removed from the output
    • Multiple arguments are concatenated and processed together

Behavior Details:

  • Uses the camelcase library internally for initial conversion
  • Capitalizes the first character of the camelCase result
  • Supports various separator combinations: --foo--bar--'FooBar'
  • Handles mixed casing input: 'FOO-BAR''FooBar'
  • Preserves single separator characters: '-''-'
  • Returns empty string for separator-only inputs: '--'''

Usage Examples:

// Single string conversions
upperCamelCase('foo-bar-baz');        // 'FooBarBaz'
upperCamelCase('__foo__bar__');       // 'FooBar'
upperCamelCase('--foo.bar');          // 'FooBar'
upperCamelCase('  foo  bar  ');       // 'FooBar'

// Multiple argument conversion
upperCamelCase('foo', 'bar');         // 'FooBar'
upperCamelCase('foo', '-bar', 'baz'); // 'FooBarBaz'

// Edge cases
upperCamelCase('');                   // ''
upperCamelCase('-');                  // '-'
upperCamelCase('--');                 // ''
upperCamelCase('FOO');                // 'Foo'
upperCamelCase('fooBar');             // 'FooBar'

// Complex separator patterns
upperCamelCase('--foo--bar--');       // 'FooBar'
upperCamelCase('__foo__bar__');       // 'FooBar'
upperCamelCase('..foo..bar..');       // 'FooBar'
Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/uppercamelcase@3.0.x
Publish Source
CLI
Badge
tessl/npm-uppercamelcase badge