Project detail
Readonly View
StableA deeply readonly, lazy, live view of owner-controlled mutable data for JavaScript and TypeScript.
Overview
A deeply readonly, lazy, live view of owner-controlled mutable data for JavaScript and TypeScript.
Why it exists
It exists for ownership boundaries where an owner keeps mutating data while consumers need a live API that cannot mutate through the returned view.
Evidence for purposeVerified claims
Live readonly views
readonlyView(source) exposes a deeply readonly, lazy view; owner-side changes remain visible while writes through the view throw DirectMutationError.
Evidence for Live readonly viewsIdentity preservation
Supported nested values are protected lazily, while shared references and cycles preserve identity within one membrane.
Evidence for Identity preservationDocumented supported types
Supports plain objects, arrays, Map, Set, Date, symbols, accessors, shared references, and cycles; functions and custom classes have documented caveats.
Evidence for Documented supported types
Scope and limitations
Not immutable storage
The source remains mutable through other aliases; the package is not an immutable snapshot, owner-mutation guard, or security sandbox.
Evidence for Not immutable storageExample
Example sourceimport { readonlyView } from '@nipe-solutions/readonly-view'
const source = { user: { name: 'Alice' } }
const view = readonlyView(source)
source.user.name = 'Bob'
console.log(view.user.name) // BobInstall
npm install @nipe-solutions/readonly-view