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

string-capitalizer

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-capitalizer - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

15

lib/stringUtility/stringManipulator.js

@@ -5,3 +5,2 @@ export class StringManipulator {

constructor (newString) {
this.#validateString(newString)
this.#stringToBeManipulated = newString

@@ -15,2 +14,6 @@ }

capitalizeString() {
if (this.#stringToBeManipulated === null || typeof(this.#stringToBeManipulated) !== 'string') {
throw new Error('Invalid string')
}
const capitalizedString = this.#stringToBeManipulated.charAt(0).toUpperCase() + this.#stringToBeManipulated.slice(1)

@@ -20,12 +23,2 @@

}
#validateString(newString) {
if (newString === null || typeof(newString) !== 'string') {
throw new Error('Invalid string')
}
if (newString.length === 0) {
throw new Error('String cannot be empty')
}
}
}
{
"name": "string-capitalizer",
"version": "1.0.4",
"version": "1.0.5",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "type": "module",

@@ -7,6 +7,13 @@ # String Capitalizer

capitalizeString() method capitalizes the first letter of a string and returns the capitalized string.
If invalid string is inputted, 'invalid string'-error will be thrown.
### Use instructions
Start by importing StringManipulator. Create a new instance of StringManipulator and invoke the method you wish to use.
```javascript
import StringManipulator from 'string-capitalizer'
const stringManipulator = new StringManipulator()
const stringManipulator = new StringManipulator(stringToManipulate)

@@ -18,7 +25,6 @@ const capitalizedString = stringManipulator.capitalizeString('hello world')

capitalizeString() method capitalizes the first letter of a string and returns the capitalized string.
If invalid string is inputted, 'invalid string'-error will be thrown.
### Disclaimer
### Use instructions
This library is still in development and is not yet ready for production use. Use at your own risk.
Start by importing StringManipulator. Create a new instance of StringManipulator (new StringManipulator()) and invoke the method you wish to use.
It is a practice project for learning purposes.
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