dphelper 0.2.28 → 0.2.29
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 +13 -0
- package/package.json +4 -4
- package/scripts/camelCase.js +6 -6
- package/scripts/pathHash.js +1 -2
- package/scripts/pathRail.js +12 -13
- package/README.md.bak +0 -70
package/data/list.json
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
"title" : "List",
|
|
4
4
|
"description" : "Complete list of tools"
|
|
5
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
|
+
],
|
|
6
19
|
"scripts" : [
|
|
7
20
|
{
|
|
8
21
|
"name" : "Anchors to onClick",
|
package/package.json
CHANGED
package/scripts/camelCase.js
CHANGED
|
@@ -13,16 +13,16 @@ window.dphelper.camelCase = {
|
|
|
13
13
|
|
|
14
14
|
// toSpace
|
|
15
15
|
toSpace: ( string ) => {
|
|
16
|
-
string
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return string
|
|
17
|
+
.replace(/([A-Z])/g, ' $1')
|
|
18
|
+
.replace(/^./, function(str){ return str.toUpperCase(); })
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
// toUnderscore
|
|
22
22
|
toUnderscore: ( string ) => {
|
|
23
|
-
string
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
return string
|
|
24
|
+
.replace(/\.?([A-Z])/g, function (x,y){ return "_" + y.toLowerCase()})
|
|
25
|
+
.replace(/^_/, "");
|
|
26
26
|
},
|
|
27
27
|
|
|
28
28
|
};
|
package/scripts/pathHash.js
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
12
|
window.dphelper.pathHash = () => {
|
|
13
|
-
const array = location.hash
|
|
14
|
-
.replace('#', '').split('/');
|
|
13
|
+
const array = location.hash.replace('#', '').split('/');
|
|
15
14
|
if (array.length) {
|
|
16
15
|
return array.filter(item => item);
|
|
17
16
|
} else {
|
package/scripts/pathRail.js
CHANGED
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
12
|
window.dphelper.pathRail = () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
13
|
+
const array = location.href
|
|
14
|
+
.split("?")[0]
|
|
15
|
+
.replace(location.protocol, '')
|
|
16
|
+
.replace(location.host, '')
|
|
17
|
+
.replace(location.hash, '')
|
|
18
|
+
.split('/');
|
|
19
|
+
if ( array.length > 0 ) {
|
|
20
|
+
const arrayFinal = array.filter(item => item);
|
|
21
|
+
return arrayFinal;
|
|
22
|
+
} else {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
26
25
|
};
|
package/README.md.bak
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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
|