New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

queuejson

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queuejson - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

lib/appenders/func_all.ts

272

app.ts

@@ -11,161 +11,173 @@

top_one = require('./lib/appenders/top_one'),
bottom_one = require('./lib/appenders/bottom_one')
bottom_one = require('./lib/appenders/bottom_one'),
func_all = require('./lib/appenders/func_all'),
exports = module.exports = class QueueJson {
exports = module.exports = class QueueJson {
private appenders: Array<any> = [
{ name: 'all', obj: null }
]
private props: any;
private all: any;
private top_one: any;
private bottom_one: any;
private appenders_dir = './lib/appenders/'
private debug: boolean = false;
private appender_selected = 0;
private blue: any;
private class_obj_array: any = [];
private appenders: Array<any> = [
{ name: 'all', obj: null }
]
private props: any;
private all: any;
private top_one: any;
private bottom_one: any;
private func_all: any;
private appenders_dir = './lib/appenders/'
private debug: boolean = false;
private appender_selected = 0;
private blue: any;
private class_obj_array: any = [];
constructor(props: any) {
let t = this, fname = `app constructor`
try {
t.props = props
t.props.getParent = t.getParent
t.props.log = t.log
constructor(props: any) {
let t = this, fname = `app constructor`
try {
t.props = props
t.props.getParent = t.getParent
t.props.log = t.log
if (typeof t.props != 'undefined' && typeof t.props.debug != 'undefined') {
t.debug = t.props.debug
} else {
throw new Error(`props is not defined`)
}
if (typeof t.props != 'undefined' && typeof t.props.debug != 'undefined') {
t.debug = t.props.debug
} else {
throw new Error(`props is not defined`)
}
t.log = t.log.bind(t)
t.init = t.init.bind(t)
t.process = t.process.bind(t)
t.getParent = t.getParent.bind(t)
t.log = t.log.bind(t)
t.init = t.init.bind(t)
t.process = t.process.bind(t)
t.getParent = t.getParent.bind(t)
// t.log(fname, "debug");
return t
} catch (e) {
t.log(`${fname}: ${e}`, "error")
// t.log(fname, "debug");
return t
} catch (e) {
t.log(`${fname}: ${e}`, "error")
}
}
}
getParent = () => {
return this
}
getParent = () => {
return this
}
getFunctionName = () => {
return this.props.function_name
}
get_class_obj_array = () => {
return this.class_obj_array
}
get_class_obj_array = () => {
return this.class_obj_array
}
init = (props: any) => {
let t = this, fname = `app init`, add = false
try {
// t.log(fname, "debug");
init = (props: any) => {
let t = this, fname = `app init`, add = false
try {
// t.log(fname, "debug");
try {
if (typeof props.input_data != 'undefined') {
props.input_data.map((dat: any, i: number) => {
add = false
switch (t.props.appender) {
case 'top_one':
if (i == 0)
try {
if (typeof props.input_data != 'undefined') {
props.input_data.map((dat: any, i: number) => {
add = false
switch (t.props.appender) {
case 'top_one':
if (i == 0)
add = true
break
case 'bottom_one':
if (i == (props.input_data.length - 1))
add = true
break
default:
add = true
break
case 'bottom_one':
if (i == (props.input_data.length - 1))
add = true
break
default:
add = true
}
if (add)
t.class_obj_array.push(new t.props.class_obj(dat.props))
})
} else
throw new Error('no input data array defined.')
}
if (add)
t.class_obj_array.push(new t.props.class_obj(dat.props))
})
} else
throw new Error('no input data array defined.')
} catch (e) {
throw e
}
} catch (e) {
throw e
throw `new class_obj: ${e}`
}
t.appenders.map((aPen, i) => {
switch (t.props.appender) {
case 'all':
t.all = new all(t.props)
break
case 'top_one':
t.top_one = new top_one(t.props)
break
case 'func_all':
t.func_all = new func_all(t.props)
break
case 'bottom_one':
t.bottom_one = new bottom_one(t.props)
break
default:
throw new Error(`appender(${t.props.appender}) is not defined`)
}
})
return t
} catch (e) {
throw `new class_obj: ${e}`
t.log(`${fname}: ${e}`, "error")
}
t.appenders.map((aPen, i) => {
}
switch (t.props.appender) {
case 'all':
t.all = new all(t.props)
log = (msg: any, type?: string) => {
try {
let t = this, tp
switch (type) {
case 'debug':
if (!t.debug)
return
tp = "bg_dark_cyan"
break
case 'top_one':
t.top_one = new top_one(t.props)
case 'error':
tp = "fg_red"
break
case 'bottom_one':
t.bottom_one = new bottom_one(t.props)
case 'purple':
tp = "bg_purple"
break
case 'success':
tp = "fg_green"
break
case 'white':
tp = "bg_white"
break
default:
throw new Error(`appender(${t.props.appender}) is not defined`)
tp = 'bg_dark_gray'
}
})
return t
} catch (e) {
t.log(`${fname}: ${e}`, "error")
console.log(cc.set(tp, msg))
return t
} catch (e) {
console.log(`app log: ${e}`)
}
}
}
log = (msg: any, type?: string) => {
try {
let t = this, tp
switch (type) {
case 'debug':
if (!t.debug)
return
tp = "bg_dark_cyan"
break
case 'error':
tp = "fg_red"
break
case 'purple':
tp = "bg_purple"
break
case 'success':
tp = "fg_green"
break
case 'white':
tp = "bg_white"
break
default:
tp = 'bg_dark_gray'
process = (props: any) => {
let t = this, fname = `app process`
let pro = { 'dat_array': [''] }
try {
// t.log(`${fname} appender(${JSON.stringify(t.props)})`, "debug");
switch (t.props.appender) {
case 'all':
pro.dat_array.push('all')
return t.all.process()
case 'top_one':
pro.dat_array.push('top_one')
return t.top_one.process()
case 'bottom_one':
pro.dat_array.push('bottom_one')
return t.bottom_one.process()
case 'func_all':
pro.dat_array.push('func_all')
return t.func_all.process()
default:
throw new Error(`nothing to process`)
}
} catch (e) {
t.log(`${fname}: ${e}`, "error")
}
console.log(cc.set(tp, msg))
return t
} catch (e) {
console.log(`app log: ${e}`)
}
}
process = (props: any) => {
let t = this, fname = `app process`
let pro = { 'dat_array': [''] }
try {
// t.log(`${fname} appender(${JSON.stringify(t.props)})`, "debug");
switch (t.props.appender) {
case 'all':
pro.dat_array.push('all')
return t.all.process()
case 'top_one':
pro.dat_array.push('top_one')
return t.top_one.process()
case 'bottom_one':
pro.dat_array.push('bottom_one')
return t.bottom_one.process()
default:
throw new Error(`nothing to process`)
}
} catch (e) {
t.log(`${fname}: ${e}`, "error")
}
}
}

@@ -15,2 +15,4 @@ /*

private qObj: any;
private aname: string = '';
private function_name: string = '';
private stats: boolean = false;

@@ -57,3 +59,3 @@ private parent: any;

process_all = () => {
let t = this, fname = `base process_all`, coa
let t = this, fname = `base process_all`, coa, funcN, objF
try {

@@ -69,4 +71,15 @@ // t.log(fname, "debug");

dat.log = t.log
t.qObj.add(dat)
switch (t.aname) {
case 'func_all':
funcN = t.parent.getFunctionName();
if (typeof funcN != 'string')
throw new Error(`function name (${funcN}) does not exist`)
objF = eval(`dat.${funcN}`)
if (typeof objF != 'function')
throw new Error(`function(${funcN}) does not exist`)
t.qObj.add(objF)
break
default:
t.qObj.add(dat)
}
})

@@ -73,0 +86,0 @@

/*
* @author Jim Manton: jrman@risebroadband.net
* @since 2022-05-24
* all.ts
* bottom_one.ts
*/

@@ -20,4 +20,3 @@

}
}
}
/*
* @author Jim Manton: jrman@risebroadband.net
* @since 2022-05-24
* all.ts
* top_one.ts
*/

@@ -6,0 +6,0 @@

{
"name": "queuejson",
"version": "3.0.0",
"version": "4.0.0",
"description": "Process class objects according to json array input data.",

@@ -8,3 +8,2 @@ "main": "app.ts",

"chai": "^4.3.3",
"colors": "^1.4.0",
"compare-json-difference": "^0.1.3",

@@ -21,2 +20,3 @@ "mocha": "^9.1.3",

"test_bottom_one": "npx ts-node ./tests/bottom_one.ts",
"test_func_all": "npx ts-node ./tests/func_all.ts",
"test": "mocha"

@@ -23,0 +23,0 @@ },

@@ -10,2 +10,3 @@ # QueueJson

* bottom_one - asynchronous - process class object per the last entry in a json input array.
* func_all - asynchronous - process custom functions to custom class objects per json input array.

@@ -30,2 +31,3 @@ Installation

npm run test_bottom_one
npm run test_func_all

@@ -67,4 +69,4 @@ ```

{ props: { id: 2, name: 'another' } },
{ props: { id: 3, name: 'another' } },
{ props: { id: 4, name: 'another' } }
{ props: { id: 3, name: 'some name' } },
{ props: { id: 4, name: 'name x' } }
]

@@ -71,0 +73,0 @@

@@ -6,7 +6,7 @@ var assert = require('assert');

describe('require', function () {
it('colors', function () {
it('queueobj', function () {
try {
colors = require('colors')
if (typeof colors == 'undefined') {
throw new Error('no colors')
queueobj = require('queueobj')
if (typeof queueobj == 'undefined') {
throw new Error('no queueobj')
}

@@ -18,2 +18,15 @@ } catch (e) {

})
describe('node-console-colors', function () {
it('node-console-colors', function () {
try {
ncc = require('node-console-colors')
if (typeof ncc == 'undefined') {
throw new Error('no node-console-colors')
}
} catch (e) {
assert(false)
}
})
})
})

@@ -7,3 +7,3 @@ const assert = require('assert'),

"name": "queuejson",
"version": "3.0.0",
"version": "4.0.0",
"description": "Process class objects according to json array input data.",

@@ -13,3 +13,2 @@ "main": "app.ts",

"chai": "^4.3.3",
"colors": "^1.4.0",
"compare-json-difference": "^0.1.3",

@@ -26,2 +25,3 @@ "mocha": "^9.1.3",

"test_bottom_one": "npx ts-node ./tests/bottom_one.ts",
"test_func_all": "npx ts-node ./tests/func_all.ts",
"test": "mocha"

@@ -28,0 +28,0 @@ },

@@ -5,3 +5,3 @@

* @since 2022-05-24
* bottom_one.ts
* top_one.ts
*/

@@ -8,0 +8,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc