Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hisorange committed Aug 4, 2021
1 parent ef5be68 commit e04592d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions __tests__/elastring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,8 @@ describe('Elastring', () => {
expect(new Elastring(input).pathCase.toString()).toBe(output);
},
);

it('should reverse the string', () => {
expect(new Elastring('rev').reverse.toString()).toBe('ver');
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hisorange/elastring",
"version": "1.0.0",
"version": "1.1.0",
"description": "Fluent immutable string transformations",
"keywords": [
"fluent",
Expand Down
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ console.log(`${str.pathCase.prefix('../').suffix('.js')} at!`); // ../orm/driver
| **prefix()** | string.prefix('ela') | elastring | x |
| **suffix()** | ela.suffix('string.js') | elastring.js | x |
| **stripExtension()** | elastring.js | elastring | x |
| **reverse** | elastring | gnirtsale | x |

### Technicalities

Expand All @@ -80,4 +81,8 @@ console.log(`${str.pathCase.prefix('../').suffix('.js')} at!`); // ../orm/driver

---

### 1.0.0 - Initial Release
#####

- Added the reverse transformation

##### 1.0.0 - Initial Release
5 changes: 5 additions & 0 deletions src/elastring.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export interface IElastring {
*/
readonly pathCase: IElastring;

/**
* rev -> ver
*/
readonly reverse: IElastring;

/**
* Concatanate with the given string.
*
Expand Down
4 changes: 4 additions & 0 deletions src/elastring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export class Elastring implements IElastring {
return new Elastring(removeSpaces(this.subject));
}

get reverse(): IElastring {
return new Elastring(this.subject.split('').reverse().join(''));
}

prefix(prefix: string | IElastring): IElastring {
if (typeof prefix === 'string') {
prefix = new Elastring(prefix);
Expand Down

0 comments on commit e04592d

Please sign in to comment.