mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
14 lines
446 B
TypeScript
14 lines
446 B
TypeScript
import { pipe, range } from 'ramda';
|
|
import type { SyntheticEvent } from 'react';
|
|
|
|
type Optional<T> = T | null | undefined;
|
|
|
|
export type OptionalString = Optional<string>;
|
|
|
|
export const handleEventPreventingDefault = <T>(handler: () => T) => pipe(
|
|
(e: SyntheticEvent) => e.preventDefault(),
|
|
handler,
|
|
);
|
|
|
|
export const rangeOf = <T>(size: number, mappingFn: (value: number) => T, startAt = 1): T[] =>
|
|
range(startAt, size + 1).map(mappingFn);
|