Socket
Socket
Sign inDemoInstall

@toolz/capitalize

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @toolz/capitalize

A JavaScript utility for capitalizing strings


Version published
Weekly downloads
4
Maintainers
1
Install size
99.6 kB
Created
Weekly downloads
 

Readme

Source

capitalize

capitalize is a JavaScript utility for capitalizing strings.

Usage

After installation, import the package:

import { capitalize } from '@toolz/capitalize';

.firstLetter()

Capitalizes the first letter - and only the first letter - in the string.

const API = {
   arguments: {
      string: {
         required,
         format: 'non-empty string',
      },
   },
   returns: string,
}

Examples

const florida = 'florida';
const country = 'united states of america';
console.log(capitalize.firstLetter(florida)); // Florida
console.log(capitalize.firstLetter(country)); // United states of america

.everyFirstLetter()

Splits the string by spaces (' '), treating each resulting value as a "word". It then capitalizes the first letter in each word.

const API = {
   arguments: {
      string: {
         required,
         format: 'non-empty string',
      },
   },
   returns: string,
}

Examples

const florida = 'florida';
const country = 'united states of america';
console.log(capitalize.everyFirstLetter(florida)); // Florida
console.log(capitalize.everyFirstLetter(country)); // United States Of America

Keywords

FAQs

Last updated on 03 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc