Skip to content

Commit

Permalink
Revert change to urlize
Browse files Browse the repository at this point in the history
  • Loading branch information
GoudekettingRM committed Jan 23, 2024
1 parent 8883722 commit bab2575
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ A TypeScript library for normalizing and parameterizing strings, making them URL
Install `parameterize` using npm:

```bash
npm install parameterize
npm install @goudekettingrm/parameterize
```

or using yarn:

```bash
yarn add parameterize
yarn add @goudekettingrm/parameterize
```

## Usage
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CHARACTER_MAP, type CharacterMap } from './characterMap';

type TUrlizeOptions = {
type TParameterizeOptions = {
charCap?: number;
separator?: string;
};
Expand All @@ -23,7 +23,7 @@ class CharNormalizer {
}
}

const urlize = (str: string, opts?: TUrlizeOptions): string => {
const parameterize = (str: string, opts?: TParameterizeOptions): string => {
const options = opts || {};

str = CharNormalizer.normalize(str)
Expand All @@ -35,4 +35,4 @@ const urlize = (str: string, opts?: TUrlizeOptions): string => {
return str.substring(0, options.charCap);
};

export { urlize };
export { parameterize };
19 changes: 19 additions & 0 deletions src/parameterize.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { parameterize } from './index';

describe('parameterize', () => {
it('should normalize and parameterize a string with special characters', () => {
expect(parameterize('Äpfel & Birnen!')).toEqual('apfel-birnen');
});

it('should handle Greek characters', () => {
expect(parameterize('αβγ')).toEqual('abg');
});

it('should respect the character cap', () => {
expect(parameterize('Hello World', { charCap: 5 })).toEqual('hello');
});

it('should replace spaces with specified separator', () => {
expect(parameterize('Hello World', { separator: '_' })).toEqual('hello_world');
});
});
19 changes: 0 additions & 19 deletions src/urlize.test.ts

This file was deleted.

0 comments on commit bab2575

Please sign in to comment.