dphelper 3.2.2 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/SUMMARY.md +54 -0
- package/docs/tools/ai.md +25 -0
- package/docs/tools/anchor.md +33 -0
- package/docs/tools/array.md +36 -0
- package/docs/tools/audio.md +30 -0
- package/docs/tools/avoid.md +28 -0
- package/docs/tools/browser.md +45 -0
- package/docs/tools/check.md +24 -0
- package/docs/tools/color.md +28 -0
- package/docs/tools/cookie.md +27 -0
- package/docs/tools/coords.md +28 -0
- package/docs/tools/credits.md +28 -0
- package/docs/tools/date.md +44 -0
- package/docs/tools/disable.md +28 -0
- package/docs/tools/dispatch.md +26 -0
- package/docs/tools/element.md +25 -0
- package/docs/tools/event.md +27 -0
- package/docs/tools/form.md +49 -0
- package/docs/tools/format.md +25 -0
- package/docs/tools/json.md +28 -0
- package/docs/tools/load.md +26 -0
- package/docs/tools/logging.md +27 -0
- package/docs/tools/math.md +28 -0
- package/docs/tools/memory.md +25 -0
- package/docs/tools/navigation.md +43 -0
- package/docs/tools/net.md +24 -0
- package/docs/tools/obj.md +34 -0
- package/docs/tools/path.md +46 -0
- package/docs/tools/promise.md +24 -0
- package/docs/tools/sanitize.md +24 -0
- package/docs/tools/screen.md +25 -0
- package/docs/tools/scrollbar.md +29 -0
- package/docs/tools/security.md +32 -0
- package/docs/tools/shortcut.md +24 -0
- package/docs/tools/socket.md +29 -0
- package/docs/tools/svg.md +29 -0
- package/docs/tools/sync.md +25 -0
- package/docs/tools/system.md +32 -0
- package/docs/tools/terminal.md +28 -0
- package/docs/tools/text.md +28 -0
- package/docs/tools/timer.md +25 -0
- package/docs/tools/tools.md +26 -0
- package/docs/tools/translators.md +24 -0
- package/docs/tools/trigger.md +26 -0
- package/docs/tools/type.md +27 -0
- package/docs/tools/ui.md +45 -0
- package/docs/tools/window.md +30 -0
- package/dphelper.umd.js +16 -16
- package/index.js +20 -20
- package/package.json +1 -1
- package/types/dphelper.d.ts +0 -656
package/docs/SUMMARY.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Table of contents
|
|
2
|
+
|
|
3
|
+
* [dpHelper](../README.md)
|
|
4
|
+
|
|
5
|
+
## General
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
* [anchor](tools/anchor.md)
|
|
10
|
+
* [ai](tools/ai.md)
|
|
11
|
+
* [array](tools/array.md)
|
|
12
|
+
* [audio](tools/audio.md)
|
|
13
|
+
* [avoid](tools/avoid.md)
|
|
14
|
+
* [browser](tools/browser.md)
|
|
15
|
+
* [check](tools/check.md)
|
|
16
|
+
* [color](tools/color.md)
|
|
17
|
+
* [cookie](tools/cookie.md)
|
|
18
|
+
* [coords](tools/coords.md)
|
|
19
|
+
* [credits](tools/credits.md)
|
|
20
|
+
* [date](tools/date.md)
|
|
21
|
+
* [disable](tools/disable.md)
|
|
22
|
+
* [dispatch](tools/dispatch.md)
|
|
23
|
+
* [element](tools/element.md)
|
|
24
|
+
* [event](tools/event.md)
|
|
25
|
+
* [form](tools/form.md)
|
|
26
|
+
* [format](tools/format.md)
|
|
27
|
+
* [json](tools/json.md)
|
|
28
|
+
* [load](tools/load.md)
|
|
29
|
+
* [logging](tools/logging.md)
|
|
30
|
+
* [math](tools/math.md)
|
|
31
|
+
* [memory](tools/memory.md)
|
|
32
|
+
* [navigation](tools/navigation.md)
|
|
33
|
+
* [net](tools/net.md)
|
|
34
|
+
* [obj](tools/obj.md)
|
|
35
|
+
* [path](tools/path.md)
|
|
36
|
+
* [promise](tools/promise.md)
|
|
37
|
+
* [sanitize](tools/sanitize.md)
|
|
38
|
+
* [screen](tools/screen.md)
|
|
39
|
+
* [scrollbar](tools/scrollbar.md)
|
|
40
|
+
* [security](tools/security.md)
|
|
41
|
+
* [shortcut](tools/shortcut.md)
|
|
42
|
+
* [socket](tools/socket.md)
|
|
43
|
+
* [svg](tools/svg.md)
|
|
44
|
+
* [sync](tools/sync.md)
|
|
45
|
+
* [system](tools/system.md)
|
|
46
|
+
* [terminal](tools/terminal.md)
|
|
47
|
+
* [text](tools/text.md)
|
|
48
|
+
* [timer](tools/timer.md)
|
|
49
|
+
* [tools](tools/tools.md)
|
|
50
|
+
* [translators](tools/translators.md)
|
|
51
|
+
* [trigger](tools/trigger.md)
|
|
52
|
+
* [type](tools/type.md)
|
|
53
|
+
* [ui](tools/ui.md)
|
|
54
|
+
* [window](tools/window.md)
|
package/docs/tools/ai.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ai
|
|
2
|
+
|
|
3
|
+
AI-related utilities and LLM helpers.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `tokenCount` | Estimates token count for LLMs (approx 4 chars/token) | `dphelper.ai.tokenCount(text)` |
|
|
10
|
+
| `smartSanitize` | Removes PII (emails, phones, CC) for AI privacy | `dphelper.ai.smartSanitize(text)` |
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
The AI module provides lightweight helpers to interact with LLMs, including privacy sanitization and token estimation to optimize API costs and security.
|
|
15
|
+
|
|
16
|
+
## Details
|
|
17
|
+
|
|
18
|
+
- **Author:** Dario Passariello & Jo
|
|
19
|
+
- **Version:** 0.0.1
|
|
20
|
+
- **Creation Date:** 20260220
|
|
21
|
+
- **Last Modified:** 20260220
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# anchor
|
|
2
|
+
|
|
3
|
+
Tool for managing HTML links and converting them into onclick events.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `toOnClick` | Converts all links in an element into onclick events | `dphelper.anchor.toOnClick('#container')` |
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
This tool allows you to convert all links in an element into 'onclick'. Useful for working with SPAs while maintaining full compatibility with all browsers.
|
|
14
|
+
|
|
15
|
+
## Usage Examples
|
|
16
|
+
|
|
17
|
+
### Automatic link conversion
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
// Converts all links in the #main-content div
|
|
21
|
+
dphelper.anchor.toOnClick('#main-content');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Details
|
|
25
|
+
|
|
26
|
+
- **Author:** Dario Passariello
|
|
27
|
+
- **Version:** 0.0.1
|
|
28
|
+
- **Creation Date:** 20210101
|
|
29
|
+
- **Last Modified:** 20210101
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# array
|
|
2
|
+
|
|
3
|
+
Advanced utilities for JavaScript array manipulation.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `find` | Finds an element recursively | `dphelper.array.find(array, 'key')` |
|
|
10
|
+
| `delete` | Deletes an element recursively by key | `dphelper.array.delete(array, 'key')` |
|
|
11
|
+
| `merge` | Merges two objects/arrays recursively | `dphelper.array.merge(arrA, arrB)` |
|
|
12
|
+
| `mergeByKey` | Merges two arrays of objects via a specific key | `dphelper.array.mergeByKey(arrA, arrB, 'id')` |
|
|
13
|
+
| `duplicates` | Finds duplicate elements in an array | `dphelper.array.duplicates(array)` |
|
|
14
|
+
| `even` / `odd` | Filters even or odd numbers | `dphelper.array.even(array)` |
|
|
15
|
+
| `sumColumn` | Sums values of a column in a multidimensional array | `dphelper.array.sumColumn(arr, 0)` |
|
|
16
|
+
| `shuffle` | Randomly shuffles elements | `dphelper.array.shuffle(array)` |
|
|
17
|
+
| `generate` | Generates an array of random numbers | `dphelper.array.generate(10)` |
|
|
18
|
+
| `testArrayInt` | Checks for missing numbers in a sequence | `dphelper.array.testArrayInt([1,2,4])` |
|
|
19
|
+
| `rand32` | Generates an array of random 32-bit integers | `dphelper.array.rand32(5)` |
|
|
20
|
+
| `match` | Finds intersections between two arrays of words | `dphelper.array.match(arrA, arrB)` |
|
|
21
|
+
| `pathToJson` | Converts an array of paths into a JSON object | `dphelper.array.pathToJson(paths, '/')` |
|
|
22
|
+
|
|
23
|
+
## Description
|
|
24
|
+
|
|
25
|
+
Tool for advanced array manipulation. Native functions (such as `unique` via Set, `sort`, or `structuredClone`) have been removed to encourage the use of modern JavaScript APIs.
|
|
26
|
+
|
|
27
|
+
## Details
|
|
28
|
+
|
|
29
|
+
- **Author:** Dario Passariello
|
|
30
|
+
- **Version:** 0.0.2
|
|
31
|
+
- **Creation Date:** 20210101
|
|
32
|
+
- **Last Modified:** 20260220
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# audio
|
|
2
|
+
|
|
3
|
+
Management of audio playback in web pages.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `play` | Plays an audio file or stops existing ones | `dphelper.audio.play('sound.mp3')` |
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
Plays an audio file if it is not already playing. If called without arguments, it stops and removes **only** the audio elements previously created by `dphelper`, protecting other players on the page.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
- `file` - (Optional) Name of the audio file. If omitted, cleans up its own audio elements.
|
|
18
|
+
- `path` - File path (default: "").
|
|
19
|
+
- `loop` - Continuous playback (default: false).
|
|
20
|
+
|
|
21
|
+
## Details
|
|
22
|
+
|
|
23
|
+
- **Author:** Dario Passariello
|
|
24
|
+
- **Version:** 0.0.2
|
|
25
|
+
- **Creation Date:** 20240924
|
|
26
|
+
- **Last Modified:** 20260220
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# avoid
|
|
2
|
+
|
|
3
|
+
Utilities for preventing browser caching.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `cache` | Adds a cache-busting parameter to the URI | `dphelper.avoid.cache(uri)` |
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
Appends a unique query parameter to a given URI to prevent the browser from using a cached version of the resource.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
- `uri` - The URI to which the cache-busting parameter will be added.
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.1
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20210101
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# browser
|
|
2
|
+
|
|
3
|
+
Functionality for navigation and browser state.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `state` | Pushes a new state to the history | `dphelper.browser.state([state, title, url])` |
|
|
10
|
+
| `forw` | Moves forward in the history | `dphelper.browser.forw([number])` |
|
|
11
|
+
| `back` | Moves backward in the history | `dphelper.browser.back([number])` |
|
|
12
|
+
| `reload` | Reloads the page | `dphelper.browser.reload()` |
|
|
13
|
+
| `href` | Navigates to a URL | `dphelper.browser.href()` |
|
|
14
|
+
| `offLine` | Shows an offline message | `dphelper.browser.offLine()` |
|
|
15
|
+
| `zoom` | Returns the zoom level | `dphelper.browser.zoom()` |
|
|
16
|
+
| `status` | Returns a description of the HTTP status | `dphelper.browser.status()` |
|
|
17
|
+
|
|
18
|
+
## Description
|
|
19
|
+
|
|
20
|
+
A complete tool for managing browser navigation, including history, URLs, and connection status.
|
|
21
|
+
|
|
22
|
+
## Usage Examples
|
|
23
|
+
|
|
24
|
+
### Change URL without reloading
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
dphelper.browser.state({ id: 1 }, "Page Title", "/new-url");
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Forced navigation
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
dphelper.browser.href("https://google.com");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Details
|
|
37
|
+
|
|
38
|
+
- **Author:** Dario Passariello
|
|
39
|
+
- **Version:** 0.0.1
|
|
40
|
+
- **Creation Date:** 20210101
|
|
41
|
+
- **Last Modified:** 20210101
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# check
|
|
2
|
+
|
|
3
|
+
Validation and check utilities.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `version` | Compares two version strings | `dphelper.check.version([v1], [v2], [opts])` |
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
Tool for validating versions and performing other checks.
|
|
14
|
+
|
|
15
|
+
## Details
|
|
16
|
+
|
|
17
|
+
- **Author:** Dario Passariello
|
|
18
|
+
- **Version:** 0.0.1
|
|
19
|
+
- **Creation Date:** 20240829
|
|
20
|
+
- **Last Modified:** 20240829
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# color
|
|
2
|
+
|
|
3
|
+
Utilities for color conversion and management.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `hex` | Converts a number (0-255) into a two-digit hexadecimal string | `dphelper.color.hex(255)` |
|
|
10
|
+
| `toHex` | Converts an RGB array to a hexadecimal string | `dphelper.color.toHex([255, 0, 0])` |
|
|
11
|
+
| `toRGB` | Converts a hexadecimal string to an RGB array | `dphelper.color.toRGB('#FF0000')` |
|
|
12
|
+
| `oleColor` | Converts a hex color to OLE decimal format (used in legacy Windows) | `dphelper.color.oleColor('#FFFFFF')` |
|
|
13
|
+
| `gradient` | Generates a color scale (array) between two shades | `dphelper.color.gradient('#000', '#FFF', 10)` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Tool for conversion between different color formats. Hexadecimal conversion logic has been modernized using native JavaScript methods.
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.2
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20260220
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# cookie
|
|
2
|
+
|
|
3
|
+
Management of browser cookies.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `set` | Creates a cookie with specified properties | `dphelper.cookie.set({name, value, time, path = '/'})` |
|
|
10
|
+
| `get` | Retrieves the value of a cookie | `dphelper.cookie.get(name)` |
|
|
11
|
+
| `delete` | Deletes a specific cookie | `dphelper.cookie.delete(name)` |
|
|
12
|
+
| `removeAll` | Removes all cookies | `dphelper.cookie.removeAll()` |
|
|
13
|
+
|
|
14
|
+
## Description
|
|
15
|
+
|
|
16
|
+
Complete tool for cookie management: creation, reading, and deletion.
|
|
17
|
+
|
|
18
|
+
## Details
|
|
19
|
+
|
|
20
|
+
- **Author:** Dario Passariello
|
|
21
|
+
- **Version:** 0.0.1
|
|
22
|
+
- **Creation Date:** 20210101
|
|
23
|
+
- **Last Modified:** 20240613
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coords
|
|
2
|
+
|
|
3
|
+
Utilities for geographic calculations, coordinate conversions, and spatial mappings.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `degreesToRadians` | Converts degrees to radians | `dphelper.coords.degreesToRadians(180)` |
|
|
10
|
+
| `latToMeters` | Approximates conversion from latitude to meters | `dphelper.coords.latToMeters([lat, lng])` |
|
|
11
|
+
| `distance` | Calculates distance between two points (Haversine) in Km, Mi, and NMi | `dphelper.coords.distance(p1, p2)` |
|
|
12
|
+
| `polarToCartesian` | Converts polar coordinates to Cartesian (X, Y) | `dphelper.coords.polarToCartesian(cx, cy, r, angle)` |
|
|
13
|
+
| `mapDegreesToPixels` | Maps geographic degrees to pixel coordinates with padding | `dphelper.coords.mapDegreesToPixels(deg, min, max, pMin, pMax, pad)` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Specialized tool for trigonometric and geographic calculations. Mapping formulas (pixel/degrees) have been optimized and commented for better readability and geometric precision.
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.2
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20260220
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# credits
|
|
2
|
+
|
|
3
|
+
Log project information to the console.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `credits` | Logs project properties | `dphelper.credits(props)` |
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
Logs various properties about a project to the console in a formatted manner.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
- `props` - The project properties (name, version, description, license, author, email).
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.1
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20210101
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# date
|
|
2
|
+
|
|
3
|
+
Advanced utilities for date management.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `toIso` | Converts a date to ISO format | `dphelper.date.toIso([value, int = 'en'])` |
|
|
10
|
+
| `toMMDDYYYY` | Converts to MMDDYYYY format | `dphelper.date.toMMDDYYYY([value])` |
|
|
11
|
+
| `toYYYYMMDD` | Converts to YYYYMMDD format | `dphelper.date.toYYYYMMDD([value])` |
|
|
12
|
+
| `toHuman` | Converts to a human-readable format | `dphelper.date.toHuman([value])` |
|
|
13
|
+
| `convert` | Converts dates between formats | `dphelper.date.convert()` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Complete tool for converting and formatting dates in various formats.
|
|
18
|
+
|
|
19
|
+
## Usage Examples
|
|
20
|
+
|
|
21
|
+
### Database Format
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
const dbDate = dphelper.date.toYYYYMMDD(new Date());
|
|
25
|
+
console.log(dbDate); // '20260223'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Human-Readable Format
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
const humanDate = dphelper.date.toHuman("20260223");
|
|
32
|
+
console.log(humanDate); // '23 February 2026' (depends on locale)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Details
|
|
36
|
+
|
|
37
|
+
- **Author:** Dario Passariello
|
|
38
|
+
- **Version:** 0.0.1
|
|
39
|
+
- **Creation Date:** 20210101
|
|
40
|
+
- **Last Modified:** 20230101
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# disable
|
|
2
|
+
|
|
3
|
+
Disabling browser functionalities on DOM elements.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `select` | Disables text selection | `dphelper.disable.select([el = 'body'])` |
|
|
10
|
+
| `spellCheck` | Disables spell checking | `dphelper.disable.spellCheck([tmr = 5000])` |
|
|
11
|
+
| `rightClick` | Disables the context menu | `dphelper.disable.rightClick([el = 'body'])` |
|
|
12
|
+
| `copy` | Disables copy functionality | `dphelper.disable.copy([el = 'body'])` |
|
|
13
|
+
| `paste` | Disables paste functionality | `dphelper.disable.paste([el = 'body'])` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Tool for disabling browser features on specific elements: text selection, copy, paste, right-click, and spell-check.
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.1
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20210101
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# dispatch
|
|
2
|
+
|
|
3
|
+
Custom event dispatching system.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `set` | Dispatches a custom event | `dphelper.dispatch.set([name, value])` |
|
|
10
|
+
| `listen` | Listens for specified events | `dphelper.dispatch.listen([eventNames, callback=null], flag = true)` |
|
|
11
|
+
| `remove` | Removes an event listener | `dphelper.dispatch.remove([eventNames, callback=null], flag = true)` |
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
Tool for managing custom events: dispatch, listen, and remove.
|
|
16
|
+
|
|
17
|
+
## Details
|
|
18
|
+
|
|
19
|
+
- **Author:** Dario Passariello
|
|
20
|
+
- **Version:** 0.0.1
|
|
21
|
+
- **Creation Date:** 20231231
|
|
22
|
+
- **Last Modified:** 20240612
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# element
|
|
2
|
+
|
|
3
|
+
Advanced manipulation of DOM elements.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `fitScale` | Scales an element based on the window | `dphelper.element.fitScale([el = 'root', scale = 1, fit = false])` |
|
|
10
|
+
| `scaleBasedOnWindow` | Scales based on window dimensions | `dphelper.element.scaleBasedOnWindow(elm, scale, fit)` |
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
Tool for responsive scaling of DOM elements based on window size.
|
|
15
|
+
|
|
16
|
+
## Details
|
|
17
|
+
|
|
18
|
+
- **Author:** Dario Passariello
|
|
19
|
+
- **Version:** 0.0.1
|
|
20
|
+
- **Creation Date:** 20230527
|
|
21
|
+
- **Last Modified:** 20230527
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# event
|
|
2
|
+
|
|
3
|
+
Advanced management of DOM events.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `list` | Lists attached events | `dphelper.event.list([element])` |
|
|
10
|
+
| `multi` | Attaches multiple event listeners | `dphelper.event.multi([element, eventNames, listener])` |
|
|
11
|
+
| `copy` | Copies content to clipboard | `dphelper.event.copy([element])` |
|
|
12
|
+
| `onDrag` | Manages drag functionality | `dphelper.event.onDrag([element])` |
|
|
13
|
+
|
|
14
|
+
## Description
|
|
15
|
+
|
|
16
|
+
Tool for advanced event management: event listing, multiple listeners, and drag-and-drop support.
|
|
17
|
+
|
|
18
|
+
## Details
|
|
19
|
+
|
|
20
|
+
- **Author:** Dario Passariello
|
|
21
|
+
- **Version:** 0.0.1
|
|
22
|
+
- **Creation Date:** 20210101
|
|
23
|
+
- **Last Modified:** 20210101
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# form
|
|
2
|
+
|
|
3
|
+
Complete management of HTML forms.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `serialize` | Serializes form into an object | `dphelper.form.serialize([form])` |
|
|
10
|
+
| `confirmType` | Confirms the type of a value | `dphelper.form.confirmType([type, value])` |
|
|
11
|
+
| `required` | Checks if a value is required | `dphelper.form.required([value])` |
|
|
12
|
+
| `minLength` | Checks minimum length | `dphelper.form.minLength([value, num = 1])` |
|
|
13
|
+
| `maxLength` | Checks maximum length | `dphelper.form.maxLength([value, num = 1])` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Complete tool for form management: serialization, validation, and field control.
|
|
18
|
+
|
|
19
|
+
## Usage Examples
|
|
20
|
+
|
|
21
|
+
### Serialize a Form
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
const formData = dphelper.form.serialize('#my-form');
|
|
25
|
+
console.log(formData.email); // 'user@email.com'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Quick Validation
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
if (!dphelper.form.required(input.value)) {
|
|
32
|
+
console.error("Required field!");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!dphelper.form.minLength(password.value, 8)) {
|
|
36
|
+
console.warn("Password too short.");
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Details
|
|
41
|
+
|
|
42
|
+
- **Author:** Dario Passariello
|
|
43
|
+
- **Version:** 0.0.1
|
|
44
|
+
- **Creation Date:** 20210101
|
|
45
|
+
- **Last Modified:** 20210101
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# format
|
|
2
|
+
|
|
3
|
+
Utilities for data formatting.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `currency` | Formats a number as currency | `dphelper.format.currency(value, locale, currency)` |
|
|
10
|
+
| `phoneNumber` | Formats a string as a phone number | `dphelper.format.phoneNumber(value, countryCode)` |
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
Tool for formatting currencies and phone numbers.
|
|
15
|
+
|
|
16
|
+
## Details
|
|
17
|
+
|
|
18
|
+
- **Author:** Dario Passariello
|
|
19
|
+
- **Version:** 0.0.1
|
|
20
|
+
- **Creation Date:** 20210101
|
|
21
|
+
- **Last Modified:** 20210101
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# json
|
|
2
|
+
|
|
3
|
+
Utilities for JSON data manipulation.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `is` | Verifies if a string is a valid JSON | `dphelper.json.is(str)` |
|
|
10
|
+
| `sanitize` | Attempts to fix and normalize malformed JSON strings | `dphelper.json.sanitize(str)` |
|
|
11
|
+
| `toCsv` | Converts an array of objects to CSV format | `dphelper.json.toCsv(data)` |
|
|
12
|
+
| `saveCsvAs` | Generates and downloads a CSV file from provided data | `dphelper.json.saveCsvAs(csv, 'file.csv')` |
|
|
13
|
+
| `counter` | Counts occurrences of keys/values in a structure | `dphelper.json.counter(data)` |
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
Tool for JSON manipulation: safe parsing, normalization of dirty data (via `sanitize`), CSV conversions, and validation.
|
|
18
|
+
|
|
19
|
+
## Details
|
|
20
|
+
|
|
21
|
+
- **Author:** Dario Passariello
|
|
22
|
+
- **Version:** 0.0.2
|
|
23
|
+
- **Creation Date:** 20210101
|
|
24
|
+
- **Last Modified:** 20260220
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
*Automatically generated document*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# load
|
|
2
|
+
|
|
3
|
+
Asynchronous resource loading.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description | Example |
|
|
8
|
+
|----------|-------------|---------|
|
|
9
|
+
| `all` | Loads all files from a directory context | `dphelper.load.all(require.context('Scripts', true, /\.(js|ts)$/) [, 'cacheName'])` |
|
|
10
|
+
| `file` | Loads a specific file | `dphelper.load.file(filePath)` |
|
|
11
|
+
| `fileToElement` | Loads a file and inserts it into an element | `dphelper.load.fileToElement(filePath, elementSelector)` |
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
Tool for asynchronous loading of files and resources: scripts, files, and HTML content.
|
|
16
|
+
|
|
17
|
+
## Details
|
|
18
|
+
|
|
19
|
+
- **Author:** Dario Passariello
|
|
20
|
+
- **Version:** 0.0.1
|
|
21
|
+
- **Creation Date:** 20210101
|
|
22
|
+
- **Last Modified:** 20240101
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
*Automatically generated document*
|