Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rbxts/immut) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Immut
A draft-based immutable data library based on Immer
TypeScript Usage
import Immut, { produce } from "@rbxts/immut";
let oldState: Array<string> | undefined;
const newState = produce(oldState, (draft) => {
if (!draft) return [];
if (draft.includes("foo")) return None;
// draft.push(), draft.insert(), draft.unshift() NOT allowed as they compile to table.insert, which is not draft-safe
Immut.table.insert(draft, "draft-safe");
// index starts at 1 for draft-safe table functions!
Immut.table.insert(draft, 1, "draft-safe");
// draft.remove(), draft.shift() NOT allowed as they compile to table.remove, which is not draft-safe
Immut.table.remove(draft);
// index starts at 1 for draft-safe table functions!
Immut.table.remove(draft, 1);
draft.pop(); // allowed as it does not compile to table.remove: draft[#draft] = nil
// draft.sort() NOT allowed as it compiles to table.sort, which is not draft-safe
Immut.table.sort(draft, (a, b) => a > b);
// draft.clear() NOT allowed as it compiles to table.clear, which is not draft-safe
Immut.table.clear(draft);
});