dphelper 0.0.4 → 0.0.8

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/init.js CHANGED
@@ -12,7 +12,7 @@
12
12
  const pjson = require('./package.json');
13
13
 
14
14
  // CREATE ROOT STORE
15
- window.dphelper = {};
15
+ const dphelper = window.dphelper = {};
16
16
 
17
17
  // FIRST MESSAGE
18
18
  console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
@@ -42,8 +42,8 @@
42
42
  require('./scripts/indexedDB.js');
43
43
 
44
44
  // NUMBERS
45
- require('./scripts/randomNumberTmr.js');
46
- require('./scripts/randomNumber.js');
45
+ require('./scripts/randomNum.js');
46
+ require('./scripts/randomNumTmr.js');
47
47
 
48
48
  // TIME
49
49
  require('./scripts/epoch.js');
@@ -56,7 +56,7 @@
56
56
  require('./scripts/dateLocal-ISOTime.js');
57
57
 
58
58
  // PATH
59
- require('./scripts/pathRails.js');
59
+ require('./scripts/pathRail.js');
60
60
  require('./scripts/pathQuery.js');
61
61
  require('./scripts/pathHash.js');
62
62
  require('./scripts/pushState.js');
@@ -64,7 +64,7 @@
64
64
 
65
65
  // FILE
66
66
  require('./scripts/loadFile.js');
67
- require('./scripts/loadAsset.js');
67
+ //require('./scripts/loadAsset.js');
68
68
  require('./scripts/loadJson.js');
69
69
  require('./scripts/loadJsonExternal.js');
70
70
 
@@ -73,6 +73,7 @@
73
73
 
74
74
  // ARRAY
75
75
  require('./scripts/arrayItemFinder.js');
76
+ require('./scripts/arrayDeleteItem.js');
76
77
  require('./scripts/arrayMerge.js');
77
78
  require('./scripts/object2array.js');
78
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "description": "Many utils for your projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -39,7 +39,9 @@
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
41
  "jquery": "^3.6.0",
42
- "jshint": "^2.13.1"
42
+ "jshint": "^2.13.1",
43
+ "require": "^2.4.20",
44
+ "require-context": "^1.1.0"
43
45
  },
44
46
  "contributors": [
45
47
  {
@@ -0,0 +1,35 @@
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
+ dphelper.arrayDeleteItem = ( array, id ) =>{
13
+
14
+ array.some(function iter (o,i,a) {
15
+
16
+ if (o.Id === id) {
17
+ a.splice(i, 1);
18
+ return true;
19
+ }
20
+
21
+ var key = Object.keys(o);
22
+
23
+ for (let key of Object.keys(o)) {
24
+ let value = o[key];
25
+ if(value.length && typeof value === 'object') return value && value.map(iter);
26
+ }
27
+
28
+ // OLD SCHOOL WAY
29
+ // for (var p=0; p < key.length; ++p){
30
+ // if( o[key[p]]?.length && typeof o[key[p]] === 'object') return o[key[p]] && o[key[p]].some(iter);
31
+ // }
32
+
33
+ });
34
+
35
+ };
@@ -9,7 +9,7 @@
9
9
 
10
10
  /***********************************************************************/
11
11
 
12
- dphelper.loadAsset = function( folder, img, path = '/assets/images/'){
12
+ dphelper.loadAsset = ( folder, img, path = '/assets/images/') => {
13
13
 
14
14
  const check = /\.(ttf|eot|svg|gif|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/;
15
15