The lodash method _.startCase exported as a module for converting strings to start case format
npx @tessl/cli install tessl/npm-lodash.startcase@3.1.0Lodash StartCase provides the startCase method from the Lodash utility library as a standalone module. The startCase function converts strings to start case format, where each word is capitalized and separated by spaces. It handles various input formats including camelCase, snake_case, kebab-case, and other delimited strings, transforming them into properly formatted title case text.
npm install lodash.startcasevar startCase = require('lodash.startcase');For ES modules (if supported):
import startCase from 'lodash.startcase';var startCase = require('lodash.startcase');
// Convert camelCase
var result1 = startCase('fooBar');
// => 'Foo Bar'
// Convert kebab-case
var result2 = startCase('--foo-bar');
// => 'Foo Bar'
// Convert snake_case
var result3 = startCase('__foo_bar__');
// => 'Foo Bar'
// Convert space-separated
var result4 = startCase('foo bar');
// => 'Foo Bar'
// Handle all caps (converted to proper case)
var result5 = startCase('FOO BAR');
// => 'Foo Bar'Converts strings to start case format where each word is capitalized and separated by spaces.
/**
* Converts string to start case.
* @param {string} [string=''] - The string to convert
* @returns {string} Returns the start cased string
*/
function startCase(string)Usage Examples:
var startCase = require('lodash.startcase');
// Basic conversions
startCase('fooBar');
// => 'Foo Bar'
startCase('foo-bar');
// => 'Foo Bar'
startCase('foo_bar');
// => 'Foo Bar'
startCase('foo bar');
// => 'Foo Bar'
// Handles various delimiters
startCase('--foo-bar--');
// => 'Foo Bar'
startCase('__foo_bar__');
// => 'Foo Bar'
// All caps (converted to proper case)
startCase('FOO BAR');
// => 'Foo Bar'
startCase('fOoBaR');
// => 'F Oo Ba R'
// Empty and null handling
startCase('');
// => ''
startCase();
// => ''
// Accented characters
startCase('café-münü');
// => 'Cafe Menu'
// Numbers and special characters
startCase('foo2bar');
// => 'Foo 2 Bar'
startCase('foo-bar-123');
// => 'Foo Bar 123'The startCase function: