You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

dphelper

Package Overview
Dependencies
Maintainers
1
Versions
407
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dphelper - npm Package Compare versions

Comparing version
3.2.7
to
3.2.8
index.cjs

Sorry, the diff of this file is too big to display

+657
// --- AUTO-GENERATED TOOL TYPES START ---
// --- ai ---
interface AiTool {
tokenCount: (data: any) => number
smartSanitize: (text: string) => string
toon: (data: any) => string
toonToJson: (toon: string) => any
chunker: (text: string, options?: { size?: number, overlap?: number }) => string[]
similarity: (a: number[], b: number[]) => number
extractReasoning: (text: string) => { reasoning: string, content: string }
prompt: (template: string, vars: Record<string, any>) => string
schema: (data: any) => string
snapshot: () => string
}
// --- anchor ---
interface AnchorTool {
/**
* Converts anchor tags to onClick events
* @param selector - CSS selector for target elements
*/
toOnClick(selector: string): void
}
// --- array ---
interface ArrayTool {
find<T>(array: T[], key: any): T | any
unique<T>(array: T[]): T[]
delete<T>(array: T[], key: keyof T): void
merge<T>(arrayA: T[], arrayB: T[]): T[]
mergeByKey<T extends Record<string, any>>(arrayA: T[], arrayB: T[], key: keyof T): T[]
asc<T>(array: T[]): T[]
desc<T>(array: T[]): T[]
duplicates<T>(array: T[]): T[]
even<T>(array: T[]): T[]
odd<T>(array: T[]): T[]
toObj<T>(array: T[]): Record<string, T>
sumColumn(array: number[][], column: number): number
shuffle<T>(array: T[]): T[]
generate(num: number): number[]
testArrayInt(array: unknown[]): number[]
rand32(number: number): number
findindex<T>(array: T[], key: any): number
pathToJson(array: string[], separator?: string): Record<string, unknown>
deepClone<T>(src: T): T
match(arrayWords: string[], arrayToCheck: string[]): boolean
}
// --- audio ---
interface AudioTool {
/**
* Plays an audio file if it is not already playing.
* If no file is specified, removes all audio elements from the document.
*
* @param file - The name of the audio file to play.
* @param path - The path to the audio file.
* @param loop - Whether the audio should loop.
*/
play: (file?: string, path?: string, loop?: boolean) => void
}
// --- avoid ---
interface AvoidTool {
cache: (uri: string) => string
}
// --- browser ---
interface BrowserTool {
state(state: any, title: any, url: any): void
forw(times: number): void
back(times: number): void
reload(): void
href(url: string): void
offLine(text?: string): void
zoom(): number
status(code: number): string
interlock(onUpdate: (tabs: number) => void): void
}
// --- check ---
interface CheckTool {
url: (url: string) => any
version: (v1: string, v2: string, opts?: any) => any
npmVer: (npm: string) => any
}
// --- color ---
interface ColorTool {
hex: (c: any) => string
toHex: (rgb: any) => string
toRGB: (c: any) => number[]
oleColor: (c: any) => string
gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
}
// --- cookie ---
interface CookieTool {
set: (pars: {
name: any,
value: any,
time?: any,
path?: string,
sameSite?: string,
secure?: string
}) => any
get: (name: string) => any
delete: (name: string) => any
removeAll: () => any
}
// --- coords ---
interface CoordsTool {
degreesToRadians: (degrees: any) => any
latToMeters: (points: any) => any
toVector: (points: any) => any
convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
distance: (point1: any, point2: any) => any
polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
}
// --- credits ---
interface Credits {
name: string
version: string
description: string
license: string
author: {
name: string
email: string
}
}
type CreditsTool = (props: Credits) => void
// --- date ---
interface DateTool {
days: (lang?: string) => string[]
months: (lang?: string) => string[]
year: () => number
toIso: (value: any, int?: string) => string | null
toMMDDYYYY: (value: any) => string
toYYYYMMDD: (value: any) => string | undefined
toHuman: (value: any) => string
convert: (value: any, format: string[]) => string | null
iso2Epoch: (value: any) => number
localIsoTime: (value: any) => string
utc: () => string
parse: (value: any, separator?: string) => string | null
addDays: (date: any, days: number) => Date
dateTimeToString: (dateObject: any) => string
isoToHuman: (value: any, symbol?: string) => string | null
fullDate: () => string
epoch: () => number
diffInDays: (d1: any, d2: any) => number
diffInWeeks: (d1: any, d2: any) => number
diffInMonths: (d1: any, d2: any) => number
diffInYears: (d1: any, d2: any) => number
dateToYMD: (date: any) => string
collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
timeZones: () => string[]
}
// --- disable ---
interface DisableTool {
select: (el?: string) => void
spellCheck: (tmr?: number) => void
rightClick: (el?: string) => void
copy: (el?: string) => void
paste: (el?: string) => void
cut: (el?: string) => void
drag: (el?: string) => void
}
// --- dispatch ---
interface DispatchTool {
set: (name: string, value?: any) => void
listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
remove: (name: string) => void
}
// --- elements ---
interface ElementsTool {
fitScale: (el: any, scale?: number, fit?: boolean) => void
scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
}
// --- events ---
interface EventsTool {
list: (el: Element) => any
multi: (element: Element, eventNames: string, listener: EventListener) => void
copy: (el: string) => void
onDrag: (elem: string) => void
keys: (e: KeyboardEvent) => { key: string; ctrl: boolean; alt: boolean; shift: boolean }
}
// --- fetch ---
interface FetchTool {
/**
* Perform a resilient fetch with automatic retries and exponential backoff.
*/
(url: string, options?: any, retries?: number, backoff?: number): Promise<Response>
/**
* Perform a GET request.
*/
get: (url: string, options?: any) => Promise<Response>
/**
* Perform a POST request with optional JSON body auto-serialization.
*/
post: (url: string, body: any, options?: any) => Promise<Response>
}
// --- form ---
interface FormTool {
serialize: (form: HTMLFormElement) => { [key: string]: any }
confirmType: (type: string, value: any) => boolean
required: (value: any) => string | undefined
minLength: (value: any, num?: number) => string | undefined
maxLength: (value: any, num?: number) => string | undefined
maxPhoneNumber: (value: any, num?: number) => string | undefined
isNumeric: (value: any) => boolean
isEmail: (value: any) => boolean
pattern: (e: Event) => void
noSpecialChars: (e: Event) => void
table: (size: [number, number], id: string, elem: HTMLElement) => void
sanitize: (str: string) => string | undefined
}
// --- format ---
interface FormatTool {
currency: (value: number, locale?: string, currency?: string) => string
phoneNumber: (value: string, countryCode?: string) => string
}
// --- json ---
interface JsonTool {
counter: (json: any, key?: string, val?: any) => number | null
toCsv: (jsonInput: any) => string
saveCsvAs: (csvData: string, fileName: string) => void
is: (str: string) => boolean
parse: (file: string) => any
sanitize: (str: string) => string
sanitizeJsonValue: (str: string) => string
}
// --- load ---
interface LoadTool {
all: (context: any, cacheName?: string) => void
file: (filePath: string) => Promise<string>
fileToElement: (elementSelector: string, filePath: string) => Promise<void>
json: (filePath: string) => Promise<any>
remote: (path: string, method?: string, headers?: HeadersInit) => Promise<any>
script: (scripts: string[], elementSelector?: string) => void
toJson: (context: any, cacheName?: string) => void
}
// --- logging ---
interface LoggingTool {
list: {
type: string
message: string
}[]
reg: (txt: string) => void
debug: (txt: string) => void
error: (txt: string) => void
}
// --- math ---
interface MathTool {
rnd: () => number
tmr: () => number
add: (a: number, b: number) => number
sub: (a: number, b: number) => number
multi: (a: number, b: number) => number
div: (a: number, b: number) => number
rem: (a: number, b: number) => number
exp: (a: number, b: number) => number
isOdd: (a: number) => boolean
float2int: (a: number) => number
percent: (n: number, tot: number) => number
isPrime: (n: number) => boolean
}
// --- memory ---
interface MemoryTool {
lock: (obj: string) => void
unlock: (obj: string) => void
}
// --- navigation ---
interface NavigationTool {
load(url: string): Promise<void>
ajax(): void
ajax_running?: boolean
}
// --- net ---
interface NetTool {
/**
* Smart Fetch with automatic retry and exponential backoff.
* @param url The URL to fetch.
* @param options Fetch options (method, headers, body, etc.)
* @param retries Number of retry attempts (default: 3)
* @param backoff Initial backoff delay in ms (default: 1000)
* @returns Promise resolving to the Response
*/
smartFetch(url: string, options?: RequestInit, retries?: number, backoff?: number): Promise<Response>
}
// --- objects ---
interface ObjectsTool {
toArray: (object: Record<string, any>) => [string, any][]
replaceNullObjects: (data: Record<string, any>) => Record<string, any>
serialize: (value: any) => any
deSerialize: (valueNew: any) => any
sort: (o: Record<string, any>) => Record<string, any>
toXML: (obj: Record<string, any>) => string
find: (array: any[], key: string, value: any) => any
instance: (obj: any) => any
updateByKey: (obj: Record<string, any>, key: string, newValue: any) => Record<string, any>
findindex: (array: any[], key: string) => number
parse: (val: any) => any
isObject: (val: any) => boolean
diff: (obj1: Record<string, any>, obj2: Record<string, any>) => Record<string, { obj1: any, obj2: any }>
path: (prop: string, array: string[], separator?: string) => string
}
// --- path ---
interface PathTool {
rail: () => string[]
hash: () => string[]
query: (url: string) => Record<string, string>
}
// --- promise ---
interface PromiseTool {
check: (p: any) => boolean
resolve: (data: any) => Promise<any>
}
// --- sanitize ---
interface SanitizeTool {
html: (s: string) => string
}
// --- screen ---
interface ScreenTool {
fullScreen: (el: string) => void
toggle: (el: string) => void
info: () => {
width: number
height: number
availWidth: number
availHeight: number
colorDepth: number
pixelDepth: number
}
}
// --- scrollbar ---
interface ScrollbarTool {
custom: (el: string, options: any) => void
indicator: (props: any) => void
position: {
get: (el: any) => void
set: (el: any) => void
}
smooth: (target: any, speed: any, smooth: any) => void
scrollTo: (container: string, element: string, gap?: number) => void
}
// --- security ---
interface SecurityTool {
uuid: {
byVal: (string: string) => string
v4: string
v5: string
}
hashPass: (u: string, p: string, t?: string) => Promise<string>
crypt: (u: string, p: string, mode?: string) => string
deCrypt: (u: string, p: string, mode?: string) => string
AES_KeyGen: (passKey?: string) => string
SHA256_Hex: (passKey: string) => string
ulid: () => string
fingerprint: () => string
saveEncrypted: (key: string, value: string, secret: string) => void
getEncrypted: (key: string, secret: string) => string | null
}
// --- shortcut ---
interface ShortcutTool {
keys: (e: any, trigger: any) => void
}
// --- socket ---
interface SocketTool {
info: () => string
start: (element: any, server: any, name: string) => void
conn: (id: any, server: any, name: string) => void
connect: (server: any, name: string) => void
open: (id: any, server: any, name: string) => void
send: (mex: any, type?: string) => void
ping: (name: string) => void
receive: (el?: any, name?: string) => void
keepAlive: (name: string) => void
check: () => void
list: () => WebSocket[]
}
// --- sse ---
interface SseTool {
/**
* Opens an SSE connection with support for custom fetch options (POST, Headers, etc).
*/
open(url: string, options?: any): {
on(event: "message" | "error" | "open", cb: (data: any) => void): void
close(): void
}
}
// --- svg ---
interface SvgTool {
init: (container: HTMLElement, source1: [HTMLElement, string], source2: [HTMLElement, string], cb?: Function) => void
check: () => boolean
update: (rect1: HTMLElement, rect2: HTMLElement, cxn: HTMLElement) => void
getCurve: (p1: [number, number], p2: [number, number], dx: number) => string
getIntersection: (dx: number, dy: number, cx: number, cy: number, w: number, h: number) => [number, number]
setConnector: (source: HTMLElement, side: string) => HTMLElement
removeConnection: (container: HTMLElement) => void
makeScrollable: (svgContainer: HTMLElement, scrollContainer: HTMLElement, elm1: HTMLElement, elm2: HTMLElement, rect1: HTMLElement, rect2: HTMLElement) => void
makeDraggable: (evt: Event) => void
toggle: (evt: Event, container: HTMLElement, source1: HTMLElement, source2: HTMLElement) => void
convert: (options: any) => string | void
}
// --- sync ---
interface SyncTool {
/**
* Synchronize data between tabs using BroadcastChannel.
*/
tab: (channelName: string, callback: (data: any) => void) => { post: (data: any) => void, close: () => void }
/**
* Create a Proxy object linked to localStorage for auto-sync with optional encryption.
*/
storageProxy: <T extends object>(key: string, initialValue: T, secret?: string) => T
/**
* Low-latency cross-tab event bus.
*/
pulse: (channelName: string, callback: (data: any) => void) => { emit: (data: any) => void, stop: () => void }
}
// --- system ---
interface SystemTool {
multiSplit: () => any
}
// --- text ---
interface TextTool {
trim(s: string, c: string, b: number, e: number): string
capitalize(txt: string): string
lower(txt: string): string
upper(txt: string): string
nl2br(str: string): string
sanitize(str: string): string
camelCase: {
toSpace(string: string): string
toUnderscore(string: string): string
}
fitContainer(el: string): void
}
// --- timer ---
interface TimerTool {
sleep(ms: number): Promise<void>
percentage(start: string, end: string): string
}
// --- tools ---
interface ToolsTool {
getip(): Promise<void>
byteSize(bytes: number): string
zIndex(): number
zeroToFalse(value: number): boolean | number
}
// --- translators ---
interface TranslatorsTool {
convertMatrixToScale(values: any): number
}
// --- triggers ---
interface TriggersTool {
/**
* Add a trigger for custom events.
* @param event - The event name
* @param callback - The callback to execute when the event is triggered
*/
add: (event: string, callback: (...args: any[]) => void) => void
/**
* Listen for a trigger event (alias for add).
*/
on: (event: string, callback: (...args: any[]) => void) => void
/**
* Emit a trigger event and call all registered callbacks.
* @param event - The event name
* @param args - Arguments to pass to the callbacks
*/
emit: (event: string, ...args: any[]) => void
/**
* Remove a trigger event and all its callbacks.
* @param event - The event name
*/
remove: (event: string) => void
/**
* Remove a specific callback from an event.
* @param event - The event name
* @param callback - The callback to remove
*/
off: (event: string, callback: (...args: any[]) => void) => void
/**
* Clear all triggers.
*/
clear: () => void
/**
* List all registered trigger events.
* @returns Array of event names
*/
list: () => string[]
}
// --- types ---
interface TypesTool {
of(p: any): string
instOfObj(p: any): boolean
isNull(p: any): (p: any) => boolean
isBool(val: any): boolean
}
// --- ui ---
interface UiTool {
anchorContext(): void
[key: string]: any
}
// --- window ---
interface WindowTool {
enhancement(): void
animationframe(): any
center(params: { url: string; title: string; name: string; w: number; h: number }): void
onBeforeUnLoad(e: any): void
purge(d?: Document, time?: number): void
stopZoomWheel(e: any): void
setZoom(element?: string, zoom?: number): string
getZoom(element?: string): number
}
// --- AUTO-GENERATED TOOL TYPES END ---
interface SubCommand {
name: string
version: string
example: string
author: string
creationDate: string
lastMod: string
type: string
active: boolean
description: string
env?: "client" | "server" | "both"
subCommand: SubCommand[]
}
interface Description {
name: string
active: boolean
subCommand: SubCommand[]
}
interface _dphelper {
[key: string]: any
// --- AUTO-GENERATED TOOL MEMBERS START ---
readonly ai: AiTool
readonly anchor: AnchorTool
readonly array: ArrayTool
readonly audio: AudioTool
readonly avoid: AvoidTool
readonly browser: BrowserTool
readonly check: CheckTool
readonly color: ColorTool
readonly cookie: CookieTool
readonly coords: CoordsTool
readonly credits: CreditsTool
readonly date: DateTool
readonly disable: DisableTool
readonly dispatch: DispatchTool
readonly element: ElementsTool
readonly events: EventsTool
readonly fetch: FetchTool
readonly form: FormTool
readonly format: FormatTool
readonly json: JsonTool
readonly load: LoadTool
readonly logging: LoggingTool
readonly math: MathTool
readonly memory: MemoryTool
readonly navigation: NavigationTool
readonly net: NetTool
readonly object: ObjectsTool
readonly path: PathTool
readonly promise: PromiseTool
readonly sanitize: SanitizeTool
readonly screen: ScreenTool
readonly scrollbar: ScrollbarTool
readonly security: SecurityTool
readonly shortcut: ShortcutTool
readonly socket: SocketTool
readonly sse: SseTool
readonly svg: SvgTool
readonly sync: SyncTool
readonly system: SystemTool
readonly text: TextTool
readonly timer: TimerTool
readonly tools: ToolsTool
readonly translators: TranslatorsTool
readonly trigger: TriggersTool
readonly type: TypesTool
readonly ui: UiTool
readonly window: WindowTool
// --- AUTO-GENERATED TOOL MEMBERS END ---
// setDescription: (description: Description, newObj: any) => void
// setProps: (root: any, desc: any, options?: any) => void
// _list: {
// scripts: Description[]
// sockets: any[]
// [key: string]: any
// }
version: string
isServer: boolean
isBrowser: boolean
}
declare function confirm(message: string, func1: Function, func2?: Function): boolean
declare var __DPH_VERSION__: string
declare var dphelper: _dphelper
type dphelper = _dphelper
+56
-27
{
"name": "dphelper",
"version": "3.2.7",
"version": "3.2.8",
"description": "dphelper devtools for developers",
"type": "module",
"main": "./index.js",
"module": "./index.js",
"main": "./index.cjs",
"browser": "./index.cjs",
"types": "./index.d.ts",
"typings": "./types/*",
"exports": {
".": "./index.js",
"./types/*": "./types/*"
},
"browser": "./dphelper.umd.js",
"files": [
"**/*"
"typing": "./types/*",
"homepage": "https://a51.gitbook.io/dphelper",
"license": "MIT",
"copyright": "Dario Passariello",
"author": "Dario Passariello",
"contributors": [
{
"name": "Dario Passariello",
"email": "dariopassarielloa@gmail.com"
},
{
"name": "Valeria Cala Scaglitta",
"email": "valeriacalascaglitta@gmail.com"
}
],
"scripts": {},
"keywords": [

@@ -43,22 +47,47 @@ "dphelper",

],
"author": "Dario Passariello <dariopassariello@gmail.com>",
"contributors": [
"funding": [
{
"name": "Dario Passariello",
"email": "dariopassariello@gmail.com"
},
{
"name": "Valeria Cala Scaglitta",
"email": "valeriacalascaglitta@gmail.com"
"type": "patreon",
"url": "https://www.patreon.com/passariello"
}
],
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"funding": [
{
"type": "patreon"
"files": [
"**/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/a51-dev/a51.dphelper.public.git"
},
"bugs": {
"url": "https://github.com/a51-dev/a51.dphelper.public/issues"
},
"support": {
"name": "Dario Passariello",
"url": "https://dario.passariello.ca/",
"email": "dariopassariello@gmail.com"
},
"peerDependenciesMeta": {
"react": {
"optional": false
},
"react-dom": {
"optional": false
},
"jquery": {
"optional": false
}
]
}
},
"module": "./index.js",
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs",
"types": "./index.d.ts"
},
"./types/*": "./types/*"
},
"typings": "./index.d.ts"
}

@@ -8,16 +8,24 @@ # [dphelper](https://npmjs.com/package/dphelper)

[![version](https://img.shields.io/npm/v/dphelper.svg)](https://npmjs.org/package/dphelper)
[![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=dphelper&query=$.install.pretty&label=install%20size&style=flat-square)](https://packagephobia.now.sh/result?p=dphelper)
[![downloads](https://img.shields.io/npm/dm/dphelper.svg)](https://npmjs.org/package/dphelper)
![Snyk](https://img.shields.io/badge/Snyk-gray?logo=Snyk)
[![Known Vulnerabilities](https://snyk.io/test/npm/dphelper/badge.svg)](https://snyk.io/test/npm/dphelper)
[![Socket Badge](https://socket.dev/api/badge/npm/package/dphelper)](https://socket.dev/npm/package/dphelper)
![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
![React](https://img.shields.io/badge/React-gray?logo=React)
![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
![AI Ready](https://img.shields.io/badge/AI-Ready-brightgreen?logo=openai)
![TOON](https://img.shields.io/badge/TOON-Format-blue)
![esbuild](https://img.shields.io/badge/esbuild-gray?logo=esbuild)
![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
![ESLint](https://img.shields.io/badge/Eslint-gray?logo=eslint)
![esbuild](https://img.shields.io/badge/esbuild-gray?logo=esbuild)
![Snyk](https://img.shields.io/badge/Snyk-gray?logo=Snyk)
![Playwright](https://img.shields.io/badge/Playwright-gray?logo=playwright)
![AI Ready](https://img.shields.io/badge/AI-Ready-brightgreen?logo=openai)
![TOON](https://img.shields.io/badge/TOON-Format-blue)
[![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/dphelper)
---

@@ -101,3 +109,3 @@

```html
<script src="https://unpkg.com/dphelper/dphelper.umd.js"></script>
<script src="https://unpkg.com/dphelper/dphelper.js"></script>

@@ -148,3 +156,3 @@ <!-- Optional check -->

2. Generates dynamic imports for the core.
3. Synchronizes TypeScript interfaces in `types/dphelper.d.ts`.
3. Synchronizes TypeScript interfaces in `dphelper.d.ts`.

@@ -232,1 +240,5 @@ This ensures that adding new tools is instantaneous and always documented with full Intellisense support.

All rights reserved - Copyright (c) 2019 - 2026
## License
MIT
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will
communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at <dariopassariello@gmail.com>.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.

Sorry, the diff of this file is too big to display

# These are supported funding model platforms
github: passariello
patreon: passariello
ko_fi: passariello
liberapay: passariello
issuehunt: passariello
custom:
[
"https://dario.passariello.ca",
"https://www.indiegogo.com/individuals/28513718",
]
# Security
Please email [@passariello](https://github.com/passariello) or see <https://dario.passariello.ca/contact/> if you have a potential security vulnerability to report.
interface AiTool {
tokenCount: (data: any) => number
smartSanitize: (text: string) => string
toon: (data: any) => string
toonToJson: (toon: string) => any
chunker: (text: string, options?: { size?: number, overlap?: number }) => string[]
similarity: (a: number[], b: number[]) => number
extractReasoning: (text: string) => { reasoning: string, content: string }
prompt: (template: string, vars: Record<string, any>) => string
schema: (data: any) => string
snapshot: () => string
}
interface AnchorTool {
/**
* Converts anchor tags to onClick events
* @param selector - CSS selector for target elements
*/
toOnClick(selector: string): void
}
interface ArrayTool {
find<T>(array: T[], key: any): T | any
unique<T>(array: T[]): T[]
delete<T>(array: T[], key: keyof T): void
merge<T>(arrayA: T[], arrayB: T[]): T[]
mergeByKey<T extends Record<string, any>>(arrayA: T[], arrayB: T[], key: keyof T): T[]
asc<T>(array: T[]): T[]
desc<T>(array: T[]): T[]
duplicates<T>(array: T[]): T[]
even<T>(array: T[]): T[]
odd<T>(array: T[]): T[]
toObj<T>(array: T[]): Record<string, T>
sumColumn(array: number[][], column: number): number
shuffle<T>(array: T[]): T[]
generate(num: number): number[]
testArrayInt(array: unknown[]): number[]
rand32(number: number): number
findindex<T>(array: T[], key: any): number
pathToJson(array: string[], separator?: string): Record<string, unknown>
deepClone<T>(src: T): T
match(arrayWords: string[], arrayToCheck: string[]): boolean
}
interface AudioTool {
/**
* Plays an audio file if it is not already playing.
* If no file is specified, removes all audio elements from the document.
*
* @param file - The name of the audio file to play.
* @param path - The path to the audio file.
* @param loop - Whether the audio should loop.
*/
play: (file?: string, path?: string, loop?: boolean) => void
}
interface AvoidTool {
cache: (uri: string) => string
}
interface BrowserTool {
state(state: any, title: any, url: any): void
forw(times: number): void
back(times: number): void
reload(): void
href(url: string): void
offLine(text?: string): void
zoom(): number
status(code: number): string
interlock(onUpdate: (tabs: number) => void): void
}
interface CheckTool {
url: (url: string) => any
version: (v1: string, v2: string, opts?: any) => any
npmVer: (npm: string) => any
}
interface ColorTool {
hex: (c: any) => string
toHex: (rgb: any) => string
toRGB: (c: any) => number[]
oleColor: (c: any) => string
gradient: (colorStart: any, colorEnd: any, colorCount: any) => any
}
interface CookieTool {
set: (pars: {
name: any,
value: any,
time?: any,
path?: string,
sameSite?: string,
secure?: string
}) => any
get: (name: string) => any
delete: (name: string) => any
removeAll: () => any
}
interface CoordsTool {
degreesToRadians: (degrees: any) => any
latToMeters: (points: any) => any
toVector: (points: any) => any
convertToDecDegrees: (deg: any, minutes: any, sec: any, direction: any) => any
distance: (point1: any, point2: any) => any
polarToCartesian: (centerX: any, centerY: any, radius: any, angleInDegrees: any) => any
mapDegreesToPixels: (degree: number, minDegree: number, maxDegree: number, minPixel: number, maxPixel: number, padding: number) => number
}
interface Credits {
name: string
version: string
description: string
license: string
author: {
name: string
email: string
}
}
type CreditsTool = (props: Credits) => void
interface DateTool {
days: (lang?: string) => string[]
months: (lang?: string) => string[]
year: () => number
toIso: (value: any, int?: string) => string | null
toMMDDYYYY: (value: any) => string
toYYYYMMDD: (value: any) => string | undefined
toHuman: (value: any) => string
convert: (value: any, format: string[]) => string | null
iso2Epoch: (value: any) => number
localIsoTime: (value: any) => string
utc: () => string
parse: (value: any, separator?: string) => string | null
addDays: (date: any, days: number) => Date
dateTimeToString: (dateObject: any) => string
isoToHuman: (value: any, symbol?: string) => string | null
fullDate: () => string
epoch: () => number
diffInDays: (d1: any, d2: any) => number
diffInWeeks: (d1: any, d2: any) => number
diffInMonths: (d1: any, d2: any) => number
diffInYears: (d1: any, d2: any) => number
dateToYMD: (date: any) => string
collection: (params: { date?: Date; type: string; locale?: string }) => string | undefined
timeZones: () => string[]
}
interface DisableTool {
select: (el?: string) => void
spellCheck: (tmr?: number) => void
rightClick: (el?: string) => void
copy: (el?: string) => void
paste: (el?: string) => void
cut: (el?: string) => void
drag: (el?: string) => void
}
interface DispatchTool {
set: (name: string, value?: any) => void
listen: (name: string, cb?: (e: Event) => void, flag?: boolean) => void
remove: (name: string) => void
}
interface ElementsTool {
fitScale: (el: any, scale?: number, fit?: boolean) => void
scaleBasedOnWindow: (elm: any, scale: number, fit: boolean) => void
}
interface EventsTool {
list: (el: Element) => any
multi: (element: Element, eventNames: string, listener: EventListener) => void
copy: (el: string) => void
onDrag: (elem: string) => void
keys: (e: KeyboardEvent) => { key: string; ctrl: boolean; alt: boolean; shift: boolean }
}
interface FetchTool {
/**
* Perform a resilient fetch with automatic retries and exponential backoff.
*/
(url: string, options?: any, retries?: number, backoff?: number): Promise<Response>
/**
* Perform a GET request.
*/
get: (url: string, options?: any) => Promise<Response>
/**
* Perform a POST request with optional JSON body auto-serialization.
*/
post: (url: string, body: any, options?: any) => Promise<Response>
}
interface FormTool {
serialize: (form: HTMLFormElement) => { [key: string]: any }
confirmType: (type: string, value: any) => boolean
required: (value: any) => string | undefined
minLength: (value: any, num?: number) => string | undefined
maxLength: (value: any, num?: number) => string | undefined
maxPhoneNumber: (value: any, num?: number) => string | undefined
isNumeric: (value: any) => boolean
isEmail: (value: any) => boolean
pattern: (e: Event) => void
noSpecialChars: (e: Event) => void
table: (size: [number, number], id: string, elem: HTMLElement) => void
sanitize: (str: string) => string | undefined
}
interface FormatTool {
currency: (value: number, locale?: string, currency?: string) => string
phoneNumber: (value: string, countryCode?: string) => string
}
interface JsonTool {
counter: (json: any, key?: string, val?: any) => number | null
toCsv: (jsonInput: any) => string
saveCsvAs: (csvData: string, fileName: string) => void
is: (str: string) => boolean
parse: (file: string) => any
sanitize: (str: string) => string
sanitizeJsonValue: (str: string) => string
}
interface LoadTool {
all: (context: any, cacheName?: string) => void
file: (filePath: string) => Promise<string>
fileToElement: (elementSelector: string, filePath: string) => Promise<void>
json: (filePath: string) => Promise<any>
remote: (path: string, method?: string, headers?: HeadersInit) => Promise<any>
script: (scripts: string[], elementSelector?: string) => void
toJson: (context: any, cacheName?: string) => void
}
interface LoggingTool {
list: {
type: string
message: string
}[]
reg: (txt: string) => void
debug: (txt: string) => void
error: (txt: string) => void
}
interface MathTool {
rnd: () => number
tmr: () => number
add: (a: number, b: number) => number
sub: (a: number, b: number) => number
multi: (a: number, b: number) => number
div: (a: number, b: number) => number
rem: (a: number, b: number) => number
exp: (a: number, b: number) => number
isOdd: (a: number) => boolean
float2int: (a: number) => number
percent: (n: number, tot: number) => number
isPrime: (n: number) => boolean
}
interface MemoryTool {
lock: (obj: string) => void
unlock: (obj: string) => void
}
interface NavigationTool {
load(url: string): Promise<void>
ajax(): void
ajax_running?: boolean
}
interface ObjectsTool {
toArray: (object: Record<string, any>) => [string, any][]
replaceNullObjects: (data: Record<string, any>) => Record<string, any>
serialize: (value: any) => any
deSerialize: (valueNew: any) => any
sort: (o: Record<string, any>) => Record<string, any>
toXML: (obj: Record<string, any>) => string
find: (array: any[], key: string, value: any) => any
instance: (obj: any) => any
updateByKey: (obj: Record<string, any>, key: string, newValue: any) => Record<string, any>
findindex: (array: any[], key: string) => number
parse: (val: any) => any
isObject: (val: any) => boolean
diff: (obj1: Record<string, any>, obj2: Record<string, any>) => Record<string, { obj1: any, obj2: any }>
path: (prop: string, array: string[], separator?: string) => string
}
interface PathTool {
rail: () => string[]
hash: () => string[]
query: (url: string) => Record<string, string>
}
interface PromiseTool {
check: (p: any) => boolean
resolve: (data: any) => Promise<any>
}
interface SanitizeTool {
html: (s: string) => string
}
interface ScreenTool {
fullScreen: (el: string) => void
toggle: (el: string) => void
info: () => {
width: number
height: number
availWidth: number
availHeight: number
colorDepth: number
pixelDepth: number
}
}
interface ScrollbarTool {
custom: (el: string, options: any) => void
indicator: (props: any) => void
position: {
get: (el: any) => void
set: (el: any) => void
}
smooth: (target: any, speed: any, smooth: any) => void
scrollTo: (container: string, element: string, gap?: number) => void
}
interface SecurityTool {
uuid: {
byVal: (string: string) => string
v4: string
v5: string
}
hashPass: (u: string, p: string, t?: string) => Promise<string>
crypt: (u: string, p: string, mode?: string) => string
deCrypt: (u: string, p: string, mode?: string) => string
AES_KeyGen: (passKey?: string) => string
SHA256_Hex: (passKey: string) => string
ulid: () => string
fingerprint: () => string
saveEncrypted: (key: string, value: string, secret: string) => void
getEncrypted: (key: string, secret: string) => string | null
}
interface ShortcutTool {
keys: (e: any, trigger: any) => void
}
interface SocketTool {
info: () => string
start: (element: any, server: any, name: string) => void
conn: (id: any, server: any, name: string) => void
connect: (server: any, name: string) => void
open: (id: any, server: any, name: string) => void
send: (mex: any, type?: string) => void
ping: (name: string) => void
receive: (el?: any, name?: string) => void
keepAlive: (name: string) => void
check: () => void
list: () => WebSocket[]
}
interface SseTool {
/**
* Opens an SSE connection with support for custom fetch options (POST, Headers, etc).
*/
open(url: string, options?: any): {
on(event: "message" | "error" | "open", cb: (data: any) => void): void
close(): void
}
}
interface SvgTool {
init: (container: HTMLElement, source1: [HTMLElement, string], source2: [HTMLElement, string], cb?: Function) => void
check: () => boolean
update: (rect1: HTMLElement, rect2: HTMLElement, cxn: HTMLElement) => void
getCurve: (p1: [number, number], p2: [number, number], dx: number) => string
getIntersection: (dx: number, dy: number, cx: number, cy: number, w: number, h: number) => [number, number]
setConnector: (source: HTMLElement, side: string) => HTMLElement
removeConnection: (container: HTMLElement) => void
makeScrollable: (svgContainer: HTMLElement, scrollContainer: HTMLElement, elm1: HTMLElement, elm2: HTMLElement, rect1: HTMLElement, rect2: HTMLElement) => void
makeDraggable: (evt: Event) => void
toggle: (evt: Event, container: HTMLElement, source1: HTMLElement, source2: HTMLElement) => void
convert: (options: any) => string | void
}
interface SyncTool {
/**
* Synchronize data between tabs using BroadcastChannel.
*/
tab: (channelName: string, callback: (data: any) => void) => { post: (data: any) => void, close: () => void }
/**
* Create a Proxy object linked to localStorage for auto-sync with optional encryption.
*/
storageProxy: <T extends object>(key: string, initialValue: T, secret?: string) => T
/**
* Low-latency cross-tab event bus.
*/
pulse: (channelName: string, callback: (data: any) => void) => { emit: (data: any) => void, stop: () => void }
}
interface SystemTool {
multiSplit: () => any
}
interface TextTool {
trim(s: string, c: string, b: number, e: number): string
capitalize(txt: string): string
lower(txt: string): string
upper(txt: string): string
nl2br(str: string): string
sanitize(str: string): string
camelCase: {
toSpace(string: string): string
toUnderscore(string: string): string
}
fitContainer(el: string): void
}
interface TimerTool {
sleep(ms: number): Promise<void>
percentage(start: string, end: string): string
}
interface ToolsTool {
getip(): Promise<void>
byteSize(bytes: number): string
zIndex(): number
zeroToFalse(value: number): boolean | number
}
interface TranslatorsTool {
convertMatrixToScale(values: any): number
}
interface TriggersTool {
/**
* Add a trigger for custom events.
* @param event - The event name
* @param callback - The callback to execute when the event is triggered
*/
add: (event: string, callback: (...args: any[]) => void) => void
/**
* Listen for a trigger event (alias for add).
*/
on: (event: string, callback: (...args: any[]) => void) => void
/**
* Emit a trigger event and call all registered callbacks.
* @param event - The event name
* @param args - Arguments to pass to the callbacks
*/
emit: (event: string, ...args: any[]) => void
/**
* Remove a trigger event and all its callbacks.
* @param event - The event name
*/
remove: (event: string) => void
/**
* Remove a specific callback from an event.
* @param event - The event name
* @param callback - The callback to remove
*/
off: (event: string, callback: (...args: any[]) => void) => void
/**
* Clear all triggers.
*/
clear: () => void
/**
* List all registered trigger events.
* @returns Array of event names
*/
list: () => string[]
}
interface TypesTool {
of(p: any): string
instOfObj(p: any): boolean
isNull(p: any): (p: any) => boolean
isBool(val: any): boolean
}
interface UiTool {
anchorContext(): void
[key: string]: any
}
interface WindowTool {
enhancement(): void
animationframe(): any
center(params: { url: string; title: string; name: string; w: number; h: number }): void
onBeforeUnLoad(e: any): void
purge(d?: Document, time?: number): void
stopZoomWheel(e: any): void
setZoom(element?: string, zoom?: number): string
getZoom(element?: string): number
}
/// <reference path="./dphelper.d.ts" />
export default dphelper;
interface MonitorInfo {
id: string;
width: number;
height: number;
left: number;
top: number;
isPrimary: boolean;
}
interface PopupState {
id: string;
monitorId: string;
left: number;
top: number;
width: number;
height: number;
monitorFingerprint: string;
}
export declare const popupManager: {
save: (id: string, win?: Window) => void;
restore: (id: string) => {
left: number;
top: number;
width: number;
height: number;
} | null;
remove: (id: string) => void;
list: () => Record<string, PopupState>;
clear: () => void;
getMonitors: () => MonitorInfo[];
getCurrentMonitor: () => MonitorInfo;
};
export default popupManager;

Sorry, the diff of this file is too big to display