queueobj 10.5.4 → 11.0.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.
package/README.md CHANGED
@@ -6,16 +6,15 @@ Included tag appenders:
6
6
  * func_all - synchronous - process custom functions to added objects.
7
7
  * top_one - synchronous - process only the object in the 0(zero) position of the process array.
8
8
  * bottom_one - synchronous - process only the object in the last position of the process array.
9
- * sync_all - synchronous - All appenders are synchronous now. Sync_all is no different than all .
9
+ * sync_all - synchronous - All appenders are synchronous now. Sync_all is no different than all.
10
10
  * status - synchronous - queue and process all objects by status.
11
+ * name - synchronous - queue and process all objects by name.
11
12
  * version - synchronous - queue and process all objects by version.
12
13
 
13
14
  Installation
14
15
  ---------
15
- ```
16
- [![NPM](https://nodei.co/npm/queueobj.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/queueobj/)
17
16
 
18
- ```
17
+ [![NPM](https://nodei.co/npm/queueobj.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/queueobj/)
19
18
 
20
19
  Mocha Test
21
20
  ---------
@@ -33,6 +32,7 @@ npm run test_func_all
33
32
  npm run test_sync_all
34
33
  npm run test_status
35
34
  npm run test_version
35
+ npm run test_name
36
36
 
37
37
  ```
38
38
 
@@ -102,7 +102,7 @@ class test4 {
102
102
  }
103
103
  }
104
104
  let tst4 = new test4()
105
- let qObj = new queue(), props = { appender: 'sync_all' }
105
+ let qObj = new queue(), props = { appender: 'name' }
106
106
 
107
107
  qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(tst4.custom_function)
108
108
 
package/app.js CHANGED
@@ -10,6 +10,7 @@ var colors = require('colors'),
10
10
  bottom_one = require('./lib/appenders/bottom_one'),
11
11
  sync_all = require('./lib/appenders/sync_all'),
12
12
  status = require('./lib/appenders/status'),
13
+ jrmdig = require('./lib/appenders/name'),
13
14
  version = require('./lib/appenders/version')
14
15
 
15
16
  class QueueObj {
@@ -28,6 +29,7 @@ class QueueObj {
28
29
  t.version = null
29
30
  t.stats = false
30
31
  t.sync_all = null
32
+ t.name = null
31
33
  t.func_all = null
32
34
  t.objs = []
33
35
  t.resolve = null
@@ -147,6 +149,9 @@ class QueueObj {
147
149
  case 'sync_all':
148
150
  t.sync_all = new sync_all(props)
149
151
  break
152
+ case 'name':
153
+ t.name = new jrmdig(props)
154
+ break
150
155
  default:
151
156
  throw new Error(`appender(${props.appender}) not found`)
152
157
  }
@@ -189,11 +194,22 @@ class QueueObj {
189
194
  return 'sync_all'
190
195
  }
191
196
  }
197
+ if (t.name != null) {
198
+ obj._getProperty = (o) => {
199
+ return 'name'
200
+ }
201
+ }
192
202
  if (typeof obj.status != 'undefined') {
193
203
  obj._getProperty = (o) => {
194
204
  return o.status
195
205
  }
196
206
 
207
+ }
208
+ if (typeof obj.name != 'undefined') {
209
+ obj._getProperty = (o) => {
210
+ return o.name
211
+ }
212
+
197
213
  }
198
214
  if (typeof obj.version != 'undefined') {
199
215
  obj._getProperty = (o) => {
@@ -238,6 +254,8 @@ class QueueObj {
238
254
  case 'sync':
239
255
  case 'sync_all':
240
256
  return t.sync_all.process(props)
257
+ case 'name':
258
+ return t.name.process(props)
241
259
  case 'status':
242
260
  return t.status.process(props)
243
261
  case 'version':
@@ -0,0 +1,17 @@
1
+ /*
2
+ * @author Jim Manton: jrman@risebroadband.net
3
+ * @since 2023-01-16
4
+ * lib/appenders/name.js
5
+ */
6
+
7
+ var base = require('./base.js')
8
+
9
+ exports = module.exports = class name extends base {
10
+ constructor(props) {
11
+ super(props)
12
+ var t = this
13
+ t.aname = 'name'
14
+ t.pro_types = ['name']
15
+ return t
16
+ }
17
+ }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * @author Jim Manton: jrman@risebroadband.net
3
- * @since 2021-03-22
3
+ * @since 2023-01-16
4
4
  * lib/appenders/status.js
5
5
  */
6
6
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": {
3
3
  "name": "Jim Manton"
4
4
  },
5
- "version": "10.5.4",
5
+ "version": "11.0.0",
6
6
  "bundleDependencies": false,
7
7
  "dependencies": {
8
8
  "chai": "^4.3.7",
@@ -17,7 +17,9 @@
17
17
  "test_all": "node ./tests/test_all",
18
18
  "test_bottom_one": "node ./tests/test_bottom_one",
19
19
  "test_func_all": "node ./tests/test_func_all",
20
+ "test_sync_all": "node ./tests/test_sync_all",
20
21
  "test_status": "node ./tests/test_status",
22
+ "test_name": "node ./tests/test_name",
21
23
  "test_top_one": "node ./tests/test_top_one",
22
24
  "test_version": "node ./tests/test_version"
23
25
  },
package/test/app.js CHANGED
@@ -63,6 +63,10 @@ describe('require', function () {
63
63
  assert(require('../lib/appenders/sync_all'))
64
64
  })
65
65
 
66
+ it('name appender', function () {
67
+ assert(require('../lib/appenders/name'))
68
+ })
69
+
66
70
  it('status appender', function () {
67
71
  assert(require('../lib/appenders/status'))
68
72
  })
package/test/package.js CHANGED
@@ -6,7 +6,7 @@ const packageMock = {
6
6
  "author": {
7
7
  "name": "Jim Manton"
8
8
  },
9
- "version": "10.5.4",
9
+ "version": "11.0.0",
10
10
  "bundleDependencies": false,
11
11
  "dependencies": {
12
12
  "chai": "^4.3.7",
@@ -21,7 +21,9 @@ const packageMock = {
21
21
  "test_all": "node ./tests/test_all",
22
22
  "test_bottom_one": "node ./tests/test_bottom_one",
23
23
  "test_func_all": "node ./tests/test_func_all",
24
+ "test_sync_all": "node ./tests/test_sync_all",
24
25
  "test_status": "node ./tests/test_status",
26
+ "test_name": "node ./tests/test_name",
25
27
  "test_top_one": "node ./tests/test_top_one",
26
28
  "test_version": "node ./tests/test_version"
27
29
  },
package/tests/test_all.js CHANGED
@@ -1,6 +1,5 @@
1
- var colors = require('colors')
2
-
3
- var queue = require("../app.js");
1
+ var colors = require('colors'),
2
+ queue = require("../app.js")
4
3
 
5
4
  class test1 {
6
5
  process(callback) {
@@ -1,6 +1,5 @@
1
- var colors = require('colors')
2
-
3
- var queue = require("./app.js");
1
+ var colors = require('colors'),
2
+ queue = require("../app.js")
4
3
 
5
4
  class test1 {
6
5
  process(callback) {
@@ -1,6 +1,5 @@
1
- var colors = require('colors')
2
-
3
- var queue = require("./app.js");
1
+ var colors = require('colors'),
2
+ queue = require("../app.js");
4
3
 
5
4
  class test1 {
6
5
  some_function(callback) {
@@ -0,0 +1,86 @@
1
+ /*
2
+ * @author Jim Manton: jrman@risebroadband.net
3
+ * @since 2023-01-16
4
+ * test_name.js
5
+ */
6
+
7
+ var colors = require('colors'),
8
+ queue = require("../app.js")
9
+
10
+ class test1 {
11
+ constructor() {
12
+ let t = this
13
+ t.id = 100
14
+ t.name = "new"
15
+
16
+ t.process = t.process.bind(t)
17
+ }
18
+
19
+ process(callback) {
20
+ callback({success: {msg: `processing test1 id(${this.id}) name(${this.name})`}})
21
+ }
22
+ }
23
+
24
+ class test2 {
25
+ constructor() {
26
+ let t = this
27
+ t.id = 200
28
+ t.name = "big_data"
29
+
30
+ t.process = t.process.bind(t)
31
+ }
32
+
33
+ process(callback) {
34
+ let t = this, msg = `some kinda problem here`
35
+ callback({error: {msg: msg}}) //this will show errors
36
+ // callback({success: {msg: `processing test2 id(${this.id}) name(${this.name})`}}) //this will show no errors
37
+ }
38
+
39
+ ping() {
40
+ qObj.logMsg('hello from test2'.rainbow)
41
+ }
42
+ }
43
+
44
+ class test3 {
45
+ constructor() {
46
+ let t = this
47
+ t.id = 300
48
+ t.name = "secondary"
49
+
50
+ t.process = t.process.bind(t)
51
+ }
52
+
53
+ process(callback) {
54
+ callback({success: {msg: `processing test3 id(${this.id}) name(${this.name})`}}) //this will show no errors
55
+ }
56
+ }
57
+
58
+ class test4 {
59
+ constructor() {
60
+ let t = this
61
+ t.id = 400
62
+ t.name = "old"
63
+
64
+ t.process = t.process.bind(t)
65
+ }
66
+
67
+ process(callback) {
68
+ callback({success: {msg: `processing test4 id(${this.id}) name(${this.name})`}}) //this will show no errors
69
+ }
70
+ }
71
+
72
+ let qObj = new queue(), props = { appender: 'status', stats: true }
73
+
74
+ qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4())
75
+
76
+ qObj.process({ property: 'name', items: ['big_data'] }).then(res => {
77
+ qObj.logMsg(`success with name processing: (${res})`.bold.italic.green)
78
+ }, err => {
79
+ qObj.logMsg(`errors with name processing: (${err})`.red)
80
+ })
81
+
82
+ // qObj.process({ property: 'status', items: ['error'] }).then(res => {
83
+ // qObj.logMsg(`success with status error processing: (${JSON.stringify(res)})`.bold.italic.green)
84
+ // }, err => {
85
+ // qObj.logMsg(`errors with status error processing: (${JSON.stringify(err)})`.red)
86
+ // })
@@ -4,8 +4,8 @@
4
4
  * test_status.js
5
5
  */
6
6
 
7
- var colors = require('colors')
8
- var queue = require("./app.js");
7
+ var colors = require('colors'),
8
+ queue = require("../app.js")
9
9
 
10
10
  class test1 {
11
11
  constructor() {
@@ -73,7 +73,7 @@ let qObj = new queue(), props = { appender: 'status', stats: true }
73
73
 
74
74
  qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4())
75
75
 
76
- qObj.process({ property: 'status', items: ['init'] }).then(res => {
76
+ qObj.process({ property: 'status', items: ['new'] }).then(res => {
77
77
  qObj.logMsg(`success with status processing: (${res})`.bold.italic.green)
78
78
  }, err => {
79
79
  qObj.logMsg(`errors with status processing: (${err})`.red)
@@ -4,8 +4,8 @@
4
4
  * test_sync.js
5
5
  */
6
6
 
7
- var colors = require('colors')
8
- var queue = require("./app.js");
7
+ var colors = require('colors'),
8
+ queue = require("../app.js")
9
9
 
10
10
  class test1 {
11
11
  constructor() {
@@ -1,6 +1,5 @@
1
- var colors = require('colors')
2
-
3
- var queue = require("./app.js");
1
+ var colors = require('colors'),
2
+ queue = require("../app.js");
4
3
 
5
4
  class test1 {
6
5
  process(callback){
@@ -4,8 +4,8 @@
4
4
  * test_status.js
5
5
  */
6
6
 
7
- var colors = require('colors')
8
- var queue = require("./app.js");
7
+ var colors = require('colors'),
8
+ queue = require("../app.js")
9
9
 
10
10
  class test1 {
11
11
  constructor() {