dphelper 0.2.2 → 0.2.24

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/.jshintrc CHANGED
@@ -1,13 +1,13 @@
1
- {
2
- "esversion": 9,
3
- "asi": false,
4
- "esnext": false,
5
- "moz": true,
6
- "boss": true,
7
- "node": true,
8
- "validthis": true,
9
- "globals": {
10
- "EventEmitter": true,
11
- "Promise": true
12
- }
13
- }
1
+ {
2
+ "esversion": 11,
3
+ "asi": false,
4
+ "esnext": false,
5
+ "moz": true,
6
+ "boss": true,
7
+ "node": true,
8
+ "validthis": true,
9
+ "globals": {
10
+ "EventEmitter": true,
11
+ "Promise": true
12
+ }
13
+ }
package/README.md CHANGED
@@ -1,13 +1,122 @@
1
- # dpHelper
2
-
3
- Many utils for your projects
4
-
5
- Use "npm i dphelper" to install
6
-
7
- in the index:
8
-
9
- ```js
10
- import "dphelper"
11
- ```
12
-
13
- type 'dphelper' in your console to have a look about all available functions that you can use globaly!
1
+ # dpHelper
2
+
3
+ Many tools for your projects
4
+
5
+ ## about
6
+
7
+ You have a lot of tools for you that make your life easier and faster!
8
+
9
+ ## install
10
+
11
+ ```js
12
+ npm install dphelper
13
+ ```
14
+
15
+ in the index (and only there):
16
+
17
+ ```js
18
+ import "dphelper"
19
+ ```
20
+
21
+ ## check
22
+
23
+ type 'dphelper' in your console to have a look about all available tools that you can use globaly!
24
+
25
+ You can call these from everywhere without import (just one at index)
26
+
27
+ ## LIST
28
+
29
+ ### CURRENCY
30
+
31
+ ```js
32
+ dphelper.currency( val, int = 'en-US', cur = 'USD' )
33
+ ```
34
+
35
+ ### MEMORY / STORAGE
36
+
37
+ ```js
38
+ dphelper.storage.get( name )
39
+ dphelper.storage.set( name , value )
40
+ dphelper.storage.delete( name )
41
+ dphelper.storage.clearAll()
42
+ ```
43
+
44
+ ### MEMORY / COOKIE
45
+
46
+ ```js
47
+ dphelper.cookie.set( name , value , time , path = '/' )
48
+ dphelper.cookie.get( name )
49
+ dphelper.cookie.delete( name )
50
+ dphelper.cookie.clearAll()
51
+ ```
52
+
53
+ ### MEMORY / INDEXED-DB
54
+
55
+ ```js
56
+ dphelper.indexedDB.create( storeName, table, name )
57
+ dphelper.indexedDB.open( storeName )
58
+ dphelper.indexedDB.store( storeName, table )
59
+ dphelper.indexedDB.insert( storeName, table, key, value )
60
+ dphelper.indexedDB.update( storeName, table, key, value )
61
+ dphelper.indexedDB.get( storeName, table, key )
62
+
63
+ window.dphelper.dbExist() -> know databases
64
+ ```
65
+
66
+ ### NUMBERS
67
+
68
+ ```js
69
+ dphelper.rnd() // generate long random number
70
+ dphelper.tmr() // generate number by timer
71
+ ```
72
+
73
+ ### DATE / TIME
74
+
75
+ ```js
76
+ dphelper.epoch() // return epoch time
77
+ dphelper.parseDate( value ) // epoch to human date
78
+ dphelper.dateUTC() // generate UTC date format
79
+ dphelper.dateIso2Epoch( value ) // transform human date to epoch
80
+ dphelper.dateConvert( value , format ) // format like 23 Dec, 2021
81
+ dphelper.date2MMDDYYYY( value ) // format like 12312021
82
+ dphelper.date2Iso( value , int = 'en' ) // format in bese of internationalization
83
+ dphelper.localISOTime( value ) // format Thu, 31 May 2012 08:33:41 +0000
84
+ ```
85
+
86
+ ### PATH RAILS
87
+
88
+ ```js
89
+ dphelper.pathRail() // Generate array start from subFolders
90
+ dphelper.pathQuery() // Generate array start from querystring
91
+ dphelper.pathHash() // Generate array start from hash path
92
+ dphelper.pushState(state, title, url) // Create a new spushState and avoid page reload
93
+ dphelper.anchorToOnClick( container ) // Transform all a href to onclick (use . for class or # for div )
94
+ ```
95
+
96
+ ### FILE
97
+
98
+ ```js
99
+ dphelper.loadFile(element, path) // text to element
100
+ dphelper.loadJson( file ) // load json data to a variable
101
+ dphelper.loadJsonExternal( path, method='GET', type='application/json' ) // load json from remote to variable
102
+ ```
103
+
104
+ ### FORM
105
+
106
+ ```js
107
+ dphelper.serializeForm( form ) // serialize a form (input array) to json
108
+ dphelper.objSerialize(value) // serialize object to json
109
+ ```
110
+
111
+ ### ARRAY
112
+
113
+ ```js
114
+ dphelper.array.find( id, array ) // find value by ID into array
115
+ dphelper.array.delete( id, array ) // delete value by ID from array
116
+ dphelper.array.merge( arrayA , arrayB ) // merge two array
117
+ dphelper.array.unique( array ) // remove all duplicates
118
+
119
+ dphelper.obj2array( object ) // transform obj to array
120
+ ```
121
+
122
+ ... TO BE CONTINUE
package/README.md.bak ADDED
@@ -0,0 +1,70 @@
1
+ # dpHelper
2
+
3
+ Many utils for your projects
4
+
5
+ Use "npm i dphelper" to install
6
+
7
+ in the index:
8
+
9
+ ```js
10
+ import "dphelper"
11
+ ```
12
+
13
+ type 'dphelper' in your console to have a look about all available functions that you can use globaly!
14
+
15
+ You can call these from everywhere without import
16
+
17
+ ## CURRENCY
18
+
19
+ ```js
20
+ dphelper.currency( val, int = 'en-US', cur = 'USD' )
21
+ ```
22
+
23
+ ## MEMORY
24
+
25
+ ### STORAGE
26
+
27
+ ```js
28
+ dphelper.storage.get( name )
29
+ dphelper.storage.set( name , value )
30
+ dphelper.storage.delete( name )
31
+ dphelper.storage.clearAll()
32
+ ```
33
+
34
+ ### COOKIE
35
+
36
+ ```js
37
+ dphelper.cookie.set( name , value , time , path = '/' )
38
+ dphelper.cookie.get( name )
39
+ dphelper.cookie.delete( name )
40
+ dphelper.cookie.clearAll()
41
+ ```
42
+
43
+ ### INDEXED-DB
44
+
45
+ ```js
46
+ dphelper.indexedDB.create( storeName, table, name )
47
+ dphelper.indexedDB.open( storeName )
48
+ dphelper.indexedDB.store( storeName, table )
49
+ dphelper.indexedDB.insert( storeName, table, key, value )
50
+ dphelper.indexedDB.update( storeName, table, key, value )
51
+ dphelper.indexedDB.get( storeName, table, key )
52
+
53
+ window.dphelper.dbExist() -> know databases
54
+ ```
55
+
56
+ ### NUMBERS
57
+
58
+ ```js
59
+ dphelper.rnd() // generate long random number
60
+ dphelper.tmr() // generate number by timer
61
+ ```
62
+
63
+ ### TIME
64
+
65
+ ```js
66
+ dphelper.epoch() // return epoch time
67
+ dphelper.parseDate(value) // epoch to human date
68
+ ```
69
+
70
+ ### 3Party
package/init.js CHANGED
@@ -1,112 +1,114 @@
1
- /*!
2
- * dpHelper <https://github.com/passariello/dpHelper>
3
- *
4
- * Copyright (c) 2021, Dario Passariello.
5
- * Licensed under the Apache-2.0 License.
6
- */
7
-
8
- /***********************************************************************/
9
-
10
- (function () {
11
-
12
- if (typeof window === 'undefined') {
13
- global.window = {};
14
- }
15
-
16
- const pjson = require('./package.json');
17
-
18
- // CREATE ROOT STORE
19
- const dphelper = window.dphelper = {};
20
-
21
- // FIRST MESSAGE
22
- console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
23
- console.debug( `%c${pjson.name} v${pjson.version}%c by Dario Passariello started`,"color:orange","" );
24
- console.debug( `%cType ${pjson.name} in this console to see it`, "color:gray","" );
25
- console.debug( "%cFor help visit: " + pjson.repository.help, "color:gray","" );
26
- console.debug( 'name: %c' + pjson.name,"color:orange","" );
27
- console.debug( 'version: %c' + pjson.version,"color:orange","" );
28
- console.debug( 'description: %c' + pjson.description,"color:orange","" );
29
- console.debug( 'license: %c' + pjson.license,"color:orange","" );
30
- console.debug( 'repository: %c' + pjson.repository.url,"color:orange","" );
31
- console.debug( 'author: %c' + pjson.author.name,"color:orange","" );
32
- console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
33
- console.groupEnd();
34
-
35
- const $ = require("jquery");
36
-
37
- // 3party
38
- require('./3party/shortcut.js');
39
-
40
- // CURRENCY
41
- require('./scripts/currency.js');
42
-
43
- // MEMORY
44
- require('./scripts/storage.js');
45
- require('./scripts/cookie.js');
46
- require('./scripts/indexedDB.js');
47
-
48
- // NUMBERS
49
- require('./scripts/randomNum.js');
50
- require('./scripts/randomNumTmr.js');
51
-
52
- // TIME
53
- require('./scripts/epoch.js');
54
- require('./scripts/parseDate.js');
55
- require('./scripts/dateUTC.js');
56
- require('./scripts/dateIso2Epoch.js');
57
- require('./scripts/dateConvert.js');
58
- require('./scripts/date2MMDDYYYY.js');
59
- require('./scripts/date2Iso.js');
60
- require('./scripts/dateLocal-ISOTime.js');
61
-
62
- // PATH
63
- require('./scripts/pathRail.js');
64
- require('./scripts/pathQuery.js');
65
- require('./scripts/pathHash.js');
66
- require('./scripts/pushState.js');
67
- require('./scripts/anchorToOnClick.js');
68
-
69
- // FILE
70
- require('./scripts/loadFile.js');
71
- //require('./scripts/loadAsset.js');
72
- require('./scripts/loadJson.js');
73
- require('./scripts/loadJsonExternal.js');
74
-
75
- // FORMS
76
- require('./scripts/serializeForm.js');
77
-
78
- // ARRAY
79
- require('./scripts/arrayItemFinder.js');
80
- require('./scripts/arrayDeleteItem.js');
81
- require('./scripts/arrayMerge.js');
82
- require('./scripts/object2array.js');
83
-
84
- // SCROLL
85
- require('./scripts/scrollToElement.js');
86
- require('./scripts/scrollSmooth.js');
87
- require('./scripts/scrollIndicator.js');
88
- require('./scripts/scrollMemory.js');
89
- require('./scripts/scrollCustom.js');
90
-
91
- // OTHER
92
- require('./scripts/uuid.js');
93
- require('./scripts/noCache.js');
94
- require('./scripts/parseBool.js');
95
- require('./scripts/isPromise.js');
96
- require('./scripts/textChanger.js');
97
- require('./scripts/nl2br.js');
98
- require('./scripts/sleep.js');
99
- require('./scripts/printInfo.js');
100
- require('./scripts/disableSelect.js');
101
- require('./scripts/fullScreen.js');
102
- require('./scripts/disableSpellCheck.js');
103
- require('./scripts/serializeObj.js');
104
- require('./scripts/triggerClick.js');
105
- require('./scripts/handleEvent.js');
106
- require('./scripts/window.js');
107
- require('./scripts/purge.js');
108
- require('./scripts/svgSupport.js');
109
- require('./scripts/stopConsole.js');
110
- require('./scripts/onBeforeUnLoad.js');
111
-
112
- })();
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * Copyright (c) 2021, Dario Passariello.
5
+ * Licensed under the Apache-2.0 License.
6
+ */
7
+
8
+ /***********************************************************************/
9
+
10
+ ( () => {
11
+
12
+ if (typeof window === 'undefined') {
13
+ global.window = {};
14
+ }
15
+
16
+ const pjson = require('./package.json');
17
+
18
+ // CREATE ROOT STORE
19
+ const dphelper = window.dphelper = {};
20
+
21
+ // FIRST MESSAGE
22
+ console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
23
+ console.debug( `%c${pjson.name} v${pjson.version}%c by Dario Passariello started`,"color:orange","" );
24
+ console.debug( `%cType ${pjson.name} in this console to see it`, "color:gray","" );
25
+ console.debug( "%cFor help visit: " + pjson.repository.help, "color:gray","" );
26
+ console.debug( 'name: %c' + pjson.name,"color:orange","" );
27
+ console.debug( 'version: %c' + pjson.version,"color:orange","" );
28
+ console.debug( 'description: %c' + pjson.description,"color:orange","" );
29
+ console.debug( 'license: %c' + pjson.license,"color:orange","" );
30
+ console.debug( 'repository: %c' + pjson.repository.url,"color:orange","" );
31
+ console.debug( 'author: %c' + pjson.author.name,"color:orange","" );
32
+ console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
33
+ console.groupEnd();
34
+
35
+ const $ = require("jquery");
36
+
37
+ // 3party
38
+ require('./3party/shortcut.js');
39
+
40
+ // CURRENCY
41
+ require('./scripts/currency.js');
42
+
43
+ // MEMORY
44
+ require('./scripts/storage.js');
45
+ require('./scripts/cookie.js');
46
+ require('./scripts/indexedDB.js');
47
+
48
+ // NUMBERS
49
+ require('./scripts/randomNum.js');
50
+ require('./scripts/randomNumTmr.js');
51
+
52
+ // TIME
53
+ require('./scripts/epoch.js');
54
+ require('./scripts/parseDate.js');
55
+ require('./scripts/dateUTC.js');
56
+ require('./scripts/dateIso2Epoch.js');
57
+ require('./scripts/dateConvert.js');
58
+ require('./scripts/date2MMDDYYYY.js');
59
+ require('./scripts/date2Iso.js');
60
+ require('./scripts/dateLocal-ISOTime.js');
61
+
62
+ // PATH
63
+ require('./scripts/pathRail.js');
64
+ require('./scripts/pathQuery.js');
65
+ require('./scripts/pathHash.js');
66
+ require('./scripts/pushState.js');
67
+ require('./scripts/anchorToOnClick.js');
68
+
69
+ // FILE
70
+ require('./scripts/loadFile.js');
71
+ //require('./scripts/loadAsset.js');
72
+ require('./scripts/loadJson.js');
73
+ require('./scripts/loadJsonExternal.js');
74
+
75
+ // FORMS
76
+ require('./scripts/serializeForm.js');
77
+ require('./scripts/serializeObj.js');
78
+
79
+ // ARRAY
80
+ // require('./scripts/arrayItemFinder.js');
81
+ // require('./scripts/arrayDeleteItem.js');
82
+ // require('./scripts/arrayMerge.js');
83
+ // require('./scripts/arrayUnique.js');
84
+ require('./scripts/array.js');
85
+ require('./scripts/object2array.js');
86
+
87
+ // SCROLL
88
+ require('./scripts/scrollToElement.js');
89
+ require('./scripts/scrollSmooth.js');
90
+ require('./scripts/scrollIndicator.js');
91
+ require('./scripts/scrollMemory.js');
92
+ require('./scripts/scrollCustom.js');
93
+
94
+ // OTHER
95
+ require('./scripts/uuid.js');
96
+ require('./scripts/noCache.js');
97
+ require('./scripts/parseBool.js');
98
+ require('./scripts/isPromise.js');
99
+ require('./scripts/textChanger.js');
100
+ require('./scripts/nl2br.js');
101
+ require('./scripts/sleep.js');
102
+ require('./scripts/printInfo.js');
103
+ require('./scripts/disableSelect.js');
104
+ require('./scripts/fullScreen.js');
105
+ require('./scripts/disableSpellCheck.js');
106
+ require('./scripts/triggerClick.js');
107
+ require('./scripts/handleEvent.js');
108
+ require('./scripts/window.js');
109
+ require('./scripts/purge.js');
110
+ require('./scripts/svgSupport.js');
111
+ require('./scripts/stopConsole.js');
112
+ require('./scripts/onBeforeUnLoad.js');
113
+
114
+ })();
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "0.2.2",
3
+ "version": "0.2.24",
4
4
  "description": "Many utils for your projects",
5
5
  "main": "index.js",
6
6
  "publishConfig": {},
7
7
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
8
+ "test1": "echo \"Error: no test specified\" && exit 1",
9
+ "test": "jest --silent --detectOpenHandles",
10
+ "test-coverage": "jest --coverage --silent"
9
11
  },
10
12
  "targets": {
11
13
  "main": {
@@ -55,7 +57,8 @@
55
57
  "dependencies": {
56
58
  "jquery": "^3.6.0",
57
59
  "jshint": "^2.13.1",
58
- "require": "^0.4.4"
60
+ "require": "^0.4.4",
61
+ "uglify-js": "^3.14.5"
59
62
  },
60
63
  "contributors": [
61
64
  {
File without changes
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * arrayUnique
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.arrayUnique = ( array ) => {
13
+ let unique = [...new Set( array )];
14
+ return unique;
15
+ };
@@ -1,36 +1,36 @@
1
- /*!
2
- * dpHelper <https://github.com/passariello/dpHelper>
3
- *
4
- * anchorToOnClick
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.anchorToOnClick = function(){
13
- // const $ = require("jquery");
14
-
15
- $('a').each( function( index ) {
16
-
17
- let elem = $( this );
18
- let href = elem.attr( 'href' );
19
-
20
- if( href ){
21
- elem
22
- .on( 'mouseup', function(){
23
- Loader( 'body' , null );
24
- })
25
- .css('cursor','pointer')
26
- .addClass( dphelper.pathRail()[3].replace(/\//g, '') )
27
- .removeAttr( 'href' )
28
- .on( 'click', function(){
29
- window.location.href = href;
30
- window.history.pushState('', '', href);
31
- });
32
- }
33
-
34
- });
35
-
36
- };
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * anchorToOnClick
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.anchorToOnClick = function( container ){
13
+ // const $ = require("jquery");
14
+
15
+ $( container + ' a' ).each( function( index ) {
16
+
17
+ let elem = $( this );
18
+ let href = elem.attr( 'href' );
19
+
20
+ if( href ){
21
+ elem
22
+ .on( 'mouseup', function(){
23
+ Loader( 'body' , null );
24
+ })
25
+ .css('cursor','pointer')
26
+ .addClass( dphelper.pathRail()[3].replace(/\//g, '') )
27
+ .removeAttr( 'href' )
28
+ .on( 'click', function(){
29
+ window.location.href = href;
30
+ window.history.pushState('', '', href);
31
+ });
32
+ }
33
+
34
+ });
35
+
36
+ };
@@ -0,0 +1,69 @@
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * arrayDeleteItem
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.array = {
13
+
14
+ // FIND
15
+ find: ( id, array )=>{
16
+ for (let node of array) {
17
+ if (node.id === id) return node;
18
+
19
+ if (node.children) {
20
+ let finalNode = window.dphelper.arrayFindItem(id, node.children);
21
+ if (finalNode) return finalNode;
22
+ }
23
+ }
24
+ return false;
25
+ },
26
+
27
+ // UNIQUE
28
+ unique: ( array ) => {
29
+ let unique = [...new Set( array )];
30
+ return unique;
31
+ },
32
+
33
+ // DELETE
34
+ delete: ( id, array ) => {
35
+ array.some(function iter (o,i,a) {
36
+
37
+ if (o.Id === id) {
38
+ a.splice(i, 1);
39
+ return true;
40
+ }
41
+
42
+ var key = Object.keys(o);
43
+
44
+ for (let key of Object.keys(o)) {
45
+ let value = o[key];
46
+ if(value.length && typeof value === 'object') return value && value.map(iter);
47
+ }
48
+
49
+ // OLD SCHOOL WAY
50
+ // for (var p=0; p < key.length; ++p){
51
+ // if( o[key[p]]?.length && typeof o[key[p]] === 'object') return o[key[p]] && o[key[p]].some(iter);
52
+ // }
53
+
54
+ });
55
+
56
+ },
57
+
58
+ // MERGE
59
+ merge: ( arrayA, arrayB ) => {
60
+ for (const key of Object.keys(source)) {
61
+ if (source[key] instanceof Object && target[key]) Object.assign(source[key], window.dphelper.mergeArrays(target[key], source[key]));
62
+ }
63
+
64
+ Object.assign(target || {}, source);
65
+ return target;
66
+ }
67
+
68
+ };
69
+
@@ -1,21 +1,21 @@
1
- /*!
2
- * dpHelper <https://github.com/passariello/dpHelper>
3
- *
4
- * currency
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.currency = ( val, int = 'en-US', cur = 'USD' ) => {
13
- if( !val || isNaN( val ) ) val = 0;
14
- var formatter = new Intl.NumberFormat( int , {
15
- style: 'currency',
16
- currency: cur,
17
- });
18
-
19
- // return ( val ).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
20
- return formatter.format( val );
21
- };
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * currency
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.currency = ( val, int = 'en-US', cur = 'USD' ) => {
13
+ if( !val || isNaN( val ) ) val = 0;
14
+ var formatter = new Intl.NumberFormat( int , {
15
+ style: 'currency',
16
+ currency: cur,
17
+ });
18
+
19
+ // return ( val ).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
20
+ return formatter.format( val );
21
+ };
@@ -1,18 +1,16 @@
1
- /*!
2
- * dpHelper <https://github.com/passariello/dpHelper>
3
- *
4
- * object2array
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.object2array = (object) => {
13
- return Object
14
- .entries(object)
15
- .map(([key, value]) => Object.assign({key}, value && typeof value === 'object' ? {forms: ObjToArray(value)}
16
- : {value, forms: []}
17
- ));
18
- };
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * object2array
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.obj2array = ( object ) => {
13
+ return Object
14
+ .entries( object )
15
+ .map( ( [ key, value ] ) => Object.assign( { key } , value && typeof value === 'object' ? { forms: ObjToArray( value ) } : { value, forms: [] } ) );
16
+ };
@@ -1,14 +1,14 @@
1
- /*!
2
- * dpHelper <https://github.com/passariello/dpHelper>
3
- *
4
- * random number
5
- *
6
- * Copyright (c) 2021, Dario Passariello.
7
- * Licensed under the Apache-2.0 License.
8
- */
9
-
10
- /***********************************************************************/
11
-
12
- window.dphelper.rnd = () => {
13
- return Math.floor(100000 + Math.random() * dphelper.tmr());
14
- };
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * random number
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ window.dphelper.rnd = () => {
13
+ return Math.floor( 100000 + Math.random() * dphelper.tmr() );
14
+ };