yet-another-js-utils 0.0.1
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/.editorconfig +10 -0
- package/.gitattributes +7 -0
- package/.nvmrc +1 -0
- package/.vscode/css.code-snippets +62 -0
- package/.vscode/javascript.code-snippets +231 -0
- package/.vscode/markdown.code-snippets +73 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +0 -0
- package/JS_STYLE_GUIDE.md +44 -0
- package/LICENSE.txt +373 -0
- package/README.md +26 -0
- package/dist/index.md +1 -0
- package/docs/index.md +1 -0
- package/eslint.config.js +217 -0
- package/gruntfile.js +88 -0
- package/js-utils.js +299 -0
- package/jsconfig.json +15 -0
- package/main.js +3 -0
- package/package.json +36 -0
- package/tests/index.md +1 -0
- package/tests/main.test.js +0 -0
package/.editorconfig
ADDED
package/.gitattributes
ADDED
package/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v20.11.1
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
// Place your snippets for css here. Each snippet is defined under a snippet name and has a prefix, body and
|
3
|
+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
4
|
+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
|
5
|
+
// same ids are connected.
|
6
|
+
// Example:
|
7
|
+
"code fonts": {
|
8
|
+
"prefix": "font-family:code",
|
9
|
+
"body": [
|
10
|
+
"font-family: Consolas, Menlo, JuliaMono, Liberation Mono, monospace;"
|
11
|
+
],
|
12
|
+
"description": "Code fonts"
|
13
|
+
},
|
14
|
+
"core fonts": {
|
15
|
+
"prefix": "font-family:core",
|
16
|
+
"body": [
|
17
|
+
"font-family: Segoe UI, Roboto, sans-serif, Arial, Liberation Sans;"
|
18
|
+
],
|
19
|
+
"description": "Core fonts"
|
20
|
+
},
|
21
|
+
"variable fonts": {
|
22
|
+
"prefix": "font-family:variable",
|
23
|
+
"body": [
|
24
|
+
"font-family: Segoe UI Variable, Roboto Flex, SF Pro Text, sans-serif, Inter;"
|
25
|
+
],
|
26
|
+
"description": "Variable fonts"
|
27
|
+
},
|
28
|
+
"boilerplate": {
|
29
|
+
"prefix": "boil",
|
30
|
+
"body": [
|
31
|
+
"body {",
|
32
|
+
" --fonts-core: Segoe UI, Roboto, sans-serif, Arial, Liberation Sans;",
|
33
|
+
" --fonts-code: Consolas, Menlo, JuliaMono, Liberation Mono, monospace;",
|
34
|
+
" --fonts-variable: Segoe UI Variable, Roboto Flex, SF Pro Text, sans-serif, Inter;",
|
35
|
+
" --color: #FEFEFE;",
|
36
|
+
" --colors-white: rgb(255, 255, 255);",
|
37
|
+
" --colors-red: rgb(255, 0, 0);",
|
38
|
+
" --colors-cyan: rgb(0, 255, 255);",
|
39
|
+
" --colors-orange: rgb(255, 128, 0);",
|
40
|
+
" --colors-yellow: rgb(255, 255, 0);",
|
41
|
+
" --colors-purple: rgb(128, 0, 128);",
|
42
|
+
" --colors-green: rgb(0, 255, 0);",
|
43
|
+
" --colors-magenta: rgb(255, 0, 255);",
|
44
|
+
" --lights-0: #171717;",
|
45
|
+
" --tempo: 8px;",
|
46
|
+
" --tab-size: 4;",
|
47
|
+
" line-height: 1.5;",
|
48
|
+
" margin: 0;",
|
49
|
+
" tab-size: var(--tab-size);",
|
50
|
+
" -moz-tab-size: var(--tab-size);",
|
51
|
+
" background-color: #2B2B2B;",
|
52
|
+
" font-size: 14px;",
|
53
|
+
" color: var(--color);",
|
54
|
+
" color-scheme: dark;",
|
55
|
+
" /* scrollbar-width: thin; */",
|
56
|
+
" scrollbar-color: #AAAAAA #2B2B2B;",
|
57
|
+
" scroll-behavior: smooth;",
|
58
|
+
" accent-color: var(--colors-cyan);",
|
59
|
+
"}"
|
60
|
+
]
|
61
|
+
}
|
62
|
+
}
|
@@ -0,0 +1,231 @@
|
|
1
|
+
{
|
2
|
+
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
|
3
|
+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
4
|
+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
|
5
|
+
// same ids are connected.
|
6
|
+
// Example:
|
7
|
+
// "Print to console": {
|
8
|
+
// "prefix": "log",
|
9
|
+
// "body": [
|
10
|
+
// "console.log('$1');",
|
11
|
+
// "$2"
|
12
|
+
// ],
|
13
|
+
// "description": "Log output to console"
|
14
|
+
// }
|
15
|
+
"For_i_Loop": {
|
16
|
+
"prefix": "fori",
|
17
|
+
"body": [
|
18
|
+
"for (let i = 0, c = ${1:array}.length; i < c; i++) {",
|
19
|
+
"\t${1:array}[i]",
|
20
|
+
"}"
|
21
|
+
],
|
22
|
+
"description": "For i Loop"
|
23
|
+
},
|
24
|
+
"For_i--_Loop": {
|
25
|
+
"prefix": "fori-",
|
26
|
+
"body": [
|
27
|
+
"for (let i = ${1:array}.length - 1; i > -1; i--) {",
|
28
|
+
"\t${1:array}[i]",
|
29
|
+
"}"
|
30
|
+
],
|
31
|
+
"description": "For i Loop"
|
32
|
+
},
|
33
|
+
"For_z_Loop": {
|
34
|
+
"prefix": "forz",
|
35
|
+
"body": [
|
36
|
+
"for (let z = 0, x = ${1:array}.length; z < x; z++) {",
|
37
|
+
"\t${1:array}[i]",
|
38
|
+
"}"
|
39
|
+
],
|
40
|
+
"description": "For z Loop"
|
41
|
+
},
|
42
|
+
"For_j_Loop": {
|
43
|
+
"prefix": "forj",
|
44
|
+
"body": [
|
45
|
+
"for (let j = 0, k = ${1:array}.length; j < k; j++) {",
|
46
|
+
"\t${1:array}[j]",
|
47
|
+
"}"
|
48
|
+
],
|
49
|
+
"description": "For j Loop"
|
50
|
+
},
|
51
|
+
"Recursion": {
|
52
|
+
"prefix": "_rec",
|
53
|
+
"body": [
|
54
|
+
"return _recurse(${1:structureInstance});",
|
55
|
+
"function _recurse(structure){",
|
56
|
+
"\t// Base case",
|
57
|
+
"}"
|
58
|
+
],
|
59
|
+
"description": "simple recursion"
|
60
|
+
},
|
61
|
+
"Debouncing": {
|
62
|
+
"prefix": "_deb",
|
63
|
+
"body": [
|
64
|
+
"var functionTimeoutId;",
|
65
|
+
"function _debouncingFunction() {",
|
66
|
+
" var context = this,",
|
67
|
+
" args = arguments;",
|
68
|
+
" clearTimeout(historyUpdateTimeoutId);",
|
69
|
+
" historyUpdateTimeoutId = setTimeout(function(){",
|
70
|
+
" historyUpdateTimeoutId = null;",
|
71
|
+
" historyUpdate.apply(context, args);",
|
72
|
+
" }, 200);",
|
73
|
+
"}"
|
74
|
+
],
|
75
|
+
"description": "simple recursion"
|
76
|
+
},
|
77
|
+
"DOM_by_Id": {
|
78
|
+
"prefix": "byId",
|
79
|
+
"body": [
|
80
|
+
"D.getElementById('${1:id}')"
|
81
|
+
],
|
82
|
+
"description": "getElementById query"
|
83
|
+
},
|
84
|
+
"DOM_create": {
|
85
|
+
"prefix": "crea",
|
86
|
+
"body": [
|
87
|
+
"D.createElement('${1:tag}')"
|
88
|
+
],
|
89
|
+
"description": "createElement"
|
90
|
+
},
|
91
|
+
"DOM_by_Tag_Name": {
|
92
|
+
"prefix": "byT",
|
93
|
+
"body": [
|
94
|
+
"D.getElementsByTagName('${1:tag}')"
|
95
|
+
],
|
96
|
+
"description": "getElementsByTagName query"
|
97
|
+
},
|
98
|
+
"DOM_by_Class_Name": {
|
99
|
+
"prefix": "byC",
|
100
|
+
"body": [
|
101
|
+
"D.getElementsByClassName('${1:class}')"
|
102
|
+
],
|
103
|
+
"description": "getElementsByClassName query"
|
104
|
+
},
|
105
|
+
"DOM_by_Selector": {
|
106
|
+
"prefix": "QS",
|
107
|
+
"body": [
|
108
|
+
"D.querySelector('${1:selector}')"
|
109
|
+
],
|
110
|
+
"description": "querySelector query"
|
111
|
+
},
|
112
|
+
"DOM_by_Selector_All": {
|
113
|
+
"prefix": "QSA",
|
114
|
+
"body": [
|
115
|
+
"D.querySelectorAll('${1:selector}')"
|
116
|
+
],
|
117
|
+
"description": "querySelectorAll query"
|
118
|
+
},
|
119
|
+
"throw": {
|
120
|
+
"prefix": "thrw",
|
121
|
+
"body": [
|
122
|
+
"throw ${1:variable};"
|
123
|
+
],
|
124
|
+
"description": "throws a variable"
|
125
|
+
},
|
126
|
+
"throw_A": {
|
127
|
+
"prefix": "thrA",
|
128
|
+
"body": [
|
129
|
+
"throw 'A';"
|
130
|
+
],
|
131
|
+
"description": "throws 'A'"
|
132
|
+
},
|
133
|
+
"throw_B": {
|
134
|
+
"prefix": "thrB",
|
135
|
+
"body": [
|
136
|
+
"throw 'B';"
|
137
|
+
],
|
138
|
+
"description": "throws 'B'"
|
139
|
+
},
|
140
|
+
"throw_C": {
|
141
|
+
"prefix": "thrC",
|
142
|
+
"body": [
|
143
|
+
"throw 'C';"
|
144
|
+
],
|
145
|
+
"description": "throws 'C'"
|
146
|
+
},
|
147
|
+
"throw_D": {
|
148
|
+
"prefix": "thrD",
|
149
|
+
"body": [
|
150
|
+
"throw 'D';"
|
151
|
+
],
|
152
|
+
"description": "throws 'D'"
|
153
|
+
},
|
154
|
+
"throw_E": {
|
155
|
+
"prefix": "thrE",
|
156
|
+
"body": [
|
157
|
+
"throw 'E';"
|
158
|
+
],
|
159
|
+
"description": "throws 'E'"
|
160
|
+
},
|
161
|
+
"console_log": {
|
162
|
+
"prefix": "logV",
|
163
|
+
"body": [
|
164
|
+
"console.log(${1:variable});"
|
165
|
+
],
|
166
|
+
"description": "console.log"
|
167
|
+
},
|
168
|
+
"console_log_A": {
|
169
|
+
"prefix": "logA",
|
170
|
+
"body": [
|
171
|
+
"console.log('A');"
|
172
|
+
],
|
173
|
+
"description": "console.log('A')"
|
174
|
+
},
|
175
|
+
"console_log_B": {
|
176
|
+
"prefix": "logB",
|
177
|
+
"body": [
|
178
|
+
"console.log('B');"
|
179
|
+
],
|
180
|
+
"description": "console.log('B')"
|
181
|
+
},
|
182
|
+
"console_log_C": {
|
183
|
+
"prefix": "logC",
|
184
|
+
"body": [
|
185
|
+
"console.log('C');"
|
186
|
+
],
|
187
|
+
"description": "console.log('C')"
|
188
|
+
},
|
189
|
+
"console_log_D": {
|
190
|
+
"prefix": "logD",
|
191
|
+
"body": [
|
192
|
+
"console.log('D');"
|
193
|
+
],
|
194
|
+
"description": "console.log('D')"
|
195
|
+
},
|
196
|
+
"console_log_E": {
|
197
|
+
"prefix": "logE",
|
198
|
+
"body": [
|
199
|
+
"console.log('E');"
|
200
|
+
],
|
201
|
+
"description": "console.log('E')"
|
202
|
+
},
|
203
|
+
"debugger": {
|
204
|
+
"prefix": "deb",
|
205
|
+
"body": [
|
206
|
+
"debugger;"
|
207
|
+
],
|
208
|
+
"description": "Sets a breakpoint to walk from."
|
209
|
+
},
|
210
|
+
"class": {
|
211
|
+
"prefix": "class",
|
212
|
+
"body": [
|
213
|
+
"var Component = require('./component.js');",
|
214
|
+
"",
|
215
|
+
"//#### ${1:classname}",
|
216
|
+
"// <${2:element} id=\"\">",
|
217
|
+
"module.exports =",
|
218
|
+
"class ${1:classname} extends Component {",
|
219
|
+
"\t//# MODEL",
|
220
|
+
"\t/**",
|
221
|
+
"\t* @param {string} id",
|
222
|
+
"\t* @param {{ mode: string; }} app",
|
223
|
+
"\t*/",
|
224
|
+
"\tconstructor(id, app) {",
|
225
|
+
"\t\tsuper(id, app, document);",
|
226
|
+
"\t\tlet $ = this;",
|
227
|
+
"\t}",
|
228
|
+
"};",
|
229
|
+
]
|
230
|
+
}
|
231
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
// Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and
|
3
|
+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
4
|
+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
|
5
|
+
// same ids are connected.
|
6
|
+
// Example:
|
7
|
+
"COMPUTATIONAL INSTRUMENTALISM": {
|
8
|
+
"prefix": "CPUI",
|
9
|
+
"body": [
|
10
|
+
"[COMPUTATIONAL INSTRUMENTALISM](./)"
|
11
|
+
],
|
12
|
+
"description": "Dispatch heading link"
|
13
|
+
},
|
14
|
+
"PSYCHOLOGY": {
|
15
|
+
"prefix": "PSY",
|
16
|
+
"body": [
|
17
|
+
"[PSYCHOLOGY](./)"
|
18
|
+
],
|
19
|
+
"description": "Dispatch heading link"
|
20
|
+
},
|
21
|
+
"SCIENCE/PROBLEM SOLVING": {
|
22
|
+
"prefix": "SCIP",
|
23
|
+
"body": [
|
24
|
+
"[SCIENCE/PROBLEM SOLVING](./)"
|
25
|
+
],
|
26
|
+
"description": "Dispatch heading link"
|
27
|
+
},
|
28
|
+
"BELIEF SYSTEMS": {
|
29
|
+
"prefix": "BELIEFS",
|
30
|
+
"body": [
|
31
|
+
"[BELIEF SYSTEMS](./)"
|
32
|
+
],
|
33
|
+
"description": "Dispatch heading link"
|
34
|
+
},
|
35
|
+
"CRISIS OF BELIEF": {
|
36
|
+
"prefix": "CRIBE",
|
37
|
+
"body": [
|
38
|
+
"[CRISIS OF BELIEF](./)"
|
39
|
+
],
|
40
|
+
"description": "Dispatch heading link"
|
41
|
+
},
|
42
|
+
"FORMALIZATION": {
|
43
|
+
"prefix": "FORMA",
|
44
|
+
"body": [
|
45
|
+
"[FORMALIZATION](./)"
|
46
|
+
],
|
47
|
+
"description": "Dispatch heading link"
|
48
|
+
},
|
49
|
+
"DEVELOPMENT": {
|
50
|
+
"prefix": "DEV",
|
51
|
+
"body": [
|
52
|
+
"[DEVELOPMENT](./)"
|
53
|
+
],
|
54
|
+
"description": "Dispatch heading link"
|
55
|
+
},
|
56
|
+
"DECISION ENGINE": {
|
57
|
+
"prefix": "DNGI",
|
58
|
+
"body": [
|
59
|
+
"[DECISION ENGINE](./)"
|
60
|
+
],
|
61
|
+
"description": "Dispatch heading link"
|
62
|
+
},
|
63
|
+
"kanban.md": {
|
64
|
+
"prefix": "kanban",
|
65
|
+
"body": [
|
66
|
+
"# FEATURED",
|
67
|
+
"# PLANNED",
|
68
|
+
"# EXPLORED",
|
69
|
+
"# INBOX"
|
70
|
+
],
|
71
|
+
"description": "Template for kanban.md"
|
72
|
+
}
|
73
|
+
}
|
package/CHANGELOG.md
ADDED
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
In addition to automated rules, please abide to the ones defined in the "MANUAL" section.
|
3
|
+
|
4
|
+
- Guiding principle
|
5
|
+
- consistency and editability before line count minimalization and ease of debugging
|
6
|
+
- js style guide
|
7
|
+
- inspired by idiomatic.js
|
8
|
+
- if a line presents an issue or prevents editability, break it into two lines
|
9
|
+
|
10
|
+
# MANUAL
|
11
|
+
|
12
|
+
```js
|
13
|
+
method() {
|
14
|
+
let $ = this;
|
15
|
+
}
|
16
|
+
```
|
17
|
+
|
18
|
+
```js
|
19
|
+
class ClassName {
|
20
|
+
|
21
|
+
}
|
22
|
+
```
|
23
|
+
|
24
|
+
````js
|
25
|
+
_privateMethod() {}
|
26
|
+
````
|
27
|
+
|
28
|
+
````js
|
29
|
+
eventHandler() {}
|
30
|
+
````
|
31
|
+
|
32
|
+
````js
|
33
|
+
document.addEventListener();
|
34
|
+
````
|
35
|
+
|
36
|
+
# AUTOMATED
|
37
|
+
|
38
|
+
- You can find those in:
|
39
|
+
- .editorconfig
|
40
|
+
- docs
|
41
|
+
- .eslintrc
|
42
|
+
- docs
|
43
|
+
- jsconfig.json
|
44
|
+
- docs
|