remove typeof'
This commit is contained in:
@@ -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, '_')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user