dphelper 0.2.27 → 0.2.31
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/data/list.json +19 -26
- package/init.js +20 -5
- package/package.json +6 -11
- package/scripts/{date2Iso.js → .OLD/~date2Iso.js} +31 -20
- package/scripts/{date2MMDDYYYY.js → .OLD/~date2MMDDYYYY.js} +27 -16
- package/scripts/{dateConvert.js → .OLD/~dateConvert.js} +31 -20
- package/scripts/{dateIso2Epoch.js → .OLD/~dateIso2Epoch.js} +28 -17
- package/scripts/{dateLocal-ISOTime.js → .OLD/~dateLocal-ISOTime.js} +28 -17
- package/scripts/.OLD/~dateUTC.js +25 -0
- package/scripts/{disableSpellCheck.js → .OLD/~disableSpellCheck.js} +32 -21
- package/scripts/.OLD/~loadJson.js +27 -0
- package/scripts/{loadJsonExternal.js → .OLD/~loadJsonExternal.js} +44 -32
- package/scripts/{object2array.js → .OLD/~object2array.js} +15 -3
- package/scripts/.OLD/~parseDate.js +30 -0
- package/scripts/.OLD/~pathHash.js +27 -0
- package/scripts/.OLD/~pathQuery.js +28 -0
- package/scripts/.OLD/~pathRail.js +27 -0
- package/scripts/{scrollIndicator.js → .OLD/~scrollIndicator.js} +0 -0
- package/scripts/{scrollMemory.js → .OLD/~scrollMemory.js} +0 -0
- package/scripts/{scrollSmooth.js → .OLD/~scrollSmooth.js} +0 -0
- package/scripts/{scrollToElement.js → .OLD/~scrollToElement.js} +0 -0
- package/scripts/{svgSupport.js → .OLD/~svgSupport.js} +0 -0
- package/scripts/addListenerMulti.js +22 -0
- package/scripts/anchorToOnClick.js +15 -3
- package/scripts/array.js +29 -3
- package/scripts/camelCase.js +41 -0
- package/scripts/console.js +86 -0
- package/scripts/cookie.js +97 -71
- package/scripts/currency.js +31 -11
- package/scripts/date.js +101 -0
- package/scripts/disable.js +88 -0
- package/scripts/font.js +52 -0
- package/scripts/form.js +113 -0
- package/scripts/indexedDB.js +47 -10
- package/scripts/isPromise.js +26 -14
- package/scripts/json.js +42 -0
- package/scripts/load.js +70 -0
- package/scripts/nl2br.js +26 -14
- package/scripts/noCache.js +26 -14
- package/scripts/obj.js +81 -0
- package/scripts/onBeforeUnLoad.js +120 -108
- package/scripts/parseBool.js +27 -15
- package/scripts/path.js +94 -0
- package/scripts/printInfo.js +28 -16
- package/scripts/purge.js +53 -41
- package/scripts/pushState.js +33 -14
- package/scripts/randomNum.js +15 -3
- package/scripts/randomNumTmr.js +26 -14
- package/scripts/screen.js +64 -0
- package/scripts/scrollbar.js +226 -0
- package/scripts/{handleEvent.js → shortcut.js} +70 -59
- package/scripts/sleep.js +26 -14
- package/scripts/storage.js +29 -3
- package/scripts/svg.js +372 -0
- package/scripts/text.js +49 -0
- package/scripts/time.js +41 -0
- package/scripts/trigger.js +37 -0
- package/scripts/uuid.js +33 -14
- package/scripts/window.js +50 -38
- package/#cmd.exe.lnk +0 -0
- package/.github/workflows/codeql-analysis.yml +0 -70
- package/README.md.bak +0 -70
- package/scripts/.OLD/arrayDeleteItem.js +0 -35
- package/scripts/.OLD/arrayItemFinder.js +0 -22
- package/scripts/.OLD/arrayMerge.js +0 -20
- package/scripts/.OLD/arrayUnique.js +0 -15
- package/scripts/.OLD/loadAsset.js +0 -26
- package/scripts/dateUTC.js +0 -14
- package/scripts/disableSelect.js +0 -46
- package/scripts/epoch.js +0 -14
- package/scripts/fontFit.js +0 -24
- package/scripts/fullScreen.js +0 -40
- package/scripts/jsonCounter.js +0 -21
- package/scripts/loadFile.js +0 -17
- package/scripts/loadJson.js +0 -15
- package/scripts/parseDate.js +0 -19
- package/scripts/pathHash.js +0 -20
- package/scripts/pathQuery.js +0 -24
- package/scripts/pathRail.js +0 -26
- package/scripts/scrollCustom.js +0 -41
- package/scripts/serializeForm.js +0 -94
- package/scripts/serializeObj.js +0 -47
- package/scripts/stopConsole.js +0 -49
- package/scripts/textChanger.js +0 -24
- package/scripts/triggerClick.js +0 -16
package/data/list.json
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"info" : {
|
|
3
|
-
"title" : "List",
|
|
4
|
-
"description" : "Complete list of tools"
|
|
5
|
-
},
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"command" : "array",
|
|
21
|
-
"example" : "// FIND\r\ndphelper.array.find( 12345 , YourArray ) --> search your data\r\n\r\n// UNIQUE\r\ndphelper.array.unique( YourArray ) --> remove duplicates\r\n\r\n// DELETE\r\ndphelper.array.delete( 12345 , YourArray ) --> remove a sub-data using id\r\n\r\n// MERGE\r\ndphelper.array.merge( YourArray1 , YourArray2 ) --> result is YourArray3 ",
|
|
22
|
-
"author" : "Dario Passariello",
|
|
23
|
-
"active" : true
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"info" : {
|
|
3
|
+
"title" : "List",
|
|
4
|
+
"description" : "Complete list of tools"
|
|
5
|
+
},
|
|
6
|
+
"categories" : [
|
|
7
|
+
"3dparty",
|
|
8
|
+
"system",
|
|
9
|
+
"financial",
|
|
10
|
+
"memory",
|
|
11
|
+
"numbers",
|
|
12
|
+
"time",
|
|
13
|
+
"path",
|
|
14
|
+
"file",
|
|
15
|
+
"forms",
|
|
16
|
+
"ui",
|
|
17
|
+
"other"
|
|
18
|
+
]
|
|
19
|
+
}
|
package/init.js
CHANGED
|
@@ -17,9 +17,23 @@
|
|
|
17
17
|
|
|
18
18
|
// CREATE ROOT STORE
|
|
19
19
|
const dphelper = window.dphelper = {};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
window.dphelper._list = require('./data/list.json');
|
|
22
|
+
window.dphelper._list.scripts = [];
|
|
23
|
+
window.dphelper._list.version = pjson.version;
|
|
24
|
+
|
|
25
|
+
const cache = {};
|
|
26
|
+
|
|
27
|
+
function importAll(r){
|
|
28
|
+
r.keys().forEach(
|
|
29
|
+
(key) => (
|
|
30
|
+
cache[key] = r(key)
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
importAll( require.context( __dirname + '/scripts/', false, /\.js$/) );
|
|
36
|
+
|
|
23
37
|
|
|
24
38
|
// FIRST MESSAGE
|
|
25
39
|
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
|
|
@@ -35,8 +49,7 @@
|
|
|
35
49
|
console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
|
|
36
50
|
console.groupEnd();
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
/*
|
|
40
53
|
// SYSTEM
|
|
41
54
|
require('./scripts/addListenerMulti.js');
|
|
42
55
|
|
|
@@ -98,6 +111,7 @@
|
|
|
98
111
|
require('./scripts/scrollCustom.js');
|
|
99
112
|
|
|
100
113
|
// OTHER
|
|
114
|
+
require('./scripts/camelCase.js');
|
|
101
115
|
require('./scripts/fontFit.js');
|
|
102
116
|
require('./scripts/uuid.js');
|
|
103
117
|
require('./scripts/noCache.js');
|
|
@@ -117,5 +131,6 @@
|
|
|
117
131
|
require('./scripts/svgSupport.js');
|
|
118
132
|
require('./scripts/stopConsole.js');
|
|
119
133
|
require('./scripts/onBeforeUnLoad.js');
|
|
134
|
+
*/
|
|
120
135
|
|
|
121
136
|
})();
|
package/package.json
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.31",
|
|
4
|
+
"description": "Developer Tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {},
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test1": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"test": "jest --silent --detectOpenHandles",
|
|
10
|
-
"test-coverage": "jest --coverage --silent"
|
|
11
|
-
},
|
|
12
7
|
"targets": {
|
|
13
8
|
"main": {
|
|
14
9
|
"includeNodeModules": {
|
|
@@ -29,12 +24,12 @@
|
|
|
29
24
|
},
|
|
30
25
|
"funding": [
|
|
31
26
|
{
|
|
32
|
-
"type"
|
|
33
|
-
"url"
|
|
27
|
+
"type": "individual",
|
|
28
|
+
"url": "https://www.paypal.com/donate/?business=HC7LJ2ZXRRNDL&no_recurring=0&item_name=I+am+a+software+developer.+Just+a+donation+can+help+me+to+have+more+time+to+dedicate+on+this+project¤cy_code=CAD"
|
|
34
29
|
},
|
|
35
30
|
{
|
|
36
|
-
"type"
|
|
37
|
-
"url"
|
|
31
|
+
"type": "patreon",
|
|
32
|
+
"url": "https://www.patreon.com/passariello"
|
|
38
33
|
}
|
|
39
34
|
],
|
|
40
35
|
"eslintConfig": {
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Date To Iso",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "date2Iso",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.date2Iso = (value , int = 'en' ) => {
|
|
24
|
+
if (!value) value = '';
|
|
25
|
+
let date = new Date(value);
|
|
26
|
+
if (date == 'Invalid Date') return null; //date = new Date()
|
|
27
|
+
const dateTimeFormat = new Intl.DateTimeFormat( int , {
|
|
28
|
+
year: 'numeric', month: 'long', day: 'numeric',
|
|
29
|
+
});
|
|
30
|
+
return dateTimeFormat.format(date);
|
|
31
|
+
};
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Date To MMDDYYYY",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "date2MMDDYYYY",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.date2MMDDYYYY = (value) => {
|
|
24
|
+
if (!value) value = '';
|
|
25
|
+
let date = new Date(value);
|
|
26
|
+
return ('0' + (date.getMonth() + 1)).slice(-2) + "" + ('0' + date.getDate()).slice(-2) + "" + date.getFullYear();
|
|
27
|
+
};
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Convert Date",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "dateConvert",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.dateConvert = (value , format ) => {
|
|
24
|
+
if( !format) format = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
25
|
+
if (!value) return null;
|
|
26
|
+
let monthNames = format;
|
|
27
|
+
let month = value.substring(0, 2).replace('0', '');
|
|
28
|
+
let day = value.substring(2, 4);
|
|
29
|
+
let year = value.substring(value.length - 4);
|
|
30
|
+
return day + ' ' + monthNames[Number(month) - 1] + ' ' + year;
|
|
31
|
+
};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Date Iso To Epoch",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "dateIso2Epoch",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.dateIso2Epoch = (value) => {
|
|
24
|
+
if (!value) value = '';
|
|
25
|
+
let date = new Date(value);
|
|
26
|
+
let milliseconds = date.getTime();
|
|
27
|
+
return milliseconds;
|
|
28
|
+
};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Local Iso Time",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "localISOTime",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.localISOTime = (value) => {
|
|
24
|
+
if (!value) value = '';
|
|
25
|
+
let tzoffset = (new Date(value)).getTimezoneOffset() * 60000;
|
|
26
|
+
let localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
|
|
27
|
+
return localISOTime;
|
|
28
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Date UTC",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "dateUTC",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.dateUTC = () => {
|
|
24
|
+
return moment().toISOString();
|
|
25
|
+
};
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Disable SpellCheck",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "disableSpellCheck",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"active" : true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.dphelper._list.scripts.push( description );
|
|
20
|
+
|
|
21
|
+
/***********************************************************************/
|
|
22
|
+
|
|
23
|
+
window.dphelper.disableSpellCheck = ( tmr = 5000 ) => {
|
|
24
|
+
setInterval( () => {
|
|
25
|
+
let inputs = document.querySelectorAll("input[type=text], textarea");
|
|
26
|
+
for(let i = 0; i < inputs.length; i++){
|
|
27
|
+
if( !inputs[i].getAttribute("spellcheck") ){
|
|
28
|
+
inputs[i].setAttribute("spellcheck", "false");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, tmr );
|
|
32
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Load Internal Json",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "loadJson",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.dphelper.loadJson = function( file ){
|
|
25
|
+
if ( file.match(/.(json)$/i ) ) return require( '' + file + '' );
|
|
26
|
+
};
|
|
27
|
+
|
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Load External Json",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "loadJsonExternal",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.dphelper.loadJsonExternal = ( path, method='GET', type='application/json' ) => {
|
|
25
|
+
|
|
26
|
+
fetch( path ,{
|
|
27
|
+
method: method,
|
|
28
|
+
headers : {
|
|
29
|
+
'Content-Type': type
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.then(
|
|
33
|
+
function(response) {
|
|
34
|
+
//return response.json();
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
.then(
|
|
39
|
+
function( myFile ) {
|
|
40
|
+
return myFile;
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
};
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* object2array
|
|
5
|
-
*
|
|
6
3
|
* Copyright (c) 2021, Dario Passariello.
|
|
7
4
|
* Licensed under the Apache-2.0 License.
|
|
8
5
|
*/
|
|
9
6
|
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Convert Object To Array",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "obj2array",
|
|
14
|
+
"sub-command" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
10
22
|
/***********************************************************************/
|
|
11
23
|
|
|
12
24
|
window.dphelper.obj2array = ( object ) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "MMDDYYYY To DD/MM/YYYY",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "parseDate",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.dphelper.parseDate = ( value , separator = '/' ) => {
|
|
25
|
+
if (!value) return null;
|
|
26
|
+
let month = value.substring(0, 2);
|
|
27
|
+
let day = value.substring(2, 4);
|
|
28
|
+
let year = value.substring(4, 8);
|
|
29
|
+
return month + separator + day + separator + year;
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Array From Hash Path",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "pathHash",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
// ALIAS
|
|
24
|
+
window.dphelper.pathHash = () => {
|
|
25
|
+
console.log( 'Please use "dphelper.path.hash()"' );
|
|
26
|
+
return window.dphelper.path.hash();
|
|
27
|
+
};
|