A simple utility package with basic functions for greeting, math operations, and string manipulation.
npm install npmpackage
const { greet, add, capitalize } = require('npmpackage');
// Greeting function
console.log(greet('World')); // "Hello, World!"
console.log(greet('Alice', 'Hi')); // "Hi, Alice!"
// Math function
console.log(add(5, 3)); // 8
// String manipulation
console.log(capitalize('hello world')); // "Hello World"
Greets a person with a customizable message.
-
name
(string): The name of the person to greet -
greeting
(string, optional): Custom greeting message (default: "Hello")
Returns a formatted greeting string.
Calculates the sum of two numbers.
-
a
(number): First number -
b
(number): Second number
Returns the sum of the two numbers.
Capitalizes the first letter of each word in a string.
-
str
(string): The string to capitalize
Returns the capitalized string.
npm test
ISC
arsh
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request