qtools-library-dot-d 1.0.12 → 1.1.0

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/package.json +9 -3
  4. package/qtools-library-dot-d.js +553 -2
  5. package/libDotD_Working_Example/README.md +0 -234
  6. package/libDotD_Working_Example/demoModules_DotD/demo1.js +0 -46
  7. package/libDotD_Working_Example/demoModules_DotD/demo2.js +0 -48
  8. package/libDotD_Working_Example/index.js +0 -133
  9. package/libDotD_Working_Example/node_modules/.package-lock.json +0 -29
  10. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/README.md +0 -213
  11. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/package.json +0 -20
  12. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/qtools-asynchronous-pipe-plus.js +0 -278
  13. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/test.js +0 -79
  14. package/libDotD_Working_Example/node_modules/qtools-functional-library/README.md +0 -110
  15. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/package.json +0 -11
  16. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/qtools-clone.js +0 -103
  17. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/test.js +0 -78
  18. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/package.json +0 -11
  19. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/qtools-get-by-property.js +0 -73
  20. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/test.js +0 -129
  21. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/package.json +0 -11
  22. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/qtools-includes-regex.js +0 -54
  23. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/test.js +0 -76
  24. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/package.json +0 -11
  25. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/qtools-log-output.js +0 -114
  26. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/test.js +0 -130
  27. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/package.json +0 -11
  28. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/qtools-map-properties.js +0 -99
  29. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/test.js +0 -118
  30. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/package.json +0 -11
  31. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/qtools-merge.js +0 -147
  32. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/test.js +0 -214
  33. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/package.json +0 -11
  34. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/qtools-new-method-template.js +0 -70
  35. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/test.js +0 -66
  36. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/package.json +0 -11
  37. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/qtools-number-iterator.js +0 -137
  38. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/test.js +0 -68
  39. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/package.json +0 -11
  40. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/qtools-number-keys-to-array.js +0 -131
  41. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/test.js +0 -181
  42. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/package.json +0 -11
  43. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/qtools-object-sure-path.js +0 -204
  44. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/test.js +0 -345
  45. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/package.json +0 -11
  46. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/qtools-pass-through.js +0 -58
  47. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/test.js +0 -66
  48. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/package.json +0 -11
  49. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/qtools-pop.js +0 -175
  50. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/test.js +0 -118
  51. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/package.json +0 -11
  52. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/qtools-print-debug.js +0 -352
  53. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/test.js +0 -77
  54. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/package.json +0 -11
  55. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/qtools-select-properties.js +0 -132
  56. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/test.js +0 -156
  57. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/README.md +0 -3
  58. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/package.json +0 -11
  59. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/qtools-template-replace.js +0 -106
  60. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/test.js +0 -168
  61. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/package.json +0 -11
  62. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/qtools-to-key-value-array.js +0 -83
  63. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/test.js +0 -68
  64. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/package.json +0 -11
  65. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/qtools-to-string.js +0 -84
  66. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/test.js +0 -63
  67. package/libDotD_Working_Example/node_modules/qtools-functional-library/package.json +0 -37
  68. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtFunctionalDemo.js +0 -297
  69. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtools-functional-library.js +0 -271
  70. package/libDotD_Working_Example/node_modules/qtools-functional-library/test.js +0 -47
  71. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/README.md +0 -208
  72. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/package.json +0 -15
  73. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/qtools-library-dot-d.js +0 -239
  74. package/libDotD_Working_Example/package-lock.json +0 -37
  75. package/libDotD_Working_Example/package.json +0 -23
@@ -1,345 +0,0 @@
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 = ({
9
- verbose = false,
10
- logErrors = false,
11
- moduleName
12
- }) => (methodName, thisStepMessage, thisStepResult, thisStepEvalFunction) => {
13
- const thisStepPass = thisStepEvalFunction(thisStepResult);
14
-
15
- if (logErrors && !thisStepPass) {
16
- console.log(`FAIL TEST: ${thisStepMessage} in ...${moduleName}`);
17
- }
18
- if (verbose) {
19
- console.log(`Result for: ${methodName} ${thisStepMessage} (${thisStepPass?'PASS':'FAIL'}):`);
20
- console.dir(thisStepResult);
21
- console.log('\n\n');
22
- }
23
-
24
- return passingTests && thisStepPass;
25
- };
26
-
27
- const completeStep = completeStepActual(args);
28
-
29
- let passingTests = true;
30
-
31
- let thisStepMessage;
32
- let thisStepResult;
33
- let thisStepEvalFunction;
34
- let methodName;
35
-
36
- //TESTS ============================================================
37
-
38
-
39
- const testArray = {
40
- data: {
41
- studentReport: {
42
- rows: [
43
- {
44
- student: {
45
- id: '7369',
46
- firstName: 'Harry',
47
- middleName: 'Z.',
48
- lastName: 'Krazy',
49
- suffix: '',
50
- gender: 'Male'
51
- },
52
- testScores: [
53
- {
54
- testId: '10',
55
- testName: 'MN - Accountability Tests',
56
- variant: {
57
- id: '10001',
58
- name: 'MCA II'
59
- },
60
- season: {
61
- id: '2901',
62
- name: '2018-2019'
63
- },
64
- outline: {
65
- id: '100001',
66
- name: 'Math',
67
- parentId: null,
68
- level: 1
69
- },
70
- gradeLevel: null,
71
- dateTaken: null,
72
- scoreType: {
73
- id: '1009',
74
- name: 'Scale Score'
75
- },
76
- score: null,
77
- altScore: null,
78
- performanceScales: []
79
- },
80
- {
81
- testId: '10',
82
- testName: 'MN - Accountability Tests',
83
- variant: {
84
- id: '10005',
85
- name: 'MCA III'
86
- },
87
- season: {
88
- id: '2901',
89
- name: '2018-2019'
90
- },
91
- outline: {
92
- id: '100001',
93
- name: 'Math',
94
- parentId: null,
95
- level: 1
96
- },
97
- gradeLevel: '05',
98
- dateTaken:
99
- 'Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)',
100
- scoreType: {
101
- id: '1009',
102
- name: 'Scale Score'
103
- },
104
- score: 549,
105
- altScore: null,
106
- performanceScales: [
107
- {
108
- performanceSet: {
109
- id: '1001',
110
- name: 'Proficiency'
111
- },
112
- performanceValue: 'Partially Meets'
113
- },
114
- {
115
- performanceSet: {
116
- id: '1005',
117
- name: 'Career and College Readiness'
118
- },
119
- performanceValue: 'N/A'
120
- }
121
- ]
122
- }
123
- ]
124
- },
125
- {
126
- student: {
127
- id: '9748',
128
- firstName: 'Julie',
129
- middleName: 'T.',
130
- lastName: 'Blue',
131
- suffix: '',
132
- gender: 'Female'
133
- },
134
- testScores: [
135
- {
136
- testId: '10',
137
- testName: 'MN - Accountability Tests',
138
- variant: {
139
- id: '10001',
140
- name: 'MCA II'
141
- },
142
- season: {
143
- id: '2901',
144
- name: '2018-2019'
145
- },
146
- outline: {
147
- id: '100001',
148
- name: 'Math',
149
- parentId: null,
150
- level: 1
151
- },
152
- gradeLevel: null,
153
- dateTaken: null,
154
- scoreType: {
155
- id: '1009',
156
- name: 'Scale Score'
157
- },
158
- score: null,
159
- altScore: null,
160
- performanceScales: []
161
- },
162
- {
163
- testId: '10',
164
- testName: 'MN - Accountability Tests',
165
- variant: {
166
- id: '10005',
167
- name: 'MCA III'
168
- },
169
- season: {
170
- id: '2901',
171
- name: '2018-2019'
172
- },
173
- outline: {
174
- id: '100001',
175
- name: 'Math',
176
- parentId: null,
177
- level: 1
178
- },
179
- gradeLevel: '05',
180
- dateTaken:
181
- 'Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)',
182
- scoreType: {
183
- id: '1009',
184
- name: 'Scale Score'
185
- },
186
- score: 544,
187
- altScore: null,
188
- performanceScales: [
189
- {
190
- performanceSet: {
191
- id: '1001',
192
- name: 'Proficiency'
193
- },
194
- performanceValue: 'Partially Meets'
195
- },
196
- {
197
- performanceSet: {
198
- id: '1005',
199
- name: 'Career and College Readiness'
200
- },
201
- performanceValue: 'N/A'
202
- }
203
- ]
204
- }
205
- ]
206
- },
207
- {
208
- student: {
209
- id: '1387',
210
- firstName: 'Virtue',
211
- middleName: 'H.',
212
- lastName: 'RosiePosie',
213
- suffix: '',
214
- gender: 'Female'
215
- },
216
- testScores: [
217
- {
218
- testId: '10',
219
- testName: 'MN - Accountability Tests',
220
- variant: {
221
- id: '10001',
222
- name: 'MCA II'
223
- },
224
- season: {
225
- id: '2901',
226
- name: '2018-2019'
227
- },
228
- outline: {
229
- id: '100001',
230
- name: 'Math',
231
- parentId: null,
232
- level: 1
233
- },
234
- gradeLevel: null,
235
- dateTaken: null,
236
- scoreType: {
237
- id: '1009',
238
- name: 'Scale Score'
239
- },
240
- score: null,
241
- altScore: null,
242
- performanceScales: []
243
- },
244
- {
245
- testId: '10',
246
- testName: 'MN - Accountability Tests',
247
- variant: {
248
- id: '10005',
249
- name: 'MCA III'
250
- },
251
- season: {
252
- id: '2901',
253
- name: '2018-2019'
254
- },
255
- outline: {
256
- id: '100001',
257
- name: 'Math',
258
- parentId: null,
259
- level: 1
260
- },
261
- gradeLevel: '05',
262
- dateTaken:
263
- 'Sun Mar 03 2019 18:00:00 GMT-0600 (Central Standard Time)',
264
- scoreType: {
265
- id: '1009',
266
- name: 'Scale Score'
267
- },
268
- score: 531,
269
- altScore: null,
270
- performanceScales: [
271
- {
272
- performanceSet: {
273
- id: '1001',
274
- name: 'Proficiency'
275
- },
276
- performanceValue: 'Does Not Meet'
277
- },
278
- {
279
- performanceSet: {
280
- id: '1005',
281
- name: 'Career and College Readiness'
282
- },
283
- performanceValue: 'N/A'
284
- }
285
- ]
286
- }
287
- ]
288
- }
289
- ]
290
- }
291
- }
292
- };
293
-
294
-
295
- //TEST ITEM ------------------------------------------------------
296
- methodName = 'qtGetSurePath';
297
- thisStepMessage = 'not yet implemented';
298
- thisStepResult = testArray[methodName]('data.studentReport.rows', []);
299
- thisStepEvalFunction = item => item.length==3;
300
- passingTests =
301
- completeStep(
302
- methodName,
303
- thisStepMessage,
304
- thisStepResult,
305
- thisStepEvalFunction
306
- ) && passingTests;
307
-
308
-
309
- methodName = 'qtPutSurePath';
310
- thisStepMessage = 'not yet implemented';
311
- thisStepResult = testArray[methodName]('data.studentReport.rows[0].student.id', 9999);
312
- thisStepEvalFunction = item => item.qtGetSurePath('data.studentReport.rows[0].student.id')==9999;
313
- passingTests =
314
- completeStep(
315
- methodName,
316
- thisStepMessage,
317
- thisStepResult,
318
- thisStepEvalFunction
319
- ) && passingTests;
320
-
321
-
322
-
323
- methodName = 'qtPutSurePath';
324
- thisStepMessage = 'avoid prototype polution';
325
- thisStepResult = testArray[methodName]('__proto__', 9999);
326
- thisStepEvalFunction = item => item.qtGetSurePath('__proto__')!=9999;
327
- passingTests =
328
- completeStep(
329
- methodName,
330
- thisStepMessage,
331
- thisStepResult,
332
- thisStepEvalFunction
333
- ) && passingTests;
334
-
335
-
336
-
337
-
338
- return passingTests;
339
- };
340
-
341
- //END OF moduleFunction() ============================================================
342
-
343
- module.exports = moduleFunction;
344
- //module.exports = new moduleFunction();
345
-
@@ -1,11 +0,0 @@
1
- {
2
- "name": "qtools-pass-through",
3
- "version": "1.0.0",
4
- "description": "executes a supplied function but never changes the value supplied",
5
- "main": "qtools-pass-through.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "TQ White II",
10
- "license": "ISC"
11
- }
@@ -1,58 +0,0 @@
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
- //first method definition function ==========================
10
- const firstMethodFunction = (commonFunctions) => {
11
- const functionObject = new Map(); // prettier-ignore
12
-
13
- const methodName = 'qtPassThrough';
14
- const description = `executes a supplied function; 'this' is the only parameter; if supplied function returns a value, it is returned, else 'this' is returned.`;
15
- const supportedTypeList = [Object, Array, String, Number, Boolean, Date];
16
-
17
- const method = () =>
18
- function (utilityFunction) {
19
- //if one of the supportedTypeList elements is Object, basically all data types will have this method and type checking is important.
20
- if (!commonFunctions.isSupportedType(this, supportedTypeList)) {
21
- // prettier-ignore
22
- throw new Error(
23
- `${methodName}(): unsupported data type: '${commonFunctions.toType(this)}' (${methodName} supports ${supportedTypeList.map(item=>item.toString().replace(/.*function (.*?)\(\).*/, '$1')).join(', ')})`
24
- );
25
- }
26
-
27
- const utilityResult = utilityFunction(this);
28
- if (utilityResult!=undefined) {
29
- return utilityResult;
30
- } else {
31
- return this;
32
- }
33
- };
34
-
35
- functionObject.set(methodName, {
36
- description,
37
- supportedTypeList,
38
- method,
39
- test: (args) => {
40
- return require('./test.js')({
41
- ...args,
42
- ...{
43
- moduleName: module.id.replace(module.path, ''),
44
- },
45
- });
46
- },
47
- });
48
-
49
- return functionObject;
50
- };
51
- this.addToPrototype = addToPrototypeActual(
52
- firstMethodFunction(commonFunctions),
53
- );
54
-
55
- };
56
- //END OF moduleFunction() ============================================================
57
- module.exports = moduleFunction;
58
- //module.exports = new moduleFunction();
@@ -1,66 +0,0 @@
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
-
15
- const thisStepPass = thisStepEvalFunction(thisStepResult);
16
-
17
- if (logErrors && !thisStepPass) {
18
- console.log(`FAIL TEST: ${thisStepMessage} in ...${moduleName}`);
19
- }
20
- if (verbose) {
21
- console.log(`Result for: ${methodName} (${thisStepPass?'PASS':'FAIL'}):`);
22
- console.dir(thisStepResult);
23
- console.log('\n\n');
24
- }
25
-
26
- return passingTests && thisStepPass;
27
- };
28
-
29
- const completeStep = completeStepActual(args);
30
-
31
- let passingTests = true;
32
-
33
- let thisStepMessage;
34
- let thisStepResult;
35
- let thisStepEvalFunction;
36
- let methodName;
37
-
38
- //TESTS ============================================================
39
-
40
-
41
- const testArray = [
42
- 'allocute',
43
- 'Hello'
44
- ];
45
-
46
-
47
- //TEST ITEM ------------------------------------------------------
48
- methodName='qtTemplateMethod'
49
- thisStepMessage = "not yet implemented";
50
- thisStepResult = testArray[methodName]('SUFFIX');
51
- thisStepEvalFunction = item => item='allocute,Hello : SUFFIX';
52
- passingTests =
53
- completeStep(methodName, thisStepMessage, thisStepResult, thisStepEvalFunction) &&
54
- passingTests;
55
-
56
-
57
-
58
-
59
- return passingTests;
60
- };
61
-
62
- //END OF moduleFunction() ============================================================
63
-
64
- module.exports = moduleFunction;
65
- //module.exports = new moduleFunction();
66
-
@@ -1,11 +0,0 @@
1
- {
2
- "name": "qtools-pop",
3
- "version": "1.0.0",
4
- "description": "basically this is pop surePath.",
5
- "main": "qtools-pop.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "TQ White II",
10
- "license": "ISC"
11
- }
@@ -1,175 +0,0 @@
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
- const firstMethodFunction = commonFunctions => {
13
- const methodName = 'qtPop';
14
- const description = `operand.qtPop() pops with an optional default argument`;
15
- const supportedTypeList = [Array];
16
-
17
- const method = () =>
18
- function(defaultValue) {
19
- const inData = this;
20
- if (typeof inData.length == 'undefined') {
21
- throw 'array.qtPop(defaultValue=undefined) works for Arrays only';
22
- }
23
- const arrayValue = inData.pop();
24
- const result =
25
- typeof arrayValue != 'undefined' ? arrayValue : defaultValue;
26
- return result;
27
- };
28
-
29
- const test = args => {
30
- return require('./test.js')({
31
- ...args,
32
- ...{
33
- moduleName: module.id.replace(module.path, '')
34
- }
35
- });
36
- };
37
-
38
- return {
39
- methodName,
40
- description,
41
- supportedTypeList,
42
- method,
43
- test
44
- };
45
- };
46
- //second method definition function ==========================
47
- const secondMethodFunction = commonFunctions => {
48
- const methodName = 'qtLast';
49
- const description = `operand.qtLast() return last element but leave it on stack) with an optional default argument`;
50
- const supportedTypeList = [Array];
51
-
52
- const method = () =>
53
- function(defaultValue) {
54
- const inData = this;
55
- if (typeof inData.length == 'undefined') {
56
- throw 'array.qtLast(defaultValue=undefined) works for Arrays only';
57
- }
58
- const arrayValue = inData.length?inData[inData.length-1]:void('');
59
- const result =
60
- typeof arrayValue != 'undefined' ? arrayValue : defaultValue;
61
- return result;
62
- };
63
-
64
- return {
65
- methodName,
66
- description,
67
- supportedTypeList,
68
- method
69
- };
70
- };
71
- //third method definition function ==========================
72
- const thirdMethodFunction = commonFunctions => {
73
- const methodName = 'qtPush';
74
- const description = `operand.qtPush(value) pushes to the array and returns the array`;
75
- const supportedTypeList = [Array];
76
-
77
- const method = () =>
78
- function(value) {
79
- const inData = this;
80
- if (typeof inData.length == 'undefined') {
81
- throw 'array.qtPush(defaultValue=undefined) works for Arrays only';
82
- }
83
-
84
- inData.push(value);
85
- return inData;
86
- };
87
-
88
- const test = args => {
89
- return require('./test.js')({
90
- ...args,
91
- ...{
92
- moduleName: module.id.replace(module.path, '')
93
- }
94
- });
95
- };
96
-
97
- return {
98
- methodName,
99
- description,
100
- supportedTypeList,
101
- method,
102
- test
103
- };
104
- };
105
- //fourth method definition function ==========================
106
- const fourthMethodFunction = commonFunctions => {
107
- const methodName = 'qtFirst';
108
- const description = `operand.qtFirst(value) gets element zero or default`;
109
- const supportedTypeList = [Array];
110
-
111
- const method = () =>
112
- function(defaultValue) {
113
- const inData = this;
114
- if (typeof inData.length == 'undefined') {
115
- throw 'array.qtFirst(defaultValue=undefined) works for Arrays only';
116
- }
117
- const arrayValue = inData[0]?inData[0]:void('');
118
- const result =
119
- typeof arrayValue != 'undefined' ? arrayValue : defaultValue;
120
- return result;
121
- };
122
-
123
- const test = args => {
124
- return require('./test.js')({
125
- ...args,
126
- ...{
127
- moduleName: module.id.replace(module.path, '')
128
- }
129
- });
130
- };
131
-
132
- return {
133
- methodName,
134
- description,
135
- supportedTypeList,
136
- method,
137
- test
138
- };
139
- };
140
-
141
- const functionObject = new Map(); // prettier-ignore
142
- const addFunction = definition => {
143
- const {
144
- methodName,
145
- description,
146
- supportedTypeList,
147
- method,
148
- test
149
- } = definition;
150
- functionObject.set(methodName, {
151
- description,
152
- supportedTypeList,
153
- method,
154
- test: args => {
155
- return require('./test.js')({
156
- ...args,
157
- ...{
158
- moduleName: module.id.replace(module.path, '')
159
- }
160
- });
161
- }
162
- });
163
- };
164
-
165
- addFunction(firstMethodFunction());
166
- addFunction(secondMethodFunction());
167
- addFunction(thirdMethodFunction());
168
- addFunction(fourthMethodFunction());
169
-
170
- this.addToPrototype = addToPrototypeActual(functionObject);
171
-
172
- };
173
- //END OF moduleFunction() ============================================================
174
- module.exports = moduleFunction;
175
- //module.exports = new moduleFunction();