Overview
Protocols define the core interfaces and behaviors required for composable utilities within the Jane ecosystem. They enforce strict contracts for custom classes and objects that need to participate in the four-layer runtime model (guards, normalizers, validators, and parsers). Protocols ensure third-party extensions are predictable and safe to use.
Protocols are defined as TypeScript interfaces, ensuring that all implementations provide the necessary methods for processing data without side effects.
- validateAsyncIterable: - Ensures a value implements the minimal contract for asynchronous iteration (
Symbol.asyncIteratorreturning an async iterator). - validateCallable: Ensures a value is a callable function and not an ES2015 class constructor.
- validateIterable: Ensures a value implements the synchronous iteration protocol (
Symbol.iteratorreturning an iterator). - validatePromise: Ensures a value is a real Promise with a compliant then method and standard Promise behavior.
- validateThenable: - Ensures a value is a Promise-like object with a callable
thenmethod, without requiring full Promise semantics.
All protocols are pure, contract-driven, and designed to promote a consistent, decoupled architecture across the entire library.