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

12
test.ce
View File

@@ -287,11 +287,11 @@ function run_tests(package_name, specific_test) {
test_mod = shop.use(mod_path, use_pkg)
var tests = []
if (typeof test_mod == 'function') {
if (is_function(test_mod)) {
tests.push({name: 'main', fn: test_mod})
} else if (typeof test_mod == 'object') {
} else if (is_object(test_mod)) {
for (var k in test_mod) {
if (typeof test_mod[k] == 'function') {
if (is_function(test_mod[k])) {
tests.push({name: k, fn: test_mod[k]})
}
}
@@ -312,9 +312,9 @@ function run_tests(package_name, specific_test) {
try {
var ret = t.fn()
if (typeof ret == 'string') {
if (is_text(ret)) {
throw new Error(ret)
} else if (ret && (typeof ret.message == 'string' || ret instanceof Error)) {
} else if (ret && (is_text(ret.message) || ret instanceof Error)) {
throw ret
}
@@ -330,7 +330,7 @@ function run_tests(package_name, specific_test) {
}
if (e.name) test_entry.error.name = e.name
if (typeof e == 'object' && e.message) {
if (is_object(e) && e.message) {
test_entry.error.message = e.message
}