{"id":"averyark/keeper","name":"keeper","scope":"averyark","platform":"roblox","description":"Keeper class for tracking and cleaning up objects with keys","version":"1.10.2","latest":"1.10.2","versions":["1.9.0","1.9.1","1.9.2","1.10.0","1.10.1","1.10.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"6a9cf39b1670c41fa61d0f712b1c5a1343f76fa29ebb1f4856d2be23ebb93ccf","likes":0,"downloads":0,"install":"forest install averyark/keeper","url":"https://forest.dev/p/roblox/averyark/keeper","files":"https://api.forest.dev/ai/package/roblox/averyark/keeper/files","readme":"# Keeper\r\n\r\nKeeper is a Trove-style utility for tracking and cleaning up objects, now with optional keys for grouped cleanup.\r\n\r\n## Install (Wally)\r\n\r\n```\r\n[dependencies]\r\nKeeper = \"averyark/keeper@1.9.0\"\r\n```\r\n\r\n## Basic Use\r\n\r\n```lua\r\nlocal Keeper = require(path.To.Keeper)\r\n\r\nlocal trove = Keeper.new()\r\nlocal part = Instance.new(\"Part\")\r\n\r\ntrove:Add(part, \"effects\")\r\ntrove:Clean(\"effects\")\r\n```\r\n\r\n## Keys and cleanup methods\r\n\r\n`Add(object, key?, cleanupMethod?)` uses its second argument as a group key.\r\nPass `nil` for the key when supplying a custom cleanup method without a group:\r\n\r\n```lua\r\nlocal resource = { Release = function(self) print(\"Released\") end }\r\ntrove:Add(resource, nil, \"Release\")\r\n-- Or use a group:\r\ntrove:Add(resource, \"effects\", \"Release\")\r\n```\r\n\r\nKeys can be any non-nil value, including `false`. Multiple objects can share a key.\r\n\r\n| Call | Behavior |\r\n| --- | --- |\r\n| `Clean(key)` | Clean every entry with that key. |\r\n| `Clean()` | Clean all keyed and unkeyed entries. |\r\n| `Remove(object, key?)` | Remove and clean one matching entry, optionally filtered by key. |\r\n| `Remove(nil, key)` | Remove and clean every entry with that key. |\r\n| `Pop(object, key?)` | Stop tracking one matching entry without cleaning it. |\r\n| `Pop(nil, key)` | Stop tracking every entry with that key without cleaning them. |\r\n| `WrapClean(key?)` | Return a callback that cleans the given group, or everything if omitted. |\r\n| `Destroy()` | Clean everything. |\r\n\r\n`Remove` and `Pop` return whether any entries were removed. With neither an object\r\nnor a key, they return `false`. A missing group is a no-op. `nil` in `Clean` and\r\n`WrapClean` means all entries; it does not select only unkeyed entries.\r\n\r\nPassing a key as the object, as in `Remove(\"effects\")`, throws an error. Use\r\n`Remove(nil, \"effects\")` or `Clean(\"effects\")` instead.\r\n\r\n## Tests\r\n\r\nRun `lune run test/run.luau` with Lune installed. The runner supplies a minimal\r\nRoblox service stub for the group tests; it does not exercise Roblox services.\r\n","readmeTruncated":false}