Skip to content

Commit

Permalink
Merge pull request #44 from behzadam/42-add-url-utility-functions
Browse files Browse the repository at this point in the history
42 add url utility functions
  • Loading branch information
behzadam committed Jul 11, 2023
2 parents 8e329b5 + a187b7c commit f651edd
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "publish npm"
name: 'publish npm'
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
release:
Expand All @@ -24,4 +24,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
2 changes: 1 addition & 1 deletion dist/index.esm.js

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

2 changes: 1 addition & 1 deletion dist/index.js

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

6 changes: 3 additions & 3 deletions docs/yotils.countitems.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ Counts of repeated items in flattened arrays.
<b>Signature:</b>

```typescript
export declare function countItems<T extends Primitive>(array: T[]): Record<string, T>;
export declare function countItems<Item extends Primitive>(array: Item[]): Record<string, Item>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| array | T\[\] | array of items. |
| array | Item\[\] | array of items. |

<b>Returns:</b>

Record&lt;string, T&gt;
Record&lt;string, Item&gt;

- key value list

Expand Down
4 changes: 2 additions & 2 deletions docs/yotils.getlength.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Gets length of string \| array \| object
<b>Signature:</b>

```typescript
export declare function getLength<T>(value: T): number;
export declare function getLength<Input>(input: Input): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | T | string \| array \| object |
| input | Input | string \| array \| object |

<b>Returns:</b>

Expand Down
4 changes: 2 additions & 2 deletions docs/yotils.hasduplicates.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Determines whether an array has duplicates.
<b>Signature:</b>

```typescript
export declare function hasDuplicates<T extends keyof Primitive>(array: T[]): boolean;
export declare function hasDuplicates<Item extends keyof Primitive>(array: Item[]): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| array | T\[\] | input |
| array | Item\[\] | input |

<b>Returns:</b>

Expand Down
12 changes: 6 additions & 6 deletions docs/yotils.indexby.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ Returns the spilted lists grouped by index. They key should be unique and for un
<b>Signature:</b>

```typescript
export declare function indexBy<T extends {
[K in keyof T]: string | number | symbol;
}, K extends keyof T>(array: T[], key: K): Record<T[K], T>;
export declare function indexBy<Item extends {
[Key in keyof Item]: string | number | symbol;
}, Key extends keyof Item>(array: Item[], key: Key): Record<Item[Key], Item>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| array | T\[\] | of objects. |
| key | K | unique key |
| array | Item\[\] | of objects. |
| key | Key | unique key |

<b>Returns:</b>

Record&lt;T\[K\], T&gt;
Record&lt;Item\[Key\], Item&gt;

grouped by index, key value list.

Expand Down
6 changes: 3 additions & 3 deletions docs/yotils.isarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Determines whether the input is an array or not.
<b>Signature:</b>

```typescript
export declare function isArray<T>(value: unknown): value is Array<T>;
export declare function isArray<Input>(input: unknown): input is Array<Input>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | unknown | Generic input. |
| input | unknown | Generic input. |

<b>Returns:</b>

value is Array&lt;T&gt;
input is Array&lt;Input&gt;

true if the input is an array or false otherwise.

Expand Down
6 changes: 3 additions & 3 deletions docs/yotils.isarrayofstring.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Determines whether the input is array of string or not.
<b>Signature:</b>

```typescript
export declare function isArrayOfString(value: unknown): value is string[];
export declare function isArrayOfString(input: unknown): input is string[];
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | unknown | input |
| input | unknown | input |

<b>Returns:</b>

value is string\[\]
input is string\[\]

true if the input is array, false otherwise.

Expand Down
10 changes: 5 additions & 5 deletions docs/yotils.isdatevalid.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Determines whether the input string is valid date or not.
<b>Signature:</b>

```typescript
export declare function isDateString(value: string): value is string;
export declare function isStringDate(input: string): input is string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | string | input string. |
| input | string | input string. |

<b>Returns:</b>

value is string
input is string

true if the input string is valid date, false otherwise.

Expand All @@ -32,7 +32,7 @@ While there are some regular expressions that allow date validations, it is bett


```ts
isDateString('01/01/2000') // true
isDateString('31/09/2000') // false
isStringDate('01/01/2000') // true
isStringDate('31/09/2000') // false
```

6 changes: 3 additions & 3 deletions docs/yotils.isstring.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Determines whether the input is string or not.
<b>Signature:</b>

```typescript
export declare function isString(value: unknown): value is string;
export declare function isString(input: unknown): input is string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | unknown | input |
| input | unknown | input |

<b>Returns:</b>

value is string
input is string

true if the input is string, false otherwise.

Expand Down
14 changes: 7 additions & 7 deletions docs/yotils.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ TypeScript Utility Library.
| Function | Description |
| --- | --- |
| [countItems(array)](./yotils.countitems.md) | <b><i>(BETA)</i></b> Counts of repeated items in flattened arrays. |
| [getLength(value)](./yotils.getlength.md) | Gets length of string \| array \| object |
| [getLength(input)](./yotils.getlength.md) | Gets length of string \| array \| object |
| [hasDuplicates(array)](./yotils.hasduplicates.md) | Determines whether an array has duplicates. |
| [indexBy(array, key)](./yotils.indexby.md) | Returns the spilted lists grouped by index. They key should be unique and for ununique keys it would be replaced with the last key. |
| [isArray(value)](./yotils.isarray.md) | Determines whether the input is an array or not. |
| [isArrayOfString(value)](./yotils.isarrayofstring.md) | Determines whether the input is array of string or not. |
| [isArray(input)](./yotils.isarray.md) | Determines whether the input is an array or not. |
| [isArrayOfString(input)](./yotils.isarrayofstring.md) | Determines whether the input is array of string or not. |
| [isDate(value)](./yotils.isdate.md) | Determines whether the input is a Date type or not. |
| [isDateValid(value)](./yotils.isdatevalid.md) | Determines whether the input string is valid date or not. |
| [isDateValid(input)](./yotils.isdatevalid.md) | Determines whether the input string is valid date or not. |
| [isDefined(value)](./yotils.isdefined.md) | Determines whether the input is defined or not. |
| [isEmpty(value)](./yotils.isempty.md) | Determines whether an input is empty or not. |
| [isEqualDate(target, other)](./yotils.isequaldate.md) | <b><i>(BETA)</i></b> Compares two given date type values. |
Expand All @@ -27,7 +27,7 @@ TypeScript Utility Library.
| [isObject(value)](./yotils.isobject.md) | Determines whether the input is an object or not. |
| [isObjectLike(value)](./yotils.isobjectlike.md) | Determines whether the input is an object like or not. When a value is object like, it is not null and <code>typeof</code> result is "object". |
| [isSet(value)](./yotils.isset.md) | Determines whether the input is <code>Set</code> or not. |
| [isString(value)](./yotils.isstring.md) | Determines whether the input is string or not. |
| [toChunks(value, chunkSize)](./yotils.tochunks.md) | <b><i>(BETA)</i></b> Split a string into N chunks of equal size. The last chunk may be smaller. |
| [wrapInArray(value)](./yotils.wrapinarray.md) | Wraps the input in an array even if the input is an array. |
| [isString(input)](./yotils.isstring.md) | Determines whether the input is string or not. |
| [toChunks(input, chunkSize)](./yotils.tochunks.md) | <b><i>(BETA)</i></b> Split a string into N chunks of equal size. The last chunk may be smaller. |
| [wrapInArray(input)](./yotils.wrapinarray.md) | Wraps the input in an array even if the input is an array. |

4 changes: 2 additions & 2 deletions docs/yotils.tochunks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Split a string into N chunks of equal size. The last chunk may be smaller.
<b>Signature:</b>

```typescript
export declare function toChunks(value: string, chunkSize: number): string[];
export declare function toChunks(input: string, chunkSize: number): string[];
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | string | string |
| input | string | string |
| chunkSize | number | number |

<b>Returns:</b>
Expand Down
6 changes: 3 additions & 3 deletions docs/yotils.wrapinarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Wraps the input in an array even if the input is an array.
<b>Signature:</b>

```typescript
export declare function wrapInArray<Type>(value: Type): Type[];
export declare function wrapInArray<Input>(input: Input): Input[];
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | Type | input |
| input | Input | input |

<b>Returns:</b>

Type\[\]
Input\[\]

wrapped input in an array.

Expand Down
Loading

0 comments on commit f651edd

Please sign in to comment.