Seed CLISeed CLI

Strings

String manipulation, case conversion, and pluralization.

bun add @seedcli/strings

The strings module provides case conversion, pluralization, and common string manipulation utilities.

Case Conversion

seed.strings.camelCase('hello world')      // 'helloWorld'
seed.strings.pascalCase('hello world')     // 'HelloWorld'
seed.strings.snakeCase('helloWorld')       // 'hello_world'
seed.strings.kebabCase('helloWorld')       // 'hello-world'
seed.strings.constantCase('helloWorld')    // 'HELLO_WORLD'
seed.strings.titleCase('hello world')      // 'Hello World'
seed.strings.sentenceCase('helloWorld')    // 'Hello world'
seed.strings.upperFirst('hello')           // 'Hello'
seed.strings.lowerFirst('Hello')           // 'hello'

Pluralization

seed.strings.plural('user')       // 'users'
seed.strings.plural('person')     // 'people'
seed.strings.plural('category')   // 'categories'

seed.strings.singular('users')    // 'user'
seed.strings.singular('people')   // 'person'
seed.strings.singular('categories') // 'category'

seed.strings.isPlural('users')    // true
seed.strings.isSingular('user')   // true

String Manipulation

Truncate

seed.strings.truncate('Hello, World!', 8)         // 'Hello...'
seed.strings.truncate('Hello, World!', 8, ' >>>') // 'Hell >>>'

Padding

seed.strings.pad('hi', 10)           // '    hi    '
seed.strings.padStart('42', 5, '0')  // '00042'
seed.strings.padEnd('hi', 10, '.')   // 'hi........'

Repeat & Reverse

seed.strings.repeat('ab', 3)  // 'ababab'
seed.strings.reverse('hello') // 'olleh'

Checks

seed.strings.isBlank('')          // true
seed.strings.isBlank('  ')       // true
seed.strings.isBlank(null)       // true
seed.strings.isBlank(undefined)  // true
seed.strings.isBlank('hello')    // false

seed.strings.isNotBlank('hello') // true

seed.strings.isEmpty('')         // true
seed.strings.isEmpty(null)       // true
seed.strings.isEmpty('  ')      // false (has whitespace)

seed.strings.isNotEmpty('  ')   // true

Simple Templating

Replace {{placeholders}} in strings:

seed.strings.template('Hello, {{name}}! Welcome to {{place}}.', {
  name: 'Alice',
  place: 'Wonderland',
})
// => 'Hello, Alice! Welcome to Wonderland.'

API Reference

FunctionSignatureDescription
camelCase(str: string) => stringConvert to camelCase
pascalCase(str: string) => stringConvert to PascalCase
snakeCase(str: string) => stringConvert to snake_case
kebabCase(str: string) => stringConvert to kebab-case
constantCase(str: string) => stringConvert to CONSTANT_CASE
titleCase(str: string) => stringConvert to Title Case
sentenceCase(str: string) => stringConvert to Sentence case
upperFirst(str: string) => stringCapitalize first character
lowerFirst(str: string) => stringLowercase first character
plural(str: string) => stringPluralize a word
singular(str: string) => stringSingularize a word
isPlural(str: string) => booleanCheck if plural
isSingular(str: string) => booleanCheck if singular
truncate(str: string, length: number, suffix?: string) => stringTruncate with suffix
pad(str: string, length: number, char?: string) => stringCenter pad
padStart(str: string, length: number, char?: string) => stringLeft pad
padEnd(str: string, length: number, char?: string) => stringRight pad
repeat(str: string, count: number) => stringRepeat string
reverse(str: string) => stringReverse string
isBlank(str: string | null | undefined) => booleanCheck if blank
isNotBlank(str: string | null | undefined) => booleanCheck if not blank
isEmpty(str: string | null | undefined) => booleanCheck if empty
isNotEmpty(str: string | null | undefined) => booleanCheck if not empty
template(str: string, data: Record<string, string>) => stringSimple templating

On this page