remove typeof'

This commit is contained in:
2026-01-06 11:08:27 -06:00
parent df07069c38
commit 63cf76dcf9
17 changed files with 139 additions and 205 deletions

View File

@@ -38,7 +38,7 @@ function parse_key(key) {
function get_nested(obj, path) {
var current = obj
for (var segment of path) {
if (!current || typeof current != 'object') return null
if (is_null(current) || !is_object(current)) return null
current = current[segment]
}
return current
@@ -49,7 +49,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 (is_null(current[segment]) || !is_object(current[segment])) {
current[segment] = {}
}
current = current[segment]
@@ -74,8 +74,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 (is_text(val)) return '"' + val + '"'
if (is_number(val) && val >= 1000) {
// Add underscores to large numbers
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '_')
}