Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@huyennbl/capitalize-word

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huyennbl/capitalize-word

Capitalize matched word in a string

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

capitalize-word

Installation

npm install @huyennbl/capitalize-word

Usage

capitalizeWord(str, word)

  • 1st argument: input string
  • 2nd argument: word to be capitalized in str
  • Returns a new string with all the matched word (case-insensitive) in str, having first letter capitalized, and the remaining characters of each word are in lowercase.
  • Partially matches are ignore, e.g.: capitalizeWord('github', 'git') will still return 'github')
import { capitalizeWord } from '@huyennbl/capitalize-word'

capitalizeWord('frank talks about it frankly', 'frank');
// 'Frank talks about it frankly'
// => first 'frank' is fully match, so capitalized. 'frankly' is partially match, hence ignored.

capitalizeWord('Lorem ipsum...', 'ipsUM')
// 'Lorem Ipsum...'

Keywords

FAQs

Package last updated on 11 Oct 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc