(tag: unknown): ProtocolKind | undefinedThe declared ProtocolKind of the Node a tag is bound to (how a client reaches it —
Http/WebSocket/IpcSocket), or undefined for a nodeless/bare tag or a node with no declared
kind. A structural read (like kindOf) — the server uses it to reject a node-bound resource
served over a mismatched transport (ProtocolKindMismatch).
export const const nodeKindOf: (
tag: unknown
) => ProtocolKind | undefined
The declared
ProtocolKind
of the
Node
a tag is bound to (how a client reaches it —
Http/WebSocket/IpcSocket), or undefined for a nodeless/bare tag or a node with no declared
kind. A structural read (like
kindOf
) — the server uses it to reject a node-bound resource
served over a mismatched transport (
ProtocolKindMismatch
).
nodeKindOf = (tag: unknowntag: unknown): import ProtocolKindProtocolKind | undefined => {
const const node: anynode = const nodeOf: (
tag: unknown
) => NodeKey<unknown> | undefined
The
Node
a tag is bound to (its transport key), or undefined for a nodeless/bare tag
or any non-tag. Accepts unknown so a Group member passes straight in — walk a group tree and
collect the distinct nodes to know which nodes back its resources.
nodeOf(tag: unknowntag);
if (const node: anynode !== var undefinedundefined && import PredicatePredicate.const hasProperty: <"kind">(self: unknown, property: "kind") => self is { [K in "kind"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(const node: anynode, "kind")) {
const const k: unknownk = const node: {
kind: unknown
}
node.kind: unknownkind;
return const k: unknownk === "Http" || const k: unknownk === "WebSocket" || const k: unknownk === "IpcSocket" ? const k:
| "Http"
| "WebSocket"
| "IpcSocket"
k : var undefinedundefined;
}
return var undefinedundefined;
};