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.
Files changed (85) hide show
  1. package/data/list.json +19 -26
  2. package/init.js +20 -5
  3. package/package.json +6 -11
  4. package/scripts/{date2Iso.js → .OLD/~date2Iso.js} +31 -20
  5. package/scripts/{date2MMDDYYYY.js → .OLD/~date2MMDDYYYY.js} +27 -16
  6. package/scripts/{dateConvert.js → .OLD/~dateConvert.js} +31 -20
  7. package/scripts/{dateIso2Epoch.js → .OLD/~dateIso2Epoch.js} +28 -17
  8. package/scripts/{dateLocal-ISOTime.js → .OLD/~dateLocal-ISOTime.js} +28 -17
  9. package/scripts/.OLD/~dateUTC.js +25 -0
  10. package/scripts/{disableSpellCheck.js → .OLD/~disableSpellCheck.js} +32 -21
  11. package/scripts/.OLD/~loadJson.js +27 -0
  12. package/scripts/{loadJsonExternal.js → .OLD/~loadJsonExternal.js} +44 -32
  13. package/scripts/{object2array.js → .OLD/~object2array.js} +15 -3
  14. package/scripts/.OLD/~parseDate.js +30 -0
  15. package/scripts/.OLD/~pathHash.js +27 -0
  16. package/scripts/.OLD/~pathQuery.js +28 -0
  17. package/scripts/.OLD/~pathRail.js +27 -0
  18. package/scripts/{scrollIndicator.js → .OLD/~scrollIndicator.js} +0 -0
  19. package/scripts/{scrollMemory.js → .OLD/~scrollMemory.js} +0 -0
  20. package/scripts/{scrollSmooth.js → .OLD/~scrollSmooth.js} +0 -0
  21. package/scripts/{scrollToElement.js → .OLD/~scrollToElement.js} +0 -0
  22. package/scripts/{svgSupport.js → .OLD/~svgSupport.js} +0 -0
  23. package/scripts/addListenerMulti.js +22 -0
  24. package/scripts/anchorToOnClick.js +15 -3
  25. package/scripts/array.js +29 -3
  26. package/scripts/camelCase.js +41 -0
  27. package/scripts/console.js +86 -0
  28. package/scripts/cookie.js +97 -71
  29. package/scripts/currency.js +31 -11
  30. package/scripts/date.js +101 -0
  31. package/scripts/disable.js +88 -0
  32. package/scripts/font.js +52 -0
  33. package/scripts/form.js +113 -0
  34. package/scripts/indexedDB.js +47 -10
  35. package/scripts/isPromise.js +26 -14
  36. package/scripts/json.js +42 -0
  37. package/scripts/load.js +70 -0
  38. package/scripts/nl2br.js +26 -14
  39. package/scripts/noCache.js +26 -14
  40. package/scripts/obj.js +81 -0
  41. package/scripts/onBeforeUnLoad.js +120 -108
  42. package/scripts/parseBool.js +27 -15
  43. package/scripts/path.js +94 -0
  44. package/scripts/printInfo.js +28 -16
  45. package/scripts/purge.js +53 -41
  46. package/scripts/pushState.js +33 -14
  47. package/scripts/randomNum.js +15 -3
  48. package/scripts/randomNumTmr.js +26 -14
  49. package/scripts/screen.js +64 -0
  50. package/scripts/scrollbar.js +226 -0
  51. package/scripts/{handleEvent.js → shortcut.js} +70 -59
  52. package/scripts/sleep.js +26 -14
  53. package/scripts/storage.js +29 -3
  54. package/scripts/svg.js +372 -0
  55. package/scripts/text.js +49 -0
  56. package/scripts/time.js +41 -0
  57. package/scripts/trigger.js +37 -0
  58. package/scripts/uuid.js +33 -14
  59. package/scripts/window.js +50 -38
  60. package/#cmd.exe.lnk +0 -0
  61. package/.github/workflows/codeql-analysis.yml +0 -70
  62. package/README.md.bak +0 -70
  63. package/scripts/.OLD/arrayDeleteItem.js +0 -35
  64. package/scripts/.OLD/arrayItemFinder.js +0 -22
  65. package/scripts/.OLD/arrayMerge.js +0 -20
  66. package/scripts/.OLD/arrayUnique.js +0 -15
  67. package/scripts/.OLD/loadAsset.js +0 -26
  68. package/scripts/dateUTC.js +0 -14
  69. package/scripts/disableSelect.js +0 -46
  70. package/scripts/epoch.js +0 -14
  71. package/scripts/fontFit.js +0 -24
  72. package/scripts/fullScreen.js +0 -40
  73. package/scripts/jsonCounter.js +0 -21
  74. package/scripts/loadFile.js +0 -17
  75. package/scripts/loadJson.js +0 -15
  76. package/scripts/parseDate.js +0 -19
  77. package/scripts/pathHash.js +0 -20
  78. package/scripts/pathQuery.js +0 -24
  79. package/scripts/pathRail.js +0 -26
  80. package/scripts/scrollCustom.js +0 -41
  81. package/scripts/serializeForm.js +0 -94
  82. package/scripts/serializeObj.js +0 -47
  83. package/scripts/stopConsole.js +0 -49
  84. package/scripts/textChanger.js +0 -24
  85. 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
- "scripts" : [
7
- {
8
- "name" : "Anchors to onClick",
9
- "description" : "Transform all anchor inside specific elements in to onClick (DOM)\r\n<br/>\r\n<br/>\r\n\r\nUsage: <br/>\r\n<br/>\r\n\r\n<code>\r\ndphelper.anchorToOnClick( \"your element(s)\" )\r\n</code>\r\n\r\n<br/>\r\n<br/>\r\nAutomatically all anchors became onClick. Use it at end off page or defer or after DOMs loaded \r\n\r\n",
10
- "version" : "0.0.1",
11
- "command" : "anchorToOnClick",
12
- "example" : "dphelper.anchorToOnClick(\"nav\") --> now all nav anchor are onClick ( href is removed )",
13
- "author" : "Dario Passariello",
14
- "active" : true
15
- },
16
- {
17
- "name" : "Arrays Tools",
18
- "description" : "Useful way to andle array without efforts\r\n<br/>\r\n\r\n\r\n",
19
- "version" : "0.0.1",
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
- window.dphelper.list = require('./data/list.json');
22
- window.dphelper.list.version = pjson.version;
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
- const $ = require("jquery");
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.27",
4
- "description": "Many utils for your projects",
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" : "individual",
33
- "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&currency_code=CAD"
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&currency_code=CAD"
34
29
  },
35
30
  {
36
- "type" : "patreon",
37
- "url" : "https://www.patreon.com/passariello"
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
- * date to iso
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.date2Iso = (value , int = 'en' ) => {
13
- if (!value) value = '';
14
- let date = new Date(value);
15
- if (date == 'Invalid Date') return null; //date = new Date()
16
- const dateTimeFormat = new Intl.DateTimeFormat( int , {
17
- year: 'numeric', month: 'long', day: 'numeric',
18
- });
19
- return dateTimeFormat.format(date);
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
- * date to MMDDYYYY
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.date2MMDDYYYY = (value) => {
13
- if (!value) value = '';
14
- let date = new Date(value);
15
- return ('0' + (date.getMonth() + 1)).slice(-2) + "" + ('0' + date.getDate()).slice(-2) + "" + date.getFullYear();
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
- * date convert
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.dateConvert = (value , format ) => {
13
- if( !format) format = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
14
- if (!value) return null;
15
- let monthNames = format;
16
- let month = value.substring(0, 2).replace('0', '');
17
- let day = value.substring(2, 4);
18
- let year = value.substring(value.length - 4);
19
- return day + ' ' + monthNames[Number(month) - 1] + ' ' + year;
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
- * date iso to epoch
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.dateIso2Epoch = (value) => {
13
- if (!value) value = '';
14
- let date = new Date(value);
15
- let milliseconds = date.getTime();
16
- return milliseconds;
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
- * parse date
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.localISOTime = (value) => {
13
- if (!value) value = '';
14
- let tzoffset = (new Date(value)).getTimezoneOffset() * 60000;
15
- let localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
16
- return localISOTime;
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
- * disableSpellCheck
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.disableSpellCheck = ( tmr = 5000 ) => {
13
- setInterval( () => {
14
- let inputs = document.querySelectorAll("input[type=text], textarea");
15
- for(let i = 0; i < inputs.length; i++){
16
- if( !inputs[i].getAttribute("spellcheck") ){
17
- inputs[i].setAttribute("spellcheck", "false");
18
- }
19
- }
20
- }, tmr );
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
- * loadJsonExternal
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.loadJsonExternal = ( path, method='GET', type='application/json' ) => {
13
-
14
- fetch( path ,{
15
- method: method,
16
- headers : {
17
- 'Content-Type': type
18
- }
19
- })
20
- .then(
21
- function(response) {
22
- //return response.json();
23
- return response;
24
- }
25
- )
26
- .then(
27
- function( myFile ) {
28
- return myFile;
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
+ };