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

@@ -96,7 +96,7 @@ globalThis.isa = function(value, master) {
if (master == null) return false
// isa(value, function) - check if function.prototype is in chain
if (typeof master == 'function') {
if (is_function(master)) {
// Special type checks
if (master == stone) return is_stone(value)
if (master == number) return is_number(value)
@@ -119,7 +119,7 @@ globalThis.isa = function(value, master) {
}
// isa(object, master_object) - check prototype chain
if (typeof master == 'object') {
if (is_object(master)) {
var proto = _getPrototypeOf(value)
while (proto != null) {
if (proto == master) return true
@@ -543,7 +543,7 @@ function actor_send(actor, message) {
if (!isa(actor, actor) && !isa(actor.replycc, actor)) throw new Error(`Must send to an actor object. Attempted send to ${actor}`)
if (typeof message != 'object') throw new Error('Must send an object record.')
if (!is_object(message)) throw new Error('Must send an object record.')
// message to self
if (actor[ACTORDATA].id == _cell.id) {
@@ -611,10 +611,10 @@ var need_stop = false
var replies = {}
globalThis.send = function send(actor, message, reply) {
if (typeof actor != 'object')
if (!is_object(actor))
throw new Error(`Must send to an actor object. Provided: ${actor}`);
if (typeof message != 'object')
if (!is_object(message))
throw new Error('Message must be an object')
var send = {type:"user", data: message}