remove dynamic equality
This commit is contained in:
@@ -303,7 +303,7 @@ function deepFreeze(object) {
|
||||
for (var name of propNames) {
|
||||
var value = object[name];
|
||||
|
||||
if ((value && typeof value === "object") || typeof value === "function") {
|
||||
if ((value && typeof value == "object") || typeof value == "function") {
|
||||
deepFreeze(value);
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ function handle_host(e) {
|
||||
break
|
||||
case "disconnect":
|
||||
peer_queue.delete(e.peer)
|
||||
for (var id in peers) if (peers[id] === e.peer) delete peers[id]
|
||||
for (var id in peers) if (peers[id] == e.peer) delete peers[id]
|
||||
log.system('portal got disconnect from ' + e.peer.address + ":" + e.peer.port)
|
||||
break
|
||||
case "receive":
|
||||
@@ -461,7 +461,7 @@ function handle_host(e) {
|
||||
data.replycc[ACTORDATA].port = e.peer.port
|
||||
}
|
||||
function populate_actor_addresses(obj) {
|
||||
if (typeof obj !== 'object' || obj === null) return
|
||||
if (typeof obj != 'object' || obj == null) return
|
||||
if (obj[ACTORDATA] && !obj[ACTORDATA].address) {
|
||||
obj[ACTORDATA].address = e.peer.address
|
||||
obj[ACTORDATA].port = e.peer.port
|
||||
@@ -494,7 +494,7 @@ $_.start = function start(cb, program, ...args) {
|
||||
if (!program) return
|
||||
var id = guid()
|
||||
|
||||
if (args.length === 1 && Array.isArray(args[0]))
|
||||
if (args.length == 1 && Array.isArray(args[0]))
|
||||
args = args[0]
|
||||
|
||||
var startup = {
|
||||
@@ -543,7 +543,7 @@ $_.delay[cell.DOC] = "used to schedule the invocation of a function..."
|
||||
|
||||
var couplings = new Set()
|
||||
$_.couple = function couple(actor) {
|
||||
if (actor === $_) return // can't couple to self
|
||||
if (actor == $_) return // can't couple to self
|
||||
couplings.add(actor[ACTORDATA].id)
|
||||
sys_msg(actor, {kind:'couple', from: $_})
|
||||
log.system(`coupled to ${actor}`)
|
||||
@@ -569,10 +569,10 @@ function actor_send(actor, message) {
|
||||
|
||||
if (!is_actor(actor) && !is_actor(actor.replycc)) throw new Error(`Must send to an actor object. Attempted send to ${json.encode(actor)}`)
|
||||
|
||||
if (typeof message !== 'object') throw new Error('Must send an object record.')
|
||||
if (typeof message != 'object') throw new Error('Must send an object record.')
|
||||
|
||||
// message to self
|
||||
if (actor[ACTORDATA].id === cell.id) {
|
||||
if (actor[ACTORDATA].id == cell.id) {
|
||||
if (receive_fn) receive_fn(message.data)
|
||||
return
|
||||
}
|
||||
@@ -627,10 +627,10 @@ function send_messages() {
|
||||
var replies = {}
|
||||
|
||||
globalThis.send = function send(actor, message, reply) {
|
||||
if (typeof actor !== 'object')
|
||||
if (typeof actor != 'object')
|
||||
throw new Error('Must send to an actor object. Provided: ' + actor);
|
||||
|
||||
if (typeof message !== 'object')
|
||||
if (typeof message != 'object')
|
||||
throw new Error('Message must be an object')
|
||||
var send = {type:"user", data: message}
|
||||
|
||||
@@ -763,7 +763,7 @@ function handle_message(msg) {
|
||||
Object.defineProperty(letter, HEADER, {
|
||||
value: msg, enumerable: false
|
||||
})
|
||||
Object.defineProperty(letter, ACTORDATA, { // this is so is_actor === true
|
||||
Object.defineProperty(letter, ACTORDATA, { // this is so is_actor == true
|
||||
value: { reply: msg.reply }, enumerable: false
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user