Skip to content

Commit

Permalink
Doc updated and test
Browse files Browse the repository at this point in the history
  • Loading branch information
Waqas-Jani committed Jan 3, 2024
1 parent 80d9156 commit 59dc221
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 24 deletions.
16 changes: 8 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ or relevant libraries. Common operations include concatenation, searching, repla
| ✔✔ `JStr.headline` | Converts the string to a headline format. | [Documentation](docs/Headline.md) |
| ✔✔ `JStr.capitalize` | Converts the string to a capitalize format. | [Documentation](docs/Capitalize.md) |
| `JStr.inlineMarkdown` | Converts the string to inline Markdown format. | [Documentation](docs/InlineMarkdown.md) |
|`JStr.is` | Checks if the string is equal to a specified value. | [Documentation](docs/Is.md) |
| `JStr.is` | Checks if the string is equal to a specified value. | [Documentation](docs/Is.md) |
| ✔✔ `JStr.isAscii` | Checks if the string contains only ASCII characters. | [Documentation](docs/IsAscii.md) |
|`JStr.isJson` | Checks if the string is a valid JSON format. | [Documentation](docs/IsJson.md) |
| `JStr.isJson` | Checks if the string is a valid JSON format. | [Documentation](docs/IsJson.md) |
|`JStr.isUlid` | Checks if the string is a valid ULID (Universally Unique Lexicographically Sortable Identifier). | [Documentation](docs/IsUlid.md) |
|`JStr.isUrl` | Checks if the string is a valid URL. | [Documentation](docs/IsUrl.md) |
| `JStr.isUrl` | Checks if the string is a valid URL. | [Documentation](docs/IsUrl.md) |
|`JStr.isUuid` | Checks if the string is a valid UUID (Universally Unique Identifier). | [Documentation](docs/IsUuid.md) |
|`JStr.kebab` | Converts the string to kebab case. | [Documentation](docs/Kebab.md) |
|`JStr.lcfirst` | Converts the first character of the string to lowercase. | [Documentation](docs/Lcfirst.md) |
| ✔✔ `JStr.length` | Returns the length of the string. | [Documentation](docs/Length.md) |
|`JStr.limit` | Limits the length of the string to a specified number of characters. | [Documentation](docs/Limit.md) |
| `JStr.limit` | Limits the length of the string to a specified number of characters. | [Documentation](docs/Limit.md) |
| ✔✔ `JStr.lower` | Converts the string to lowercase. | [Documentation](docs/Lower.md) |
|`JStr.ltrim` | Removes whitespace from the beginning of the string. | [Documentation](docs/Ltrim.md) |
| `JStr.markdown` | Converts the string to Markdown format. | [Documentation](docs/Markdown.md) |
Expand Down Expand Up @@ -172,18 +172,18 @@ clarity and conciseness in your code.
| ✔✔ `headline` | Converts the string to a headline format. | [Documentation](docs/Headline.md) |
| ✔✔ `capitalize` | Converts the string to a capitalize format. | [Documentation](docs/Capitalize.md) |
| `inlineMarkdown` | Converts the string to inline Markdown format. | [Documentation](docs/InlineMarkdown.md) |
|`is` | Checks if the string is equal to a specified value. | [Documentation](docs/Is.md) |
| `is` | Checks if the string is equal to a specified value. | [Documentation](docs/Is.md) |
| ✔✔ `isAscii` | Checks if the string contains only ASCII characters. | [Documentation](docs/IsAscii.md) |
| ✔✔ `isEmpty` | Checks if the string is empty. | [Documentation](docs/IsEmpty.md) |
|`isNotEmpty` | Checks if the string is not empty. | [Documentation](docs/IsNotEmpty.md) |
|`isJson` | Checks if the string is a valid JSON format. | [Documentation](docs/IsJson.md) |
| `isJson` | Checks if the string is a valid JSON format. | [Documentation](docs/IsJson.md) |
|`isUlid` | Checks if the string is a valid ULID (Universally Unique Lexicographically Sortable Identifier). | [Documentation](docs/IsUlid.md) |
|`isUrl` | Checks if the string is a valid URL. | [Documentation](docs/IsUrl.md) |
| `isUrl` | Checks if the string is a valid URL. | [Documentation](docs/IsUrl.md) |
|`isUuid` | Checks if the string is a valid UUID (Universally Unique Identifier). | [Documentation](docs/IsUuid.md) |
|`kebab` | Converts the string to kebab case. | [Documentation](docs/Kebab.md) |
|`lcfirst` | Converts the first character of the string to lowercase. | [Documentation](docs/Lcfirst.md) |
| ✔✔ `length` | Returns the length of the string. | [Documentation](docs/Length.md) |
|`limit` | Limits the length of the string to a specified number of characters. | [Documentation](docs/Limit.md) |
| `limit` | Limits the length of the string to a specified number of characters. | [Documentation](docs/Limit.md) |
| ✔✔ `lower` | Converts the string to lowercase. | [Documentation](docs/Lower.md) |
|`ltrim` | Removes whitespace from the beginning of the string. | [Documentation](docs/Ltrim.md) |
| `markdown` | Converts the string to Markdown format. | [Documentation](docs/Markdown.md) |
Expand Down
24 changes: 24 additions & 0 deletions docs/Is.md
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
```
33 changes: 33 additions & 0 deletions docs/IsJson.md
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
```
30 changes: 30 additions & 0 deletions docs/IsUrl.md
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
```
32 changes: 32 additions & 0 deletions docs/Limit.md
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...
```
25 changes: 25 additions & 0 deletions docs/Remove.md
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.
```
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 59dc221

Please sign in to comment.