-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80d9156
commit 59dc221
Showing
13 changed files
with
416 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Is | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const pattern = "foo*"; | ||
const value = "foobar"; | ||
const result = JStr.of(value).is(pattern); | ||
console.log(result); // Outputs: true | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const pattern = "baz*"; | ||
const value = "foobar"; | ||
const result = JStr.is(pattern, value); | ||
|
||
console.log(result); // Outputs: false | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# isJson | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const validJsonString = '{"key": "value"}'; | ||
const result = JStr.of(validJsonString).isJson(); | ||
console.log(result); // Outputs: true | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const invalidJsonString = '{key: "value"}'; // Note: keys must be in double quotes for valid JSON | ||
const result = JStr.of(invalidJsonString).isJson(); | ||
|
||
console.log(result); // Outputs: false | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const validJsonString = '{"key": "value"}'; | ||
const result = JStr.isJson(validJsonString); | ||
|
||
console.log(result); // Outputs: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# isUrl | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("http://example.com").isUrl(); | ||
console.log(result); // Outputs: true | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("beautifull").isUrl(); | ||
|
||
console.log(result); // Outputs: false | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.isUrl("https://www.example.com/page"); | ||
|
||
console.log(result); // Outputs: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# limit | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("Lorem ipsum dolor sit amet").limit(10).toString(); | ||
console.log(result); // Outputs: Lorem ipsu... | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("Lorem ipsum dolor sit amet") | ||
.limit(10, "***") | ||
.toString(); | ||
|
||
console.log(result); // Outputs: Lorem ipsu*** | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.limit("Lorem ipsum dolor sit amet", 10); | ||
|
||
console.log(result); // Outputs: Lorem ipsu... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# remove | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("Arkansas is quite beautiful!") | ||
.remove("quite ") | ||
.toString(); | ||
console.log(result); // Outputs: Arkansas is beautiful! | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.remove( | ||
"e", | ||
"Peter Piper picked a peck of pickled peppers." | ||
); | ||
|
||
console.log(result); // Outputs: Ptr Pipr pickd a pck of pickld ppprs. | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.