qtools-library-dot-d 1.0.7 → 1.0.9

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 (74) hide show
  1. package/README.md +19 -25
  2. package/libDotD_Working_Example/README.md +234 -0
  3. package/libDotD_Working_Example/demoModules_DotD/demo1.js +46 -0
  4. package/libDotD_Working_Example/demoModules_DotD/demo2.js +48 -0
  5. package/libDotD_Working_Example/index.js +133 -0
  6. package/libDotD_Working_Example/node_modules/.package-lock.json +29 -0
  7. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/README.md +213 -0
  8. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/package.json +20 -0
  9. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/qtools-asynchronous-pipe-plus.js +278 -0
  10. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/test.js +79 -0
  11. package/libDotD_Working_Example/node_modules/qtools-functional-library/README.md +110 -0
  12. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/package.json +11 -0
  13. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/qtools-clone.js +103 -0
  14. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/test.js +78 -0
  15. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/package.json +11 -0
  16. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/qtools-get-by-property.js +73 -0
  17. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/test.js +129 -0
  18. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/package.json +11 -0
  19. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/qtools-includes-regex.js +54 -0
  20. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/test.js +76 -0
  21. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/package.json +11 -0
  22. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/qtools-log-output.js +114 -0
  23. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/test.js +130 -0
  24. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/package.json +11 -0
  25. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/qtools-map-properties.js +99 -0
  26. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/test.js +118 -0
  27. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/package.json +11 -0
  28. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/qtools-merge.js +147 -0
  29. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/test.js +214 -0
  30. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/package.json +11 -0
  31. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/qtools-new-method-template.js +70 -0
  32. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/test.js +66 -0
  33. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/package.json +11 -0
  34. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/qtools-number-iterator.js +137 -0
  35. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/test.js +68 -0
  36. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/package.json +11 -0
  37. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/qtools-number-keys-to-array.js +131 -0
  38. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/test.js +181 -0
  39. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/package.json +11 -0
  40. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/qtools-object-sure-path.js +204 -0
  41. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/test.js +345 -0
  42. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/package.json +11 -0
  43. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/qtools-pass-through.js +58 -0
  44. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/test.js +66 -0
  45. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/package.json +11 -0
  46. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/qtools-pop.js +175 -0
  47. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/test.js +118 -0
  48. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/package.json +11 -0
  49. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/qtools-print-debug.js +352 -0
  50. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/test.js +77 -0
  51. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/package.json +11 -0
  52. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/qtools-select-properties.js +132 -0
  53. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/test.js +156 -0
  54. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/README.md +3 -0
  55. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/package.json +11 -0
  56. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/qtools-template-replace.js +106 -0
  57. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/test.js +168 -0
  58. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/package.json +11 -0
  59. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/qtools-to-key-value-array.js +83 -0
  60. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/test.js +68 -0
  61. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/package.json +11 -0
  62. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/qtools-to-string.js +84 -0
  63. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/test.js +63 -0
  64. package/libDotD_Working_Example/node_modules/qtools-functional-library/package.json +37 -0
  65. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtFunctionalDemo.js +297 -0
  66. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtools-functional-library.js +271 -0
  67. package/libDotD_Working_Example/node_modules/qtools-functional-library/test.js +47 -0
  68. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/README.md +208 -0
  69. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/package.json +15 -0
  70. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/qtools-library-dot-d.js +239 -0
  71. package/libDotD_Working_Example/package-lock.json +37 -0
  72. package/libDotD_Working_Example/package.json +23 -0
  73. package/package.json +1 -1
  74. package/qtools-library-dot-d.js +2 -2
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+ //START OF moduleFunction() ============================================================
3
+ var moduleFunction = function(args = {}) {
4
+ const { commonFunctions } = args;
5
+
6
+ const addToPrototypeActual = functionObject => () =>
7
+ commonFunctions.universalAddToPrototype(commonFunctions, functionObject);
8
+
9
+
10
+
11
+ //first method definition function ==========================
12
+
13
+
14
+ const toType = function(obj) {
15
+ if (obj === null) {
16
+ return 'null';
17
+ } else if (typeof obj == 'undefined') {
18
+ return 'undefined';
19
+ } else {
20
+ return {}.toString
21
+ .call(obj)
22
+ .match(/\s([a-z|A-Z]+)/)[1]
23
+ .toLowerCase();
24
+ }
25
+ };
26
+
27
+
28
+ const firstMethodFunction = commonFunctions => {
29
+ const methodName = 'qtToString';
30
+ const description = `operand.qtTemplateMethod('some string') converts 'source' to string and appends argument. This method serves only as a template for creating new qtLib methods.`;
31
+ const supportedTypeList = [Array];
32
+
33
+ const method = () =>
34
+ function(arg) {
35
+
36
+ switch(toType(this)){
37
+
38
+ case 'array':
39
+ let separator=', '
40
+ let suffix='';
41
+ let prefix='';
42
+ if (typeof(args)=='string'){
43
+ separator=args;
44
+ }
45
+ else if (typeof(args)=='object'){
46
+ separator=args.separator?args.separator:separator;
47
+ suffix=args.suffix?args.suffix:suffix;
48
+ prefix=args.prefix?args.prefix:prefix;
49
+ }
50
+ else if (typeof(args)!='undefined') {
51
+ throw `qtToString() says, string or {separator:'xxx'} are only valid arguments`
52
+ }
53
+ const tmp=this.join(separator).replace(new RegExp(`${separator}$`), '');
54
+ return `${prefix}${tmp}${suffix}`;
55
+ break;
56
+ default:
57
+ return this.toString();
58
+ }
59
+
60
+
61
+ };
62
+
63
+ const functionObject = new Map(); // prettier-ignore
64
+ functionObject.set(methodName, {
65
+ description,
66
+ supportedTypeList,
67
+ method,
68
+ test: (args) =>
69
+ {
70
+ return require('./test.js')({...args, ...{
71
+ moduleName: module.id.replace(module.path, '')
72
+ }})
73
+ }
74
+ });
75
+ return functionObject;
76
+ };
77
+ this.addToPrototype = addToPrototypeActual(
78
+ firstMethodFunction(commonFunctions)
79
+ );
80
+
81
+ };
82
+ //END OF moduleFunction() ============================================================
83
+ module.exports = moduleFunction;
84
+ //module.exports = new moduleFunction();
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ //START OF moduleFunction() ============================================================
4
+
5
+ const moduleFunction = function(args) {
6
+ //this module is initialized with parameters spec'd in the main function module
7
+
8
+ const completeStepActual = ({verbose=false, logErrors=false, moduleName}) => (
9
+ methodName,
10
+ thisStepMessage,
11
+ thisStepResult,
12
+ thisStepEvalFunction
13
+ ) => {
14
+ const thisStepPass = thisStepEvalFunction(thisStepResult);
15
+
16
+ if (logErrors && !thisStepPass) {
17
+ console.log(`FAIL TEST: ${thisStepMessage} in ...${moduleName}`);
18
+ }
19
+ if (verbose) {
20
+ console.log(`Result for: ${methodName} (${thisStepPass?'PASS':'FAIL'}):`);
21
+ console.dir(thisStepResult);
22
+ console.log('\n\n');
23
+ }
24
+
25
+ return passingTests && thisStepPass;
26
+ };
27
+
28
+ const completeStep = completeStepActual(args);
29
+
30
+ let passingTests = true;
31
+
32
+ let thisStepMessage;
33
+ let thisStepResult;
34
+ let thisStepEvalFunction;
35
+ let methodName;
36
+
37
+ //TESTS ============================================================
38
+
39
+
40
+ const testArray = [
41
+ 'allocute',
42
+ 'Hello'
43
+ ];
44
+
45
+
46
+ //TEST ITEM ------------------------------------------------------
47
+ methodName='qtToString'
48
+ thisStepMessage = `${methodName} did not get the right string`;
49
+ thisStepResult = testArray[methodName]();
50
+ thisStepEvalFunction = item => item =='allocute, Hello';
51
+ passingTests =
52
+ completeStep(methodName, thisStepMessage, thisStepResult, thisStepEvalFunction) &&
53
+ passingTests;
54
+
55
+
56
+ return passingTests;
57
+ };
58
+
59
+ //END OF moduleFunction() ============================================================
60
+
61
+ module.exports = moduleFunction;
62
+ //module.exports = new moduleFunction();
63
+
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "qtools-functional-library",
3
+ "version": "2.0.4",
4
+ "description": "Useful additions to JS prototypes to facilliate chainable, functional (mostly) style. Also make life more convenient.\"",
5
+ "main": "qtools-functional-library.js",
6
+ "scripts": {
7
+ "sample": "node test.js -listTests -logErrors -verbose --methodList=qtClone,qtToString,qtPop",
8
+ "sample2": "node test.js -listTests -logErrors --methodList=qtClone,qtToString,qtPop",
9
+ "logTest": "node --trace-uncaught test.js -listTests -logErrors --methodList=qtLog",
10
+ "test": "node test.js -logErrors",
11
+ "quiet": "node test.js -listTests -logErrors"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/tqwhite/qtools-functional-library.git"
16
+ },
17
+ "author": "TQ White II",
18
+ "license": "ISC",
19
+ "bugs": {
20
+ "url": "https://github.com/tqwhite/qtools-functional-library/issues"
21
+ },
22
+ "homepage": "https://github.com/tqwhite/qtools-functional-library#readme",
23
+ "devDependencies": {},
24
+ "keywords": [
25
+ "functional",
26
+ "chain"
27
+ ],
28
+ "licenses": [
29
+ {
30
+ "type": "MIT",
31
+ "url": "https://github.com/evangelion1204/multi-ini/blob/master/LICENSE"
32
+ }
33
+ ],
34
+ "pkg":{
35
+ "assets":"./lib"
36
+ }
37
+ }
@@ -0,0 +1,297 @@
1
+ #!/usr/local/bin/node
2
+ 'use strict';
3
+
4
+ const qtoolsGen = require('qtools');
5
+ const qtools = new qtoolsGen(module, { updatePrototypes: true });
6
+
7
+ // console.log(`\n=-============= help ========================= [noodleWithNode.js.]\n`);
8
+ //
9
+ // qtools.qt.help().qtDump();
10
+ // qtools.qt.help(/various/).qtDump();
11
+
12
+ //const timeStamp = qtools.dateToSql();
13
+ // const timeStamp2 = qtools.dateToSqlNew();
14
+ //
15
+ // timeStamp.qtDump({label:"dateToSql"});
16
+ // timeStamp2.qtDump({label:"dateToSqlNew"});
17
+
18
+
19
+ const jamesData={
20
+ "data": {
21
+ "studentReport": {
22
+ "rows": [
23
+ {
24
+ "student": {
25
+ "id": "7369",
26
+ "firstName": "Harry",
27
+ "middleName": "Z.",
28
+ "lastName": "Krazy",
29
+ "suffix": "",
30
+ "gender": "Male"
31
+ },
32
+ "testScores": [
33
+ {
34
+ "testId": "10",
35
+ "testName": "MN - Accountability Tests",
36
+ "variant": {
37
+ "id": "10001",
38
+ "name": "MCA II"
39
+ },
40
+ "season": {
41
+ "id": "2901",
42
+ "name": "2018-2019"
43
+ },
44
+ "outline": {
45
+ "id": "100001",
46
+ "name": "Math",
47
+ "parentId": null,
48
+ "level": 1
49
+ },
50
+ "gradeLevel": null,
51
+ "dateTaken": null,
52
+ "scoreType": {
53
+ "id": "1009",
54
+ "name": "Scale Score"
55
+ },
56
+ "score": null,
57
+ "altScore": null,
58
+ "performanceScales": []
59
+ },
60
+ {
61
+ "testId": "10",
62
+ "testName": "MN - Accountability Tests",
63
+ "variant": {
64
+ "id": "10005",
65
+ "name": "MCA III"
66
+ },
67
+ "season": {
68
+ "id": "2901",
69
+ "name": "2018-2019"
70
+ },
71
+ "outline": {
72
+ "id": "100001",
73
+ "name": "Math",
74
+ "parentId": null,
75
+ "level": 1
76
+ },
77
+ "gradeLevel": "05",
78
+ "dateTaken": "Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)",
79
+ "scoreType": {
80
+ "id": "1009",
81
+ "name": "Scale Score"
82
+ },
83
+ "score": 549,
84
+ "altScore": null,
85
+ "performanceScales": [
86
+ {
87
+ "performanceSet": {
88
+ "id": "1001",
89
+ "name": "Proficiency"
90
+ },
91
+ "performanceValue": "Partially Meets"
92
+ },
93
+ {
94
+ "performanceSet": {
95
+ "id": "1005",
96
+ "name": "Career and College Readiness"
97
+ },
98
+ "performanceValue": "N/A"
99
+ }
100
+ ]
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "student": {
106
+ "id": "9748",
107
+ "firstName": "Julie",
108
+ "middleName": "T.",
109
+ "lastName": "Blue",
110
+ "suffix": "",
111
+ "gender": "Female"
112
+ },
113
+ "testScores": [
114
+ {
115
+ "testId": "10",
116
+ "testName": "MN - Accountability Tests",
117
+ "variant": {
118
+ "id": "10001",
119
+ "name": "MCA II"
120
+ },
121
+ "season": {
122
+ "id": "2901",
123
+ "name": "2018-2019"
124
+ },
125
+ "outline": {
126
+ "id": "100001",
127
+ "name": "Math",
128
+ "parentId": null,
129
+ "level": 1
130
+ },
131
+ "gradeLevel": null,
132
+ "dateTaken": null,
133
+ "scoreType": {
134
+ "id": "1009",
135
+ "name": "Scale Score"
136
+ },
137
+ "score": null,
138
+ "altScore": null,
139
+ "performanceScales": []
140
+ },
141
+ {
142
+ "testId": "10",
143
+ "testName": "MN - Accountability Tests",
144
+ "variant": {
145
+ "id": "10005",
146
+ "name": "MCA III"
147
+ },
148
+ "season": {
149
+ "id": "2901",
150
+ "name": "2018-2019"
151
+ },
152
+ "outline": {
153
+ "id": "100001",
154
+ "name": "Math",
155
+ "parentId": null,
156
+ "level": 1
157
+ },
158
+ "gradeLevel": "05",
159
+ "dateTaken": "Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)",
160
+ "scoreType": {
161
+ "id": "1009",
162
+ "name": "Scale Score"
163
+ },
164
+ "score": 544,
165
+ "altScore": null,
166
+ "performanceScales": [
167
+ {
168
+ "performanceSet": {
169
+ "id": "1001",
170
+ "name": "Proficiency"
171
+ },
172
+ "performanceValue": "Partially Meets"
173
+ },
174
+ {
175
+ "performanceSet": {
176
+ "id": "1005",
177
+ "name": "Career and College Readiness"
178
+ },
179
+ "performanceValue": "N/A"
180
+ }
181
+ ]
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "student": {
187
+ "id": "1387",
188
+ "firstName": "Virtue",
189
+ "middleName": "H.",
190
+ "lastName": "RosiePosie",
191
+ "suffix": "",
192
+ "gender": "Female"
193
+ },
194
+ "testScores": [
195
+ {
196
+ "testId": "10",
197
+ "testName": "MN - Accountability Tests",
198
+ "variant": {
199
+ "id": "10001",
200
+ "name": "MCA II"
201
+ },
202
+ "season": {
203
+ "id": "2901",
204
+ "name": "2018-2019"
205
+ },
206
+ "outline": {
207
+ "id": "100001",
208
+ "name": "Math",
209
+ "parentId": null,
210
+ "level": 1
211
+ },
212
+ "gradeLevel": null,
213
+ "dateTaken": null,
214
+ "scoreType": {
215
+ "id": "1009",
216
+ "name": "Scale Score"
217
+ },
218
+ "score": null,
219
+ "altScore": null,
220
+ "performanceScales": []
221
+ },
222
+ {
223
+ "testId": "10",
224
+ "testName": "MN - Accountability Tests",
225
+ "variant": {
226
+ "id": "10005",
227
+ "name": "MCA III"
228
+ },
229
+ "season": {
230
+ "id": "2901",
231
+ "name": "2018-2019"
232
+ },
233
+ "outline": {
234
+ "id": "100001",
235
+ "name": "Math",
236
+ "parentId": null,
237
+ "level": 1
238
+ },
239
+ "gradeLevel": "05",
240
+ "dateTaken": "Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)",
241
+ "scoreType": {
242
+ "id": "1009",
243
+ "name": "Scale Score"
244
+ },
245
+ "score": 531,
246
+ "altScore": null,
247
+ "performanceScales": [
248
+ {
249
+ "performanceSet": {
250
+ "id": "1001",
251
+ "name": "Proficiency"
252
+ },
253
+ "performanceValue": "Does Not Meet"
254
+ },
255
+ {
256
+ "performanceSet": {
257
+ "id": "1005",
258
+ "name": "Career and College Readiness"
259
+ },
260
+ "performanceValue": "N/A"
261
+ }
262
+ ]
263
+ }
264
+ ]
265
+ }
266
+ ]
267
+ }
268
+ }
269
+ }
270
+
271
+
272
+ const selectionId='9748'
273
+
274
+ const tmp=jamesData
275
+ .qtGetSurePath('data.studentReport.rows', [])
276
+ .qtGetByProperty('student.id', selectionId, [])
277
+ .qtPop({})
278
+ .qtGetSurePath('testScores', [])
279
+ .qtGetByProperty('variant.id', 10005, [])
280
+ .qtGetByProperty('outline.id', 100001, [])
281
+ .qtPop({})
282
+ .qtGetSurePath('score', 'n/a')
283
+ .qtDump();
284
+
285
+
286
+ // const students=jamesData.data.studentReport.rows;
287
+ //
288
+ // students.length.qtDump({label:"students.length"});
289
+ //
290
+ // students.qtPop()
291
+ //
292
+ // students.length.qtDump({label:"students.length"});
293
+ //
294
+ //
295
+ // students.qtPop()
296
+ //
297
+ // students.length.qtDump({label:"students.length"});