Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add new string methods" #12

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ lib/**/files/**
lib/channels/**
test/**
*.spec.ts
*.md
Empty file added CHANGELOG.md
Empty file.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Support
# Nestjs Hasher

## Contents

Expand All @@ -21,18 +21,6 @@

### <a name="sam"></a> Available methods

For the majority of the remaining Str documentation

[contains](#method-contains)
[ucFirst](#method-ucFirst)
[lower](#method-lower)

#### <a name="method-contains"></a> `contains()`

#### <a name="method-ucFirst"></a> `ucFirst()`

#### <a name="method-lower"></a> `lower()`

## <a name="arr"></a> Array - Arr

### <a name="aam"></a> Available methods
Expand Down
4 changes: 3 additions & 1 deletion lib/arr/array.interface.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
//
export interface IArr {
//
}
4 changes: 3 additions & 1 deletion lib/collect/collect.interface.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
//
export interface ICollect {
//
}
4 changes: 1 addition & 3 deletions lib/str/string.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export interface IString {
ucFirst(value: string): string;
contains(value: string, needles: string | string[]): boolean;
lower(value: string): string;
//
}
50 changes: 0 additions & 50 deletions lib/str/string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,4 @@ describe('Str', () => {
it('should be defined', () => {
expect(str).toBeDefined();
});

describe('Property ucFirst', () => {
it('should be have property ucFirst', () => {
expect(str).toHaveProperty('ucFirst');
});

it('should be use ucFirst property', () => {
expect(str.ucFirst('test')).toEqual('Test');
});

it('ucFirst not affected more word than first', () => {
expect(str.ucFirst('hello world!')).toEqual('Hello world!');
});
});

describe('Property contains', () => {
it('should be have property contain', () => {
expect(str).toHaveProperty('contains');
});

it('should be use contains have value', () => {
expect(str.contains('test', 'tes')).toEqual(false);
});

it('should be use contains have value', () => {
expect(str.contains('test', 'test')).toEqual(true);
});

it('value not exist in array', () => {
expect(str.contains('hello', ['fly', 'hell', 'bye'])).toEqual(false);
});

it('value not exist in array', () => {
expect(str.contains('hello', ['fly', 'hello', 'bye'])).toEqual(true);
});
});

describe('Property lower', () => {
it('should be have property lower', () => {
expect(str).toHaveProperty('lower');
});

it('should be use lower property', () => {
expect(str.lower('Test')).toEqual('test');
});

it('lower not affected more word than first', () => {
expect(str.lower('Hello World!')).toEqual('hello world!');
});
});
});
30 changes: 2 additions & 28 deletions lib/str/string.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
import { IString } from './string.interface';

export class Str implements IString {
/**
* Make a string's first character uppercase.
* @method
* @param {string} value
* @return string
*/
ucFirst(value: string): string {
return value.charAt(0).toUpperCase() + value.substring(1);
}

/**
* Determine if a given string contains a given substring.
* @param value
* @param needles
* @return boolean
*/
contains(value: string, needles: string | string[]): boolean {
return needles.includes(value);
}

/**
* Convert the given string to lower-case.
* @param value
*/
lower(value: string): string {
return value.toLowerCase();
}
export class Str extends String implements IString {
//
}
Loading