npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dev-classes

v1.4.18

Published

<h3 align="center">SocketApi</h3> ### !!! Пакет пепеехал в lib-socket-api !!!

Readme

import { HTTPSApi, RequestPayloadHTTPSApi } from "dev-classes";

HTTPSApi.init();

HTTPSApi.on('fetch', (info) => { })
HTTPSApi.request({keyAction: 'action1', request: {url: '...'}})
import { NetworkInformation, NetworkInformationCordova, NetworkInformationPC } from 'dev-classes';

const internet = new NetworkInformation([new NetworkInformationPC(), new NetworkInformationCordova()]);

internet.run((status, textStatus) => {
  status ? online() : offline();
});

type ColorRgb = [number, number, number];

interface Color_P{
  ColorRgb: ColorRgb;
  ColorRgba: [...ColorRgb, number];
  ColorHsla: Record<"h" | "s" | "l" | "a", number>;
  TypeBrightness_OR:"BT601" | "BT709" | "BT2020"
}

interface ColorProps{
  componentToHex: (c: number) => string;
  rgbToHex(r: number, g: number, b: number): string;
  rgbToHsv(r: number, g: number, b: number): Color_P['ColorRgb'];
  hsvToRgb(h: number, s: number, v: number): Color_P['ColorRgb'];
  rgbaToHsla(r: number, g: number, b: number, a: number): Color_P['ColorHsla'];
  hslaToRgba(h: number, s: number, l: number, a: number): Color_P['ColorRgba'];
  hslaStringToRgba(hsla: string): Color_P['ColorRgba'];
  hexaToRgba(hexa: string, isNormalizeAlpha?: boolean): Color_P['ColorRgba'];
  hexToRgb(hex: string): Color_P['ColorRgb'];
  hexaToHsla(hexa: string): Color_P['ColorHsla'];
  rgbaToHexa(rgba: Color_P['ColorRgba'] | Color_P['ColorRgb'] ): string;
  hslaStringToHexa(hsla: string): string;
  hslaStringToHex(hsla: string): string;
  mixColors(color1: Color_P['ColorRgb'] , color2: Color_P['ColorRgb'], weight: number): Color_P['ColorRgb'];
  getRgbByTypeBrightness(type: Color_P['TypeBrightness_OR']): Color_P['ColorRgb'];
  getAverageColor(color1: Color_P['ColorRgb'], color2: Color_P['ColorRgb']): Color_P['ColorRgb'];
  getAccentColor(baseHsv: number[], baseColor: Color_P['ColorRgb'], elementColor: Color_P['ColorRgb']): Color_P['ColorRgb']
  changeColorAccent(baseHsv: number[], accentHsv: number[], color: Color_P['ColorRgb'], isDarkTheme: boolean): Color_P['ColorRgb'];
  changeBrightness(color: Color_P['ColorRgb'], amount: number): Color_P['ColorRgb'];
  hexBrightness(hex:string, amount: number):string;
  getHexColorFromTelegramColor(color: number): string;  
  getRgbColorFromTelegramColor(color: number): Color_P['ColorRgb'];
  rgbaToRgb(rgba: Color_P['ColorRgba'], bg: Color_P['ColorRgb']): Color_P['ColorRgb'];
  calculateBrightness(rgb: Color_P['ColorRgb'], type?:Color_P['TypeBrightness_OR']): number;
  getTextColor(luminance: number): Color_P['ColorRgb']
  calculateOpacity(luminance: number, targetContrast: number): number;
  clamp(v: number, min: number, max: number): number;
  isHex(color:string):boolean;
  generateHex():string;
  generateHexMultiple(count:number):string[];
}

interface DateProcessingProps{
  getActiveColorClassInDiffDate(a:string, b:string, c:string):string
  getClassByDifferenceDay(a:string, b:{className:string, diffDay:number}[]):string
  getMinMaxDate(a:string, b:string, c:string):Record<'minDate' | 'maxDate' | 'minMaxMonth', string >
  splitDateFromTime(a:string):string[]
  getCorrectDateAndTime(a:string):[string, string]
  reverseDate(a:string):string
  correctionDataISO8601(a:string):string
  isDateDMY(a:string):boolean
  correctionDateAndRemoveYear(a:string, b?:Partial<{isYear:boolean}>):string
  correctionDateWithOutCurrentYear(a:string, b?:Partial<{shortYear:boolean}>):string
  correctionShortYear(a:string):string
  correctionDate(a:string, b?:Partial<Record<'isRemoveYear'| 'shortYear' | 'withOutCurrentYear', boolean>>):string
  hasDateLessPeriod(a:string, b: string, c?:{dateMinMax: '<=' | '>=' | '<' | '>'}):boolean
  hasDateLessPeriods(a:string, b: string, c:string, d?:{dateMinMax: '<=' | '>=' | '<' | '>'}):Record<'one' | 'two', boolean>
  getDi(a:string, b: string):number
  getDifferenceDates(a:string, b: string):number
  hasDateLessInNumber(a:string, b: string, c:number):boolean
  correctionCurrentYear(a:[string], b?:number):string[]
  getChunkFromDate(a:string, b:'day' | 'month' | 'year', c?:{isBeforeZero:boolean}):string
  getNameMonthByNumber(a:number):(typeof itemsMonths)[number]
  minMaxMountStr(a:Record<'minDate' | 'maxDate', string>): {minMaxMonth: string}
  getDatesToCurrentDate(a:string[]):string[]
  getDayOfWeek(a:string):(typeof itemsWeek)[number] | null
  cropSecond(a:string):string
  getRenderDate(a:string, b?:{withOutCurrentYear: boolean} ):'Сегодня' | 'Вчера' | 'Позавчера' | string 
  getCurrentDate():string 
  getDaysInMonth(a: number, b: number):number 
  getCurrentYear():number 
  getDateDeviation(date: string, config: Partial<Record<"day" | "month" | "year", number>>): string
}

interface ControlAction{
  stop(status?: boolean):void; 
  getIsActiveEvent():boolean; 
}
interface  StartActionEveryConfigI {
  interval: number,
  cutoffTime?: number;//4000
  countAction?:number;//example 5
  watchIdInterval?(id:number | null):void;
  controlAction?(control:ControlAction):void
}

interface OneOfPromiseReject{
  status: boolean;
  msg: string;
}


interface DelaysPromiseProps{
   startActionEvery: (cb: () => boolean, config: StartActionEveryConfigI) => {
    stop: ControlAction['stop'],
    promise: Promise<{status: boolean, msg: string}>
  }
  oneOf: (watchPromise: () => Promise<any>, potentialCaseCB: () => void, config: {second: number}) => void
  oneOfPromise:(watchPromise: () => Promise<any>, cbPotentialReject: (p:OneOfPromiseReject) => OneOfPromiseReject, config: {second: number}) => Promise<any>
}

interface NumbersProps {
  randomNumber: () => number;
  getOnlyTheStringNumbers(dirtyString: string): string;
  isNumber(charStr: string | number): boolean;
}

import { File } from 'dev-classes';

File.download({
  name: 'test',
  base64: 'test',
  format: 'pdf',
})

interface UtilsProps {
  events (status: 'add' | 'remove', who:EventTarget, entriesEvents, msg: string): Promise<string>;
  sortDataByAlphabet(arrData: {[key: string]: any}[], sortKey: string): {[key: string]: any}[] ;
  sortDataByDate(data:any[], keyDate: string): string[];
  sortDataByDateAndTime(data:any[], keyDate: string): string[];
  reverseDate(datePPR:string):string;
  correctionDataISO8601(date:string):string; 
  hasDateLessPeriod(date: string, period: string, option?:{ dateMinMax: '<=' | '>=' | '<' | '>'; } ): boolean;
  getEndsWithArr(arr: any[], countEnd: number): any[];
  deepMerge<T extends object = object>(...itemsOb: T[]): T;
  filterItems<T extends Array<{ [key in string]: any } & { name: string }>>(list: T, searchQuery: string): T;
  sortByOnline <T extends Array<{[key in string]: any} & {name: string, online:boolean}>>(list: T):T
}

import { NetworkInformation, NetworkInformationPC, NetworkInformationCordova } from 'dev-classes';

const internet = new NetworkInformation([new NetworkInformationPC(), new NetworkInformationCordova()]);

const online = () => {}
const offline = () => {}
internet.run((status) => {
  status ? online() : offline();
});

interface EventSubscribersProps<EventsProps>{
  getSubscribers: () => {[K in keyof EventsProps]?: EventsProps[K][]}
  subscribe: <K extends keyof EventsProps>(name: K, cb: EventsProps[K]) => void
  unsubscribe: <K extends keyof EventsProps>(name: K, cb: EventsProps[K]) => void
  publish: <K extends keyof EventsProps>(name: K, data: EventsProps[K] extends (...args: any[]) => any ? Parameters<EventsProps[K]>[0] : any) => void
  resetSubscribers: () => void
}


import { EventSubscribers } from 'dev-classes';

interface CustomEvents{
  myEvent(status: boolean): void;
} 

class MyClass{
  private static events = new EventSubscribers<CustomEvents>(["myEvent"]);
  static on = MyClass.events.subscribe;
  static off = MyClass.events.unsubscribe;

  static runTime(num: number){
    const id = setTimeout(() => {
      let status = true;
      //...
      // if(/*.... */) { status = false; }
      MyClass.events.publish('myEvent', status);
      
      clearTimeout(id);
    }, num * 1000)
  }
}

MyClass.on('myEvent', (status) => {
  console.log(status)
})
MyClass.runTime(2);
// Будущая замена NetworkInformation
  const networkTicker = new NetworkStatusTracker([]);
  networkTicker.startEvents((info) => {
    SocketApi.setNetworkStatus(info);
  });