-
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
e25e770
commit 9632cfb
Showing
7 changed files
with
404 additions
and
6 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,40 @@ | ||
# plural | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.plural("man"); | ||
console.log(result); // Outputs: 'men' | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.plural("dog"); | ||
|
||
console.log(result); // Outputs: 'dogs' | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("foot").plural().toString(); | ||
|
||
console.log(result); // Outputs: 'feet' | ||
``` | ||
|
||
### Example#4 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("fish").plural().toString(); | ||
|
||
console.log(result); // Outputs: 'fish' | ||
``` |
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,40 @@ | ||
# pluralStudly | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.pluralStudly("manwoman"); | ||
console.log(result); // Outputs: 'manwomen' | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.pluralStudly("Babyboy"); | ||
|
||
console.log(result); // Outputs: 'Babyboys' | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("forkKnife").pluralStudly().toString(); | ||
|
||
console.log(result); // Outputs: 'forkKnives' | ||
``` | ||
|
||
### Example#4 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("fish").pluralStudly().toString(); | ||
|
||
console.log(result); // Outputs: 'fish' | ||
``` |
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,40 @@ | ||
# singular | ||
|
||
### Example#1 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.singular("men"); | ||
console.log(result); // Outputs: 'man' | ||
``` | ||
|
||
### Example#2 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.singular("dogs"); | ||
|
||
console.log(result); // Outputs: 'dog' | ||
``` | ||
|
||
### Example#3 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("feet").singular().toString(); | ||
|
||
console.log(result); // Outputs: 'foot' | ||
``` | ||
|
||
### Example#4 | ||
|
||
```javascript | ||
import JStr from "@akcybex/jstr"; | ||
|
||
const result = JStr.of("fist").singular().toString(); | ||
|
||
console.log(result); // Outputs: 'fish' | ||
``` |
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,109 @@ | ||
import JStr from "../src/main.ts"; | ||
|
||
/** | ||
* The plural method converts the given string to plural: | ||
*/ | ||
|
||
describe('plural JStr static function', () => { | ||
test('should call plural with the provided value', () => { | ||
const input = 'dog'; | ||
expect(JStr.plural(input)).toBe('dogs'); | ||
}); | ||
test('should plural with the men value', () => { | ||
const input = 'man'; | ||
expect(JStr.plural(input)).toBe('men'); | ||
}); | ||
|
||
test('should plural with the Crocodile value', () => { | ||
const input = 'Crocodile'; | ||
expect(JStr.plural(input)).toBe('Crocodiles'); | ||
}); | ||
|
||
test('should plural ies plural with the Baby value', () => { | ||
const input = 'Baby'; | ||
expect(JStr.plural(input)).toBe('Babies'); | ||
}); | ||
|
||
test('should plural ies plural with the Rally value', () => { | ||
const input = 'Rally'; | ||
expect(JStr.plural(input)).toBe('Rallies'); | ||
}); | ||
|
||
test('should plural with the Knife value', () => { | ||
const input = 'Knife'; | ||
expect(JStr.plural(input)).toBe('Knives'); | ||
}); | ||
test('should plural with the Leaf value', () => { | ||
const input = 'Leaf'; | ||
expect(JStr.plural(input)).toBe('Leaves'); | ||
}); | ||
|
||
test('should plural with the Child value', () => { | ||
const input = 'Child'; | ||
expect(JStr.plural(input)).toBe('Children'); | ||
}); | ||
test('should plural with the Foot value', () => { | ||
const input = 'Foot'; | ||
expect(JStr.plural(input)).toBe('Feet'); | ||
}); | ||
|
||
test('should plural with the Fish value', () => { | ||
const input = 'Fish'; | ||
expect(JStr.plural(input)).toBe('Fish'); | ||
}); | ||
|
||
|
||
|
||
}); | ||
|
||
describe('plural JStr dynamic function', () => { | ||
test('should call plural with the provided value', () => { | ||
const input = 'dog'; | ||
expect(JStr.of(input).plural().toString()).toBe('dogs'); | ||
}); | ||
test('should plural with the men value', () => { | ||
const input = 'man'; | ||
expect(JStr.of(input).plural().toString()).toBe('men'); | ||
}); | ||
|
||
test('should plural with the Crocodile value', () => { | ||
const input = 'Crocodile'; | ||
expect(JStr.of(input).plural().toString()).toBe('Crocodiles'); | ||
}); | ||
|
||
test('should plural ies plural with the Baby value', () => { | ||
const input = 'Baby'; | ||
expect(JStr.of(input).plural().toString()).toBe('Babies'); | ||
}); | ||
|
||
test('should plural ies plural with the Rally value', () => { | ||
const input = 'Rally'; | ||
expect(JStr.of(input).plural().toString()).toBe('Rallies'); | ||
}); | ||
|
||
test('should plural with the Knife value', () => { | ||
const input = 'Knife'; | ||
expect(JStr.of(input).plural().toString()).toBe('Knives'); | ||
}); | ||
test('should plural with the Leaf value', () => { | ||
const input = 'Leaf'; | ||
expect(JStr.of(input).plural().toString()).toBe('Leaves'); | ||
}); | ||
|
||
test('should plural with the Child value', () => { | ||
const input = 'Child'; | ||
expect(JStr.of(input).plural().toString()).toBe('Children'); | ||
}); | ||
test('should plural with the Foot value', () => { | ||
const input = 'Foot'; | ||
expect(JStr.of(input).plural().toString()).toBe('Feet'); | ||
}); | ||
|
||
test('should plural with the Fish value', () => { | ||
const input = 'Fish'; | ||
expect(JStr.of(input).plural().toString()).toBe('Fish'); | ||
}); | ||
|
||
|
||
|
||
}); |
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,60 @@ | ||
import JStr from "../src/main.ts"; | ||
|
||
/** | ||
* The pluralStudly method converts a singular word string formatted in studly caps case to its plural form | ||
*/ | ||
|
||
describe('plural JStr static function', () => { | ||
test('should call plural with the provided value', () => { | ||
const input = 'dogcat'; | ||
expect(JStr.pluralStudly(input)).toBe('dogcats'); | ||
}); | ||
test('should plural with the men value', () => { | ||
const input = 'manwoman'; | ||
expect(JStr.plural(input)).toBe('manwomen'); | ||
}); | ||
|
||
test('should plural of the dog value', () => { | ||
const input = 'catdog'; | ||
expect(JStr.pluralStudly(input)).toBe('catdogs'); | ||
}); | ||
|
||
test('should plural ies plural with the Baby value', () => { | ||
const input = 'Babyboy'; | ||
expect(JStr.plural(input)).toBe('Babyboys'); | ||
}); | ||
|
||
test('should plural with the Knife value', () => { | ||
const input = 'forkKnife'; | ||
expect(JStr.plural(input)).toBe('forkKnives'); | ||
}); | ||
|
||
}); | ||
|
||
describe('plural JStr dynamic function', () => { | ||
test('should call plural with the provided value', () => { | ||
const input = 'dogcat'; | ||
expect(JStr.of(input).pluralStudly().toString()).toBe('dogcats'); | ||
}); | ||
test('should plural with the men value', () => { | ||
const input = 'manwoman'; | ||
expect(JStr.of(input).pluralStudly().toString()).toBe('manwomen'); | ||
}); | ||
|
||
test('should plural of the dog value', () => { | ||
const input = 'catdog'; | ||
expect(JStr.of(input).pluralStudly().toString()).toBe('catdogs'); | ||
}); | ||
|
||
test('should plural ies plural with the Baby value', () => { | ||
const input = 'Babyboy'; | ||
expect(JStr.of(input).pluralStudly().toString()).toBe('Babyboys'); | ||
}); | ||
|
||
test('should plural with the Knife value', () => { | ||
const input = 'forkKnife'; | ||
expect(JStr.of(input).pluralStudly().toString()).toBe('`forkKnives`'); | ||
}); | ||
|
||
}); | ||
|
Oops, something went wrong.