Skip to content

Commit

Permalink
use interfaces instead of types when available
Browse files Browse the repository at this point in the history
  • Loading branch information
icmx committed Jul 26, 2022
1 parent 750c824 commit 0f8814e
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/date/diffDate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import { DateValue } from '../../types/DateValue';
import { isValidDate } from '../isValidDate';
import { ERROR_INVALID_DATE } from './constants';

export type DiffDateResultUnits = {
export interface DiffDateResultUnits {
milliseconds: number;
seconds: number;
minutes: number;
hours: number;
days: number;
months: number;
years: number;
};
}

export type DiffDateResult = {
export interface DiffDateResult {
total: DiffDateResultUnits;
remain: DiffDateResultUnits;
raw: number;
inversed: boolean;
};
}

/**
* Returns total amount of time between two dates (years, months, days,
Expand Down
4 changes: 2 additions & 2 deletions src/date/isValidDate/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { equally } from '../../filters/equally';
import { DateValue } from '../../types/DateValue';

export type IsValidDateOptions = {
export interface IsValidDateOptions {
/**
* Treat falsy values (0 and '') as valid. They return zero date
* which is 1970-01-01T00:00:00.000.
*/
allowFalsy?: boolean;
};
}

/**
* Returns true if value is valid Date or suits for Date creation.
Expand Down
4 changes: 2 additions & 2 deletions src/date/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FloatHandling } from '../../types/FloatHandling';

export type TsOptions = {
export interface TsOptions {
/**
* Date to use for timestamp creation. Current by default.
*/
Expand All @@ -14,7 +14,7 @@ export type TsOptions = {
* @default 'keep'
*/
milliseconds?: FloatHandling;
};
}

/**
* Returns a Unix timestamp for current or specified date.
Expand Down
4 changes: 2 additions & 2 deletions src/filters/isEmpty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isUndefined } from '../isUndefined';
import { neither } from '../neither';
import { ERROR_EMPTY_VALUES_NOT_ARRAY } from './constants';

export type IsEmptyOptions = {
export interface IsEmptyOptions {
/**
* Values that sould be considered as empty. By default it's NaN and
* empty string.
Expand All @@ -15,7 +15,7 @@ export type IsEmptyOptions = {
* i.e. set to empty array — [].
*/
emptyValues?: any[];
};
}

/**
* Returns true if value is empty, i.e. undefined, null, empty string,
Expand Down
4 changes: 2 additions & 2 deletions src/filters/isNumber/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type IsNumberOptions = {
export interface IsNumberOptions {
/**
* Return true if value is positive or negative Infinity.
*/
Expand All @@ -8,7 +8,7 @@ export type IsNumberOptions = {
* Return true if value is NaN.
*/
allowNaN?: boolean;
};
}

/**
* Returns true if value is a number.
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/filterObject/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { isObject } from '../../filters/isObject';
import { Entry } from '../../types/Entry';

export type FilterObjectOptions = {
export interface FilterObjectOptions {
/**
* Enable same filtering over sub-objects (if any).
*/
recursive?: boolean;
};
}

/**
* Filters object entries by predicate like standard array's filter.
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/mapObject/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { isObject } from '../../filters/isObject';
import { Entry } from '../../types/Entry';

export type MapObjectOptions = {
export interface MapObjectOptions {
/**
* Enable same mapping over sub-objects (if any).
*/
recursive?: boolean;
};
}

/**
* Maps object entries by callback function like standard array's map.
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/repeat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {
ERROR_TIMES_NOT_SAFE_INT,
} from './constants';

export type RepeatOptions = {
export interface RepeatOptions {
/**
* How many times to repeat some action. Once by default.
*/
times?: number;
};
}

/**
* Repeats some action for a specified number of times. Returns array
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/toBoolean/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OF_UNDEFINED } from '../../constants';
import { isBoolean } from '../../filters/isBoolean';
import { FallbackHandler } from '../../types/FallbackHAndler';

export type ToBooleanOptions = {
export interface ToBooleanOptions {
/**
* Values that should be treated as boolean false.
* @default [ 'false' ]
Expand All @@ -21,7 +21,7 @@ export type ToBooleanOptions = {
* Throws `TypeError` if manually unset.
*/
onFallback?: FallbackHandler;
};
}

/**
* Maps value into a boolean if possible.
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/toNumber/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OF_UNDEFINED } from '../../constants';
import { FallbackHandler } from '../../types/FallbackHandler';
import { FloatHandling } from '../../types/FloatHandling';

export type ToNumberOptions = {
export interface ToNumberOptions {
/**
* How to handle decimal part in a value, if any.
*
Expand All @@ -19,7 +19,7 @@ export type ToNumberOptions = {
* Throws `TypeError` if manually unset.
*/
onFallback?: FallbackHandler;
};
}

/**
* Maps value into a number if possible.
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/toString/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isString } from '../../filters/isString';

export type ToStringOptions = {
export interface ToStringOptions {
/**
* Arguments to be passed into `value.toString()` or
* `JSON.stringify()` if `useToJSON` options is set to true.
Expand All @@ -12,7 +12,7 @@ export type ToStringOptions = {
* default `toString()`.
*/
useToJSON?: boolean;
};
}

/**
* Maps value into a string.
Expand Down

0 comments on commit 0f8814e

Please sign in to comment.