Skip to content

Commit

Permalink
docs: regionMatchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ram-Amoncar committed May 14, 2024
1 parent d72d29d commit bfb90f7
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ A lightweight and versatile String Utility Package for Node.js & Browser.
* [isKebabCase](#isKebabCase)
* [isCamelCase](#isCamelCase)
* [isPascalCase](#isPascalCase)
* [regionMatch](#regionmatch)
* [looseRegionMatch](#looseregionmatch)

(Coming Soon)
* [regionMatch](#)
* [looseRegionMatch](#)
* [isAlphaNumeric](#)
* [isAlpha](#)
* [reverse](#)
Expand Down Expand Up @@ -235,6 +235,34 @@ isPascalCase(' NoSpaceAllowed');; // false
isPascalCase('WithThe1234'); // false
```

### regionMatch
Compares two strings or regions for equality.
```js
// Matching identical strings
regionMatch('hello', 'hello'); // true

// Matching identical regions in strings
const str1 = { str: 'hello world', start: 0, end: 5 };
const str2 = { str: 'hello there', start: 0, end: 5 };
regionMatch(str1, str2); // true
// OR
regionMatch('hello world', 'hello there', 0, 5) // true

// Not matching regions
regionMatch('hello world', 'hello there', 6, 11); // false
```

### looseRegionMatch
Performs a loose comparison of two strings or regions for equality.
```js
// Loose matching identical strings
looseRegionMatch('hello', 'HeLLo'); // true

// Loose matching identical regions in strings
const str1 = { str: ' hellO world', start: 1, end: 6 };
const str2 = { str: 'HelLo there', start: 0, end: 5 };
looseRegionMatch(str1, str2); // true
```

## Build
```
Expand Down

0 comments on commit bfb90f7

Please sign in to comment.