You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@full-pack/string-pack

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@full-pack/string-pack - npm Package Compare versions

Comparing version

to
0.4.0

29

dist/index.d.ts

@@ -94,3 +94,3 @@ /**

* - Provide `false` or an empty string (`''`) for no separator.
* - Provide `true` for a space (' ') as the separator.
* - Provide `true` for a space (`' '`) as the separator.
* @param {string[]} strings - The array of strings to merge.

@@ -110,6 +110,27 @@ * @returns {string} The merged string.

* - Provide `false` or an empty string (`''`) for no separator.
* - Provide `true` for a space (' ') as the separator.
* - Provide `true` for a space (`' '`) as the separator.
*/
declare function merge(sep: string | boolean, ...strings: string[]): string;
declare function merge(sep: string | boolean, ...strings: string[] | string[][]): string;
export { compare, looseCompare, merge, padBidirectional, padEnd, padStart };
/**
* Capitalizes the first letter of a word in a string.
* @param {string} str - The input string.
* @returns {string} The string with the first letter capitalized.
* @example
* capitalizeInitial('hello'); // 'Hello'
* capitalizeInitial(':> hello'); // ':> Hello'
*/
declare function capitalizeInitial(str: string): string;
/**
* Capitalizes the first letter of each word in a given string.
* @param {string} str - The input string containing words to be capitalized.
* @returns {string} Returns the input string with the first letter of each word capitalized.
* @example
* capitalizeWords('hello world');
* // 'Hello World'
* capitalizeWords('Sphinx of black quartz:-judge my vow');
* // 'Sphinx Of Black Quartz:-Judge My Vow'
*/
declare function capitalizeWords(str: string): string;
export { capitalizeInitial, capitalizeWords, compare, looseCompare, merge, padBidirectional, padEnd, padStart };

@@ -23,2 +23,4 @@ "use strict";

__export(src_exports, {
capitalizeInitial: () => capitalizeInitial,
capitalizeWords: () => capitalizeWords,
compare: () => compare,

@@ -93,2 +95,3 @@ looseCompare: () => looseCompare,

function merge(sep, ...strings) {
strings = strings.flat();
for (let i = 0, val = ""; i < strings.length; i++) {

@@ -104,4 +107,14 @@ if (strings.length - 1 === i)

}
// src/case.ts
function capitalizeInitial(str) {
return str.replace(/\b\w/, (char) => char.toUpperCase());
}
function capitalizeWords(str) {
return str.replace(/\b\w/g, (char) => char.toUpperCase());
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
capitalizeInitial,
capitalizeWords,
compare,

@@ -108,0 +121,0 @@ looseCompare,

2

package.json
{
"name": "@full-pack/string-pack",
"version": "0.3.0",
"version": "0.4.0",
"description": "A lightweight and versatile String Utility Package for Node.js & Browser.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -23,9 +23,9 @@ # @full-pack/string-pack

* [looseCompare](#loosecompare)
* [capitalizeInitial](#capitalizeinitial)
* [capitalizeWords](#capitalizewords)
(Coming Soon)
* [remove](#)
* [looseRemove](#)
* [caseConversion](#)
* [regionMatch](#)
* [looseRegionMatch](#)
* [caseCoversion](#)
* And Much More.

@@ -116,2 +116,18 @@ * [Build](#build)

### capitalizeInitial
Capitalizes the first letter of a word in a string.
```js
capitalizeInitial('hello'); // 'Hello'
capitalizeInitial(':> hello'); // ':> Hello'
```
### capitalizeWords
Capitalizes the first letter of each word in a given string.
```js
capitalizeWords('hello world'); // 'Hello World'
capitalizeWords('Sphinx of black quartz:-judge my vow'); // 'Sphinx Of Black Quartz:-Judge My Vow'
```
## Build

@@ -118,0 +134,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet