remove dynamic equality
This commit is contained in:
@@ -40,7 +40,7 @@ function parse_key(key) {
|
||||
function get_nested(obj, path) {
|
||||
var current = obj
|
||||
for (var segment of path) {
|
||||
if (!current || typeof current !== 'object') return undefined
|
||||
if (!current || typeof current != 'object') return undefined
|
||||
current = current[segment]
|
||||
}
|
||||
return current
|
||||
@@ -51,7 +51,7 @@ function set_nested(obj, path, value) {
|
||||
var current = obj
|
||||
for (var i = 0; i < path.length - 1; i++) {
|
||||
var segment = path[i]
|
||||
if (!current[segment] || typeof current[segment] !== 'object') {
|
||||
if (!current[segment] || typeof current[segment] != 'object') {
|
||||
current[segment] = {}
|
||||
}
|
||||
current = current[segment]
|
||||
@@ -62,8 +62,8 @@ function set_nested(obj, path, value) {
|
||||
// Parse value string into appropriate type
|
||||
function parse_value(str) {
|
||||
// Boolean
|
||||
if (str === 'true') return true
|
||||
if (str === 'false') return false
|
||||
if (str == 'true') return true
|
||||
if (str == 'false') return false
|
||||
|
||||
// Number (including underscores)
|
||||
var num_str = str.replace(/_/g, '')
|
||||
@@ -76,8 +76,8 @@ function parse_value(str) {
|
||||
|
||||
// Format value for display
|
||||
function format_value(val) {
|
||||
if (typeof val === 'string') return '"' + val + '"'
|
||||
if (typeof val === 'number' && val >= 1000) {
|
||||
if (typeof val == 'string') return '"' + val + '"'
|
||||
if (typeof val == 'number' && val >= 1000) {
|
||||
// Add underscores to large numbers
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '_')
|
||||
}
|
||||
@@ -90,7 +90,7 @@ function print_config(obj, prefix = '') {
|
||||
var val = obj[key]
|
||||
var full_key = prefix ? prefix + '.' + key : key
|
||||
|
||||
if (val && typeof val === 'object' && !Array.isArray(val)) {
|
||||
if (val && typeof val == 'object' && !Array.isArray(val)) {
|
||||
print_config(val, full_key)
|
||||
} else {
|
||||
log.console(full_key + ' = ' + format_value(val))
|
||||
@@ -99,7 +99,7 @@ function print_config(obj, prefix = '') {
|
||||
}
|
||||
|
||||
// Main command handling
|
||||
if (args.length === 0) {
|
||||
if (args.length == 0) {
|
||||
print_help()
|
||||
$_.stop()
|
||||
return
|
||||
@@ -137,9 +137,9 @@ switch (command) {
|
||||
var path = parse_key(key)
|
||||
var value = get_nested(config, path)
|
||||
|
||||
if (value === undefined) {
|
||||
if (value == undefined) {
|
||||
log.error("Key not found: " + key)
|
||||
} else if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
} else if (value && typeof value == 'object' && !Array.isArray(value)) {
|
||||
// Print all nested values
|
||||
print_config(value, key)
|
||||
} else {
|
||||
@@ -159,7 +159,7 @@ switch (command) {
|
||||
var value = parse_value(value_str)
|
||||
|
||||
// Validate system keys
|
||||
if (path[0] === 'system') {
|
||||
if (path[0] == 'system') {
|
||||
var valid_system_keys = [
|
||||
'ar_timer', 'actor_memory', 'net_service',
|
||||
'reply_timeout', 'actor_max', 'stack_max'
|
||||
@@ -193,7 +193,7 @@ switch (command) {
|
||||
|
||||
switch (actor_cmd) {
|
||||
case 'list':
|
||||
if (Object.keys(config.actors[actor_name]).length === 0) {
|
||||
if (Object.keys(config.actors[actor_name]).length == 0) {
|
||||
log.console("No configuration for actor: " + actor_name)
|
||||
} else {
|
||||
log.console("# Configuration for actor: " + actor_name)
|
||||
@@ -212,7 +212,7 @@ switch (command) {
|
||||
var path = parse_key(key)
|
||||
var value = get_nested(config.actors[actor_name], path)
|
||||
|
||||
if (value === undefined) {
|
||||
if (value == undefined) {
|
||||
log.error("Key not found for actor " + actor_name + ": " + key)
|
||||
} else {
|
||||
log.console('actors.' + actor_name + '.' + key + ' = ' + format_value(value))
|
||||
|
||||
Reference in New Issue
Block a user