@dev.arlamend7/js-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Javascript && Typescript

I use a jest library to test all functions It`s a package with some extensions, functions and others things. Everything that a use almost every day.

I'll create a c# library too.


Common

Extensions providers by this package

interface Array<T> {
  Distinct(): T[];
  isNullOrEmpty(): boolean;
  Sum(map?: (arg: T, index: number) => number, startValue?: number): number;
  Max(map?: (arg: T, index: number) => number): number;
  Min(map?: (arg: T, index: number) => number): number;
  Remove(elem: (arg: T) => Boolean): void;
}

interface Date {
  SameAs(Date: Date): boolean;
  isBeetween(dateStart: Date, dateEnd: Date): boolean;
}

interface Number {
  [Symbol.iterator]: () => Generator<number, void, number[]>;
}

interface String {
  RemoveAccents(): string;
  isNullOrWhiteSpace(): boolean;
  JustNumbers(): string;
}

functions

function debounce(fn: Function, milissegundos: number, ...args: any[]): () => void;
function Paginar<T>(array: T[], request?: PaginacaoRequest): PaginacaoResponse<T>;

Utils

function isRequired: (value: any) => never;

class Validator {
    CPF(str: string): boolean;
    CNPJ(str: string): boolean;
    CellPhone(str: string): boolean;
}

class Formatter {
    get CONST_REGEX(): {
        CPF: RegExp;
        CNPJ: RegExp;
        CELLPHONE: RegExp;
    };
    CPF(text: string): string;
    CNPJ(text: string): string;
    CellPhone(text: string): string;
}

Web

class NotificationService {
  notifications: Map<string, Notification>;
  addNotification(key: string, Title: string, options?: NotificationOptions): void;
  Notify(notification: globalThis.Notification): void;
  NotifyByKey(key: string): void;
}

Package Sidebar

Install

npm i @dev.arlamend7/js-ts

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

47.5 kB

Total Files

82

Last publish

Collaborators

  • dev.arlamend7